league/commonmark security advisory
CVE-2026-30838: CommonMark has DisallowedRawHtml extension bypass via whitespace in HTML tag names
CVE-2026-30838 is a medium-severity XSS vulnerability in the PHP package league/commonmark (CVSS 6.1), published 7 March 2026. The advisory does not name a fixed version. It can be exploited without an account.
medium 6.1 published 2026-03-07 · updated 2026-06-17
- Affected versions
- >= 2.0.0, <= 2.8.0
- Fixed in
- not stated
- Newest release
- 2.10.7
- Severity
- Medium · CVSS 6.1
- Type
- Cross-site scripting (XSS)
CWE-79 - Exploited in the wild
- Not on the CISA KEV list
checked 2026-11-04
Is your league/commonmark version affected?
Who can exploit CVE-2026-30838
- Access: No account. Anyone who can send a request to an app that uses the affected code.
- Interaction: A user also has to do something, such as open a link or a page the attacker prepared.
CVSS vector (scored by NVD): CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
How to fix CVE-2026-30838 in league/commonmark
- Find the installed version:
composer show league/commonmark. If you never required it yourself,composer why league/commonmarkshows which package pulls it in. - Update it:
composer update league/commonmark --with-all-dependencies. - If Composer will not go that high, your composer.json constraint is holding it back. Widen it (for example
"league/commonmark": "^2.10.7"if you can take that version), or upgrade the package that requires it. - Run
composer audit. It reads the same advisory data and should no longer list CVE-2026-30838. - Commit composer.lock and deploy it. On the server, run
composer install --no-devfrom the lock file, notcomposer update.
If you cannot upgrade yet
- Escape output in your own templates and add a Content-Security-Policy that blocks inline scripts.
- Limit who can save the content the advisory names (for example rich text, SVG or form fields).
- If your app does not use the affected feature, note that in your audit, but still plan the upgrade.
The CVE-2026-30838 advisory
league/commonmark is a PHP Markdown parser. Prior to version 2.8.1, the DisallowedRawHtml extension can be bypassed by inserting a newline, tab, or other ASCII whitespace character between a disallowed HTML tag name and the closing >. For example, <script\n> would pass through unfiltered and be rendered as a valid HTML tag by browsers. This is a cross-site scripting (XSS) vector for any application that relies on this extension to sanitize untrusted user input. All applications using the DisallowedRawHtml extension to process untrusted markdown are affected. Applications that use a dedicated HTML sanitizer (such as HTML Purifier) on the rendered output are not affected. This issue has been patched in version 2.8.1.
References
- GitHub advisory GHSA-4v6x-c7xx-hw9f github.com
Other league/commonmark advisories
- medium League/commonmark: DisallowedRawHtml bypassed when a disallowed tag name ends the raw-HTML literal 2026-09-30
- high League/commonmark: Quadratic-time denial of service in the GitHub Flavored Markdown Table extension block-start scan 2026-09-30
- high League/commonmark: Denial of service via distinctly-named attributes in the Attributes extension 2026-09-01
- high League/commonmark: Denial of service in the SmartPunct and Attributes extensions 2026-09-01
- high League/commonmark XSS: on* event-handler filter in AttributesExtension bypassed with a U+000C form feed 2026-09-01
- high League/commonmark: Denial of service via crafted code fences, reference links, and emphasis delimiters 2026-09-01
Related
Need help patching or upgrading? Laskyr does PHP and Laravel security fixes and upgrades. Tell us what you run and we reply with a plan and a price.
Ask about a fixWhere this data comes from
- Affected and fixed versions: the Packagist security advisories API (GitHub Advisory Database and FriendsOfPHP), the same data
composer audituses. Synced 2026-11-03. - Description, score, weakness and references: NIST National Vulnerability Database (NVD), checked 2026-11-04. This product uses data from the NVD API but is not endorsed or certified by the NVD.
- Exploited-in-the-wild status: the CISA Known Exploited Vulnerabilities catalog, checked 2026-11-04.
- Compiled by Daniel Lasek at Laskyr from the sources above. The summary, “who can exploit it”, “how to fix it” and hardening sections are our plain-English reading of the record and are generated from it. The quoted description is the record's own text. Spot an error? Tell us.