CVE-2026-33311 @dicebear/core and @dicebear/initials Vulnerable to SVG Injection via Unsanitized Options

Medium 4.7 Published Updated

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.

PackageAffectedFixed in
@dicebear/core npmFrom 5.0.05.4.4
@dicebear/core npmFrom 5.0.05.4.4
@dicebear/core npmFrom 6.0.06.1.4
@dicebear/core npmFrom 6.0.06.1.4
@dicebear/core npmFrom 7.0.07.1.4
@dicebear/core npmFrom 7.0.07.1.4
14 more packages
@dicebear/core npmFrom 8.0.08.0.3
@dicebear/core npmFrom 8.0.08.0.3
@dicebear/core npmFrom 9.0.09.4.1
@dicebear/core npmFrom 9.0.09.4.1
@dicebear/initials npmFrom 5.0.05.4.4
@dicebear/initials npmFrom 5.0.05.4.4
@dicebear/initials npmFrom 6.0.06.1.4
@dicebear/initials npmFrom 6.0.06.1.4
@dicebear/initials npmFrom 7.0.07.1.4
@dicebear/initials npmFrom 7.0.07.1.4
@dicebear/initials npmFrom 8.0.08.0.3
@dicebear/initials npmFrom 8.0.08.0.3
@dicebear/initials npmFrom 9.0.09.4.1
@dicebear/initials npmFrom 9.0.09.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.

Sources

Also known as GHSA-mr9r-mww3-v6gv.

Is CVE-2026-33311 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free