Medium

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

  • Disclosed: 19.03.2026
  • Updated: 11.10.2026 10:22

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

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package @dicebear/core >= 5.0.0, < 5.4.4, >= 6.0.0, < 6.1.4, >= 7.0.0, < 7.1.4, >= 8.0.0, < 8.0.3, >= 9.0.0, < 9.4.1 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1
npm package @dicebear/initials >= 5.0.0, < 5.4.4, >= 6.0.0, < 6.1.4, >= 7.0.0, < 7.1.4, >= 8.0.0, < 8.0.3, >= 9.0.0, < 9.4.1 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1

References

CVSS score 4.7/10
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-79
Platform
npm
Package
@dicebear/core, @dicebear/initials
Disclosed
19.03.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-mr9r-mww3-v6gv - CC BY 4.0

Vulnerability history: @dicebear/core

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
2
First → latest
03.2026 09.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Medium 2

Disclosures per year

  1. 2026: 2
  1. SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials this entry
    Medium · 4.7 CVE-2026-33311 >= 5.0.0, < 5.4.4, >= 6.0.0, < 6.1.4, >= 7.0.0, < 7.1.4, >= 8.0.0, < 8.0.3, >= 9.0.0, < 9.4.1 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.