DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials) (CVE-2026-68921)
Description
A vulnerability in @dicebear/core and @dicebear/initials allows SVG injection via unescaped numeric options that are not properly type-checked at runtime. Specifically, the rotate option in @dicebear/core and fontSize/fontWeight options in @dicebear/initials can be exploited to inject arbitrary SVG markup leading to cross-site scripting (XSS). This occurs because these options are interpolated into SVG transform attributes without XML escaping. The flaw is fixed in version 9.4.3 and later.
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.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
@dicebear/core generates avatar SVGs using caller-supplied options. The numeric rotate option is interpolated into an SVG transform attribute without XML escaping, and since runtime type checks are absent, string values can inject arbitrary SVG markup. Similarly, @dicebear/initials has the same issue with fontSize and fontWeight options. This vulnerability allows cross-site scripting (CWE-79) when the SVG is rendered inline or served as image/svg+xml. Exploitation requires untrusted input passed to these options, which is uncommon as these are typically developer-controlled. The issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3 by applying XML escaping to these values.
Potential Impact
The vulnerability enables cross-site scripting (XSS) attacks by injecting arbitrary SVG markup that can execute scripts in the context of the page's origin. This can occur if untrusted input is passed to the rotate, fontSize, or fontWeight options and the resulting SVG is rendered inline or opened directly as an SVG image. The impact includes potential script execution leading to data theft or session hijacking. However, exploitation is limited because these options are usually set by developers with trusted values, not user input.
Mitigation Recommendations
A fix is available in @dicebear/core and @dicebear/initials version 9.4.3 and later, which applies XML escaping to the affected options. Users should upgrade to version 9.4.3 or newer. The 5.x through 8.x versions are end-of-life and will not receive patches; upgrading is recommended. If upgrading is not possible, a workaround is to coerce the affected options to numbers before passing them to createAvatar, for example: rotate: Number(userInput) || 0.
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 enriched: 09/07/2026, 19:26:55 UTC
Last updated: 10/19/2026, 18:48:22 UTC
Views: 56
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
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
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.