HIGH 8.1

CVE-2026-5821: Image Optimizer WordPress Plugin Arbitrary File Deletion Vulnerability

The Image Optimizer plugin for WordPress contains a critical flaw that lets authenticated authors delete any file on the web server, not just their backup images. The vulnerability stems from the plugin storing file paths in a database field that users can edit directly, then using those paths without any safety checks when deleting attachments. An author-level user could inject a path to any system file they want removed, and the plugin will dutifully delete it when they remove an image. This affects all versions up to and including 1.7.4.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
Weaknesses (CWE)
CWE-73
Affected products
0 configuration(s)
Published / Modified
2026-07-02 / 2026-07-02

NVD description (verbatim)

The Image Optimizer plugin for WordPress is vulnerable to arbitrary file deletion in versions up to and including 1.7.4. This is due to insufficient path validation in the Image_Backup::remove() function where backup file paths stored in post meta are used directly in file deletion operations without verifying they are within the uploads directory. The plugin stores backup file paths in the image_optimizer_metadata post meta field and trusts these paths completely when deleting backups on the delete_attachment hook. An authenticated attacker with Author-level access can edit the image_optimizer_metadata post meta on their own attachments via WordPress's Custom Fields interface, injecting arbitrary absolute file paths into the backups array. When the attacker subsequently deletes the attachment, the plugin calls File_System::delete() on each path without validation. This makes it possible for authenticated attackers, with Author-level access and above, to delete arbitrary files on the server within the web server's filesystem permissions, potentially leading to denial of service, data loss, or security degradation.

8 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-5821 is a path traversal and arbitrary file deletion vulnerability in Image Optimizer for WordPress. The Image_Backup::remove() function processes file paths stored in the image_optimizer_metadata post meta field without validation. The vulnerability exists because: (1) backup file paths are stored in post meta that authenticated users can modify via WordPress's Custom Fields interface, (2) the delete_attachment hook triggers file deletion operations on these paths, and (3) File_System::delete() is called on unsanitized paths without verifying they are constrained to the wp-content/uploads directory. An attacker with Author role or higher can inject absolute file paths into the backups array and subsequently trigger deletion by removing the attachment, resulting in arbitrary file deletion within the web server's filesystem permissions (typically the www-data user on Linux systems). The attack requires no cross-site request forgery token bypass and no privilege escalation beyond Author level.

Business impact

This vulnerability enables data destruction and operational disruption. An author could systematically delete critical files: WordPress configuration files (wp-config.php), theme and plugin code, logs, database backups, or sensitive documents stored within the web root. The impact scales with server configuration—if the web server runs with elevated privileges or shares a host with other applications, collateral damage is possible. Additionally, the ability to delete logs can aid in covering tracks after other attacks, reducing forensic visibility and compliance evidence preservation.

Affected systems

Image Optimizer for WordPress, versions 1.7.4 and earlier, is vulnerable. Any WordPress installation with this plugin activated and users holding Author role or higher (including Administrators) can exploit the flaw. Self-hosted WordPress sites are at direct risk; managed WordPress hosting may provide some mitigations depending on server hardening and permission restrictions. Verify your installation version via Plugins > Installed Plugins in the WordPress admin dashboard.

Exploitability

Exploitation is straightforward and requires no special tools. An authenticated author logs into WordPress, navigates to an image attachment, accesses the Custom Fields meta box (if visible—it may require enabling via Screen Options), edits the image_optimizer_metadata field to inject a path like /var/www/html/wp-config.php, saves, and deletes the attachment. The file is removed immediately. No public exploit code is necessary; the WordPress interface itself is the attack vector. The CVSS score of 8.1 (HIGH) reflects the combination of low attack complexity, low privilege requirement, and high impact to integrity and availability.

Remediation

Update Image Optimizer to a patched version released after 1.7.4 that implements proper path validation in the Image_Backup::remove() function. Verify against the vendor's official advisory and changelog. If an immediate patch is unavailable, mitigate by: (1) restricting Author role assignment to trusted users only, (2) disabling the Custom Fields meta box for non-administrators via role management or plugins, (3) using a Web Application Firewall rule to block POST requests to admin-ajax.php that modify image_optimizer_metadata, or (4) temporarily deactivating the plugin if not actively used.

Patch guidance

Check the Image Optimizer plugin repository or the vendor's website for version 1.7.5 or later, which should contain fixes for path validation. Apply updates immediately once available. For WordPress administrators managing multiple sites, prioritize environments where untrusted authors have upload permissions. Test patches in a staging environment first to ensure no regressions with existing backup functionality.

Detection guidance

Monitor WordPress logs and server file access logs for unusual deletion activity. Look for: (1) attachment deletion events in wp_posts where image_optimizer_metadata contains absolute paths (e.g., /etc/, /var/www outside uploads/), (2) repeated delete_attachment hook executions in short time windows, (3) file deletion logs for sensitive files like wp-config.php or .htaccess. If your WordPress installation has Custom Fields logging or audit plugins, examine metadata edit history for image_optimizer_metadata changes. Use File Integrity Monitoring (FIM) tools to alert on unexpected deletion of configuration or core files.

Why prioritize this

Prioritize patching this vulnerability because it affects core WordPress file integrity and enables denial of service or data destruction by a low-privileged but legitimate user. Unlike remote unauthenticated exploits, this requires internal access, which lowers urgency compared to zero-days but remains critical given that Author roles are often assigned to content creators and third-party contributors. The HIGH CVSS score and the ease of exploitation justify immediate action on systems with untrusted authors.

Risk score, explained

The CVSS 3.1 score of 8.1 reflects: Network-based attack vector (AV:N), Low attack complexity (AC:L), Low privilege requirement (PR:L—Author role), No user interaction needed (UI:N), Unchanged scope (S:U), No confidentiality impact (C:N), High integrity impact (I:H—arbitrary files deleted), and High availability impact (A:H—denial of service possible). The score is not critical (9.0+) because it requires authentication and is scoped to filesystem permissions of the web server process, not system-wide. However, the combination of ease of exploitation, lack of complexity, and severe destructive potential justifies HIGH severity and immediate remediation.

Frequently asked questions

Can an Editor role exploit this, or only Authors?

Authors and higher roles (Editor, Administrator) can exploit this. Any user with the ability to modify post meta on attachments they upload or can access is at risk of being exploited. Editors typically have broader permissions and are more trusted, but the vulnerability applies to them as well.

If I delete the image_optimizer_metadata field from an attachment, does that prevent the attack?

Removing the field would prevent the plugin from attempting to delete backups associated with that attachment, but it would not protect you from future attacks if the plugin re-creates the field or if an attacker adds it again. The proper mitigation is to update the plugin to a patched version that validates paths.

Does this affect my WordPress.com or Jetpack-hosted site?

WordPress.com and managed hosts with strict file permissions and process isolation may have reduced impact. However, self-hosted WordPress sites using the Image Optimizer plugin from the WordPress.org repository are directly vulnerable. Check with your hosting provider about their patch status and any security controls they have in place.

What should I do if I cannot update immediately?

Temporarily deactivate the Image Optimizer plugin until a patch is available. If you must keep it active, restrict Author role assignment to trusted users only, disable the Custom Fields interface for non-administrators, and monitor deletion logs closely. Consider using a security plugin to audit meta field changes.

This vulnerability intelligence is based on public disclosure and vendor information as of July 2, 2026. Patch availability and version numbers should be verified directly with the Image Optimizer plugin vendor or the WordPress.org plugin repository. The attack described assumes standard WordPress installation with default role and permission structures. Environments with hardened file permissions, SELinux, or AppArmor policies may have reduced exploitability. No exploit code or weaponized proof-of-concept is provided. Organizations should conduct their own risk assessment based on their specific deployment, user base, and security controls. Source: NVD (public-domain), retrieved 2026-08-10. Analysis generated by SEC.co (claude-haiku-4-5).