# CVE-2026-68921: DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)

> Attackers can inject arbitrary SVG markup via unescaped options in DiceBear, leading to script execution if untrusted data is passed to the library.

- **Severity:** Medium 4.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N`)
- **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:** 20 Aug 2026
- **Updated:** 21 Aug 2026
- **Also known as:** GHSA-gcr2-9v8m-gq45

## What is CVE-2026-68921?

CVE-2026-68921 is a medium-severity cross-site scripting vulnerability in dicebear, published on 20 Aug 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

DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-184 (Incomplete List of Disallowed Inputs)

## Which versions are affected by CVE-2026-68921?

4 open source packages ship an affected version, including @dicebear/core and @dicebear/initials.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@dicebear/core` | npm | All versions | 9.4.3 |
| `@dicebear/core` | npm | All versions | 9.4.3 |
| `@dicebear/initials` | npm | All versions | 9.4.3 |
| `@dicebear/initials` | npm | All versions | 9.4.3 |

## How do I fix CVE-2026-68921?

Upgrade @dicebear/core to 9.4.3 or later.

## Is CVE-2026-68921 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-68921 and fix it if it is affected.

What it is: CVE-2026-68921 is a medium-severity cross-site scripting vulnerability in dicebear, published on 20 Aug 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 CVE-2026-68921 in the wild and no public exploit code.

Affected packages and fixed versions:
- @dicebear/core (npm): affected all versions; fixed in 9.4.3
- @dicebear/core (npm): affected all versions; fixed in 9.4.3
- @dicebear/initials (npm): affected all versions; fixed in 9.4.3
- @dicebear/initials (npm): affected all versions; fixed in 9.4.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/CVE-2026-68921/ (Markdown: https://insights.sbomify.com/CVE-2026-68921/index.md)
```

## Sources

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

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