NodeJS/qs/2.3.0
A querystring parser that supports nesting and arrays, with a depth limit
https://www.npmjs.com/package/qs
BSD
3 Security Vulnerabilities
qs's arrayLimit bypass in its bracket notation allows DoS via memory exhaustion
Summary
The arrayLimit option in qs did not enforce limits for bracket notation (a[]=1&a[]=2), only for indexed notation (a[0]=1). This is a consistency bug; arrayLimit should apply uniformly across all array notations.
Note: The default parameterLimit of 1000 effectively mitigates the DoS scenario originally described. With default options, bracket notation cannot produce arrays larger than parameterLimit regardless of arrayLimit, because each a[]=value consumes one parameter slot. The severity has been reduced accordingly.
Details
The arrayLimit option only checked limits for indexed notation (a[0]=1&a[1]=2) but did not enforce it for bracket notation (a[]=1&a[]=2).
Vulnerable code (lib/parse.js:159-162): javascript if (root === '[]' && options.parseArrays) { obj = utils.combine([], leaf); // No arrayLimit check }
Working code (lib/parse.js:175): javascript else if (index <= options.arrayLimit) { // Limit checked here obj = []; obj[index] = leaf; }
The bracket notation handler at line 159 uses utils.combine([], leaf) without validating against options.arrayLimit, while indexed notation at line 175 checks index <= options.arrayLimit before creating arrays.
PoC
const qs = require('qs');
const result = qs.parse('a[]=1&a[]=2&a[]=3&a[]=4&a[]=5&a[]=6', { arrayLimit: 5 });
console.log(result.a.length); // Output: 6 (should be max 5)
Note on parameterLimit interaction: The original advisory's DoS demonstration
claimed a length of 10,000, but parameterLimit (default: 1000) caps parsing to 1,000 parameters. With default options, the actual output is 1,000, not 10,000.
Impact
Consistency bug in arrayLimit enforcement. With default parameterLimit, the practical DoS risk is negligible since parameterLimit already caps the total number of parsed parameters (and thus array elements from bracket notation). The risk increases only when parameterLimit is explicitly set to a very high value.
Prototype Pollution Protection Bypass in qs
- https://nvd.nist.gov/vuln/detail/CVE-2017-1000048
- https://github.com/advisories/GHSA-gqgv-6jq5-jjj9
- https://github.com/ljharb/qs/issues/200
- https://github.com/ljharb/qs/commit/beade029171b8cef9cee0d03ebe577e2dd84976d
- https://access.redhat.com/errata/RHSA-2017:2672
- https://snyk.io/vuln/npm:qs:20170213
- https://www.npmjs.com/advisories/1469
Affected version of qs are vulnerable to Prototype Pollution because it is possible to bypass the protection. The qs.parse function fails to properly prevent an object's prototype to be altered when parsing arbitrary input. Input containing [ or ] may bypass the prototype pollution protection and alter the Object prototype. This allows attackers to override properties that will exist in all objects, which may lead to Denial of Service or Remote Code Execution in specific circumstances.
Recommendation
Upgrade to 6.0.4, 6.1.2, 6.2.3, 6.3.2 or later.
qs vulnerable to Prototype Pollution
- https://nvd.nist.gov/vuln/detail/CVE-2022-24999
- https://github.com/ljharb/qs/pull/428
- https://github.com/expressjs/express/releases/tag/4.17.3
- https://github.com/n8tz/CVE-2022-24999
- https://github.com/advisories/GHSA-hrpp-h998-j3pp
- https://github.com/ljharb/qs/commit/4310742efbd8c03f6495f07906b45213da0a32ec
- https://github.com/ljharb/qs/commit/727ef5d34605108acb3513f72d5435972ed15b68
- https://github.com/ljharb/qs/commit/73205259936317b40f447c5cdb71c5b341848e1b
- https://github.com/ljharb/qs/commit/8b4cc14cda94a5c89341b77e5fe435ec6c41be2d
- https://github.com/ljharb/qs/commit/ba24e74dd17931f825adb52f5633e48293b584e1
- https://github.com/ljharb/qs/commit/e799ba57e573a30c14b67c1889c7c04d508b9105
- https://github.com/ljharb/qs/commit/ed0f5dcbef4b168a8ae299d78b1e4a2e9b1baf1f
- https://github.com/ljharb/qs/commit/f945393cfe442fe8c6e62b4156fd35452c0686ee
- https://github.com/ljharb/qs/commit/fc3682776670524a42e19709ec4a8138d0d7afda
- https://lists.debian.org/debian-lts-announce/2023/01/msg00039.html
- https://security.netapp.com/advisory/ntap-20230908-0005
qs before 6.10.3 allows attackers to cause a Node process hang because an __ proto__ key can be used. In many typical web framework use cases, an unauthenticated remote attacker can place the attack payload in the query string of the URL that is used to visit the application, such as a[__proto__]=b&a[__proto__]&a[length]=100000000. The fix was backported to qs 6.9.7, 6.8.3, 6.7.3, 6.6.1, 6.5.3, 6.4.1, 6.3.3, and 6.2.4.
146 Other Versions
| Version | License | Security | Released | |
|---|---|---|---|---|
| 6.15.0 | BSD-3-Clause | 2026-02-15 - 06:54 | about 2 months | |
| 6.14.2 | BSD-3-Clause | 2026-02-11 - 23:39 | about 2 months | |
| 6.14.1 | BSD-3-Clause | 1 | 2025-12-29 - 22:05 | 3 months |
| 6.14.0 | BSD-3-Clause | 2 | 2025-01-14 - 18:02 | about 1 year |
| 6.13.3 | BSD-3-Clause | 2 | 2026-02-13 - 00:43 | about 2 months |
| 6.13.2 | BSD-3-Clause | 2 | 2026-02-12 - 08:09 | about 2 months |
| 6.13.1 | BSD-3-Clause | 2 | 2024-11-17 - 18:33 | over 1 year |
| 6.13.0 | BSD-3-Clause | 2 | 2024-08-01 - 17:19 | over 1 year |
| 6.12.5 | BSD-3-Clause | 2 | 2026-02-13 - 00:43 | about 2 months |
| 6.12.4 | BSD-3-Clause | 2 | 2026-02-12 - 08:10 | about 2 months |
| 6.12.3 | BSD-3-Clause | 2 | 2024-07-08 - 23:54 | over 1 year |
| 6.12.2 | BSD-3-Clause | 2 | 2024-07-01 - 18:11 | almost 2 years |
| 6.12.1 | BSD-3-Clause | 2 | 2024-04-12 - 22:24 | almost 2 years |
| 6.12.0 | BSD-3-Clause | 2 | 2024-03-06 - 18:13 | about 2 years |
| 6.11.4 | BSD-3-Clause | 2 | 2026-02-13 - 00:43 | about 2 months |
| 6.11.3 | BSD-3-Clause | 2 | 2026-02-12 - 08:10 | about 2 months |
| 6.11.2 | BSD-3-Clause | 2 | 2023-05-15 - 16:08 | almost 3 years |
| 6.11.1 | BSD-3-Clause | 2 | 2023-03-06 - 22:25 | about 3 years |
| 6.11.0 | BSD-3-Clause | 2 | 2022-06-27 - 04:49 | almost 4 years |
| 6.10.7 | BSD-3-Clause | 2 | 2026-02-13 - 00:42 | about 2 months |
| 6.10.6 | BSD-3-Clause | 2 | 2026-02-12 - 08:10 | about 2 months |
| 6.10.5 | BSD-3-Clause | 2 | 2022-06-06 - 22:52 | almost 4 years |
| 6.10.4 | BSD-3-Clause | 2 | 2022-06-06 - 19:07 | almost 4 years |
| 6.10.3 | BSD-3-Clause | 2 | 2022-01-11 - 06:00 | about 4 years |
| 6.10.2 | BSD-3-Clause | 3 | 2021-12-06 - 05:47 | over 4 years |
| 6.10.1 | BSD-3-Clause | 3 | 2021-03-22 - 03:53 | about 5 years |
| 6.10.0 | BSD-3-Clause | 3 | 2021-03-18 - 19:39 | about 5 years |
| 6.9.9 | BSD-3-Clause | 2 | 2026-02-13 - 00:42 | about 2 months |
| 6.9.8 | BSD-3-Clause | 2 | 2026-02-12 - 08:10 | about 2 months |
| 6.9.7 | BSD-3-Clause | 2 | 2022-01-11 - 05:59 | about 4 years |
| 6.9.6 | BSD-3-Clause | 3 | 2021-01-14 - 04:53 | about 5 years |
| 6.9.5 | BSD-3-Clause | 3 | 2021-01-13 - 16:29 | about 5 years |
| 6.9.4 | BSD-3-Clause | 3 | 2020-05-03 - 21:52 | almost 6 years |
| 6.9.3 | BSD-3-Clause | 3 | 2020-03-25 - 20:35 | about 6 years |
| 6.9.2 | BSD-3-Clause | 3 | 2020-03-22 - 15:39 | about 6 years |
| 6.9.1 | BSD-3-Clause | 3 | 2019-11-08 - 06:46 | over 6 years |
| 6.9.0 | BSD-3-Clause | 3 | 2019-09-21 - 22:26 | over 6 years |
| 6.8.5 | BSD-3-Clause | 2 | 2026-02-13 - 00:42 | about 2 months |
| 6.8.4 | BSD-3-Clause | 2 | 2026-02-12 - 08:11 | about 2 months |
| 6.8.3 | BSD-3-Clause | 2 | 2022-01-11 - 05:59 | about 4 years |
| 6.8.2 | BSD-3-Clause | 3 | 2020-03-25 - 19:47 | about 6 years |
| 6.8.1 | BSD-3-Clause | 3 | 2020-03-24 - 04:47 | about 6 years |
| 6.8.0 | BSD-3-Clause | 3 | 2019-08-17 - 02:45 | over 6 years |
| 6.7.5 | BSD-3-Clause | 2 | 2026-02-13 - 00:42 | about 2 months |
| 6.7.4 | BSD-3-Clause | 2 | 2026-02-12 - 08:11 | about 2 months |
| 6.7.3 | BSD-3-Clause | 2 | 2022-01-11 - 05:59 | about 4 years |
| 6.7.2 | BSD-3-Clause | 3 | 2020-03-25 - 19:17 | about 6 years |
| 6.7.1 | BSD-3-Clause | 3 | 2020-03-24 - 15:25 | about 6 years |
| 6.7.0 | BSD-3-Clause | 3 | 2019-03-22 - 20:48 | about 7 years |
| 6.6.3 | BSD-3-Clause | 1 | 2026-02-13 - 00:42 | about 2 months |
