XSS Vulnerability in PHP Markdown Parser of League/CommonMark
CVE-2025-46734
What is CVE-2025-46734?
A cross-site scripting (XSS) vulnerability exists in the Attributes extension of the league/commonmark library, allowing remote attackers to embed malicious JavaScript into HTML. This issue affects versions 1.5.0 through 2.6.x, facilitating the injection of unsafe HTML attributes through Markdown syntax. While the library offers configuration options to mitigate XSS attacks, enabling the Attributes Extension may expose users to risks. Version 2.7.0 introduces improvements to address this vulnerability by blocking unsafe attributes and enforcing a whitelist for allowed HTML attributes. To enhance security, it is advised to either upgrade or disable the AttributesExtension for untrusted users, and consider filtering rendered HTML using libraries like HTMLPurifier.
Affected Version(s)
commonmark < 2.7.0