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

Medium 4.7 Published Updated

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

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-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, CWE-184

Which versions are affected by CVE-2026-68921?

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

PackageAffectedFixed in
@dicebear/core npmAll versions9.4.3
@dicebear/core npmAll versions9.4.3
@dicebear/initials npmAll versions9.4.3
@dicebear/initials npmAll versions9.4.3

How do I fix CVE-2026-68921?

Upgrade @dicebear/core to 9.4.3 or later.

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-68921 being exploited?

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

Sources

Also known as GHSA-gcr2-9v8m-gq45.

Is CVE-2026-68921 in your software?

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

Check your SBOMs for free