GHSA-f8fg-pg57-v4j8: league/commonmark XSS: `on*` event-handler filter in `AttributesExtension` bypassed with a U+000C form feed
The AttributesExtension documents a security guarantee:
Note: Attributes starting with
on(e.g.onclickoronerror) are capable of executing JavaScript code and are therefore never allowed by default. You must explicitly add them to theallowlist if you want to use them.—
docs/2.x/extensions/attributes.md
Prefixing the attribute name with a single U+000C FORM FEED byte defeats that guarantee.
{<FF>onclick="alert(1)"} passes through AttributesHelper::filterAttributes() untouched and is
written verbatim into the output, where browsers parse it as a genuine onclick handler.
The same prefix defeats the allow_unsafe_links check, letting a javascript: URI through on
href / src even when allow_unsafe_links is false.
This bypasses the fix shipped in the 2.7.0 security release (“Fix XSS in AttributesExtension”,
43207253ea5f14867c77c697cd3838c446cadcea), which added filterAttributes() for the express
purpose of blocking these attributes.
Throughout this report <FF> denotes a literal U+000C byte ("\x0C" in PHP). It is invisible in
rendered text, so all payloads below are written with PHP escape sequences to stay unambiguous.
References
Code Behaviors & Features
Detect and mitigate GHSA-f8fg-pg57-v4j8 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →