What the vulnerability does
01Description
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.
Explanation of Vulnerability in Simple Terms
02Summary
Autoptimize versions up to 3.1.14 contain a stored cross-site scripting (XSS) vulnerability that allows authenticated users with low privileges to inject malicious scripts. The vulnerability has a changed scope, meaning the impact extends beyond the vulnerable component itself. Site administrators should update to version 3.1.15.1 or later to remediate this issue.
What an attacker can do
03Attacker Capabilities
Inject malicious scripts that execute in other users' browsers when they view affected pages.
Potential impact on your site
04Site Impact
Authenticated users can inject scripts affecting other site visitors, potentially compromising accounts or stealing data.
Conditions required to exploit
05Prerequisites
Attacker must have a low-privilege authenticated account on the site.
Key dates
06Disclosure timeline
March 20, 2026
CVE published
April 8, 2026
Record updated