Severity by source
AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
Primary rating from NVD · only source for this CVE.
CVSS VectorNVD
Lifecycle Timeline
3DescriptionCVE.org
The Autoptimize plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the lazy-loading image processing in all versions up to, and including, 3.1.14. This is due to the use of an overly permissive regular expression in the add_lazyload function that replaces all occurrences of \ssrc= in image tags without limiting to the actual attribute. 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 by crafting an image tag where the src URL contains a space followed by src=, causing the regex to break the HTML structure and promote text inside attribute values into executable HTML attributes.
AnalysisAI
The Autoptimize WordPress plugin contains a Stored Cross-Site Scripting (XSS) vulnerability in the lazy-loading image processing function that allows authenticated attackers with Contributor-level access to inject arbitrary web scripts into pages. The flaw exists in all versions up to and including 3.1.14 and stems from an overly permissive regular expression that fails to properly validate image tag attributes, enabling attackers to craft malicious image tags that break HTML structure and promote attribute values into executable code. This vulnerability carries a moderate CVSS score of 6.4 and requires user interaction for stored XSS payloads to execute when pages are accessed.
Technical ContextAI
The vulnerability resides in the add_lazyload function within the Autoptimize plugin (CPE: cpe:2.3:a:optimizingmatters:autoptimize:*:*:*:*:*:*:*:*), specifically in the autoptimizeImages.php class file. The root cause is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation, or Cross-site Scripting). The vulnerable code uses a naive regular expression pattern matching \ssrc= (a space followed by 'src=') to process image tags for lazy-loading functionality. This regex-based string replacement approach fails to distinguish between legitimate src attributes within img tags and malicious src sequences injected elsewhere in the HTML, such as within other attribute values or as part of URL parameters. When an attacker crafts an image tag with a src URL containing a space followed by 'src=', the regex matches unintended occurrences and breaks the HTML structure, effectively promoting text that should remain in attribute values into executable HTML attributes where inline event handlers or protocol handlers can be injected.
RemediationAI
Immediately upgrade Autoptimize to a version released after 3.1.14, which includes the fix committed to the GitHub repository (https://github.com/futtta/autoptimize/commit/a0f87112fe80b5a97b036229c41cb18454392858). In WordPress admin, navigate to Plugins, find Autoptimize, and click Update. As an interim measure for organizations unable to patch immediately, restrict Contributor-level access to only trusted users, audit existing contributors for compromise, and review page content and post revisions for suspicious image tags containing space-separated src attributes. Consider implementing a Web Application Firewall (WAF) rule to detect and block HTTP requests containing image tags with the malicious pattern (space followed by src= in URL parameters or post content). Monitor WordPress audit logs for posts created or modified by lower-privileged users during the vulnerability window to identify potential exploitation attempts.
More in Autoptimize
View allThe Autoptimize WordPress plugin before 2.7.8 attempts to delete malicious files (such as .php) form the uploaded archiv
Unauthenticated stored cross-site scripting affects the Autoptimize (before 3.1.15), Clearfy Cache (before 2.4.2), and S
The Autoptimize WordPress plugin before 2.7.8 attempts to remove potential malicious files from the extracted archive up
The ao_ccss_import AJAX call in Autoptimize Wordpress Plugin 2.7.6 does not ensure that the file provided is a legitimat
The Autoptimize WordPress plugin before 3.1.7 does not sanitise and escape the settings imported from a previous export,
The Autoptimize WordPress plugin before 3.1.1 does not sanitise and escape some of its settings, which could allow high
The Autoptimize WordPress plugin before 2.7.8 does not check for malicious files such as .html in the archive uploaded v
The Autoptimize WordPress plugin before 2.8.4 was missing proper escaping and sanitisation in some of its settings, allo
A Stored Cross-Site Scripting (XSS) vulnerability exists in the Autoptimize WordPress plugin through version 3.1.14, cau
Same weakness CWE-79 – Cross-site Scripting (XSS)
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-13842