CVE-2026-47099: TeleJSON Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-ccgf-5rwj-j3hv
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2026-47099 is a LOW (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting TeleJSON libraries in the npm ecosystem. The issue involves dom xss via unsanitised constructor name in `new function()`. Remediation is available by upgrading affected packages to version 6.0.0.

CVE-2026-47099 at a Glance

CVE Identifier CVE-2026-47099
GHSA Identifier GHSA-ccgf-5rwj-j3hv
Severity LOW
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product TeleJSON
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-47099

To remediate this vulnerability, upgrade all affected TeleJSON dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

telejson fixed: 6.0.0
npm install telejson@6.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls telejson

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-47099, inspect your project dependencies using npm:

npm ls telejson

Analyze the terminal output to locate any version of TeleJSON in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.0.0), your application is affected.

Note: The npm ls telejson command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In TeleJSON, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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](https://github.com/storybookjs/telejson/blob/v5.3.3/src/index.ts#L293-L299)): ```ts 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](https://github.com/storybookjs/telejson/blob/v6.0.0/src/index.ts#L340-L346)): ```ts 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.

CVE-2026-47099 Affected TeleJSON Versions

1 component(s)
Fixed Versions:
6.0.0
Product / Package Ecosystem Affected Versions Fixed Version
telejson
npm
< 6.0.0
6.0.0

References

Frequently Asked Questions

What is CVE-2026-47099?
CVE-2026-47099 is a security vulnerability in TeleJSON involving DOM XSS via unsanitised constructor name in `new Function()` under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which TeleJSON versions are affected?
Affected versions include releases prior to 6.0.0 across affected packages: telejson.
What version fixes CVE-2026-47099?
Upgrading to 6.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is telejson affected?
Yes, telejson is affected in releases prior to 6.0.0. Upgrade your dependency to 6.0.0 or later.
What is the CVSS score of CVE-2026-47099?
CVE-2026-47099 has a CVSS v3.1 base score of 6.1 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-47099?
CVE-2026-47099 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-47099?
Run the dependency tree command: 'npm ls telejson'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-ccgf-5rwj-j3hv",
  "modified" : "2026-06-08T20:16:33Z",
  "published" : "2026-04-02T23:21:23Z",
  "aliases" : [ "CVE-2026-47099" ],
  "summary" : "TeleJSON: DOM XSS via unsanitised constructor name in `new Function()`",
  "details" : "## 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "telejson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/storybookjs/telejson/security/advisories/GHSA-ccgf-5rwj-j3hv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-47099"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Niccolo10/Security-Advisories/blob/main/CVE-2026-47099/cve-2026-47099.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/storybookjs/telejson"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/telejson-dom-based-xss-via-parse-function"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-02T23:21:23Z",
    "nvd_published_at" : "2026-05-20T20:16:41Z"
  }
}