Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-30838: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in thephpleague commonmark

0
Medium
VulnerabilityCVE-2026-30838cvecve-2026-30838cwe-79
Published: Sat Mar 07 2026 (03/07/2026, 16:00:32 UTC)
Source: CVE Database V5
Vendor/Project: thephpleague
Product: commonmark

Description

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.

AI-Powered Analysis

AILast updated: 03/07/2026, 16:31:05 UTC

Technical Analysis

Thephpleague's commonmark is a widely used PHP library for parsing Markdown into HTML. Its DisallowedRawHtml extension is designed to prevent raw HTML tags from being rendered, thereby mitigating XSS risks when processing untrusted markdown input. However, prior to version 2.8.1, this extension fails to properly neutralize input containing disallowed HTML tags if an attacker inserts ASCII whitespace characters such as newlines or tabs between the tag name and the closing '>'. For example, the tag <script\n> bypasses the filter and is interpreted by browsers as a valid script tag, enabling cross-site scripting attacks. This vulnerability stems from improper input validation and sanitization during web page generation (CWE-79). The vulnerability affects all applications using the DisallowedRawHtml extension on untrusted markdown without additional HTML sanitization. Applications that apply a dedicated HTML sanitizer like HTML Purifier on the rendered output remain protected. The vulnerability has a CVSS 4.0 base score of 5.1 (medium severity), reflecting its network attack vector, low attack complexity, no privileges required, but requiring user interaction and limited impact on confidentiality and integrity. No known exploits have been reported in the wild. The issue was publicly disclosed on March 7, 2026, and fixed in version 2.8.1 of commonmark.

Potential Impact

Successful exploitation of this vulnerability allows attackers to inject malicious scripts into web pages rendered from untrusted markdown input, leading to cross-site scripting attacks. This can result in session hijacking, credential theft, defacement, or redirection to malicious sites, compromising user confidentiality and integrity. The impact is particularly significant for web applications that rely solely on the DisallowedRawHtml extension for sanitization without additional HTML filtering. Since the vulnerability can be exploited remotely over the network without authentication, any publicly accessible application using affected versions is at risk. However, the requirement for user interaction (e.g., a victim viewing the malicious markdown content) limits automated widespread exploitation. The vulnerability does not affect availability directly but can undermine user trust and lead to reputational damage. Organizations processing user-generated markdown content with the vulnerable library are most at risk.

Mitigation Recommendations

1. Upgrade thephpleague commonmark library to version 2.8.1 or later, where the vulnerability is patched. 2. If immediate upgrade is not possible, implement additional HTML sanitization on the rendered output using robust libraries such as HTML Purifier to neutralize any malicious tags or scripts. 3. Review and restrict markdown input sources to trusted users where feasible to reduce exposure. 4. Employ Content Security Policy (CSP) headers to limit the impact of potential XSS by restricting script execution and resource loading. 5. Conduct thorough security testing of markdown processing workflows to detect any residual injection vectors. 6. Educate developers and content managers about the risks of relying solely on DisallowedRawHtml for sanitization. 7. Monitor application logs and user reports for suspicious activity indicative of XSS exploitation attempts.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-03-05T21:06:44.606Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69ac4f4bc48b3f10ffae7ace

Added to database: 3/7/2026, 4:16:11 PM

Last enriched: 3/7/2026, 4:31:05 PM

Last updated: 3/8/2026, 4:11:45 AM

Views: 8

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses