# Optimole <= 4.2.18 - Authenticated (Contributor+) Stored Cross-Site Scripting via Image Tag Attribute Values

- **ID:** WPSEC-2026-2623
- **Plugin:** Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization (`optimole-wp`), https://wordpress.org/plugins/optimole-wp/
- **Affected versions:** from 4.1.0 before 4.2.19
- **Fixed in:** 4.2.19 (Update to 4.2.19 or later.)
- **Severity:** Medium 6.4 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N)
- **Weakness:** CWE-79
- **Usage among sites WPSec scans:** plugin Medium, affected versions Medium (as of 2026-11-05)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/optimole-wp
- **Fix released:** 2026-11-04
- **Published:** 2026-11-05
- **URL:** https://wpsec.com/vuln/WPSEC-2026-2623/

## Description

The Optimole plugin for WordPress is vulnerable to Stored Cross-Site Scripting via image tag attribute values in versions 4.1.0 up to, and including, 4.2.18, due to insufficient output escaping when the plugin adds missing width and height attributes to image tags. The plugin inserted the quoted width and height attributes with a plain string replacement on the text 'data-opt-id=', and that text can also appear inside an attribute value written by the post author, such as alt text. The inserted double quotes then close that value, so text the author placed after it is read as new attributes. 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.

## References

- https://wpsec.com/vuln/WPSEC-2026-2623/
- https://plugins.svn.wordpress.org/optimole-wp/tags/4.2.19/
- https://wordpress.org/plugins/optimole-wp/

Source: WPSec, https://wpsec.com/vuln/WPSEC-2026-2623/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Free to use, share and adapt, also commercially, if you credit WPSec and link to this advisory.
