{"id":"CVE-2026-47099","aliases":["EUVD-2026-31150","GHSA-ccgf-5rwj-j3hv"],"status":"published","title":"TeleJSON \u003c 6.0.0 DOM-based XSS via parse() Function","description":"TeleJSON prior to 6.0.0 contains a DOM-based cross-site scripting vulnerability in the parse() function that allows attackers to execute arbitrary JavaScript by delivering a crafted JSON payload containing a malicious _constructor-name_ property value. The custom reviver passes the constructor name directly to new Function() without sanitization when recreating object prototypes, enabling attackers to inject arbitrary JavaScript through vectors such as postMessage in cross-frame communication contexts to achieve script execution within the application.","severity":{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"low","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00358,"percentile":0.29745,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2026-04-02T23:21:23Z","modified":"2026-11-08T14:04:01Z","fixes":[{"ecosystem":"npm","package":"telejson","fixed_in":["6.0.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"telejson","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.0"}]}]},{"source":"osv","ecosystem":"npm","package":"telejson","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"6.0.0"}]}]}],"products":[{"vendor":"storybookjs","product":"telejson"}],"references":[{"url":"https://github.com/storybookjs/telejson/security/advisories/GHSA-ccgf-5rwj-j3hv","tags":["vendor-advisory","advisory","web"]},{"url":"https://github.com/Niccolo10/Security-Advisories/blob/main/CVE-2026-47099/cve-2026-47099.md","tags":["technical-description","article","web"]},{"url":"https://www.vulncheck.com/advisories/telejson-dom-based-xss-via-parse-function","tags":["third-party-advisory","advisory","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47099","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-ccgf-5rwj-j3hv"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/47xxx/CVE-2026-47099.json","tags":["advisory"]},{"url":"https://github.com/storybookjs/telejson","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-47099","title":"TeleJSON \u003c 6.0.0 DOM-based XSS via parse() Function","description":"TeleJSON prior to 6.0.0 contains a DOM-based cross-site scripting vulnerability in the parse() function that allows attackers to execute arbitrary JavaScript by delivering a crafted JSON payload containing a malicious _constructor-name_ property value. The custom reviver passes the constructor name directly to new Function() without sanitization when recreating object prototypes, enabling attackers to inject arbitrary JavaScript through vectors such as postMessage in cross-frame communication contexts to achieve script execution within the application.","status":"published","published":"2026-05-20T18:00:44.637Z","modified":"2026-11-08T14:04:01.911Z","cvss":[{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"low","assessor":"cna"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-08T15:43:33.322657Z"}],"euvd":[{"id":"EUVD-2026-31150","description":"TeleJSON prior to 6.0.0 contains a DOM-based cross-site scripting vulnerability in the parse() function that allows attackers to execute arbitrary JavaScript by delivering a crafted JSON payload containing a malicious _constructor-name_ property value. The custom reviver passes the constructor name directly to new Function() without sanitization when recreating object prototypes, enabling attackers to inject arbitrary JavaScript through vectors such as postMessage in cross-frame communication contexts to achieve script execution within the application.","status":"published","published":"2026-05-20T18:00:44Z","modified":"2026-11-08T14:04:01Z","cvss":[{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"low"}],"updated_at":"2026-11-08T15:13:08.77824Z"}],"ghsa":[{"id":"GHSA-ccgf-5rwj-j3hv","title":"TeleJSON: DOM XSS via unsanitised constructor name in `new Function()`","description":"## Summary\n \ntelejson versions prior to 6.0.0 (released 2022) are vulnerable to DOM-based Cross-Site Scripting (XSS) through unsafe deserialisation. Attacker-controlled input from the `_constructor-name_` property in parsed JSON is passed directly to `new Function()` without sanitisation, allowing arbitrary JavaScript execution.\n \n## Affected versions\n \n| Package  | Affected  | Fixed    |\n|----------|-----------|----------|\n| telejson | \u003c 6.0.0   | \u003e= 6.0.0 |\n \n \n## Details\n \ntelejson's `parse()` function uses a custom reviver to reconstruct JavaScript objects from serialised JSON. When processing objects with a `_constructor-name_` property, the reviver passes the constructor name directly to `new Function()` to recreate the object's prototype.\n \nIn versions prior to 6.0.0, this constructor name is not sanitised. An attacker who can deliver a crafted JSON payload to `telejson.parse()` (for example, via `postMessage` in applications that use telejson for cross-frame communication) can inject arbitrary JavaScript into the `new Function()` call.\n \n**Vulnerable code** ([`src/index.ts`, lines 293-299 at v5.3.3](https://github.com/storybookjs/telejson/blob/v5.3.3/src/index.ts#L293-L299)):\n \n```ts\nif (isObject\u003cValueContainer\u003e(value) \u0026\u0026 value['_constructor-name_']) {\n  const name = value['_constructor-name_'];\n  if (name !== 'Object') {\n    const Fn = new Function(`return function ${name}(){}`)();\n    Object.setPrototypeOf(value, new Fn());\n  }\n```\n \n**Fixed code** ([`src/index.ts`, lines 340-346 at v6.0.0](https://github.com/storybookjs/telejson/blob/v6.0.0/src/index.ts#L340-L346)):\n \n```ts\nif (isObject\u003cValueContainer\u003e(value) \u0026\u0026 value['_constructor-name_'] \u0026\u0026 options.allowFunction) {\n  const name = value['_constructor-name_'];\n  if (name !== 'Object') {\n    const Fn = new Function(`return function ${name.replace(/[\\W_]+/g, '')}(){}`)();\n    Object.setPrototypeOf(value, new Fn());\n  }\n```\n \nThe fix introduces two mitigations: a character allowlist via regex that strips non-word characters before they reach `new Function()`, and gating the entire code path behind the `allowFunction` option.\n \n## Impact\n \nAn attacker can execute arbitrary JavaScript in the context of the application using the vulnerable telejson version. Depending on the application, this could enable session hijacking, credential theft, or arbitrary DOM manipulation.\n \n## Remediation\n \nUpgrade to telejson \u003e= 6.0.0.","status":"published","published":"2026-04-02T23:21:23Z","modified":"2026-06-08T20:16:34Z","cvss":[{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","level":"low"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:40:20.187636Z"}],"nvd":[{"id":"CVE-2026-47099","description":"TeleJSON prior to 6.0.0 contains a DOM-based cross-site scripting vulnerability in the parse() function that allows attackers to execute arbitrary JavaScript by delivering a crafted JSON payload containing a malicious _constructor-name_ property value. The custom reviver passes the constructor name directly to new Function() without sanitization when recreating object prototypes, enabling attackers to inject arbitrary JavaScript through vectors such as postMessage in cross-frame communication contexts to achieve script execution within the application.","status":"published","published":"2026-05-20T20:16:41.063Z","modified":"2026-10-08T16:17:16.807Z","cvss":[{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"low","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"secondary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:12:19.752984Z"}],"osv":[{"id":"CVE-2026-47099","title":"TeleJSON \u003c 6.0.0 DOM-based XSS via parse() Function","description":"TeleJSON prior to 6.0.0 contains a DOM-based cross-site scripting vulnerability in the parse() function that allows attackers to execute arbitrary JavaScript by delivering a crafted JSON payload containing a malicious _constructor-name_ property value. The custom reviver passes the constructor name directly to new Function() without sanitization when recreating object prototypes, enabling attackers to inject arbitrary JavaScript through vectors such as postMessage in cross-frame communication contexts to achieve script execution within the application.","status":"published","published":"2026-05-20T18:00:44.637Z","modified":"2026-11-09T02:30:33.406663575Z","cvss":[{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"low"}],"cwes":["CWE-79"],"updated_at":"2026-11-09T03:16:44.651171Z"},{"id":"GHSA-ccgf-5rwj-j3hv","title":"TeleJSON: DOM XSS via unsanitised constructor name in `new Function()`","description":"## Summary\n \ntelejson versions prior to 6.0.0 (released 2022) are vulnerable to DOM-based Cross-Site Scripting (XSS) through unsafe deserialisation. Attacker-controlled input from the `_constructor-name_` property in parsed JSON is passed directly to `new Function()` without sanitisation, allowing arbitrary JavaScript execution.\n \n## Affected versions\n \n| Package  | Affected  | Fixed    |\n|----------|-----------|----------|\n| telejson | \u003c 6.0.0   | \u003e= 6.0.0 |\n \n \n## Details\n \ntelejson's `parse()` function uses a custom reviver to reconstruct JavaScript objects from serialised JSON. When processing objects with a `_constructor-name_` property, the reviver passes the constructor name directly to `new Function()` to recreate the object's prototype.\n \nIn versions prior to 6.0.0, this constructor name is not sanitised. An attacker who can deliver a crafted JSON payload to `telejson.parse()` (for example, via `postMessage` in applications that use telejson for cross-frame communication) can inject arbitrary JavaScript into the `new Function()` call.\n \n**Vulnerable code** ([`src/index.ts`, lines 293-299 at v5.3.3](https://github.com/storybookjs/telejson/blob/v5.3.3/src/index.ts#L293-L299)):\n \n```ts\nif (isObject\u003cValueContainer\u003e(value) \u0026\u0026 value['_constructor-name_']) {\n  const name = value['_constructor-name_'];\n  if (name !== 'Object') {\n    const Fn = new Function(`return function ${name}(){}`)();\n    Object.setPrototypeOf(value, new Fn());\n  }\n```\n \n**Fixed code** ([`src/index.ts`, lines 340-346 at v6.0.0](https://github.com/storybookjs/telejson/blob/v6.0.0/src/index.ts#L340-L346)):\n \n```ts\nif (isObject\u003cValueContainer\u003e(value) \u0026\u0026 value['_constructor-name_'] \u0026\u0026 options.allowFunction) {\n  const name = value['_constructor-name_'];\n  if (name !== 'Object') {\n    const Fn = new Function(`return function ${name.replace(/[\\W_]+/g, '')}(){}`)();\n    Object.setPrototypeOf(value, new Fn());\n  }\n```\n \nThe fix introduces two mitigations: a character allowlist via regex that strips non-word characters before they reach `new Function()`, and gating the entire code path behind the `allowFunction` option.\n \n## Impact\n \nAn attacker can execute arbitrary JavaScript in the context of the application using the vulnerable telejson version. Depending on the application, this could enable session hijacking, credential theft, or arbitrary DOM manipulation.\n \n## Remediation\n \nUpgrade to telejson \u003e= 6.0.0.","status":"published","published":"2026-04-02T23:21:23Z","modified":"2026-06-08T20:30:58.177124366Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"},{"version":"4.0","score":2.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","level":"low"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:44.927642Z"}]}}
