CVE-2026-104182: stream-json JSONC Parser And Verifier Re-scan Vulnerability

MODERATE
Advisory Identifier: GHSA-hqr4-qq8f-hg3x
CVSS 6.2
CWE-407
Published
Advisory Summary

CVE-2026-104182 is a MODERATE (CVSS 6.2) jsonc parser and verifier re-scan vulnerability (CWE-407: Inefficient Algorithmic Complexity) affecting stream-json libraries in the npm ecosystem. The issue involves jsonc parser and verifier re-scan the whole accumulated comment on every input chunk. Remediation is available by upgrading affected packages to version 3.6.0.

CVE-2026-104182 at a Glance

CVE Identifier CVE-2026-104182
GHSA Identifier GHSA-hqr4-qq8f-hg3x
Severity MODERATE
CVSS v3.1 Base Score 6.2
CWE Classification CWE-407: Inefficient Algorithmic Complexity
Affected Product stream-json
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.2

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

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-104182

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

stream-json fixed: 3.6.0
npm install stream-json@3.6.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 stream-json

How to Check if You Are Affected

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

npm ls stream-json

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

Note: The npm ls stream-json 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-407: Inefficient Algorithmic Complexity, where an algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached. In stream-json, 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 The JSONC parser (`stream-json/jsonc/parser.js`) and verifier (`stream-json/jsonc/verifier.js`) scan a comment for its terminator starting from the comment's opening `/` on every input chunk. When a comment doesn't finish inside the current buffer, the scanner returns the comment's start offset and the buffer keeps the whole comment, so the next chunk re-scans everything seen so far. A single comment of length n delivered across many chunks costs O(n²) CPU. This is the same class as GHSA-528h-pc64-c93x (path filters, medium, CWE-407): an algorithmic-complexity re-scan in a streaming feature. It's a different code path though — the comment scanner in `handleComment`, which the 3.5.0 depth cap doesn't touch — so upgrading past that advisory doesn't help here. The plain JSON parser is fine: its strings and numbers advance and drop consumed bytes, and only comments retain and re-scan. ## Proof of concept ``` npm i stream-json@3.5.0 ``` ```js import Parser from 'stream-json/jsonc/parser.js'; function feed(N) { return new Promise(resolve => { const stream = Parser.asStream(); // default options stream.on('data', () => {}); stream.on('error', () => {}); stream.on('end', resolve); const doc = '/*' + 'a'.repeat(N) + '*/1'; // one valid, closed comment for (let i = 0; i < doc.length; i += 16384) // 16 KB pieces, as a socket delivers a body stream.write(doc.slice(i, i + 16384)); stream.end(); }); } ``` Timing the pipeline (Node 22, one core, clean install): a 2 MB comment blocks the event loop ~0.9 s, 4 MB ~2.9 s, 8 MB ~13 s — roughly 4x per doubling, so quadratic. Smaller chunks make it worse, and the attacker controls TCP segment size: a fixed 4 MB comment takes ~0.75 s at 64 KB chunks, ~2.8 s at 16 KB, ~11 s at 4 KB. Feeding the same input to the JSONC verifier reproduces it identically. ## Impact Remote, unauthenticated CPU denial of service against any service that runs untrusted input through the JSONC parser or verifier: one request pins a core and stalls the whole event loop. ## Caveat Only the JSONC entry points are affected; an app on the default JSON parser is safe. The comment doesn't need to be malformed - a valid, properly closed comment does it. The payload is a few MB, or less if the client sends small chunks. I've suggested medium and left the CVSS vector to you. --- # Maintainer note on scope The attack vector is local — stream-json's documented input is data the user owns (JSONC is configuration you wrote); it is not designed for input from the open internet, and the docs now say so explicitly for JSONC. Comments now mirror chunked strings (`startComment` / `commentChunk` / `endComment`, packed `commentValue`); the scan resumes across input chunks, so a comment of any length costs linear time, and constant memory without packing.

CVE-2026-104182 Affected stream-json Versions

1 component(s)
Fixed Versions:
3.6.0
Product / Package Ecosystem Affected Versions Fixed Version
stream-json
npm
< 3.6.0
3.6.0

References

Frequently Asked Questions

What is CVE-2026-104182?
CVE-2026-104182 is a security vulnerability in stream-json involving JSONC parser and verifier re-scan the whole accumulated comment on every input chunk under CWE-407: Inefficient Algorithmic Complexity.
Which stream-json versions are affected?
Affected versions include releases prior to 3.6.0 across affected packages: stream-json.
What version fixes CVE-2026-104182?
Upgrading to 3.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is stream-json affected?
Yes, stream-json is affected in releases prior to 3.6.0. Upgrade your dependency to 3.6.0 or later.
What is the CVSS score of CVE-2026-104182?
CVE-2026-104182 has a CVSS v3.1 base score of 6.2 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-104182?
CVE-2026-104182 is classified under CWE-407: Inefficient Algorithmic Complexity (An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.).
How can I check npm dependencies for CVE-2026-104182?
Run the dependency tree command: 'npm ls stream-json'. 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-hqr4-qq8f-hg3x",
  "modified" : "2026-10-05T22:49:27Z",
  "published" : "2026-10-05T22:49:27Z",
  "aliases" : [ "CVE-2026-104182" ],
  "summary" : "stream-json: JSONC parser and verifier re-scan the whole accumulated comment on every input chunk",
  "details" : "## Summary\n\nThe JSONC parser (`stream-json/jsonc/parser.js`) and verifier (`stream-json/jsonc/verifier.js`) scan a comment for its terminator starting from the comment's opening `/` on every input chunk. When a comment doesn't finish inside the current buffer, the scanner returns the comment's start offset and the buffer keeps the whole comment, so the next chunk re-scans everything seen so far. A single comment of length n delivered across many chunks costs O(n²) CPU.\n\nThis is the same class as GHSA-528h-pc64-c93x (path filters, medium, CWE-407): an algorithmic-complexity re-scan in a streaming feature. It's a different code path though — the comment scanner in `handleComment`, which the 3.5.0 depth cap doesn't touch — so upgrading past that advisory doesn't help here. The plain JSON parser is fine: its strings and numbers advance and drop consumed bytes, and only comments retain and re-scan.\n\n## Proof of concept\n\n```\nnpm i stream-json@3.5.0\n```\n\n```js\nimport Parser from 'stream-json/jsonc/parser.js';\n\nfunction feed(N) {\n  return new Promise(resolve => {\n    const stream = Parser.asStream();            // default options\n    stream.on('data', () => {});\n    stream.on('error', () => {});\n    stream.on('end', resolve);\n    const doc = '/*' + 'a'.repeat(N) + '*/1';     // one valid, closed comment\n    for (let i = 0; i < doc.length; i += 16384)   // 16 KB pieces, as a socket delivers a body\n      stream.write(doc.slice(i, i + 16384));\n    stream.end();\n  });\n}\n```\n\nTiming the pipeline (Node 22, one core, clean install): a 2 MB comment blocks the event loop ~0.9 s, 4 MB ~2.9 s, 8 MB ~13 s — roughly 4x per doubling, so quadratic. Smaller chunks make it worse, and the attacker controls TCP segment size: a fixed 4 MB comment takes ~0.75 s at 64 KB chunks, ~2.8 s at 16 KB, ~11 s at 4 KB. Feeding the same input to the JSONC verifier reproduces it identically.\n\n## Impact\n\nRemote, unauthenticated CPU denial of service against any service that runs untrusted input through the JSONC parser or verifier: one request pins a core and stalls the whole event loop.\n\n## Caveat\n\nOnly the JSONC entry points are affected; an app on the default JSON parser is safe. The comment doesn't need to be malformed - a valid, properly closed comment does it. The payload is a few MB, or less if the client sends small chunks. I've suggested medium and left the CVSS vector to you.\n\n---\n\n# Maintainer note on scope\n\nThe attack vector is local — stream-json's documented input is data the user owns (JSONC is configuration you wrote); it is not designed for input from the open internet, and the docs now say so explicitly for JSONC. Comments now mirror chunked strings (`startComment` / `commentChunk` / `endComment`, packed `commentValue`); the scan resumes across input chunks, so a comment of any length costs linear time, and constant memory without packing.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "stream-json"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.6.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.5.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/uhop/stream-json/security/advisories/GHSA-hqr4-qq8f-hg3x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-104182"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/uhop/stream-json/commit/c0299dc168ce9455ef5ca5b6a0f6850ee7fa0468"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/uhop/stream-json"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/uhop/stream-json/releases/tag/3.6.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-407" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T22:49:27Z",
    "nvd_published_at" : "2026-10-01T21:17:19Z"
  }
}