league/commonmark (thephpleague/commonmark) versions >= 2.7.0 and < 2.9.1 contain a cross-site scripting vulnerability in the AttributesExtension. Prefixing an attribute name with a single U+000C form feed byte (e.g. {\x0Conclick="alert(1)"}) bypasses the AttributesHelper::filterAttributes() 'on*' event-handler filter because PHP's trim() does not strip U+000C, causing the attribute to be written verbatim into the output where browsers parse it as a genuine event handler. The same prefix also defeats the allow_unsafe_links check, allowing javascript: URIs through href/src attributes even when allow_unsafe_links is false. Exploitation requires processing untrusted Markdown with the AttributesExtension enabled; the injected script executes when the rendered HTML is viewed. Fixed in 2.9.1.
Fix
Patch, vendor advisory and mitigation references on NVD 3
- https://github.com/thephpleague/commonmark/commit/43207253ea5f14867c77c697cd3838c446cadcea Patch
- https://github.com/thephpleague/commonmark/security/advisories/GHSA-f8fg-pg57-v4j8 Exploit, Mitigation, Vendor Advisory
- https://www.vulncheck.com/advisories/commonmark-before-2.9.1-xss-via-attributesextension-form-feed-bypass Patch, Third Party Advisory
Every line above is quoted from NVD, CISA, Microsoft, the vendor's own advisory or DISA; nothing is generated.
Change history 1
- First seenCVSS 6.9 · thephpleagueNVD modified 2026-10-08 16:17
Affected (CPE criteria) 1
cpe:2.3:a:thephpleague:commonmark:*:*:*:*:*:*:*:*
References 3
- https://github.com/thephpleague/commonmark/commit/43207253ea5f14867c77c697cd3838c446cadcea Patch
- https://github.com/thephpleague/commonmark/security/advisories/GHSA-f8fg-pg57-v4j8 Exploit, Mitigation, Vendor Advisory
- https://www.vulncheck.com/advisories/commonmark-before-2.9.1-xss-via-attributesextension-form-feed-bypass Patch, Third Party Advisory