CVE-2026-110816
published 2026-10-14CVE-2026-110816: ### Summary `qs.stringify` with `arrayFormat: 'comma'` throws `TypeError: Cannot convert object to primitive value` when an array element cannot be coerced to…
PriorityP429medium5.3CVSS 3.1
AVNACLPRNUINSUCNINAL
EPSS
0.37%
30.4th percentile
### Summary
`qs.stringify` with `arrayFormat: 'comma'` throws `TypeError: Cannot convert object to primitive value` when an array element cannot be coerced to a string, such as an object with an own non-callable `toString` (`{ "toString": "x" }`) or a null-prototype object. The comma format joins array elements with `Array.prototype.join` and, under `encodeValuesOnly`, first passes each element through `String()` in `utils.encode`; neither guards against an element whose string coercion fails.
### Details
In `lib/stringify.js`, the comma branch collapses the array with `obj.join(',')`. For an element whose own `toString` is not callable, `ToPrimitive` skips it, falls through to `Object.prototype.valueOf` (which returns the object itself), and throws. Under `encodeValuesOnly: true`, the same element first reaches `String(str)` in `utils.encode` (`lib/utils.js`) and throws there. Nested arrays (`{ "a": [[{ "toString": "x" }]] }`) throw the same way, through `Array.prototype.toString`. The `indices`, `brackets`, and `repeat` formats walk into object elements instead of coercing them, and are not affected.
Such elements can come from untrusted input. `JSON.parse` produces `{ "a": [{ "toString": "x" }] }` with no qs option involved. `qs.parse("a[0][toString]=x", { allowPrototypes: true })` keeps the `toString` key, and `qs.parse("a[][b]=c", { plainObjects: true })` produces a null-prototype element; the default parse options drop `toString` and produce ordinary objects, which do not throw. Express 4's default `query parser`, Express 5's `extended` query parser, and body-parser's `urlencoded({ extended: true })` all call `qs.parse` with `allowPrototypes: true`.
#### PoC
```js
var qs = require("qs");
qs.stringify(JSON.parse("{\"a\":[{\"toString\":\"x\"}]}"), { arrayFormat: "comma" });
qs.stringify(qs.parse("a[0][toString]=x", { allowPrototypes: true }), { arrayFormat: "comma" });
qs.stringify(qs.parse("a[][b]=c", { plainObjects: true }), { arrayFormat: Affected
1 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| ljharb | qs | >= 6.7.0 < 6.16.1 | 6.16.1 |
CVSS provenance
nvdv3.15.3MEDIUMCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
nvdv4.06.3MEDIUMCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
vendor_redhat5.3MEDIUM
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
VulDB
ljharb qs up to 6.16.0 String Coercion lib/stringify.js qs.stringify input validation (a952e75)
vuldb·2026-10-15·CVSS 5.3
CVE-2026-110816 [MEDIUM] ljharb qs up to 6.16.0 String Coercion lib/stringify.js qs.stringify input validation (a952e75)
A vulnerability identified as problematic has been detected in ljharb qs up to 6.16.0. This vulnerability affects the function qs.stringify of the file lib/stringify.js of the component String Coercion. The manipulation leads to improper input validation.
This vulnerability is documented as CVE-2026-110816. The attack can be initiated remotely. There is not any exploit available.
You should upgrade the affected component.
Red Hat
qs: qs: Denial of Service via unhandled exception during array serialization
vendor_redhat·2026-10-14·CVSS 5.3
CVE-2026-110816 [MEDIUM] CWE-248 qs: qs: Denial of Service via unhandled exception during array serialization
qs: qs: Denial of Service via unhandled exception during array serialization
A flaw was found in qs. A remote attacker could cause a Denial of Service (DoS) by supplying specially crafted input to an application that re-serializes data using the comma array format. Because the library fails to safely handle array elements that cannot be converted to a string, an unhandled exception is thrown. In environments lacking error boundaries around the serialization routine, this uncaught exception causes the application process to crash.
Package: grafana12.4 (Red Hat Hardened Images) - Affected
Package: grafana13.1 (Red Hat Hardened Images) - Affected
Package: grafana13.2 (Red Hat Hardened Images) - Affected
Package: prometheus3.13 (Red Hat Hardened Images) - Not affected
Package: yarnpkg (R
No detection rules found.
No public exploits indexed.
2026-10-14
Published