# CVE-2025-46734: league/commonmark Cross-site Scripting vulnerability in Attributes extension

> Remote attackers can inject malicious JavaScript via Markdown attributes in the league/commonmark library when the Attributes extension is enabled.

- **Severity:** Medium 6.4 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 May 2025
- **Updated:** 6 May 2025
- **Also known as:** CLSA-2026-1771980771, DEBIAN-CVE-2025-46734, GHSA-3527-qv2q-pfvx, UBUNTU-CVE-2025-46734

## What is CVE-2025-46734?

CVE-2025-46734 is a medium-severity cross-site scripting vulnerability in thephpleague commonmark, published on 5 May 2025. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

league/commonmark is a PHP Markdown parser. A 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. 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. Version 2.7.0 contains three changes to prevent this XSS attack vector: All attributes starting with `on` are considered unsafe and blocked by default; support for an explicit allowlist of allowed HTML attributes; and manually-added `href` and `src` attributes now respect the existing `allow_unsafe_links` configuration option. If upgrading is not feasible, please consider disabling the `AttributesExtension` for untrusted users and/or filtering the rendered HTML through a library like HTMLPurifier.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2025-46734?

2 open source packages ship an affected version, including league/commonmark.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `league/commonmark` | Packagist | From 1.5.0 | 2.7.0 |
| `league/commonmark` | Packagist | From 1.5.0 | 2.7.0 |

## How do I fix CVE-2025-46734?

Upgrade league/commonmark to 2.7.0 or later.

## Is CVE-2025-46734 being exploited?

There is no known exploitation of CVE-2025-46734 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-46734 and fix it if it is affected.

What it is: CVE-2025-46734 is a medium-severity cross-site scripting vulnerability in thephpleague commonmark, published on 5 May 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-46734 in the wild and no public exploit code.

Affected packages and fixed versions:
- league/commonmark (Packagist): affected from 1.5.0; fixed in 2.7.0
- league/commonmark (Packagist): affected from 1.5.0; fixed in 2.7.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-46734/ (Markdown: https://insights.sbomify.com/CVE-2025-46734/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-46734
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-46734
- OSV: https://osv.dev/vulnerability/CVE-2025-46734

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-46734/
Summaries are generated and may contain mistakes; the official description above is the record.
