CVE-2026-30838·PHP vulnerability
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.
- Severity
- medium
- Software
- PHP
- Fixed in
- 2.8.1
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at <0.1% — higher than 10% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Affected versions
Until: 2.8.1
Fixed in: 2.8.1
How to fix this CVE
Update the league/commonmark library to version 2.8.1 or later if you are using the DisallowedRawHtml extension to sanitize untrusted markdown input. This vulnerability allows attackers to bypass HTML tag filtering by inserting whitespace characters, creating an XSS risk. Verify that your PHP dependencies are updated through your package manager or Composer, and test your markdown processing to ensure the filtering works correctly.
sudo dnf check-update php && sudo dnf upgrade phpDefensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
POST|GET request containing markdown input with patterns like <script\s+>, <iframe\s+>, <img\s+, or other HTML tags with embedded whitespace (\n, \t, \r, or other ASCII whitespace) before the closing > character, followed by script execution in the rendered outputWAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
Implement input validation rules that reject markdown or HTML content containing known dangerous tag patterns with whitespace insertion: regex pattern `<(script|iframe|img|embed|object|link|style)\s+` should trigger blocking. Additionally, enforce output encoding on all rendered markdown content and consider implementing a secondary HTML sanitizer (e.g., HTML Purifier) on the CommonMark renderer output.How to check if you are affected
- Run `php --version` to check your installed PHP version and confirm the system PHP package version
- Check if league/commonmark is installed via Composer by running `composer show league/commonmark` in your application root directory
- Review your application's markdown processing code for usage of DisallowedRawHtml extension: `grep -r 'DisallowedRawHtml' /path/to/app/src`
- Search application logs for suspicious HTML tag patterns with embedded whitespace (e.g., '<script\n>', '<iframe\t>') that may indicate exploitation attempts
- After updating to version 2.8.1+, run `composer update league/commonmark` and verify the new version with `composer show league/commonmark`
Indicators of compromise
- <script\n>
- <script\t>
- <iframe\n>
- <img\t>
- <embed\r\n>
FAQ
What is CVE-2026-30838?
This is an XSS vulnerability in the league/commonmark PHP Markdown parser where the DisallowedRawHtml extension can be bypassed by inserting whitespace characters (newlines, tabs) between an HTML tag name and the closing bracket, allowing malicious scripts to pass through filtering.
Is CVE-2026-30838 being actively exploited?
No, this vulnerability is not currently listed on the CISA Known Exploited Vulnerabilities (KEV) catalog, and there are no publicly available exploit proofs-of-concept as of the advisory date.
What versions of league/commonmark are affected by CVE-2026-30838?
All versions of league/commonmark prior to version 2.8.1 are affected when the DisallowedRawHtml extension is actively used for HTML sanitization.
How do I check if my server is vulnerable to CVE-2026-30838?
Run `composer show league/commonmark` in your application directory to check the installed version. If the version is below 2.8.1 and you use the DisallowedRawHtml extension, your application is vulnerable.
Does Defensia detect CVE-2026-30838?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and league/commonmark are present on a monitored server, CVE-2026-30838 will appear in your dashboard with remediation steps.
Related PHP CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-30838. Free for 1 server.
Get started free