4.7medium
@dicebear/core and @dicebear/initials Vulnerable to SVG Injection via Unsanitized Options
- Severity
- 4.7medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.21% (higher than 11% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-mr9r-mww3-v6gv
Description
DiceBear is an avatar library for designers and developers. Starting in version 5.0.0 and prior to versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, 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`. Starting in versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, all affected SVG attribute values are properly escaped using XML entity encoding. Users should upgrade to the listed patched versions. Some mitigating factors limit vulnerability. 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
| Product or package | Versions | Reported by |
|---|---|---|
| dicebear dicebear | >= 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, from 5.0.0 before 5.4.4, from 6.0.0 before 6.1.4, from 7.0.0 before 7.1.4 and 2 more | CVE List, NVD |
| @dicebear/core (npm) | from 5.0.0 before 5.4.4, from 6.0.0 before 6.1.4, from 7.0.0 before 7.1.4, from 8.0.0 before 8.0.3, from 9.0.0 before 9.4.1 | GitHub Advisory Database |
| @dicebear/initials (npm) | from 5.0.0 before 5.4.4, from 6.0.0 before 6.1.4, from 7.0.0 before 7.1.4, from 8.0.0 before 8.0.3, from 9.0.0 before 9.4.1 | GitHub Advisory Database |
All scores
| GitHub_M | 4.7medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 4.7medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
DiceBear is an avatar library for designers and developers. Starting in version 5.0.0 and prior to versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, 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`. Starting in versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, and 9.4.1, all affected SVG attribute values are properly escaped using XML entity encoding. Users should upgrade to the listed patched versions. Some mitigating factors limit vulnerability. 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.
GitHub Advisory Database
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
NVD (es)
DiceBear es una biblioteca de avatares para diseñadores y desarrolladores. A partir de la versión 5.0.0 y antes de las versiones 5.4.4, 6.1.4, 7.1.4, 8.0.3 y 9.4.1, los valores de atributos SVG derivados de opciones proporcionadas por el usuario ('backgroundColor', 'fontFamily', 'textColor') no se escapaban en XML antes de la interpolación en la salida SVG. Esto podría permitir cross-site scripting (XSS) cuando las aplicaciones pasan entrada no confiable a createAvatar() y sirven el SVG resultante en línea o con Content-Type: image/svg+xml. A partir de las versiones 5.4.4, 6.1.4, 7.1.4, 8.0.3 y 9.4.1, todos los valores de atributos SVG afectados se escapan correctamente utilizando la codificación de entidades XML. Los usuarios deben actualizar a las versiones parcheadas listadas. Algunos factores mitigantes limitan la vulnerabilidad. Las aplicaciones que validan la entrada contra el esquema JSON de la biblioteca antes de pasarla a createAvatar() no se ven afectadas. La CLI de DiceBear valida la entrada a través de AJV y no era vulnerable. La explotación requiere que una aplicación pase entrada externa no confiable y no validada directamente como valores de opción.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-33311 changed 2026-03-26 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-mr9r-mww3-v6gv changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-33311 changed 2026-06-17 | Public domain |