Summary
The Meta Box plugin for WordPress contains an arbitrary file deletion vulnerability where insufficient file path validation in the ajax_delete_file function allows deletion of files outside the intended upload directory.
Authenticated users with at least Contributor-level access can exploit this to delete critical application files on the server, which can in turn lead to full site compromise and potential remote code execution when sensitive configuration or executable files are removed.
Affected context
This vulnerability affects WordPress sites that:
- Have the Meta Box plugin installed and activated in versions up to and including 5.11.1
- Allow users with Contributor-level or higher roles to access Meta Box functionality that triggers the
ajax_delete_fileendpoint - Run on servers where the web process user has permission to delete files in WordPress core, plugin, theme, or configuration directories
The risk increases significantly when the PHP process can delete critical files like wp-config.php, .htaccess, or plugin/theme PHP files.
Exploit preconditions
- Attack surface: Authenticated web interface (WordPress admin / AJAX endpoints exposed by Meta Box)
- Required access: Valid WordPress account with Contributor-level or higher privileges
- Trigger point: Invocation of the
ajax_delete_filefunctionality with a crafted file path parameter - Why exploitation is possible: The server-side logic does not sufficiently constrain, normalize, or validate the target file path, allowing users to influence which file is deleted beyond the intended upload directory boundaries.
Why this happens
The core issue arises from inadequate validation of user-controlled file paths during a deletion operation, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Instead of strictly mapping the requested deletion to a whitelisted or server-generated file identifier, the code relies on a path parameter that can reference arbitrary locations on the filesystem.
Without strong checks such as canonicalization, directory whitelisting, or mapping to stored references, the deletion logic operates on attacker-influenced paths, allowing removal of files outside the allowed storage area.
Potential impact
- Deletion of critical configuration files such as
wp-config.php, potentially enabling reinstallation or takeover of the site - Deletion of
.htaccessor other web server control files, weakening security controls or disrupting routing - Removal of plugin or theme PHP files, which can break functionality and may be combined with other weaknesses to achieve code execution
- Denial of service by deleting core WordPress files, preventing the site from functioning
- Facilitation of broader compromise when combined with other vulnerabilities or misconfigurations (e.g., reinstallation wizards, backup exposure)
General mitigation guidance
Effective mitigation focuses on strictly constraining file delete operations and removing direct trust in user-supplied paths:
- Restrict deletion to files that are referenced by internal identifiers (e.g., attachment IDs or database records) rather than raw paths.
- Normalize and canonicalize file paths, and enforce that the resolved path resides inside a pre-defined, application-controlled directory (e.g., the uploads folder).
- Maintain a server-side mapping of allowed files and validate requests against this list instead of accepting arbitrary file names or paths from clients.
- Apply least-privilege to the web server user so that it has only the minimal filesystem permissions necessary for uploads, reducing the blast radius of deletion bugs.
- Where possible, design features to mark files as "deleted" in metadata rather than physically removing them immediately, limiting direct filesystem operations.
How teams detect issues like this
Organizations can detect this class of issue through a combination of code-level and runtime strategies:
- Static analysis: Flag code patterns where user input flows into filesystem APIs (e.g.,
unlink,rm, or wrapper functions) without clear path normalization and directory checks. - Code review: Pay special attention to AJAX handlers and upload/delete endpoints, verifying that they operate on server-generated IDs and apply strict whitelisting of directories.
- Policy enforcement: Define internal guidelines that prohibit direct use of user-controlled paths for file operations; enforce these via linters or custom SAST rules.
- Runtime monitoring: Use file integrity monitoring to watch for unexpected deletions of configuration, core, or plugin files, especially originating from web server processes.

