# CVE-2026-110816: qs.stringify with arrayFormat comma throws TypeError on array elements that cannot be coerced to a string

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.3
- **CVSS:** 6.3 (v4.0, CNA) `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Attack requirements: Present; Privileges required: None; User interaction: None; Confidentiality impact: None; Integrity impact: None; Availability impact: Low; Confidentiality impact on other systems: None; Integrity impact on other systems: None; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.42% (percentile 28, 2026-11-28)
- **CWE:** CWE-248, CWE-704
- **Aliases:** GHSA-6pq8-jhm2-2vcw
- **Published:** 2026-10-14T22:05:24.015Z
- **Modified:** 2026-10-27T16:15:05.324Z

## Who should check

- Projects that depend on npm package qs (\>= 6.7.0, \< 6.16.1)
- Anyone running ljharb qs \>= 6.7.0, \< 6.16.1

## Description

\#\#\# 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: "comma", encodeValuesOnly: true });



// TypeError: Cannot convert object to primitive value



\`\`\`



\#\#\#\# Fix



Applied in a952e75 on \`main\` and released as v6.16.1: an element whose string coercion would fail is coerced to its primitive \`valueOf\`, if any, or else to \`Object.prototype.toString\`, so it renders as \`\[object Object\]\`, the same as any other object element already does under the comma format. Nested arrays are walked the way \`join\` walks them. Every input that did not previously throw serializes exactly as before, and a \`toString\` or \`valueOf\` that itself throws still propagates.



\#\#\# Affected versions



\`\>=6.7.0 \<6.16.1\`, fixed in v6.16.1.



The \`join\` path was introduced with the comma format in b84acba and first shipped in v6.7.0; v6.6.x and earlier ignore \`arrayFormat: 'comma'\` and are not affected. The \`encodeValuesOnly\` \`String()\` site was introduced in 4c4b23d (v6.11.1); before that, the same input throws at \`join\`. Every release from v6.7.0 through v6.16.0 is affected.



\#\#\# Impact



An unauthenticated request can make any code path that re-serializes attacker-influenced data with \`qs.stringify\` and \`arrayFormat: 'comma'\` (for example, rebuilding a query string from \`req.query\` for a redirect or an upstream request, or serializing a parsed JSON body) throw synchronously. In a typical Node.js HTTP framework the throw is caught by the framework error boundary and the affected request returns a 500; the process survives and other requests are unaffected. Where the call runs outside an error boundary, such as an \`async\` Express 4 handler (where the throw becomes an unhandled promise rejection) or a bare \`http\` request handler, the process exits, so the impact in that case depends on the application error handling rather than on qs. The default \`arrayFormat\` (\`indices\`) is not affected.

## Affected and fixed versions

- npm `qs`: affected \>= 6.7.0, \< 6.16.1; fixed 6.16.1 (osv)
- ljharb qs: \>= 6.7.0, \< 6.16.1 (cvelist)

## Mitigation

- Upgrade qs to 6.16.1 or later.
- Vendor workaround: Use the default \`arrayFormat\` (\`indices\`), or pass a \`filter\` function to \`qs.stringify\` that replaces non-primitive array elements before the comma format joins them. Alternatively, wrap \`qs.stringify\` calls on externally influenced objects in try/catch, and avoid \`allowPrototypes: true\` / \`plainObjects: true\` when parsed untrusted input is fed back into \`qs.stringify\`.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-110816. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-110816.md
Affected: qs >= 6.7.0, < 6.16.1
Fixed in: 6.16.1

Steps:
1. Search this machine and project for qs (npm), ljharb qs: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-110816 being exploited?

There is no confirmed exploitation: CVE-2026-110816 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.42% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-110816?

Medium: CVSS 6.3 (v4.0, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2026-110816?

qs \>= 6.7.0, \< 6.16.1.

### Is there a fix for CVE-2026-110816?

Yes. Fixed in 6.16.1. Upgrade qs to 6.16.1 or later. Vendor workaround: Use the default \`arrayFormat\` (\`indices\`), or pass a \`filter\` function to \`qs.stringify\` that replaces non-primitive array elements before the comma format joins them. Alternatively, wrap \`qs.stringify\` calls on externally influenced objects in try/catch, and avoid \`allowPrototypes: true\` / \`plainObjects: true\` when parsed untrusted input is fed back into \`qs.stringify\`.

### How do I check if I'm affected by CVE-2026-110816?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/ljharb/qs/security/advisories/GHSA-6pq8-jhm2-2vcw>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2026-110816>
- patch: <https://github.com/ljharb/qs/commit/a952e7519338ef0cfb25694a2988848f93333727>
- other: <https://github.com/ljharb/qs>
- other: <https://github.com/ljharb/qs/releases/tag/v6.16.1>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-110816>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-6pq8-jhm2-2vcw> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2026-110816> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-110816>
