# AMP for WP – Accelerated Mobile Pages <= 1.1.22 - Unauthenticated Stored Cross-Site Scripting via Comment Anchor Attributes

- **ID:** WPSEC-2026-4379
- **Plugin:** AMP for WP – Accelerated Mobile Pages (`accelerated-mobile-pages`), https://wordpress.org/plugins/accelerated-mobile-pages/
- **Affected versions:** from 1.1.17 before 1.1.23
- **Fixed in:** 1.1.23 (Update to 1.1.23 or later.)
- **Severity:** High 7.2 (CVSS:3.1/AV:N/AC:L/PR:N/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-12-03)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/accelerated-mobile-pages
- **Fix released:** 2026-12-02
- **Published:** 2026-12-03
- **URL:** https://wpsec.com/vuln/WPSEC-2026-4379/

## Description

The AMP for WP – Accelerated Mobile Pages plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the AMP anchor rewriting of comment content in all versions from 1.1.17 up to, and including, 1.1.22. This is due to how ampforwp_remove_unwanted_code() and ampforwp_sanitize_anchor_opening_tag() handle anchors. They pick out any <a> tag whose attribute values contain the text 'label=', re-serialize it with DOMDocument::saveHTML(), and then cut the result at the first '>'. HTML entities in attribute values come back out as raw angle brackets, so the rebuilt tag no longer ends where the original attribute did. This makes it possible for unauthenticated attackers to inject arbitrary web scripts through comment links. The scripts run whenever a user opens the AMP version of the affected page.

## References

- https://wpsec.com/vuln/WPSEC-2026-4379/
- https://plugins.svn.wordpress.org/accelerated-mobile-pages/tags/1.1.23/
- https://wordpress.org/plugins/accelerated-mobile-pages/

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

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.
