Bug 2439353 (CVE-2026-2391)

Summary: CVE-2026-2391 qs: qs's arrayLimit bypass in comma parsing allows denial of service
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aazores, abarbaro, abrianik, abuckta, akostadi, alcohan, alizardo, amasferr, anpicker, anujha, asoldano, ataylor, bbaranow, bdettelb, bmaxwell, brasmith, brian.stansberry, bstansbe, caswilli, chfoley, cmah, cmyers, cochase, darran.lofthouse, dbruscin, dhanak, dkuc, dlofthou, dmayorov, dnakabaa, doconnor, dosoudil, dranck, drosa, dschmidt, eaguilar, ebaron, ehugonne, erezende, eric.wittmann, ewittman, ggrzybek, gmalinko, gotiwari, gparvin, hasun, ibek, istudens, ivassile, iweiss, janstey, jbalunas, jcantril, jchui, jfula, jgrulich, jhe, jhorak, jkoehler, jlanda, jlledo, jolong, jowilson, jraez, jrokos, jscholz, jwong, kaycoth, kshier, ktsao, kvanderr, kverlaen, lchilton, lcouzens, lphiri, manissin, mattdavi, mnovotny, mosmerov, mstipich, msvehla, mvyas, nboldt, nipatil, nwallace, nyancey, oaljalju, omaciel, ometelka, orabin, pahickey, pantinor, parichar, pberan, pbizzarr, pdelbell, pesilva, pjindal, pmackay, psrna, ptisnovs, rexwhite, rgodfrey, rhaigner, rhel-process-autobot, rjohnson, rkubis, rojacob, rstancel, rstepani, sausingh, sdawley, sfeifer, simaishi, smaestri, smcdonal, stcannon, sthirugn, swoodman, syedriko, tasato, teagle, thjenkin, tom.jenkinson, tpopela, tsedmik, vdosoudi, watson-tool-maintainers, xdharmai, yguenane
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A denial of service flaw has been discovered in the qs npm package. When the `comma` option is set to `true` (not the default, but configurable in applications), qs allows parsing comma-separated strings as arrays (e.g., `?param=a,b,c` becomes `['a', 'b', 'c']`). However, the limit check for `arrayLimit` (default: 20) and the optional throwOnLimitExceeded occur after the comma-handling logic in `parseArrayValue`, enabling a bypass. This permits creation of arbitrarily large arrays from a single parameter, leading to excessive memory allocation.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2439540, 2439541, 2439544, 2439547, 2439550, 2439552, 2439553, 2439571, 2439572, 2439574, 2439575, 2439582, 2439584, 2439585, 2439538, 2439539, 2439542, 2439543, 2439545, 2439546, 2439548, 2439549, 2439551, 2439554, 2439555, 2439556, 2439557, 2439558, 2439559, 2439560, 2439561, 2439562, 2439563, 2439564, 2439565, 2439566, 2439567, 2439568, 2439569, 2439570, 2439573, 2439576, 2439577, 2439578, 2439579, 2439580, 2439581, 2439583    
Bug Blocks:    

Description OSIDB Bzimport 2026-02-12 16:02:11 UTC
### Summary
The `arrayLimit` option in qs does not enforce limits for comma-separated values when `comma: true` is enabled, allowing attackers to cause denial-of-service via memory exhaustion. This is a bypass of the array limit enforcement, similar to the bracket notation bypass addressed in GHSA-6rw7-vpxm-498p (CVE-2025-15284).

### Details
When the `comma` option is set to `true` (not the default, but configurable in applications), qs allows parsing comma-separated strings as arrays (e.g., `?param=a,b,c` becomes `['a', 'b', 'c']`). However, the limit check for `arrayLimit` (default: 20) and the optional throwOnLimitExceeded occur after the comma-handling logic in `parseArrayValue`, enabling a bypass. This permits creation of arbitrarily large arrays from a single parameter, leading to excessive memory allocation.

**Vulnerable code** (lib/parse.js: lines ~40-50):
```js
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
    return val.split(',');
}

if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
    throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
}

return val;
```
The `split(',')` returns the array immediately, skipping the subsequent limit check. Downstream merging via `utils.combine` does not prevent allocation, even if it marks overflows for sparse arrays.This discrepancy allows attackers to send a single parameter with millions of commas (e.g., `?param=,,,,,,,,...`), allocating massive arrays in memory without triggering limits. It bypasses the intent of `arrayLimit`, which is enforced correctly for indexed (`a[0]=`) and bracket (`a[]=`) notations (the latter fixed in v6.14.1 per GHSA-6rw7-vpxm-498p).

### PoC
**Test 1 - Basic bypass:**
```
npm install qs
```

```js
const qs = require('qs');

const payload = 'a=' + ','.repeat(25);  // 26 elements after split (bypasses arrayLimit: 5)
const options = { comma: true, arrayLimit: 5, throwOnLimitExceeded: true };

try {
  const result = qs.parse(payload, options);
  console.log(result.a.length);  // Outputs: 26 (bypass successful)
} catch (e) {
  console.log('Limit enforced:', e.message);  // Not thrown
}
```
**Configuration:**
- `comma: true`
- `arrayLimit: 5`
- `throwOnLimitExceeded: true`

Expected: Throws "Array limit exceeded" error.
Actual: Parses successfully, creating an array of length 26.


### Impact
Denial of Service (DoS) via memory exhaustion.