Summary
The GeoDirectory WordPress plugin contains an arbitrary file deletion vulnerability caused by insufficient validation of file paths used during revision cleanup. An authenticated attacker with subscriber-level access or higher may delete files outside the intended directory, potentially enabling remote code execution if a security-critical file is removed.
Affected context
The vulnerability occurs in the plugin's revision-deletion workflow when attachment metadata supplies a file path that is later processed without adequate validation. Deployments may be affected when authenticated users can reach the relevant listing or attachment functionality and the server process has permission to remove the targeted files.
Exploit preconditions
- Attack surface: Authenticated WordPress plugin functionality involving GeoDirectory listings, attachments, and revision deletion
- Required access: Subscriber-level WordPress access or higher, subject to site-specific authorization controls
- Trigger point: Processing an attachment or revision through the plugin's
delete_revisionhandler - Required state: Attacker-influenced attachment metadata must contain a file path that reaches the deletion logic
- Why exploitation is possible: The handler dereferences and removes a path without sufficiently enforcing permitted directories, file identity, or expected post-type constraints
Why this happens
The underlying bug is improper validation of a filesystem path before it is used in a destructive file operation. The deletion handler trusts attacker-influenced attachment metadata and does not adequately constrain the resolved path to an approved storage location or verify that the referenced object matches the expected content type. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because externally influenced path data can escape its intended filesystem boundary.
Potential impact
- Arbitrary files may be deleted from the WordPress server
- The WordPress installation may become unavailable or lose configuration data
- Security-critical application files could be removed
- The attacker may enable remote code execution under favorable server conditions
- Website content, uploads, or operational data could be disrupted
General mitigation guidance
Mitigation generally focuses on treating all attachment and metadata paths as untrusted and enforcing a narrow, canonicalized storage boundary before any deletion occurs.
Common defensive patterns include:
- Resolve and validate paths against an approved upload directory before destructive operations
- Prefer stored file identifiers or server-generated paths over user-controlled path values
- Verify object type, ownership, and expected metadata relationships before deletion
- Reject absolute paths, traversal components, symlink escapes, and unexpected path formats
- Apply least-privilege permissions to the web server and WordPress process
- Require authorization checks appropriate to destructive file-management actions
- Use transactional or reversible cleanup workflows where practical
How teams detect issues like this
Organizations can look for:
- Static analysis findings where request data, metadata, or database values flow into filesystem deletion functions
- Code review signals such as direct use of path fields with unlink or equivalent operations
- Missing canonicalization, directory-boundary checks, object-type validation, or authorization checks
- Runtime logs showing unexpected deletion targets, access to protected configuration paths, or unusual attachment and revision activity
- Policy enforcement that requires centralized safe-file abstractions for all plugin file operations
- Automated security review tools configured to identify path traversal and unsafe filesystem APIs

