Vulnocalypse
Back to feed
28impact

qs.stringify throws TypeError on objects with a non-callable constructor.isBuffer property

ljharb qs · CVE-2026-82417
0 news outlets0 CERTs and agencies0 researchers

What is it?

### Summary `qs.stringify` throws a `TypeError` when it serializes an object whose own `constructor` property has a truthy, non-callable `isBuffer` member. `utils.isBuffer` duck-types buffers by calling `obj.constructor.isBuffer(obj)` after checking only that the property is truthy, so a value such as `{ constructor: { isBuffer: "x" } }` makes the call throw `TypeError: obj.constructor.isBuffer is not a function`. ### Details `lib/stringify.js:127` calls `utils.isBuffer` on every non-primitive value it serializes. `utils.isBuffer` (`lib/utils.js:332`) reads `obj.constructor.isBuffer` and invokes it without verifying that it is a function. `constructor` and `isBuffer` are ordinary property names, so any object carrying them as own properties reaches the unchecked call. Such an object can be built from untrusted input. `qs.parse("x[constructor][isBuffer]=y", { plainObjects: true })` or `{ allowPrototypes: true }` keeps the `constructor` key as an own property (the default parse options drop it), and `JSON.parse("{\"a\":{\"constructor\":{\"isBuffer\":\"x\"}}}")` produces the same shape with no qs option involved. Express 4 with its default `query parser` setting and body-p

Evidence

No coverage recorded yet.

Exploitation

  • Public proof of concept
  • Exploited in the wild
  • Listed as known exploited
CVSS
5.3
EPSS
0.4%
First seen
7 d ago
Status
corroborated

All ljharb vulnerabilities