Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-78471 Overview
CVE-2026-78471 is a Stored Cross-Site Scripting (XSS) vulnerability [CWE-79] in the Autoptimize plugin for WordPress. The flaw affects all versions up to and including 3.1.15.1. Insufficient input sanitization and output escaping of the Comment Author Name field allows unauthenticated attackers to inject arbitrary web scripts. Injected payloads execute when users access the affected pages.
Exploitation requires a specific chain of preconditions, which lowers real-world exploitability. An administrator must enable the Lazy-load images? option in Autoptimize. The w3-total-cache/w3-total-cache.php file must also be present on disk with the plugin disabled, a Minify_HTML class must be loaded by another plugin, and a moderator must approve the malicious comment.
Critical Impact
Successful exploitation enables stored script execution in the browser of any visitor viewing the affected page, which can lead to session hijacking, credential theft, or administrative account compromise.
Affected Products
- Autoptimize plugin for WordPress, all versions up to and including 3.1.15.1
- WordPress sites where the Autoptimize Lazy-load images? option is enabled
- Environments where a dormant w3-total-cache/w3-total-cache.php file is present and a Minify_HTML class is loaded by another plugin
Discovery Timeline
- 2026-10-02 - CVE-2026-78471 published to the National Vulnerability Database (NVD)
- 2026-10-03 - Last updated in NVD database
Technical Details for CVE-2026-78471
Vulnerability Analysis
The vulnerability resides in the Autoptimize image optimization logic, specifically in classes/autoptimizeImages.php. When the Lazy-load images? option is enabled, the plugin processes HTML output through an image rewriting routine. Under the required precondition chain, this routine passes attacker-controlled comment author name content into a sink that renders without proper escaping.
Because the Comment Author Name field is populated by unauthenticated commenters, any site visitor can supply a malicious payload. Rendering only occurs after the moderation workflow approves the comment, which introduces a human gating step but does not prevent exploitation on sites that accept and approve guest comments.
Root Cause
The root cause is a failure to apply sufficient input sanitization and output escaping on comment author name data as it flows through the Autoptimize lazy-load image rewriting path. The plugin trusts the content when it is handled downstream by Minify_HTML-style HTML processing supplied by another plugin, allowing script-bearing strings to be emitted into the rendered page context. See the fix in WordPress Autoptimize Changeset #3713884.
Attack Vector
An unauthenticated attacker submits a comment containing a crafted author name that includes JavaScript. A moderator approves the comment. When any visitor loads a page where Autoptimize's lazy-load rewrite runs through the required Minify_HTML class path, the payload executes in the visitor's browser under the site's origin.
The vulnerability requires a non-default plugin configuration and the presence of specific disabled or third-party components, which is reflected in the high attack complexity classification. Refer to the Wordfence Vulnerability Report B14F574D and the Autoptimize image class source for technical context.
Detection Methods for CVE-2026-78471
Indicators of Compromise
- Approved comments where the author name field contains HTML tags, <script> fragments, javascript: URIs, or event handler attributes such as onerror= or onload=.
- Presence of w3-total-cache/w3-total-cache.php on disk while the W3 Total Cache plugin is deactivated, combined with Autoptimize's Lazy-load images? option enabled.
- Unexpected outbound requests from visitor browsers to attacker-controlled domains originating from pages that render reader comments.
Detection Strategies
- Audit the WordPress wp_comments table for comment_author values containing angle brackets, encoded script sequences, or known XSS payload patterns.
- Review installed Autoptimize versions and confirm whether versions are at or below 3.1.15.1.
- Monitor web application firewall and reverse proxy logs for comment submissions carrying script-like payloads in the author name parameter.
Monitoring Recommendations
- Enable Content Security Policy (CSP) reporting to surface inline script execution from unexpected sources on comment-rendering pages.
- Alert on administrative or moderator sessions that generate anomalous actions shortly after visiting pages containing recently approved comments.
- Correlate plugin inventory telemetry with vulnerability feeds to detect vulnerable Autoptimize installations across managed WordPress fleets.
How to Mitigate CVE-2026-78471
Immediate Actions Required
- Update the Autoptimize plugin to a version later than 3.1.15.1 that includes the fix introduced in changeset 3713884.
- Review and purge any pending or approved comments containing suspicious author name content before upgrading, to prevent stale payloads from rendering.
- Remove orphaned files such as w3-total-cache/w3-total-cache.php when the associated plugin has been deactivated.
Patch Information
The vendor released a fix in Autoptimize version 3.1.16 via changeset 3713884. The complete diff between the vulnerable and patched releases is available at WordPress Autoptimize Version Changes. Apply the update through the WordPress admin plugin updater or via WP-CLI.
Workarounds
- Disable the Autoptimize Lazy-load images? option until the plugin is updated to break the required precondition chain.
- Delete leftover W3 Total Cache files from disk when the plugin is not actively in use.
- Require moderation for all comments and train moderators to reject submissions whose author name field contains HTML, scripts, or URL schemes.
- Deploy a web application firewall rule to block comment submissions where the author parameter contains <, >, or javascript:.
# Update Autoptimize via WP-CLI to the patched release
wp plugin update autoptimize --version=3.1.16
# Verify installed version post-update
wp plugin get autoptimize --field=version
# Optional: disable the vulnerable code path until patching is complete
wp option patch update autoptimize_imgopt_settings autoptimize_imgopt_checkbox_field_3 0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

