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

Machine-generated threat intelligence

AILast updated: 03/14/2026, 19:58:46 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 user input. However, prior to version 2.8.1, this extension fails to properly neutralize input when whitespace characters such as newline (\n), tab (\t), or other ASCII whitespace are inserted between the tag name and the closing angle bracket (>). For example, an attacker can craft a tag like <script\n> which bypasses the filtering logic because the extension does not recognize it as a disallowed tag due to the inserted whitespace. Browsers interpret this as a valid HTML tag, enabling script execution in the context of the vulnerable web application. This vulnerability is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation), a common vector for XSS attacks. The vulnerability affects all applications using the DisallowedRawHtml extension on untrusted markdown input without additional sanitization layers. The issue was publicly disclosed and assigned CVE-2026-30838 with a CVSS 4.0 base score of 5.1 (medium severity). The patch released in version 2.8.1 corrects the filtering logic to properly handle whitespace in tag names, closing the bypass. No known exploits are currently reported in the wild, but the vulnerability presents a credible risk for injection of malicious scripts leading to session hijacking, defacement, or other client-side attacks.

Potential Impact

This vulnerability allows attackers to inject malicious scripts into web applications that use the vulnerable commonmark versions with the DisallowedRawHtml extension to sanitize untrusted markdown input. Successful exploitation can lead to cross-site scripting attacks, compromising the confidentiality and integrity of user sessions, stealing cookies or credentials, performing actions on behalf of users, or delivering malware. The impact is primarily on client-side users of affected applications but can also damage the reputation and trustworthiness of the organization. Since the vulnerability requires no authentication but does require user interaction (e.g., viewing or submitting markdown content), it can be exploited via phishing or malicious content submission. Organizations relying on this library for content rendering without additional HTML sanitization are at risk. The scope includes any web application or service that processes user-generated markdown content with the vulnerable extension. Although no active exploits are known, the medium severity and ease of exploitation warrant prompt remediation to prevent potential attacks.

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 feasible, 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 audit all markdown processing workflows to identify usage of the DisallowedRawHtml extension and ensure untrusted input is properly sanitized. 4. Employ Content Security Policy (CSP) headers to restrict script execution and reduce the impact of potential XSS attacks. 5. Educate developers and content contributors about safe markdown usage and the risks of embedding raw HTML. 6. Monitor application logs and user reports for suspicious activity indicative of attempted XSS exploitation. 7. Conduct security testing, including fuzzing and penetration testing, focused on markdown input handling to detect similar bypasses. These steps provide layered defense beyond the vulnerable extension and reduce the attack surface.

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/14/2026, 7:58:46 PM

Last updated: 4/20/2026, 3:37:51 PM

Views: 107

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 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