{"id":"CVE-2026-47099","aliases":["CVE-2026-47099","GHSA-ccgf-5rwj-j3hv"],"related":[],"kind":"vulnerability","state":"published","title":"TeleJSON < 6.0.0 DOM-based XSS via parse() Function","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## 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 | < 6.0.0   | >= 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<ValueContainer>(value) && 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<ValueContainer>(value) && value['_constructor-name_'] && 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 >= 6.0.0.","format":"markdown","source":"ghsa"},{"lang":"es","text":"TeleJSON anterior a la versión 6.0.0 contiene una vulnerabilidad de cross-site scripting basada en DOM en la función parse() que permite a los atacantes ejecutar JavaScript arbitrario mediante la entrega de una carga útil JSON manipulada que contiene un valor de propiedad _constructor-name_ malicioso. El reviver personalizado pasa el nombre del constructor directamente a new Function() sin sanitización al recrear prototipos de objetos, lo que permite a los atacantes inyectar JavaScript arbitrario a través de vectores como postMessage en contextos de comunicación entre marcos para lograr la ejecución de scripts dentro de la aplicación.","source":"nvd"}],"published":"2026-04-02T23:21:23.000Z","modified":"2026-11-08T14:04:01.911Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","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","score":2.1,"rating":"LOW"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","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","score":2.1,"rating":"LOW"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"LOW"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"6.0.0","status":"affected"}],"vendor":"storybookjs","product":"telejson","repo":"https://github.com/storybookjs/telejson","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.0.0"}],"ecosystem":"npm","package":"telejson","purl":"pkg:npm/telejson","source":"ghsa"}],"references":[{"url":"https://github.com/storybookjs/telejson/security/advisories/GHSA-ccgf-5rwj-j3hv","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Niccolo10/Security-Advisories/blob/main/CVE-2026-47099/cve-2026-47099.md","tags":["technical-description","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/telejson-dom-based-xss-via-parse-function","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47099","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/storybookjs/telejson","tags":["package"],"sources":["ghsa"]}],"credits":["Niccolò Parlanti"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-05-20T19:28:02.710Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47099","url":"https://www.cve.org/CVERecord?id=CVE-2026-47099","licence":"CVE Terms of Use","modified":"2026-11-08T14:04:01.911Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-ccgf-5rwj-j3hv","url":"https://github.com/advisories/GHSA-ccgf-5rwj-j3hv","licence":"CC-BY-4.0","modified":"2026-06-08T20:30:58.177Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47099","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47099","licence":"Public domain","modified":"2026-10-08T16:17:16.807Z"}],"updatedAt":"2026-11-25T22:59:22.066Z","epss":{"score":0.00443,"percentile":0.4027,"date":"2026-12-01T12:00:22.000Z"}}