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

MODERATE
Advisory Identifier: GHSA-mr9r-mww3-v6gv
CVSS 4.7
CWE-79
Published
Advisory Summary

CVE-2026-33311 is a MODERATE (CVSS 4.7) svg injection vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @dicebear/core libraries in the npm ecosystem. The issue involves svg injection via unsanitized options in @dicebear/core and @dicebear/initials. Remediation is available by upgrading affected packages to version 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1.

CVE-2026-33311 at a Glance

CVE Identifier CVE-2026-33311
GHSA Identifier GHSA-mr9r-mww3-v6gv
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @dicebear/core
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-33311

To remediate this vulnerability, upgrade all affected @dicebear/core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@dicebear/core fixed: 5.4.4
npm install @dicebear/core@5.4.4
@dicebear/core fixed: 6.1.4
npm install @dicebear/core@6.1.4
@dicebear/core fixed: 7.1.4
npm install @dicebear/core@7.1.4
@dicebear/core fixed: 8.0.3
npm install @dicebear/core@8.0.3
@dicebear/core fixed: 9.4.1
npm install @dicebear/core@9.4.1
@dicebear/initials fixed: 5.4.4
npm install @dicebear/initials@5.4.4
@dicebear/initials fixed: 6.1.4
npm install @dicebear/initials@6.1.4
@dicebear/initials fixed: 7.1.4
npm install @dicebear/initials@7.1.4
@dicebear/initials fixed: 8.0.3
npm install @dicebear/initials@8.0.3
@dicebear/initials fixed: 9.4.1
npm install @dicebear/initials@9.4.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @dicebear/core

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-33311, inspect your project dependencies using npm:

npm ls @dicebear/core

Analyze the terminal output to locate any version of @dicebear/core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.4.4), your application is affected.

Note: The npm ls @dicebear/core command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In @dicebear/core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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`** — `backgroundColor` option values interpolated into SVG attributes without escaping (affects `solid` and `gradientLinear` background types) - **`@dicebear/initials`** — `fontFamily` and `textColor` option 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

CVE-2026-33311 Affected @dicebear/core Versions

10 component(s)
Fixed Versions:
5.4.46.1.47.1.48.0.39.4.1
Product / Package Ecosystem Affected Versions Fixed Version
@dicebear/core
npm
≥ 5.0.0
< 5.4.4
5.4.4
@dicebear/core
npm
≥ 6.0.0
< 6.1.4
6.1.4
@dicebear/core
npm
≥ 7.0.0
< 7.1.4
7.1.4
@dicebear/core
npm
≥ 8.0.0
< 8.0.3
8.0.3
@dicebear/core
npm
≥ 9.0.0
< 9.4.1
9.4.1
@dicebear/initials
npm
≥ 5.0.0
< 5.4.4
5.4.4
@dicebear/initials
npm
≥ 6.0.0
< 6.1.4
6.1.4
@dicebear/initials
npm
≥ 7.0.0
< 7.1.4
7.1.4
@dicebear/initials
npm
≥ 8.0.0
< 8.0.3
8.0.3
@dicebear/initials
npm
≥ 9.0.0
< 9.4.1
9.4.1

References

Frequently Asked Questions

What is CVE-2026-33311?
CVE-2026-33311 is a security vulnerability in @dicebear/core involving SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @dicebear/core versions are affected?
Affected versions include releases prior to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1 across affected packages: @dicebear/core, @dicebear/initials.
What version fixes CVE-2026-33311?
Upgrading to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @dicebear/core affected?
Yes, @dicebear/core is affected in releases prior to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1. Upgrade your dependency to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1 or later.
Is @dicebear/initials affected?
Yes, @dicebear/initials is affected in releases prior to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1. Upgrade your dependency to 5.4.4, 6.1.4, 7.1.4, 8.0.3, 9.4.1 or later.
What is the CVSS score of CVE-2026-33311?
CVE-2026-33311 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-33311?
CVE-2026-33311 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-33311?
Run the dependency tree command: 'npm ls @dicebear/core'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mr9r-mww3-v6gv",
  "modified" : "2026-03-25T20:52:39Z",
  "published" : "2026-03-19T17:49:28Z",
  "aliases" : [ "CVE-2026-33311" ],
  "summary" : "SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials",
  "details" : "## Summary\n\nSVG 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`.\n\n## Affected packages\n\n- **`@dicebear/core`** — `backgroundColor` option values interpolated into SVG attributes without escaping (affects `solid` and `gradientLinear` background types)\n- **`@dicebear/initials`** — `fontFamily` and `textColor` option values interpolated into SVG attributes without escaping\n\n## Fix\n\nAll affected SVG attribute values are now properly escaped using XML entity encoding. Users should upgrade to the listed patched versions.\n\n## Mitigating factors\n\n- Applications that validate input against the library's JSON Schema before passing it to `createAvatar()` are not affected\n- The DiceBear CLI validates input via AJV and was not vulnerable\n- Exploitation requires that an application passes untrusted, unvalidated external input directly as option values",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.4.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.4.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.1.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.1.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.1.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.1.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 8.0.2"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0"
      }, {
        "fixed" : "9.4.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.4.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.4.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.4.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.1.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.1.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.1.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.1.3"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 8.0.2"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0"
      }, {
        "fixed" : "9.4.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.4.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dicebear/dicebear/security/advisories/GHSA-mr9r-mww3-v6gv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33311"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dicebear/dicebear"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-19T17:49:28Z",
    "nvd_published_at" : "2026-03-24T14:16:30Z"
  }
}