CVE-2026-2352
Received Received - Intake
Stored XSS in Autoptimize WordPress Plugin via ao_post_preload

Publication date: 2026-03-21

Last updated on: 2026-03-21

Assigner: Wordfence

Description
The Autoptimize plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'ao_post_preload' meta value in all versions up to, and including, 3.1.14. This is due to insufficient input sanitization in the `ao_metabox_save()` function and missing output escaping when the value is rendered into a `<link>` tag in `autoptimizeImages.php`. This makes it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page, granted the "Image optimization" or "Lazy-load images" setting is enabled in the plugin configuration.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-21
Last Modified
2026-03-21
Generated
2026-05-07
AI Q&A
2026-03-21
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 2 associated CPEs
Vendor Product Version / Range
autoptimize autoptimize to 3.1.14 (inc)
autoptimize autoptimize 3.1.15
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-79 The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': 'CVE-2026-2352 is a Stored Cross-Site Scripting (XSS) vulnerability in the Autoptimize plugin for WordPress, affecting all versions up to and including 3.1.14. The vulnerability arises because the plugin does not properly sanitize input or escape output related to the \'ao_post_preload\' meta value. Specifically, the function `ao_metabox_save()` fails to sanitize user input, and the value is rendered without escaping into a <link> tag in the `autoptimizeImages.php` file. This allows authenticated users with Contributor-level access or higher to inject malicious scripts that execute whenever any user views the affected page, provided certain plugin settings like "Image optimization" or "Lazy-load images" are enabled.'}, {'type': 'paragraph', 'content': 'The vulnerability was addressed in version 3.1.15 by adding input sanitization using WordPress\'s `sanitize_text_field()` function on the meta box input, and by sanitizing the preload <link> tags with a whitelist of allowed HTML attributes using `wp_kses()`. Additional security improvements include adding the `fetchpriority="high"` attribute to preload links and securing HTML minification placeholders with cryptographically secure random values.'}] [1, 2]


How can this vulnerability impact me? :

This vulnerability allows an authenticated attacker with Contributor-level access or higher to inject arbitrary JavaScript code into pages of a WordPress site using the Autoptimize plugin. Because the injected scripts are stored and executed whenever any user accesses the affected page, this can lead to several security risks including session hijacking, defacement, unauthorized actions performed on behalf of users, or distribution of malware.

The impact is significant because the attack does not require user interaction (no user interface prompt) and affects all users who visit the compromised pages. The vulnerability exploits insufficient input sanitization and output escaping in the plugin's handling of preload link tags related to image optimization features.

The CVSS v3.1 base score of 6.4 (medium severity) reflects that the attack requires low complexity, privileges (Contributor or higher), no user interaction, and can lead to partial confidentiality and integrity loss but no availability impact.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': "The vulnerability in the Autoptimize WordPress plugin (up to version 3.1.14) is a stored Cross-Site Scripting (XSS) issue via the 'ao_post_preload' meta value, exploitable by authenticated users with Contributor-level access or higher. Detection involves checking if your WordPress installation uses the Autoptimize plugin at or below version 3.1.14 and if the 'Image optimization' or 'Lazy-load images' settings are enabled."}, {'type': 'paragraph', 'content': "Since the vulnerability involves stored XSS via a meta value, detection on the system or network level can be challenging. However, you can audit the WordPress database for suspicious or unexpected script tags or payloads stored in post meta fields related to 'ao_post_preload'."}, {'type': 'paragraph', 'content': 'Suggested commands or steps include:'}, {'type': 'list_item', 'content': 'Use WP-CLI to search for suspicious content in post meta: `wp post meta list --post_id=<post_id> | grep ao_post_preload` and inspect values for injected scripts.'}, {'type': 'list_item', 'content': "Query the WordPress database directly to find meta values containing suspicious script tags: `SELECT post_id, meta_value FROM wp_postmeta WHERE meta_key = 'ao_post_preload' AND meta_value LIKE '%<script>%';`"}, {'type': 'list_item', 'content': 'Check the plugin version installed: `wp plugin get autoptimize --field=version` to verify if it is vulnerable (<= 3.1.14).'}, {'type': 'list_item', 'content': "Monitor HTTP responses for injected scripts in `<link>` tags related to preload resources, especially if the 'Image optimization' or 'Lazy-load images' features are enabled."}, {'type': 'paragraph', 'content': 'Note that no specific detection commands are provided in the resources, so these suggestions are based on understanding the vulnerability context and plugin behavior.'}] [1, 2, 3]


What immediate steps should I take to mitigate this vulnerability?

[{'type': 'paragraph', 'content': 'The primary and immediate mitigation step is to update the Autoptimize WordPress plugin to version 3.1.15 or later, where the vulnerability has been fixed.'}, {'type': 'paragraph', 'content': 'Version 3.1.15 includes several security improvements addressing this vulnerability, such as sanitizing the \'ao_post_preload\' meta value input using `sanitize_text_field()`, sanitizing preload `<link>` tags with WordPress\'s `wp_kses()` function to allow only safe attributes, and adding the `fetchpriority="high"` attribute to preload links to improve resource loading security.'}, {'type': 'paragraph', 'content': 'Additional mitigation steps include:'}, {'type': 'list_item', 'content': 'Restrict Contributor-level and higher user permissions to trusted users only, as the vulnerability requires authenticated users with such access.'}, {'type': 'list_item', 'content': "Temporarily disable the 'Image optimization' and 'Lazy-load images' features in the Autoptimize plugin settings until the update can be applied."}, {'type': 'list_item', 'content': "Review and sanitize any existing 'ao_post_preload' meta values in the database to remove potentially malicious scripts."}, {'type': 'paragraph', 'content': 'Applying the official patch or update is the most effective and recommended action to fully mitigate the vulnerability.'}] [1, 2]


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart