{"id":78544,"date":"2026-05-17T03:46:21","date_gmt":"2026-05-17T00:16:21","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2026-8723-qs-stringify-crashes-on-null-undefined-entries-in-comma-format-arrays-under-encodevaluesonly\/"},"modified":"2026-05-17T03:46:21","modified_gmt":"2026-05-17T00:16:21","slug":"cve-2026-8723-qs-stringify-crashes-on-null-undefined-entries-in-comma-format-arrays-under-encodevaluesonly","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2026-8723-qs-stringify-crashes-on-null-undefined-entries-in-comma-format-arrays-under-encodevaluesonly\/","title":{"rendered":"CVE-2026-8723 &#8211; qs.stringify crashes on null\/undefined entries in comma-format arrays under encodeValuesOnly"},"content":{"rendered":"<p>CVE ID :CVE-2026-8723<\/p>\n<p>  Published : May 17, 2026, 12:16 a.m. | 1\u00a0hour, 41\u00a0minutes ago<\/p>\n<p>  Description :### Summary<\/p>\n<p>`qs.stringify` throws `TypeError` when called with `arrayFormat: &#8216;comma&#8217;` and `encodeValuesOnly: true` on an array containing `null` or `undefined`. The throw is synchronous and not handled by any of qs&#8217;s null-related options (`skipNulls`, `strictNullHandling`).<\/p>\n<p>### Details<\/p>\n<p>In the comma + `encodeValuesOnly` branch, `lib\/stringify.js:145` mapped the array through the raw encoder before joining:<\/p>\n<p>&#8220;`js<\/p>\n<p>obj = utils.maybeMap(obj, encoder);<\/p>\n<p>&#8220;`<\/p>\n<p>`utils.encode` (`lib\/utils.js:195`) reads `str.length` with no null guard, so a `null` or `undefined` element throws `TypeError`. `skipNulls` and `strictNullHandling` are both checked in the per-element loop below this line and never get a chance to run.<\/p>\n<p>Same class of bug as the filter-array path fixed in 0c180a4. The vulnerable shape of the comma + `encodeValuesOnly` branch was introduced in 4c4b23d (&#8220;encode comma values more consistently&#8221;, PR #463, 2023-01-19), first released in v6.11.1.<\/p>\n<p>#### PoC<\/p>\n<p>&#8220;`js<\/p>\n<p>const qs = require(&#8216;qs&#8217;);<\/p>\n<p>qs.stringify({ a: [null, &#8216;b&#8217;] },      { arrayFormat: &#8216;comma&#8217;, encodeValuesOnly: true });<\/p>\n<p>qs.stringify({ a: [undefined, &#8216;b&#8217;] }, { arrayFormat: &#8216;comma&#8217;, encodeValuesOnly: true });<\/p>\n<p>qs.stringify({ a: [null] },           { arrayFormat: &#8216;comma&#8217;, encodeValuesOnly: true });<\/p>\n<p>\/\/ TypeError: Cannot read properties of null (reading &#8216;length&#8217;)<\/p>\n<p>\/\/     at encode (lib\/utils.js:195:13)<\/p>\n<p>\/\/     at Object.maybeMap (lib\/utils.js:322:37)<\/p>\n<p>\/\/     at stringify (lib\/stringify.js:145:25)<\/p>\n<p>&#8220;`<\/p>\n<p>#### Fix<\/p>\n<p>`lib\/stringify.js:145`, applied in 21f80b3 on `main` and released as v6.15.2:<\/p>\n<p>&#8220;`diff<\/p>\n<p>&#8211; obj = utils.maybeMap(obj, encoder);<\/p>\n<p>+ obj = utils.maybeMap(obj, function (v) {<\/p>\n<p>+     return v == null ? v : encoder(v);<\/p>\n<p>+ });<\/p>\n<p>&#8220;`<\/p>\n<p>`null` and `undefined` now pass through `maybeMap` unchanged and reach the `join(&#8216;,&#8217;)` step as-is. For `{ a: [null, &#8216;b&#8217;] }` this produces `a=,b`, matching the non-`encodeValuesOnly` comma path (which already joins before encoding and produces `a=%2Cb` for the same input). Single-element `[null]` arrays still collapse via the existing `obj.join(&#8216;,&#8217;) || null` and remain subject to `skipNulls` \/ `strictNullHandling` in the main loop.<\/p>\n<p>### Affected versions<\/p>\n<p>`&gt;=6.11.1<br \/>\n  Severity: 6.3 | MEDIUM<\/p>\n<p>  Visit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID :CVE-2026-8723 Published : May 17, 2026, 12:16 a.m. | 1\u00a0hour, 41\u00a0minutes ago Description :### Summary `qs.stringify` throws `TypeError` when called with `arrayFormat: &#8216;comma&#8217;` and `encodeValuesOnly: true` on an array containing `null` or `undefined`. The throw is synchronous and not handled by any of qs&#8217;s null-related options (`skipNulls`, `strictNullHandling`). ### Details In the comma &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-78544","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/78544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=78544"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/78544\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=78544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=78544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=78544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}