2.1low
TeleJSON < 6.0.0 DOM-based XSS via parse() Function
- Severity
- 2.1low CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.44% (higher than 40% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-ccgf-5rwj-j3hv
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| storybookjs telejson | before 6.0.0 | CVE List |
| telejson (npm) | before 6.0.0 | GitHub Advisory Database |
All scores
| VulnCheck | 2.1low CVSS:4.0 | 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 |
| VulnCheck | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 6.1low CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | low CVSS:4.0 | 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 |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
Summary
telejson 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.
Affected versions
| Package | Affected | Fixed |
|---|---|---|
| telejson | < 6.0.0 | >= 6.0.0 |
Details
telejson'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.
In 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.
Vulnerable code (src/index.ts, lines 293-299 at v5.3.3):
if (isObject<ValueContainer>(value) && value['_constructor-name_']) {
const name = value['_constructor-name_'];
if (name !== 'Object') {
const Fn = new Function(`return function ${name}(){}`)();
Object.setPrototypeOf(value, new Fn());
}
Fixed code (src/index.ts, lines 340-346 at v6.0.0):
if (isObject<ValueContainer>(value) && value['_constructor-name_'] && options.allowFunction) {
const name = value['_constructor-name_'];
if (name !== 'Object') {
const Fn = new Function(`return function ${name.replace(/[\W_]+/g, '')}(){}`)();
Object.setPrototypeOf(value, new Fn());
}
The 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.
Impact
An 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.
Remediation
Upgrade to telejson >= 6.0.0.
NVD (es)
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.
References
| https://github.com/storybookjs/telejson/security/advisories/GHSA-ccgf-5rwj-j3hv | vendor-advisory, web | |
| https://github.com/Niccolo10/Security-Advisories/blob/main/CVE-2026-47099/cve-2026-47099.md | technical-description, web | |
| https://www.vulncheck.com/advisories/telejson-dom-based-xss-via-parse-function | third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-47099 | advisory | |
| https://github.com/storybookjs/telejson | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-47099 changed 2026-11-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-ccgf-5rwj-j3hv changed 2026-06-08 | CC-BY-4.0 |
| NVD | CVE-2026-47099 changed 2026-10-08 | Public domain |