# LuckyWP Table of Contents <= 2.1.14 - Authenticated (Contributor+) Stored Cross-Site Scripting via Encoded TOC Comment Markers

- **ID:** WPSEC-2026-4185
- **Plugin:** LuckyWP Table of Contents (`luckywp-table-of-contents`), https://wordpress.org/plugins/luckywp-table-of-contents/
- **Affected versions:** from 2.0.5 before 2.1.15
- **Fixed in:** 2.1.15 (Update to 2.1.15 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 Low, affected versions Low (as of 2026-11-28)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/luckywp-table-of-contents
- **Fix released:** 2026-11-27
- **Published:** 2026-11-28
- **URL:** https://wpsec.com/vuln/WPSEC-2026-4185/

## Description

The LuckyWP Table of Contents plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'lwptocEncodedData' and 'lwptocEncodedToc' HTML comment markers in all versions up to, and including, 2.1.14. This is due to the plugin base64-decoding any such comment found in post content and writing the decoded result back into the page, rather than only decoding markers it created itself. HTML comments survive KSES filtering, so 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-4185/
- https://plugins.svn.wordpress.org/luckywp-table-of-contents/tags/2.1.15/
- https://wordpress.org/plugins/luckywp-table-of-contents/

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

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.
