CVE-2026-30838: League/commonmark CommonMark Has DisallowedRawHtml Extension Bypass Vulnerability
MODERATECVE-2026-30838 is a MODERATE commonmark has disallowedrawhtml extension bypass vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting League/commonmark libraries in the Packagist ecosystem. The issue involves commonmark has disallowedrawhtml extension bypass via whitespace in html tag names. Remediation is available by upgrading affected packages to version 2.8.1.
CVE-2026-30838 at a Glance
How to Fix CVE-2026-30838
To remediate this vulnerability, upgrade all affected League/commonmark dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade league/commonmark to 2.8.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for league/commonmark
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-30838, inspect your project dependencies for League/commonmark:
inspect dependencies for league/commonmark
Analyze the terminal output to locate any version of League/commonmark in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In League/commonmark, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-30838 Affected League/commonmark Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
league/commonmark
|
Packagist |
≥ 2.0.0
< 2.8.1
|
2.8.1
|
References
Frequently Asked Questions
What is CVE-2026-30838?
Which League/commonmark versions are affected?
What version fixes CVE-2026-30838?
Is league/commonmark affected?
What CWE is associated with CVE-2026-30838?
How can I check Packagist dependencies for CVE-2026-30838?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4v6x-c7xx-hw9f",
"modified" : "2026-03-20T21:26:30Z",
"published" : "2026-03-06T23:27:03Z",
"aliases" : [ "CVE-2026-30838" ],
"summary" : "CommonMark has DisallowedRawHtml extension bypass via whitespace in HTML tag names",
"details" : "### Impact\n\nThe `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.\n\nAll 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.\n\n### Patches\n\nFixed in 2.8.1. The regex character class `[ \\/>]` was changed to `[\\s\\/>]` to match all whitespace characters that browsers accept as valid tag name terminators.\n\n### Workarounds\n\n- Set the `html_input` configuration option to `'escape'` or `'strip'` to disable all raw HTML, though this is a broader restriction than the `DisallowedRawHtml` extension provides.\n- Pass the rendered HTML through a dedicated HTML sanitizer before serving it to users ([always recommended](https://commonmark.thephpleague.com/2.x/security/#additional-filtering))",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "league/commonmark"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.8.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.8.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/thephpleague/commonmark/security/advisories/GHSA-4v6x-c7xx-hw9f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30838"
}, {
"type" : "WEB",
"url" : "https://commonmark.thephpleague.com/extensions/disallowed-raw-html"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/thephpleague/commonmark"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-06T23:27:03Z",
"nvd_published_at" : "2026-03-07T16:15:56Z"
}
}