<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>Commonmark (&gt;= 2.7.0, &lt; 2.9.1) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/commonmark--2.7.0--2.9.1/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 02 Sep 2026 00:00:45 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/commonmark--2.7.0--2.9.1/feed.xml" rel="self" type="application/rss+xml"/><image><url>https://feed.craftedsignal.io/favicon-32x32.png</url><title>CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/</link><width>32</width><height>32</height></image><webfeeds:icon>https://feed.craftedsignal.io/favicon.svg</webfeeds:icon><item><title>Stored XSS via Attribute Filter Bypass in league/commonmark</title><link>https://feed.craftedsignal.io/briefs/2026-09-league-commonmark-xss/</link><pubDate>Wed, 02 Sep 2026 00:00:45 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-09-league-commonmark-xss/</guid><description>An XSS vulnerability in league/commonmark allows attackers to execute arbitrary JavaScript by prepending a U+000C form feed character to malicious attribute names, bypassing security filters in the AttributesExtension.</description><content:encoded><![CDATA[<p>The <code>AttributesExtension</code> for the <code>league/commonmark</code> library fails to correctly sanitize attributes when a U+000C form feed character (<code>\x0C</code>) is prepended to the attribute name. The library's <code>AttributesHelper</code> uses PHP's <code>trim()</code> function to clean input, but since <code>\x0C</code> is excluded from the default trim character list, the character is preserved. This results in the validator failing to identify restricted attributes (such as <code>onclick</code> or <code>onerror</code>) or unsafe <code>javascript:</code> URIs. Because the subsequent HTML renderer does not escape attribute names, browsers interpret the malformed tag as a valid HTML element containing the malicious handler or URI. This vulnerability affects <code>league/commonmark</code> versions 2.7.0 through 2.9.0 and persists even when developers enable recommended security configurations, such as disabling <code>allow_unsafe_links</code>.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker crafts a Markdown payload containing a malicious attribute or URI, prepending a U+000C character (e.g., <code>{\x0Conclick=&quot;alert(1)&quot;}</code>).</li>
<li>The <code>league/commonmark</code> parser encounters the attribute string during Markdown conversion.</li>
<li>The <code>AttributesHelper</code> matches the attribute string, including the leading <code>\x0C</code>, via regex.</li>
<li>The code calls PHP <code>trim()</code> on the attribute name, which fails to strip the <code>\x0C</code> character.</li>
<li>The library's <code>filterAttributes()</code> function compares the sanitized attribute name against an allow-list; the presence of the hidden <code>\x0C</code> causes string comparisons to fail, allowing the malicious attribute to pass.</li>
<li>The <code>HtmlElement</code> class serializes the attribute into the final HTML output without additional validation or escaping.</li>
<li>The target's browser parses the emitted HTML, treating the <code>\x0C</code> as whitespace and executing the attacker's JavaScript payload.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation results in stored Cross-Site Scripting (XSS) in any application rendering untrusted Markdown using the <code>AttributesExtension</code>. Because payloads like <code>onerror</code> can be attached to image tags, the script executes automatically upon page load without requiring user interaction. This leads to session hijacking, unauthorized actions on behalf of the user, and potential account takeover.</p>
<h2 id="recommendation">Recommendation</h2>
<p>Prioritize patching and configuration changes to mitigate the risk of XSS exploitation.</p>
<ul>
<li>Upgrade <code>league/commonmark</code> to version 2.9.1 or later immediately.</li>
<li>As a short-term workaround, define an explicit <code>allow</code> list for attributes (e.g., <code>['id', 'class', 'align']</code>) in the <code>AttributesExtension</code> configuration; this forces the library to reject attributes that do not match the allow-list regardless of prefix characters.</li>
<li>Audit applications using <code>league/commonmark</code> to determine if the <code>AttributesExtension</code> is enabled and if inputs are retrieved from untrusted sources.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>xss</category><category>web-vulnerability</category><category>php</category><category>supply-chain</category><category>denial-of-service</category><category>algorithmic-complexity</category></item></channel></rss>