SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials
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—backgroundColoroption values interpolated into SVG attributes without escaping (affectssolidandgradientLinearbackground types)@dicebear/initials—fontFamilyandtextColoroption 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.
| Platform | Package | Vulnerable versions | Fixed 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 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
- 2026: 2
-
SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials this entry
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.