{"id":"CVE-2026-68921","aliases":["EUVD-2026-63657","GHSA-gcr2-9v8m-gq45"],"status":"published","title":"DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)","description":"DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.","severity":{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-12","score":0.00286,"percentile":0.21376,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-184","CWE-79"],"published":"2026-08-20T21:08:43Z","modified":"2026-10-28T02:30:35Z","fixes":[{"ecosystem":"npm","package":"@dicebear/core","fixed_in":["9.4.3"],"sources":["ghsa","osv"]},{"ecosystem":"npm","package":"@dicebear/initials","fixed_in":["9.4.3"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@dicebear/core","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"9.4.2"},{"fixed":"9.4.3"}]}]},{"source":"ghsa","ecosystem":"npm","package":"@dicebear/initials","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"9.4.2"},{"fixed":"9.4.3"}]}]},{"source":"osv","ecosystem":"npm","package":"@dicebear/core","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"9.4.3"}]}]},{"source":"osv","ecosystem":"npm","package":"@dicebear/initials","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"9.4.3"}]}]}],"products":[{"vendor":"dicebear","product":"dicebear"}],"references":[{"url":"https://github.com/dicebear/dicebear/security/advisories/GHSA-gcr2-9v8m-gq45","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/dicebear/dicebear/commit/922946d738c4e77ab6c412e27ede75941fec4b59","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/dicebear/dicebear/releases/tag/v9.4.3","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-68921","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-gcr2-9v8m-gq45"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/68xxx/CVE-2026-68921.json","tags":["advisory"]},{"url":"https://github.com/dicebear/dicebear","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-68921","title":"DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)","description":"DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.","status":"published","published":"2026-08-20T21:08:43.813Z","modified":"2026-08-21T11:32:29.303Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79","CWE-184"],"updated_at":"2026-11-02T13:45:59.110885Z"}],"euvd":[{"id":"EUVD-2026-63657","description":"DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.","status":"published","published":"2026-08-20T21:08:43Z","modified":"2026-08-21T11:32:29Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T18:01:37.96401Z"}],"ghsa":[{"id":"GHSA-gcr2-9v8m-gq45","title":"DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)","description":"## 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 `\u003cimage onerror\u003e` 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.","status":"published","published":"2026-09-02T22:44:25Z","modified":"2026-09-02T22:44:26Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79","CWE-184"],"updated_at":"2026-11-02T14:41:11.621873Z"}],"nvd":[{"id":"CVE-2026-68921","description":"DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.","status":"published","published":"2026-08-20T21:17:07.54Z","modified":"2026-10-26T10:10:00.14Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"secondary"}],"cwes":["CWE-79","CWE-184"],"updated_at":"2026-11-02T14:12:40.302911Z"}],"osv":[{"id":"CVE-2026-68921","title":"DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)","description":"DiceBear is an avatar library for designers and developers. Prior to 9.4.3, @dicebear/core interpolates the rotate option into an SVG transform attribute without XML escaping in addRotate in packages/@dicebear/core/src/utils/svg.ts, while @dicebear/initials similarly emits fontSize and fontWeight without escaping in packages/@dicebear/initials/src/index.ts. Runtime callers can pass strings despite the numeric TypeScript types, break out of the attributes, and inject arbitrary SVG markup. Script can execute in the page origin when the generated avatar is inserted inline or served as image/svg+xml and opened directly, although exploitation requires an application to pass untrusted values into these normally developer-controlled options. This issue is fixed in @dicebear/core and @dicebear/initials version 9.4.3.","status":"published","published":"2026-08-20T21:08:43.813Z","modified":"2026-10-28T02:30:35.751554168Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-184","CWE-79"],"updated_at":"2026-11-02T15:45:14.808935Z"},{"id":"GHSA-gcr2-9v8m-gq45","title":"DiceBear: SVG injection via the unescaped rotate option in @dicebear/core (and fontSize/fontWeight in @dicebear/initials)","description":"## 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 `\u003cimage onerror\u003e` 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.","status":"published","published":"2026-09-02T22:44:25Z","modified":"2026-09-17T05:15:05.088434034Z","cvss":[{"version":"3.1","score":4.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-184","CWE-79"],"updated_at":"2026-11-02T15:46:47.822182Z"}]}}
