MediumGHSA-3527-qv2q-pfvxCVE-2025-46734

league/commonmark contains a XSS vulnerability in Attributes extension

Published 5 May 2025 · Updated 20 Mar 2026

Is your project on an affected league/commonmark?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
>=1.5.0 <2.7.0
Fixed in
2.7.0
Update to the fixed version for your release line, for example:composer require league/commonmark:^2.7.0

Details

Summary

Cross-site scripting (XSS) vulnerability in the Attributes extension of the league/commonmark library (versions 1.5.0 through 2.6.x) allows remote attackers to insert malicious JavaScript calls into HTML.

Details

The league/commonmark library provides configuration options such as html_input: 'strip' and allow_unsafe_links: false to mitigate cross-site scripting (XSS) attacks by stripping raw HTML and disallowing unsafe links. However, when the Attributes Extension is enabled, it introduces a way for users to inject arbitrary HTML attributes into elements via Markdown syntax using curly braces.

As a result, even with the secure configuration shown above, an attacker can inject dangerous attributes into applications using this extension via a payload such as:

![](){onerror=alert(1)}

Which results in the following HTML:

<p><img onerror="alert(1)" src="" alt="" /></p>

Which causes the JS to execute immediately on page load.

Patches

Version 2.7.0 contains three changes to prevent this XSS attack vector:

Workarounds

If upgrading is not feasible, please consider:

Is GHSA-3527-qv2q-pfvx in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected league/commonmark, and gives you the command that fixes it.

More advisories for league/commonmark

  • MediumCVE-2026-105829league/commonmark: DisallowedRawHtml bypassed when a disallowed tag name ends the raw-HTML literal · 30 Sept 2026
  • HighCVE-2026-105830league/commonmark: Quadratic-time denial of service in the GitHub Flavored Markdown Table extension block-start scan · 30 Sept 2026
  • HighCVE-2026-86428league/commonmark: Denial of service via distinctly-named attributes in the Attributes extension · 1 Sept 2026
  • HighCVE-2026-86429league/commonmark: Denial of service in the SmartPunct and Attributes extensions · 1 Sept 2026
  • HighCVE-2026-86431league/commonmark XSS: `on*` event-handler filter in `AttributesExtension` bypassed with a U+000C form feed · 1 Sept 2026
  • HighCVE-2026-86430league/commonmark: Denial of service via crafted code fences, reference links, and emphasis delimiters · 1 Sept 2026
All 18 advisories for league/commonmark

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.