qs Library TypeError Vulnerability in Stringify Function with Comma Array Format

Vulnerability

A vulnerability in the 'qs' library's 'stringify' function can lead to a TypeError. This issue arises when 'arrayFormat' is set to 'comma' and 'encodeValuesOnly' is true, while the array contains null or undefined elements. The error occurs because the 'stringify' function attempts to encode these nullish values without proper handling, causing a synchronous crash. This vulnerability affects 'qs' versions 6.11.1 through 6.15.1, excluding 6.15.2, where the issue has been fixed.

Impact

This vulnerability causes a synchronous TypeError, disrupting the application flow. In Node.js HTTP frameworks like Express or Fastify, this error is caught and results in a 500 response, although it does not crash the worker process. However, in background jobs or streams, the error can halt the process.

Reproduction

To reproduce this vulnerability, use 'qs.stringify' with 'arrayFormat' set to 'comma' and 'encodeValuesOnly' set to true. Include an array element that is null or undefined. The function will throw a TypeError, indicating that it cannot read the length property of the null or undefined value.

Remediation

Users can update to 'qs' version 6.15.2 or later, where this vulnerability has been patched.

Added: May 17, 2026, 12:18 AM
Updated: May 17, 2026, 12:18 AM

Vulnerability Rating

Custom Algorithm
spread
6.6
impact
0.6
exploitability
5.7
remediation
7.7
relevance
8.6
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.