league/commonmark XSS: `on*` event-handler filter in `AttributesExtension` bypassed with a U+000C form feed
High severity. Published 1 September 2026. Update league/commonmark to 2.9.1 or later: composer update league/commonmark.
Which versions are affected?
| Package | Affected versions | Fixed in |
|---|---|---|
| league/commonmark (opens in a new tab) | >= 2.7.0, < 2.9.1 | 2.9.1 |
What should you do?
Update every affected package you use to its fixed version, then check that nothing else in your project matches an advisory. To see which version you run, and whether anything is still affected:
composer show league/commonmark
composer auditAdvisory details
| Severity | HighCVSS 7.2 |
|---|---|
| Published | |
| Updated | |
| GHSA | GHSA-f8fg-pg57-v4j8 (opens in a new tab) |
| Weakness | CWE-79, CWE-86 |
What the advisory says
Summary
The AttributesExtension documents a security guarantee:
Note: Attributes starting with on (e.g. onclick or onerror) are capable of executing JavaScript code and are therefore never allowed by default. You must explicitly add them to the allow list 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. {onclick="alert(1)"} passes through AttributesHelper::filterAttributes() untouched and is written verbatim into the output, where browsers parse it as a genuine onclick handler.
Source: GHSA-f8fg-pg57-v4j8 (opens in a new tab) in the GitHub Advisory Database (CC BY 4.0). Data from GitHub (opens in a new tab) as of .
Other recent advisories for this package
- league/commonmark: DisallowedRawHtml bypassed when a disallowed tag name ends the raw-HTML literal (opens in a new tab) (medium, 30 September 2026)
- league/commonmark: Quadratic-time denial of service in the GitHub Flavored Markdown Table extension block-start scan (high, 30 September 2026)
- league/commonmark: Denial of service in the SmartPunct and Attributes extensions (high, 1 September 2026)
- league/commonmark: Denial of service via crafted code fences, reference links, and emphasis delimiters (high, 1 September 2026)
- league/commonmark: Denial of service via distinctly-named attributes in the Attributes extension (high, 1 September 2026)