Advisory

GHSA-mr9r-mww3-v6gv

Also known as: CVE-2026-33311

Summary

SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials

Details

Summary

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.

Affected packages

  • `@dicebear/core` — backgroundColor option values interpolated into SVG attributes without escaping (affects solid and gradientLinear background types)
  • `@dicebear/initials` — fontFamily and textColor option values interpolated into SVG attributes without escaping

Fix

All affected SVG attribute values are now properly escaped using XML entity encoding. Users should upgrade to the listed patched versions.

Mitigating factors

  • 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

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2026-03-19 17:49 UTC
Modified
2026-09-10 03:51 UTC

Affected packages and fixes

@dicebear/core

npm · All systems

Affected

  • introduced 5.0.0, fixed 5.4.4 (semver)

Fixed versions

5.4.4

Fix

@dicebear/core

npm · All systems

Affected

  • introduced 6.0.0, fixed 6.1.4 (semver)

Fixed versions

6.1.4

Fix

@dicebear/core

npm · All systems

Affected

  • introduced 7.0.0, fixed 7.1.4 (semver)

Fixed versions

7.1.4

Fix

@dicebear/core

npm · All systems

Affected

  • introduced 8.0.0, fixed 8.0.3 (semver)

Fixed versions

8.0.3

Fix

@dicebear/core

npm · All systems

Affected

  • introduced 9.0.0, fixed 9.4.1 (semver)

Fixed versions

9.4.1

Fix

@dicebear/initials

npm · All systems

Affected

  • introduced 5.0.0, fixed 5.4.4 (semver)

Fixed versions

5.4.4

Fix

@dicebear/initials

npm · All systems

Affected

  • introduced 6.0.0, fixed 6.1.4 (semver)

Fixed versions

6.1.4

Fix

@dicebear/initials

npm · All systems

Affected

  • introduced 7.0.0, fixed 7.1.4 (semver)

Fixed versions

7.1.4

Fix

@dicebear/initials

npm · All systems

Affected

  • introduced 8.0.0, fixed 8.0.3 (semver)

Fixed versions

8.0.3

Fix

@dicebear/initials

npm · All systems

Affected

  • introduced 9.0.0, fixed 9.4.1 (semver)

Fixed versions

9.4.1

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences