CVE-2026-30838
JSON

5.1medium

league/commonmark: DisallowedRawHtml extension bypass via whitespace in HTML tag names

Severity
5.1medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.24% (higher than 16% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-4v6x-c7xx-hw9f

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.

Affected

Product or packageVersionsReported by
thephpleague commonmark< 2.8.1, before 2.8.1CVE List, NVD
league/commonmark (Packagist)from 2.0.0 before 2.8.1GitHub Advisory Database

All scores

GitHub_M5.1medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

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.

Patches

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

Workarounds
  • 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.
  • Pass the rendered HTML through a dedicated HTML sanitizer before serving it to users (always recommended)
NVD (es)

league/commonmark es un analizador de Markdown de PHP. Antes de la versión 2.8.1, la extensión DisallowedRawHtml puede ser eludida insertando un salto de línea, una tabulación u otro carácter de espacio en blanco ASCII entre el nombre de una etiqueta HTML no permitida y el signo de cierre &gt;. Por ejemplo, pasaría sin filtrar y sería renderizado como una etiqueta HTML válida por los navegadores. Esto es un vector de cross-site scripting (XSS) para cualquier aplicación que dependa de esta extensión para sanear la entrada de usuario no confiable. Todas las aplicaciones que utilizan la extensión DisallowedRawHtml para procesar markdown no confiable están afectadas. Las aplicaciones que utilizan un saneador de HTML dedicado (como HTML Purifier) en la salida renderizada no están afectadas. Este problema ha sido parcheado en la versión 2.8.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-30838 changed 2026-03-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-4v6x-c7xx-hw9f changed 2026-03-20CC-BY-4.0
NVDCVE-2026-30838 changed 2026-06-17Public domain