Medium · 5.3 Node.js & npm GHSA-6pq8-jhm2-2vcw CVE-2026-110816
qs.stringify() Denial-of-Service Flaw via Uncoercible Array Elements (CVE-2026-110816)
A flaw in the npm package qs causes qs.stringify() to throw an uncaught TypeError when using the 'comma' array format on objects containing array elements with a non-callable own toString property, which can crash unprotected Node.js services. Fixed in qs 6.16.1.
By PatchBriefing · ·
Produced automatically from official sources with the help of AI. How we work →
AI summary
A denial-of-service vulnerability has been identified in the widely used npm package qs, which provides query-string parsing and serialization for Node.js applications. The issue, tracked as CVE-2026-110816 (GHSA-6pq8-jhm2-2vcw), affects the qs.stringify() function when it is used with the arrayFormat: 'comma' option. Under specific conditions, serializing attacker-influenced data can trigger an uncaught exception, which may crash a Node.js process that lacks error handling around the call.
What Happened
A vulnerability was reported in the qs package affecting qs.stringify(obj, { arrayFormat: 'comma' }). When an array in the serialized object contains an element with an own, non-callable toString property, the function throws an uncaught TypeError ('Cannot convert object to primitive value') instead of handling the value gracefully. A remote, unauthenticated party who can influence the structure of an object that is later serialized this way can trigger the throw without any authentication or user interaction.
Technical Cause
When arrayFormat is set to 'comma', qs collapses an array into a single value by joining its elements (Array.prototype.join), or, when encodeValuesOnly is enabled, by mapping each element through a value encoder before joining. Both code paths perform an implicit string coercion on each array element. If an element has its own toString property set to a non-callable value, JavaScript's coercion process skips that shadowed toString, falls back to Object.prototype.valueOf (which returns the object itself rather than a primitive), and throws a TypeError. Because the comma-array branch performs this coercion before the library's normal null/skip handling runs, no downstream logic can neutralize the problematic element, and the exception propagates uncaught out of the library. This affects both the default comma-join path and the encodeValuesOnly sub-path.
Why It Matters
Applications that call qs.stringify with arrayFormat: 'comma' on data shaped by untrusted input are exposed. Attacker-controllable sources identified include qs.parse(input, { allowPrototypes: true }) — a setting used by default in some common Express/body-parser query parsing configurations — qs.parse(input, { plainObjects: true }), and even a plain JSON.parse() of a request body, which requires no qs parsing option at all. A single crafted request can force the uncaught TypeError. In a Node.js service with no synchronous error boundary around the serialization call, this crashes the worker process and takes the service offline. In frameworks such as Express that trap synchronous handler exceptions, the more likely outcome is an individual request failing with a server error rather than a full process crash. There is no confidentiality or integrity impact associated with this issue, and no prototype pollution occurs.
Discovery and Reporting
The issue was documented in a GitHub Security Advisory and corresponding OSV.dev entry published on 2026-10-27, and also appears in the Microsoft Security Update Guide. A related, independent report describing the same root cause was later merged into the same advisory as a duplicate. The advisory notes that an earlier, separate fix (addressing a different CVE for null/undefined array entries in the comma plus encodeValuesOnly path) did not cover this scenario: objects with a non-callable own toString property still trigger the throw, including on the default comma-join path that the earlier fix never touched.
Affected Versions
The vulnerable code path was introduced in qs version 6.7.0 and is present through version 6.16.0, the last version before a fix was released. Versions prior to 6.7.0 do not contain the affected comma-array join logic. The issue is fixed in qs version 6.16.1.
Fixes and Mitigation
The issue is fixed in qs version 6.16.1. Projects using the affected package should upgrade to this version or later. For deployments that cannot upgrade immediately, interim mitigations include avoiding the arrayFormat: 'comma' option when serializing data derived from untrusted input, sanitizing parsed objects by avoiding allowPrototypes and plainObjects parsing options on untrusted input, stripping unexpected own properties from objects before serialization, and wrapping qs.stringify calls in a synchronous error boundary (such as a try/catch) so that a coercion failure cannot crash the process.
Recommended Action
Site owners and developers using the qs package should check their dependency tree for affected versions (6.7.0 through 6.16.0) and upgrade to version 6.16.1 as soon as practical. Where upgrading is delayed, review any code paths that call qs.stringify with arrayFormat: 'comma' on objects derived from request input, and add defensive error handling around those calls.
PatchBriefing score
5.3 / 10 · Medium
Official CVSS: 5.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
EPSS 0.0042 (28 percentile)
Why this score
The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.
Affected versions
- qs ≥ 6.7.0 < 6.16.1
- vulnerable
- qs >= 6.7.0, <= 6.16.0
- vulnerable
- ≥ 6.16.1
- patched
Reported fixes
The issue is fixed in qs version 6.16.1. Projects using the affected package should upgrade to this version or later. For deployments that cannot upgrade immediately, interim mitigations include avoiding the arrayFormat: 'comma' option when serializing data derived from untrusted input, sanitizing parsed objects by avoiding allowPrototypes and plainObjects parsing options on untrusted input, stripping unexpected own properties from objects before serialization, and wrapping qs.stringify calls in a synchronous error boundary (such as a try/catch) so that a coercion failure cannot crash the process.
How this was built
3 source records were collected, matched and used to prepare the report above.
-
Microsoft Security Update Guide vendor
-
GitHub Advisory Database database
-
OSV.dev database
Revision history
- Published
- Generated
- Published
- Generated