CVE-2026-33311: SVG Injection Vulnerability in @dicebear/core and @dicebear/initials

@dicebear/core Updated 19 Mar 2026

Summary

19/03/2026
Yes i
Moderate
4.7

CVE-2026-33311: SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials. Affects @dicebear/core across 5 version ranges.

>= 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

Fixed in 5 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The @dicebear/core and @dicebear/initials packages are widely used libraries for generating avatars in web applications. They allow developers to create customizable avatars using various options such as background color, font family, and text color. However, these packages have a vulnerability that arises from unsanitized user inputs, which can lead to security risks when rendering SVG images.

Vulnerability Detail

The vulnerability stems from the fact that SVG attribute values derived from user-supplied options (backgroundColor, fontFamily, textColor) were not properly XML-escaped before being interpolated into SVG output. This oversight can lead to Cross-Site Scripting (XSS) attacks if applications pass untrusted input directly to the createAvatar() function and serve the resulting SVG inline or with Content-Type: image/svg+xml. Attackers could exploit this vulnerability to execute arbitrary scripts in the context of the user's browser, potentially compromising user data and application integrity.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 5.0.0, < 5.4.4 5.4.4
    npm install @dicebear/core@5.4.4
  • >= 6.0.0, < 6.1.4 6.1.4
    npm install @dicebear/core@6.1.4
  • >= 7.0.0, < 7.1.4 7.1.4
    npm install @dicebear/core@7.1.4
  • >= 8.0.0, < 8.0.3 8.0.3
    npm install @dicebear/core@8.0.3
  • >= 9.0.0, < 9.4.1 9.4.1
    npm install @dicebear/core@9.4.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, applications can validate input against the library's JSON Schema before passing it to the createAvatar() function. This validation ensures that only trusted and sanitized input is used, thereby mitigating the risk of XSS attacks.

Conclusion

The SVG injection vulnerability in @dicebear/core and @dicebear/initials poses a significant risk to applications that utilize these libraries without proper input validation. By upgrading to the latest patched versions and implementing input validation, developers can secure their applications against potential XSS attacks.

See every vulnerability recorded for @dicebear/core →

Share this vulnerability

FAQ

The vulnerability allows for SVG injection through unsanitized user inputs, potentially leading to XSS attacks.

The affected packages are @dicebear/core and @dicebear/initials.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

The CVSS score of this vulnerability is 4.7, indicating a moderate severity level.

Upgrade to the patched versions of the affected packages and validate user inputs to prevent XSS attacks.

Related vulnerabilities

Recent vulnerabilities recorded for @dicebear/core.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 5.0.0, < 5.4.4 5.4.4
    npm install @dicebear/core@5.4.4
  • >= 6.0.0, < 6.1.4 6.1.4
    npm install @dicebear/core@6.1.4
  • >= 7.0.0, < 7.1.4 7.1.4
    npm install @dicebear/core@7.1.4
  • >= 8.0.0, < 8.0.3 8.0.3
    npm install @dicebear/core@8.0.3
  • >= 9.0.0, < 9.4.1 9.4.1
    npm install @dicebear/core@9.4.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback