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

Published Aug 20, 2026
·
Updated

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.

Affected Software

2 affected components
npm/@dicebear/core<9.4.3
npm/@dicebear/initials<9.4.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade @dicebear/core to a version that resolves this vulnerability.

    Fixed in 9.4.3
  2. Upgrade

    Upgrade @dicebear/initials to a version that resolves this vulnerability.

    Fixed in 9.4.3

Event History

Aug 20, 2026
CVE Published
via MITRE·09:08 PM
Data Sourced
via MITRE·09:08 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are realistically exposed?

Applications using @dicebear/core before 9.4.3 are exposed if they pass attacker-controlled values to rotate. Applications using @dicebear/initials before 9.4.3 are exposed if they pass attacker-controlled values to fontSize or fontWeight, and render the resulting SVG inline or serve it as image/svg+xml for direct opening.

2

What must an attacker control for exploitation?

The attacker must be able to cause the application to supply a string value to one of the affected options, despite their numeric TypeScript types. They also need the generated SVG to be rendered in a context where injected SVG script can execute in the page origin.

3

Are normal default uses affected?

The issue requires untrusted input to reach normally developer-controlled avatar options. The provided information does not indicate that default option values alone trigger the vulnerability.

4

What can be done if upgrading is not immediately possible?

Do not pass untrusted values to rotate, fontSize, or fontWeight. Enforce numeric validation and reject values that are not valid numbers before generating the SVG; upgrade both affected packages to version 9.4.3 when possible.

5

How can an application determine whether it is at risk?

Review calls that generate DiceBear avatars for user- or request-controlled data reaching rotate, fontSize, or fontWeight. Also identify whether generated SVG is inserted inline or served as image/svg+xml and opened directly, as those rendering paths can allow script execution.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203