medium CVSS 6.1

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
2026-03-07

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 php

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

WAF 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

  1. Run `php --version` to check your installed PHP version and confirm the system PHP package version
  2. Check if league/commonmark is installed via Composer by running `composer show league/commonmark` in your application root directory
  3. Review your application's markdown processing code for usage of DisallowedRawHtml extension: `grep -r 'DisallowedRawHtml' /path/to/app/src`
  4. Search application logs for suspicious HTML tag patterns with embedded whitespace (e.g., '<script\n>', '<iframe\t>') that may indicate exploitation attempts
  5. 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

CVE-2025-46348CVSS 10YesWiki is a wiki system written in PHP. Prior to version 4.5.4, the request to commence a site backup can be performed and downloaded without authentication. The archives are created with a predictable filename, so a malicious user could create and download an archive without being authenticated. This could result in a malicious attacker making numerous requests to create archives and fill up the file system, or by downloading the archive which contains sensitive site information. This issue has been patched in version 4.5.4.
CVE-2024-5932CVSS 10The GiveWP – Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all versions up to, and including, 3.14.1 via deserialization of untrusted input from the 'give_title' parameter. This makes it possible for unauthenticated attackers to inject a PHP Object. The additional presence of a POP chain allows attackers to execute code remotely, and to delete arbitrary files.
CVE-2026-39337CVSS 10ChurchCRM is an open-source church management system. Prior to 7.1.0, critical pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The "$dbPassword" variable is not sanitized. This vulnerability exists due to an incomplete fix for CVE-2025-62521. This vulnerability is fixed in 7.1.0.
CVE-2026-28289CVSS 10FreeScout is a free help desk and shared inbox built with PHP's Laravel framework. A patch bypass vulnerability for CVE-2026-27636 in FreeScout 1.8.206 and earlier allows any authenticated user with file upload permissions to achieve Remote Code Execution (RCE) on the server by uploading a malicious .htaccess file using a zero-width space character prefix to bypass the security check. The vulnerability exists in the sanitizeUploadedFileName() function in app/Http/Helper.php. The function contains a Time-of-Check to Time-of-Use (TOCTOU) flaw where the dot-prefix check occurs before sanitization removes invisible characters. This vulnerability is fixed in 1.8.207.
CVE-2025-47916CVSS 10Invision Community 5.0.0 before 5.0.7 allows remote code execution via crafted template strings to themeeditor.php. The issue lies within the themeeditor controller (file: /applications/core/modules/front/system/themeeditor.php), where a protected method named customCss can be invoked by unauthenticated users. This method passes the value of the content parameter to the Theme::makeProcessFunction() method; hence it is evaluated by the template engine. Accordingly, this can be exploited by unauthenticated attackers to inject and execute arbitrary PHP code by providing crafted template strings.

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