CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-97JJ-33GV-5XF9

GHSA-97jj-33gv-5xf9: Stored Cross-Site Scripting Bypass in league/commonmark DisallowedRawHtml Extension

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 30, 2026·6 min read·17 visits

Executive Summary (TL;DR)

A regular expression flaw in league/commonmark allows attackers to bypass the DisallowedRawHtml filter using unclosed tags at block boundaries, resulting in Stored Cross-Site Scripting (XSS).

A security vulnerability in league/commonmark versions 1.3.0 through 2.10.1 allows remote attackers to bypass Stored Cross-Site Scripting (XSS) protections in the DisallowedRawHtml extension. Due to an validation logic flaw in the regular expression parser, specifically handling bare, unclosed HTML blocks ending at the string boundary, raw HTML tags can be passed to the rendered output. When combined with browser-side parsing heuristics, an attacker can execute arbitrary JavaScript in the context of the user session.

Vulnerability Overview

The PHP Markdown parser library league/commonmark is widely used to convert Markdown text into compliant HTML. To secure applications from malicious raw HTML insertion, the library provides the DisallowedRawHtml extension (which is enabled automatically under GitHub Flavored Markdown config). This extension is designed to sanitize and escape hazardous HTML tags, such as <script>, <iframe>, or <style>, preventing potential script execution in a client browser.

However, a severe design flaw exists within the input validation structure of the DisallowedRawHtml extension. The module employs a regular expression pattern to intercept and escape dangerous tags. When processing highly malformed or truncated HTML blocks, the parser can fail to match and escape these elements, leaving raw script tags intact within the rendered HTML payload.

This flaw represents a Stored Cross-Site Scripting (XSS) vulnerability. Since the processed Markdown is stored in the database (e.g., comments, forum content, wiki pages) and rendered to other users, attackers can execute arbitrary JavaScript in the sessions of unsuspecting users who view the generated page.

Root Cause Analysis

The root cause of this vulnerability lies in an impedance mismatch between the CommonMark HTML block parser and the DisallowedRawHtmlRenderer validation regex. According to the CommonMark and GFM specifications, a line starting with an HTML tag name (such as <script or <iframe) with no trailing brackets or whitespace is interpreted as the beginning of a valid HTML block.

When league/commonmark compiles this into an HtmlBlock node, it retains the exact text segment. This output text ends abruptly at the tag name boundary itself (e.g., <script). It does not append a closing bracket or space. Prior to the fix, the DisallowedRawHtmlRenderer executed the following regular expression to intercept the disallowed tag names:

$regex = \sprintf('/<(\/?(?:%s)[\s\/>])/i', \implode('|', \array_map('preg_quote', $tags)));

The trailing character class [\s\/>] requires that the matched tag name be immediately followed by either a space, a forward slash, or a closing angle bracket. Because the compiled HtmlBlock ends exactly with the last character of the tag name (the letter 't' in <script), there is no trailing character available. The regex match fails entirely, and the unescaped tag is passed directly into the final document.

When a browser parses the resulting HTML document, it encounters the raw <script string. To ensure high compatibility with poorly structured web pages, modern web browsers automatically attempt to repair unclosed tags. The browser treats subsequent HTML attributes on the next lines as the attributes of the open <script tag, leading to script execution.

Code Analysis

The vulnerability was corrected in commit 411afcc2a7402756d96c89af8882c724d12d47ca by extending the regular expression to support end-of-string boundaries. Below is a comparison of the vulnerable and patched regex implementations in DisallowedRawHtmlRenderer.php.

- $regex = \sprintf('/<(\/?(?:%s)[\s\/>])/i', \implode('|', \array_map('preg_quote', $tags)));
+ // The tag name may also end the rendered HTML: the block parser accepts a bare
+ // `<script` line, and browsers treat the following block as its attributes.
+ $regex = \sprintf('/<(\/?(?:%s)(?:[\s\/>]|$))/i', \implode('|', \array_map('preg_quote', $tags)));

In the vulnerable implementation, the regex required an explicit trailing delimiter character. In the patched code, a non-capturing group (?:[\s\/>]|$) was introduced. This alternation ensures that the pattern matches the tag name if it is followed by a standard delimiter OR if it is situated at the absolute end of the target string ($).

This correction is robust and complete. It prevents the exploitation of any block structure where the tag terminates the string, regardless of whether the tag is at the end of the entire document or nested within structural blocks. Variant attacks trying to bypass the check by abusing boundary conditions are neutralized because the regex engine now treats the string boundary as a valid terminator.

Exploitation Methodology

To exploit this vulnerability, an attacker must have permission to submit Markdown text that is subsequently rendered to other users. The configuration parameter html_input must be set to allow (the library default), and the DisallowedRawHtml extension must be active (which is typical when using GFM).

An attacker can construct a payload where the disallowed tag is isolated on its own line without any trailing characters, thereby triggering the HTML block parsing rules. The attacker then places the execution context or external resource link on a subsequent block, which the browser's loose parsing engine will merge.

An example payload utilizes a <script tag followed by a blank line and an element that looks like an attribute list:

<div>
<script
 
<span src="/evil.js">

This input translates to the following rendered HTML output:

<div>
<script
<span src="/evil.js">

When a browser reads this, it parses the open <script tag, ignores the intermediate whitespace, and interprets the src="/evil.js" attribute as belonging directly to the script element, downloading and executing the remote script.

Impact Assessment

The impact of this vulnerability is Stored Cross-Site Scripting (XSS). If successfully exploited, the attacker can execute arbitrary client-side JavaScript within the browser context of any user who views the page containing the malicious rendered Markdown.

This execution capability enables several critical attack paths. Attackers can steal session identifiers, session cookies (if not marked with the HttpOnly flag), or access tokens stored in LocalStorage. They can also perform unauthorized actions on behalf of the victim, alter the DOM to phish for user credentials, or deploy client-side keyloggers to capture sensitive user inputs.

The vulnerability is classified with a CVSS v3.1 score of 6.1 (Medium). The vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N highlights that while exploitation requires zero privileges (PR:N) and is of low complexity (AC:L), it does require a victim user to navigate to and view the page containing the injected content (UI:R), and triggers a scope change (S:C) because execution happens in the browser context.

Remediation and Mitigation Guidance

The primary and recommended mitigation is upgrading the league/commonmark package to version 2.10.2 or later. This release updates the core regex logic to handle string boundaries gracefully, ensuring that bare tag names are properly matched and escaped.

To update the dependency in a PHP application utilizing Composer, execute the following command:

composer update league/commonmark

If upgrading the library is not immediately possible due to dependency constraints, you can temporarily mitigate the vulnerability by adjusting the library configuration. Setting the html_input option to escape or strip prevents the parser from rendering any raw HTML tags, neutralizing the bypass vector.

use League\CommonMark\MarkdownConverter;
 
$config = [
    'html_input' => 'escape', // Escapes all user HTML, neutralizing XSS bypasses
];
 
$converter = new MarkdownConverter($config);

Official Patches

thephpleagueOfficial Security Advisory for GHSA-97jj-33gv-5xf9
thephpleagueLibrary Release Tag v2.10.2 with Security Patches

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Affected Systems

Applications using league/commonmark to render Markdown to HTML with raw HTML input enabled.

Affected Versions Detail

Product
Affected Versions
Fixed Version
league/commonmark
thephpleague
>= 1.3.0, <= 2.10.12.10.2
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork (AV:N)
CVSS6.1 (Medium)
EPSS ScoreN/A (No CVE assigned)
Exploit Statuspoc
KEV Statusfalse

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-79
Cross-site Scripting

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Known Exploits & Detection

GitHub Security AdvisoryProof of concept markdown rendering payload that bypasses DisallowedRawHtml using nested multiline sequences

References & Sources

  • [1]GitHub Advisory Database: GHSA-97jj-33gv-5xf9
  • [2]league/commonmark Security Advisory: XSS Bypass in DisallowedRawHtml
  • [3]Fix Commit 411afcc

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•21 minutes ago•CVE-2026-62297
7.5

CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd

An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.

Amit Schendel
Amit Schendel
1 views•10 min read
•about 1 hour ago•CVE-2026-126297
7.5

CVE-2026-126297: Algorithmic Complexity Denial of Service in NLTK ConllCorpusReader

CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).

Amit Schendel
Amit Schendel
2 views•12 min read
•about 2 hours ago•CVE-2026-126298
7.5

CVE-2026-126298: Quadratic Algorithmic Complexity Denial of Service in NLTK Tree.chomsky_normal_form

CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.

Alon Barad
Alon Barad
5 views•12 min read
•about 3 hours ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
4 views•10 min read
•about 4 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 5 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read