Vulnerabilities in pkg:npm/@dicebear/initials

PACKAGE
Advisory Identifier: GHSA-gcr2-9v8m-gq45
Advisory Summary

CVE-2026-68921 is a MODERATE (CVSS 4.7) svg injection vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting DiceBear libraries in the npm ecosystem. The issue involves svg injection via the unescaped rotate option in @dicebear/core (and fontsize/fontweight in @dicebear/initials). Remediation is available by upgrading affected packages to version 9.4.3.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@dicebear/initials

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@dicebear/initials. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-gcr2-9v8m-gq45 CVE-2026-68921 MODERATE DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)
GHSA-mr9r-mww3-v6gv CVE-2026-33311 MODERATE SVG Injection via Unsanitized Options in @dicebear/core and @dicebear/initials

CVE-2026-68921 at a Glance

CVE Identifier CVE-2026-68921
GHSA Identifier GHSA-gcr2-9v8m-gq45
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
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-68921

To remediate this vulnerability, upgrade all affected DiceBear 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: 9.4.3
npm install @dicebear/core@9.4.3
@dicebear/initials fixed: 9.4.3
npm install @dicebear/initials@9.4.3
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-68921, inspect your project dependencies using npm:

npm ls @dicebear/core

Analyze the terminal output to locate any version of DiceBear in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.4.3), 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, 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 `@dicebear/core` builds avatar SVGs from caller-supplied options. The numeric `rotate` option is interpolated into an SVG `transform` attribute without XML-escaping. It is typed as a number, but nothing checks the type at runtime, so a string value passes straight through and can break out of the attribute to inject arbitrary SVG markup. This is the same root cause as CVE-2026-33311 (GHSA-mr9r-mww3-v6gv), which escaped the string options `backgroundColor`, `fontFamily`, and `textColor` but did not cover `rotate`. `@dicebear/initials` has the same gap in its numeric `fontSize` and `fontWeight` options. ## Impact Cross-site scripting (CWE-79). When the generated avatar is rendered inline (for example via `innerHTML`) or served as `image/svg+xml` and opened directly, injected markup such as an `<image onerror>` handler runs script in the page's origin. Exploitation requires the application to pass untrusted input into one of these options: - `rotate` (`@dicebear/core`) - `fontSize`, `fontWeight` (`@dicebear/initials`) In most integrations these options are set by the developer and only `seed` is user-controlled, so the vulnerable configuration is uncommon. Applications that use trusted, hardcoded values for these options are not at risk. ## Patches Fixed in `@dicebear/core` 9.4.3 and `@dicebear/initials` 9.4.3: the values are now XML-escaped before being written into the SVG, matching the CVE-2026-33311 fix. Upgrade to 9.4.3 or later. The 5.x through 8.x lines share the same flaw but are end-of-life and will not receive a backport; upgrade to 9.4.3. The 10.x line is not affected. ## Workarounds If you cannot upgrade, coerce the affected options to a number before passing them to `createAvatar`: ```js rotate: Number(userInput) || 0, ``` ## Credits Reported by @rz1027.

CVE-2026-68921 Affected DiceBear Versions

2 component(s)
Fixed Versions:
9.4.3
Product / Package Ecosystem Affected Versions Fixed Version
@dicebear/core
npm
< 9.4.3
9.4.3
@dicebear/initials
npm
< 9.4.3
9.4.3

References

Frequently Asked Questions

What is CVE-2026-68921?
CVE-2026-68921 is a security vulnerability in DiceBear involving SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials) under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which DiceBear versions are affected?
Affected versions include releases prior to 9.4.3 across affected packages: @dicebear/core, @dicebear/initials.
What version fixes CVE-2026-68921?
Upgrading to 9.4.3 (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 9.4.3. Upgrade your dependency to 9.4.3 or later.
Is @dicebear/initials affected?
Yes, @dicebear/initials is affected in releases prior to 9.4.3. Upgrade your dependency to 9.4.3 or later.
What is the CVSS score of CVE-2026-68921?
CVE-2026-68921 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-68921?
CVE-2026-68921 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-68921?
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-gcr2-9v8m-gq45",
  "modified" : "2026-09-02T22:44:26Z",
  "published" : "2026-09-02T22:44:25Z",
  "aliases" : [ "CVE-2026-68921" ],
  "summary" : "DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)",
  "details" : "## Summary\n\n`@dicebear/core` builds avatar SVGs from caller-supplied options. The numeric `rotate` option is interpolated into an SVG `transform` attribute without XML-escaping. It is typed as a number, but nothing checks the type at runtime, so a string value passes straight through and can break out of the attribute to inject arbitrary SVG markup.\n\nThis is the same root cause as CVE-2026-33311 (GHSA-mr9r-mww3-v6gv), which escaped the string options `backgroundColor`, `fontFamily`, and `textColor` but did not cover `rotate`. `@dicebear/initials` has the same gap in its numeric `fontSize` and `fontWeight` options.\n\n## Impact\n\nCross-site scripting (CWE-79). When the generated avatar is rendered inline (for example via `innerHTML`) or served as `image/svg+xml` and opened directly, injected markup such as an `<image onerror>` handler runs script in the page's origin.\n\nExploitation requires the application to pass untrusted input into one of these options:\n\n- `rotate` (`@dicebear/core`)\n- `fontSize`, `fontWeight` (`@dicebear/initials`)\n\nIn most integrations these options are set by the developer and only `seed` is user-controlled, so the vulnerable configuration is uncommon. Applications that use trusted, hardcoded values for these options are not at risk.\n\n## Patches\n\nFixed in `@dicebear/core` 9.4.3 and `@dicebear/initials` 9.4.3: the values are now XML-escaped before being written into the SVG, matching the CVE-2026-33311 fix. Upgrade to 9.4.3 or later.\n\nThe 5.x through 8.x lines share the same flaw but are end-of-life and will not receive a backport; upgrade to 9.4.3. The 10.x line is not affected.\n\n## Workarounds\n\nIf you cannot upgrade, coerce the affected options to a number before passing them to `createAvatar`:\n\n```js\nrotate: Number(userInput) || 0,\n```\n\n## Credits\n\nReported by @rz1027.",
  "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" : "0"
      }, {
        "fixed" : "9.4.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.4.2"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@dicebear/initials"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.4.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.4.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dicebear/dicebear/security/advisories/GHSA-gcr2-9v8m-gq45"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-68921"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dicebear/dicebear/commit/922946d738c4e77ab6c412e27ede75941fec4b59"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dicebear/dicebear"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dicebear/dicebear/releases/tag/v9.4.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-02T22:44:25Z",
    "nvd_published_at" : "2026-08-20T21:17:07Z"
  }
}