CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-68921

CVE-2026-68921: Cross-Site Scripting via SVG Attribute Injection in DiceBear

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 3, 2026·7 min read·11 visits

Executive Summary (TL;DR)

A runtime type bypass in `@dicebear/core` and `@dicebear/initials` allows unescaped string payloads to be processed in place of numeric parameters, causing structural breakout in the generated SVG and enabling stored cross-site scripting.

CVE-2026-68921 is a Cross-Site Scripting (XSS) vulnerability affecting the `@dicebear/core` and `@dicebear/initials` packages. The flaw stems from a disconnect between compile-time TypeScript type definitions and runtime JavaScript execution. Unvalidated numeric-typed options can receive raw string payloads at runtime, allowing attackers to escape XML attribute boundaries and inject malicious vector markup, executing arbitrary script code within the user's web origin.

Vulnerability Overview

The avatar generation library DiceBear, specifically within the @dicebear/core and @dicebear/initials packages, contains a Cross-Site Scripting (XSS) and SVG Injection vulnerability. These packages programmatically construct Scalable Vector Graphics (SVG) assets using user-specified configuration values. Because SVGs support active content such as inline scripts, style elements, and event handlers, the structural integrity of the generated XML output must be rigidly protected.

In typical web architectures, backend services utilize libraries like DiceBear to serve dynamic user avatars on-the-fly. These applications frequently map query-string values, route parameters, or database attributes directly to library properties. If these values are not verified or sanitized, an attacker can pass raw injection strings. This exposes an attack surface where structurally destructive text payloads alter the downstream browser parser's execution flow.

The vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation) and CWE-184 (Incomplete List of Disallowed Inputs). The core flaw manifests when numeric customization attributes are used inside formatting templates. Because SVGs are parsed as active XML documents, an attacker who successfully injects attributes or elements can bypass standard cross-site scripting filters.

Root Cause Analysis

The root cause of this vulnerability lies in an architectural assumption regarding type enforcement. The @dicebear/core and @dicebear/initials packages are authored in TypeScript, which enforces strict static typing at compile-time. Variables such as rotate in @dicebear/core, and fontSize and fontWeight in @dicebear/initials are defined explicitly as number types. Under static analysis, this typing suggests to developers that string-based payloads cannot penetrate these fields.

However, once compiled to JavaScript for execution in a Node.js or browser runtime, all TypeScript static type declarations are stripped away. JavaScript execution runtimes do not perform automatic runtime type assertion on assigned values. If an upstream application accepts raw query parameters directly from an HTTP request (such as req.query.rotate in Express, which parses strings) and passes them to the library without explicit conversion or validation, string values are fed directly into the DiceBear generation methods.

Because the library expected these properties to always be numeric, it bypassed the standard XML escaping function (escapeXml) for these specific variables, interpolating them directly as template literals. When the parser constructs the SVG markup, any unescaped string parameter containing characters like quotes or angle brackets alters the XML layout. The browser's XML parser interprets these characters as layout tokens, terminating the active attribute, and initiating a new, attacker-defined element.

Code Analysis

To understand the structural failure, we analyze the vulnerable code path in @dicebear/core/src/utils/svg.ts. The addRotate utility interpolates the rotate parameter directly into a transform attribute string without escaping:

// Vulnerable implementation in @dicebear/core
export function addRotate(result: StyleCreateResult, rotate: number) {
  let { width, height, x, y } = getViewBox(result);
 
  return `<g transform="rotate(${rotate}, ${width / 2 + x}, ${
    height / 2 + y
  })">${result.body}</g>`;
}

A similar vulnerability exists in @dicebear/initials/src/index.ts, where numeric options like fontSize and fontWeight are interpolated directly into a text element, while other string parameters are properly escaped:

// Vulnerable implementation in @dicebear/initials
const svg = [
  `<text x="50%" y="50%" font-family="${escapeXml(fontFamily)}" font-size="${fontSize}" font-weight="${fontWeight}" fill="${escapeXml(textColor)}" text-anchor="middle" dy="${(fontSize * .356).toFixed(3)}">${escapeXml(initials)}</text>`,
].join('');

The fix, introduced in commit 922946d738c4e77ab6c412e27ede75941fec4b59, forces these numeric properties to undergo XML sanitization. The updated codebase casts the numeric variables to strings and routes them through the appropriate XML escape helper. In @dicebear/core, the code is modified as follows:

// Patched implementation in @dicebear/core
export function addRotate(result: StyleCreateResult, rotate: number) {
  let { width, height, x, y } = getViewBox(result);
 
  return `<g transform="rotate(${escape.xml(`${rotate}`)}, ${width / 2 + x}, ${
    height / 2 + y
  })">${result.body}</g>`;
}

This patch is complete and structurally sound. By applying escape.xml() or escapeXml(), any malicious character sequences such as double-quotes, ampersands, or angle brackets are safely mapped to their safe XML entity equivalents (e.g., &quot;, &lt;), neutralizing the injection potential before the browser parser processes the SVG.

Exploitation

Exploitation of CVE-2026-68921 depends on the victim application directly mapping user input to vulnerable DiceBear parameters. The attack scenario typically involves an API endpoint that generates dynamic avatars using query parameters. An attacker can construct a payload designed to escape the XML attribute boundaries and execute arbitrary JavaScript.

For the @dicebear/core vector, an attacker targets the rotate option. By passing the payload 0)"/><image href="y" onerror="alert(document.domain)"/><g transform="rotate(0, the rendered XML is manipulated as follows:

<g transform="rotate(0)"/><image href="y" onerror="alert(document.domain)"/><g transform="rotate(0, 50, 50)">[SVG BODY]</g>

When the victim loads a web page that renders this SVG inline, or accesses the raw SVG directly, the browser parses the unescaped <image> element. The browser fails to resolve the malformed source href="y", immediately triggering the onerror handler and executing the injected JavaScript code in the security context of the hosting origin.

For @dicebear/initials, an attacker targets fontSize or fontWeight with the payload 50" x="0" onload="alert(1)" data-x=". This breaks the text element context to append an active script trigger:

<text x="50%" y="50%" font-family="Arial" font-size="50" x="0" onload="alert(1)" data-x="" font-weight="400" ...>[INITIALS]</text>

The script execution context differs based on how the SVG is delivered. If the SVG is loaded via a standard <img> tag, modern browsers apply strict isolation policies that block internal script execution. However, if the SVG is rendered inline within the HTML Document Object Model, or served directly as an image/svg+xml document, the script fires, compromising the session.

Impact Assessment

The concrete impact of successful exploitation is stored or reflected Cross-Site Scripting (XSS) within the victim application's domain context. An attacker who executes arbitrary script code can read sensitive browser storage, access local credentials, hijack session tokens (including JWTs and non-HttpOnly cookies), and manipulate the active DOM.

Because the scope of the vulnerability changes from the generated XML markup to client-side script execution, the CVSS v3.1 scope metric is classified as Changed (S:C). The vulnerability has a CVSS base score of 4.7 (Medium). The score is moderate because exploitation requires high attack complexity (AC:H); the upstream developer must build an integration that allows end-users to control parameters intended to be static or programmatically restricted.

Despite the moderate CVSS score, if an application displays user-defined avatars on dashboard interfaces viewed by administrators, the exploit allows horizontal or vertical privilege escalation. The attacker could hijack administrative sessions to execute high-privilege operations, posing a significant risk in shared enterprise platforms.

Remediation

Remediation requires updating all dependencies referencing @dicebear/core and @dicebear/initials to version 9.4.3 or higher. This upgrade forces structural escaping on all potentially vulnerable paths. In instances where upgrading is not immediately possible, strict input boundaries must be established.

To implement defensive validation in code, wrap any parameters passed to DiceBear in an explicit parsing and type checking structure. Rather than trusting compile-time interfaces, parse all inputs strictly using run-time validation libraries or manual casting before execution:

// Defensive coding pattern to validate inputs at the runtime boundary
function sanitizeAvatarOptions(reqQuery) {
  const sanitized = {};
  if (reqQuery.rotate) {
    const rotateVal = parseInt(reqQuery.rotate, 10);
    sanitized.rotate = isNaN(rotateVal) ? 0 : rotateVal;
  }
  if (reqQuery.fontSize) {
    const sizeVal = parseInt(reqQuery.fontSize, 10);
    sanitized.fontSize = isNaN(sizeVal) ? 50 : sizeVal;
  }
  return sanitized;
}

Additionally, apply infrastructure-level defenses such as strict Content Security Policies (CSP). Disable unsafe-inline scripts and define object-src 'none'. If serving SVGs via dynamic server endpoints, set protective HTTP response headers to isolate the generated asset:

Content-Type: image/svg+xml
Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline';

Official Patches

DiceBearFix commit implementing strict XML escaping on numerical attributes.

Fix Analysis (1)

Technical Appendix

CVSS Score
4.7/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.22%
Top 87% most exploited

Affected Systems

@dicebear/core@dicebear/initials

Affected Versions Detail

Product
Affected Versions
Fixed Version
@dicebear/core
DiceBear
< 9.4.39.4.3
@dicebear/initials
DiceBear
< 9.4.39.4.3
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS v3.1 Score4.7 (Medium)
EPSS Score0.00222
ImpactCross-Site Scripting (XSS)
Exploit StatusProof-of-Concept (PoC)
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Known Exploits & Detection

GitHub Security AdvisoryProof of concept and technical description detailing attribute breakouts on rotate, fontSize, and fontWeight.

Vulnerability Timeline

Patch commit applied to DiceBear repository.
2026-07-05
DiceBear version 9.4.3 released containing the security fix.
2026-08-20
GitHub Security Advisory GHSA-gcr2-9v8m-gq45 published.
2026-08-20
CVE-2026-68921 assigned and published by GitHub CNA.
2026-08-20
National Vulnerability Database (NVD) processed and indexed the record.
2026-08-21

References & Sources

  • [1]NVD - CVE-2026-68921 Detail
  • [2]DiceBear Security Advisory GHSA-gcr2-9v8m-gq45
  • [3]DiceBear v9.4.3 Release Notes
  • [4]CVE.org Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-11748
6.9

CVE-2026-11748: Unauthenticated LDAP Injection in Central Dogma Server Authentication

An LDAP injection vulnerability exists in the centraldogma-server-auth-shiro module of LY Corporation Central Dogma before version 0.84.0. The search logic dynamically constructs LDAP search filters by interpolating user-provided usernames without escaping RFC 4515 metacharacters. Unauthenticated remote attackers can leverage this flaw to bypass authentication, enumerate directory hierarchies, and access unauthorized resources.

Alon Barad
Alon Barad
9 views•6 min read
•1 day ago•CVE-2026-11746
9.4

CVE-2026-11746: Use of Hard-coded ZooKeeper Replication Secret 'ch4n63m3' in Central Dogma Server

CVE-2026-11746 is a critical vulnerability in Central Dogma Server prior to version 0.84.0, where an embedded ZooKeeper replication secret silently falls back to a publicly known, hard-coded default string ('ch4n63m3'). Remote attackers with access to the replication network can authenticate as legitimate cluster peers, potentially leading to unauthorized data exposure, state manipulation, or complete cluster takeover.

Amit Schendel
Amit Schendel
7 views•6 min read
•1 day ago•CVE-2026-56665
4.2

CVE-2026-56665: Logical Validation Bypass in ZITADEL External JWT Identity Provider

A logical verification flaw in ZITADEL's external JWT Identity Provider validation allows attackers to bypass session expiration checks. If an incoming JWT lacks the 'exp' claim, the system skips validation entirely, creating an indefinitely valid session. This issue has been addressed in versions 3.4.12 and 4.15.2.

Alon Barad
Alon Barad
6 views•7 min read
•1 day ago•CVE-2026-59149
6.5

CVE-2026-59149: Sibling Directory Path Traversal in Mockoon Backend Server

CVE-2026-59149 identifies a directory traversal vulnerability in `@mockoon/commons-server`, the backend mock-server library powering the Mockoon application. The flaw occurs in the path containment validation logic used during raw file response generation. An unauthenticated attacker can exploit this weakness to retrieve arbitrary files from sibling directories sharing a common prefix with the designated static base directory.

Amit Schendel
Amit Schendel
9 views•5 min read
•1 day ago•CVE-2026-59148
8.8

CVE-2026-59148: Unauthenticated Administrative API and CORS Misconfiguration in Mockoon

An in-depth analysis of CVE-2026-59148, a high-severity flaw in Mockoon where unauthenticated administrative endpoints and a wildcard Cross-Origin Resource Sharing (CORS) policy allow remote execution, state poisoning, and credential theft.

Alon Barad
Alon Barad
11 views•6 min read
•1 day ago•CVE-2026-56666
4.8

CVE-2026-56666: Account Takeover via Improper Email Verification in ZITADEL Federated Identity Handler

An improper authentication vulnerability (CWE-287) in ZITADEL's external identity provider handler before version 4.15.3 allows remote attackers to perform complete account takeover. When auto-linking by email is enabled, ZITADEL verifies that the local target account has a verified email address but fails to verify if the external provider confirmed ownership of that same email. Attackers can exploit this by registering an unverified account with a victim's email address on a permissive external provider, leading to unauthorized account binding and persistent access.

Amit Schendel
Amit Schendel
7 views•7 min read