# GHSA-39h7-pwv7-rc3x: Excalidraw vulnerable to XSS via Mermaid sequence diagram labels (KaTeX rendering)

> Attackers can execute arbitrary JavaScript in Excalidraw by tricking users into pasting malicious Mermaid diagrams, requiring an upgrade to the patched library version.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 24 Apr 2026

## What is GHSA-39h7-pwv7-rc3x?

GHSA-39h7-pwv7-rc3x is a cross-site scripting vulnerability in @excalidraw/excalidraw, published on 24 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Impact

`@excalidraw/excalidraw@0.18.0` depends on a Mermaid conversion package version that resolves to a Mermaid release affected by CVE-2025-54881 / GHSA-7rqq-prvp-x9jh. User-supplied Mermaid sequence diagram labels could trigger XSS through Mermaid’s KaTeX label rendering path.

This is patched in `@excalidraw/excalidraw@0.18.1` by updating `@excalidraw/mermaid-to-excalidraw` to `2.2.2`, which uses a patched Mermaid 11 release.

Moderate severity as this XSS requires manual user action - pasting unsafe Mermaid diagram into the Excalidraw editor. No semi-automated attack vector exists by default (such as accessing a link).

### Patches

- Stable `@excalidraw/excalidraw@0.18.1` is patched.
- Unstable `@excalidraw/excalidraw@next` has resolved to patched builds since `@excalidraw/excalidraw@0.18.0-f29edf` on 2025-08-21.
- Direct consumers of `@excalidraw/mermaid-to-excalidraw` should use `1.1.3` or later.

### Workarounds

None.

### Resources

- Upstream Mermaid advisory: https://github.com/mermaid-js/mermaid/security/advisories/GHSA-7rqq-prvp-x9jh
- CVE-2025-54881

## Which versions are affected by GHSA-39h7-pwv7-rc3x?

4 open source packages ship an affected version, including @excalidraw/excalidraw and @excalidraw/mermaid-to-excalidraw.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@excalidraw/excalidraw` | npm | From 0.18.0 | 0.18.1 |
| `@excalidraw/excalidraw` | npm | From 0.18.0 | 0.18.1 |
| `@excalidraw/mermaid-to-excalidraw` | npm | From 0.3.0 | 1.1.3 |
| `@excalidraw/mermaid-to-excalidraw` | npm | From 0.3.0 | 1.1.3 |

## How do I fix GHSA-39h7-pwv7-rc3x?

Upgrade @excalidraw/excalidraw to 0.18.1 or later.

## Is GHSA-39h7-pwv7-rc3x being exploited?

There is no known exploitation of GHSA-39h7-pwv7-rc3x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-39h7-pwv7-rc3x and fix it if it is affected.

What it is: GHSA-39h7-pwv7-rc3x is a cross-site scripting vulnerability in @excalidraw/excalidraw, published on 24 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-39h7-pwv7-rc3x in the wild and no public exploit code.

Affected packages and fixed versions:
- @excalidraw/excalidraw (npm): affected from 0.18.0; fixed in 0.18.1
- @excalidraw/excalidraw (npm): affected from 0.18.0; fixed in 0.18.1
- @excalidraw/mermaid-to-excalidraw (npm): affected from 0.3.0; fixed in 1.1.3
- @excalidraw/mermaid-to-excalidraw (npm): affected from 0.3.0; fixed in 1.1.3

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/GHSA-39h7-pwv7-rc3x/ (Markdown: https://insights.sbomify.com/GHSA-39h7-pwv7-rc3x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-39h7-pwv7-rc3x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-39h7-pwv7-rc3x/
Summaries are generated and may contain mistakes; the official description above is the record.
