CVE-2026-33311 @dicebear/core and @dicebear/initials Vulnerable to SVG Injection via Unsanitized Options
Attackers can inject malicious scripts via unsanitized SVG options in DiceBear, leading to XSS if applications serve generated SVGs inline.
- 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
What is CVE-2026-33311?
CVE-2026-33311 is a medium-severity cross-site scripting vulnerability in dicebear, published on 24 Mar 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. Starting in version 5.0.0 and prior to versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, SVG attribute values derived from user-supplied options (`backgroundColor`, `fontFamily`, `textColor`) were not XML-escaped before interpolation into SVG output. This could allow Cross-Site Scripting (XSS) when applications pass untrusted input to `createAvatar()` and serve the resulting SVG inline or with `Content-Type: image/svg+xml`. Starting in versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, all affected SVG attribute values are properly escaped using XML entity encoding. Users should upgrade to the listed patched versions. Some mitigating factors limit vulnerability. Applications that validate input against the library's JSON Schema before passing it to `createAvatar()` are not affected. The DiceBear CLI validates input via AJV and was not vulnerable. Exploitation requires that an application passes untrusted, unvalidated external input directly as option values.
Weakness: CWE-79
Which versions are affected by CVE-2026-33311?
20 open source packages ship an affected version, including @dicebear/core and @dicebear/initials. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
@dicebear/core npm | From 5.0.0 | 5.4.4 |
@dicebear/core npm | From 5.0.0 | 5.4.4 |
@dicebear/core npm | From 6.0.0 | 6.1.4 |
@dicebear/core npm | From 6.0.0 | 6.1.4 |
@dicebear/core npm | From 7.0.0 | 7.1.4 |
@dicebear/core npm | From 7.0.0 | 7.1.4 |
14 more packages
@dicebear/core npm | From 8.0.0 | 8.0.3 |
@dicebear/core npm | From 8.0.0 | 8.0.3 |
@dicebear/core npm | From 9.0.0 | 9.4.1 |
@dicebear/core npm | From 9.0.0 | 9.4.1 |
@dicebear/initials npm | From 5.0.0 | 5.4.4 |
@dicebear/initials npm | From 5.0.0 | 5.4.4 |
@dicebear/initials npm | From 6.0.0 | 6.1.4 |
@dicebear/initials npm | From 6.0.0 | 6.1.4 |
@dicebear/initials npm | From 7.0.0 | 7.1.4 |
@dicebear/initials npm | From 7.0.0 | 7.1.4 |
@dicebear/initials npm | From 8.0.0 | 8.0.3 |
@dicebear/initials npm | From 8.0.0 | 8.0.3 |
@dicebear/initials npm | From 9.0.0 | 9.4.1 |
@dicebear/initials npm | From 9.0.0 | 9.4.1 |
Products include Dicebear Dicebear.
How do I fix CVE-2026-33311?
Upgrade @dicebear/core to a fixed version for your release line: 5.4.4, 6.1.4, 7.1.4 or 8.0.3.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-33311 being exploited?
There is no known exploitation of CVE-2026-33311 in the wild and no public exploit code.
Other vulnerabilities in dicebear
Sources
Also known as GHSA-mr9r-mww3-v6gv.