GHSA-gcr2-9v8m-gq45: XSS

Published Sep 2, 2026
·
Updated

Summary

@dicebear/core builds avatar SVGs from caller-supplied options. The numeric rotate option is interpolated into an SVG transform attribute without XML-escaping. It is typed as a number, but nothing checks the type at runtime, so a string value passes straight through and can break out of the attribute to inject arbitrary SVG markup.

This is the same root cause as CVE-2026-33311 (GHSA-mr9r-mww3-v6gv), which escaped the string options backgroundColor, fontFamily, and textColor but did not cover rotate. @dicebear/initials has the same gap in its numeric fontSize and fontWeight options.

Impact

Cross-site scripting (CWE-79). When the generated avatar is rendered inline (for example via innerHTML) or served as image/svg+xml and opened directly, injected markup such as an <image onerror> handler runs script in the page's origin.

Exploitation requires the application to pass untrusted input into one of these options:

- rotate (@dicebear/core) - fontSize, fontWeight (@dicebear/initials)

In most integrations these options are set by the developer and only seed is user-controlled, so the vulnerable configuration is uncommon. Applications that use trusted, hardcoded values for these options are not at risk.

Patches

Fixed in @dicebear/core 9.4.3 and @dicebear/initials 9.4.3: the values are now XML-escaped before being written into the SVG, matching the CVE-2026-33311 fix. Upgrade to 9.4.3 or later.

The 5.x through 8.x lines share the same flaw but are end-of-life and will not receive a backport; upgrade to 9.4.3. The 10.x line is not affected.

Workarounds

If you cannot upgrade, coerce the affected options to a number before passing them to createAvatar:

js rotate: Number(userInput) || 0,

Credits

Reported by @rz1027.

Affected Software

2 affected componentsFixes available
npm/@dicebear/initials<=9.4.2
9.4.3
npm/@dicebear/core<=9.4.2
9.4.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

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

    Fixed in 9.4.3
  2. Upgrade

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

    Fixed in 9.4.3
  3. Upgrade

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

    Fixed in 9.4.3
  4. Upgrade

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

    Fixed in 9.4.3
  5. Configuration

    If you cannot upgrade, coerce the numeric rotate option to a number before passing it to createAvatar (e.g., use `rotate: Number(userInput) || 0`), because a string value passes through at runtime and can break out of the SVG `transform` attribute for injection.

    @dicebear/core/@dicebear/initials rotate = Number(userInput) || 0

Event History

Sep 2, 2026
Advisory Published
via GitHub·10:44 PM
Data Sourced
via GitHub·10:44 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which applications are realistically exposed?

Applications are exposed when untrusted input can reach the rotate option in @dicebear/core or the fontSize or fontWeight options in @dicebear/initials, and the resulting SVG is rendered inline or opened directly as image/svg+xml. The advisory notes that this is uncommon in most integrations because developers usually set these options while only the seed is user-controlled.

2

What must an attacker control to exploit this issue?

An attacker must be able to supply a string value to one of the affected numeric options despite its declared numeric type. Runtime type checking is absent, allowing the string to escape the SVG attribute and inject SVG markup.

3

How can I determine whether my implementation is affected?

Review all calls that generate DiceBear avatars and trace whether untrusted data is passed to rotate, fontSize, or fontWeight. Prioritize cases where the generated SVG is inserted with innerHTML or otherwise rendered inline, or is served as image/svg+xml for direct opening.

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