Junglewise Threat Intelligence

CVE-2026-33311: DiceBear SVG injection via unsanitized options

CVE-2026-33311 · Severity: low · CVSS 3.1 · Published 2026-03-19

Executive brief

DiceBear is a JavaScript library used to generate customizable avatar images in SVG format. User-supplied options for colors and fonts were not properly escaped before being embedded into SVG output, allowing attackers to inject arbitrary SVG or JavaScript code. If an application accepts untrusted input and passes it directly to the library, attackers could conduct cross-site scripting (XSS) attacks against users viewing the generated avatars.

Technical details

The vulnerability is a Cross-Site Scripting (CWE-79) flaw in @dicebear/core and @dicebear/initials libraries. SVG attribute values derived from user-supplied options—specifically backgroundColor, fontFamily, and textColor—were interpolated directly into SVG output without XML entity encoding. An attacker can inject arbitrary XML/SVG markup or JavaScript code by crafting malicious values for these options. The attack requires that a web application passes untrusted external input directly to the createAvatar() function and serves the resulting SVG inline or with Content-Type: image/svg+xml. Applications that validate input against the library's JSON Schema before calling createAvatar() are not affected. Patches have been released for all affected versions (5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1) with proper XML entity escaping.

Affected products

  • DiceBear @dicebear/core 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
  • DiceBear @dicebear/initials 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

Timeline

  • 2026-03-18: disclosed
  • 2026-03-19: advisory
  • patched: Versions 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1 released

References