SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials
Moderate severity
GitHub Reviewed
Published
Mar 18, 2026
in
dicebear/dicebear
•
Updated Mar 25, 2026
Package
Affected versions
>= 5.0.0, <= 5.4.3
>= 6.0.0, <= 6.1.3
>= 7.0.0, <= 7.1.3
>= 8.0.0, <= 8.0.2
>= 9.0.0, <= 9.4.0
Patched versions
5.4.4
6.1.4
7.1.4
8.0.3
9.4.1
>= 5.0.0, <= 5.4.3
>= 6.0.0, <= 6.1.3
>= 7.0.0, <= 7.1.3
>= 8.0.0, <= 8.0.2
>= 9.0.0, <= 9.4.0
5.4.4
6.1.4
7.1.4
8.0.3
9.4.1
Description
Published to the GitHub Advisory Database
Mar 19, 2026
Reviewed
Mar 19, 2026
Published by the National Vulnerability Database
Mar 24, 2026
Last updated
Mar 25, 2026
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 tocreateAvatar()and serve the resulting SVG inline or withContent-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 escapingFix
All affected SVG attribute values are now properly escaped using XML entity encoding. Users should upgrade to the listed patched versions.
Mitigating factors
createAvatar()are not affectedReferences