DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials) (CVE-2026-68921)
## Summary `@dicebear/core` builds avatar SVGs from caller-supplied options. The numeric `rotate` option is interpolated into an SVG `transform` attribute without XML-escaping. It is typed as a number, but nothing checks the type at runtime, so a string value passes straight through and can break out of the attribute to inject arbitrary SVG markup. This is the same root cause as CVE-2026-33311 (GHSA-mr9r-mww3-v6gv), which escaped the string options `backgroundColor`, `fontFamily`, and `textColor` but did not cover `rotate`. `@dicebear/initials` has the same gap in its numeric `fontSize` and `fontWeight` options. ## Impact Cross-site scripting (CWE-79). When the generated avatar is rendered inline (for example via `innerHTML`) or served as `image/svg+xml` and opened directly, injected markup such as an `<image onerror>` handler runs script in the page's origin. Exploitation requires the application to pass untrusted input into one of these options: - `rotate` (`@dicebear/core`) - `fontSize`, `fontWeight` (`@dicebear/initials`) In most integrations these options are set by the developer and only `seed` is user-controlled, so the vulnerable configuration is uncommon. Applications that use trusted, hardcoded values for these options are not at risk. ## Patches Fixed in `@dicebear/core` 9.4.3 and `@dicebear/initials` 9.4.3: the values are now XML-escaped before being written into the SVG, matching the CVE-2026-33311 fix. Upgrade to 9.4.3 or later. The 5.x through 8.x lines share the same flaw but are end-of-life and will not receive a backport; upgrade to 9.4.3. The 10.x line is not affected. ## Workarounds If you cannot upgrade, coerce the affected options to a number before passing them to `createAvatar`: ```js rotate: Number(userInput) || 0, ``` ## Credits Reported by @rz1027.
DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials) (CVE-2026-68921)
Description
## Summary `@dicebear/core` builds avatar SVGs from caller-supplied options. The numeric `rotate` option is interpolated into an SVG `transform` attribute without XML-escaping. It is typed as a number, but nothing checks the type at runtime, so a string value passes straight through and can break out of the attribute to inject arbitrary SVG markup. This is the same root cause as CVE-2026-33311 (GHSA-mr9r-mww3-v6gv), which escaped the string options `backgroundColor`, `fontFamily`, and `textColor` but did not cover `rotate`. `@dicebear/initials` has the same gap in its numeric `fontSize` and `fontWeight` options. ## Impact Cross-site scripting (CWE-79). When the generated avatar is rendered inline (for example via `innerHTML`) or served as `image/svg+xml` and opened directly, injected markup such as an `<image onerror>` handler runs script in the page's origin. Exploitation requires the application to pass untrusted input into one of these options: - `rotate` (`@dicebear/core`) - `fontSize`, `fontWeight` (`@dicebear/initials`) In most integrations these options are set by the developer and only `seed` is user-controlled, so the vulnerable configuration is uncommon. Applications that use trusted, hardcoded values for these options are not at risk. ## Patches Fixed in `@dicebear/core` 9.4.3 and `@dicebear/initials` 9.4.3: the values are now XML-escaped before being written into the SVG, matching the CVE-2026-33311 fix. Upgrade to 9.4.3 or later. The 5.x through 8.x lines share the same flaw but are end-of-life and will not receive a backport; upgrade to 9.4.3. The 10.x line is not affected. ## Workarounds If you cannot upgrade, coerce the affected options to a number before passing them to `createAvatar`: ```js rotate: Number(userInput) || 0, ``` ## Credits Reported by @rz1027.
CVSS v3.1
Score 4.7medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-gcr2-9v8m-gq45
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-68921"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a998f6bacd9273b49193583
Added to database: 09/03/2026, 15:16:59 UTC
Last updated: 09/03/2026, 22:52:14 UTC
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.