qs@6.14.1

A querystring parser that supports nesting and arrays, with a depth limit

  • latest version

    6.17.1

  • latest non vulnerable version

  • first published

    15 years ago

  • latest version published

    20 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the qs package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • M
    Improper Encoding or Escaping of Output

    qs is a querystring parser that supports nesting and arrays, with a depth limit.

    Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via the stringify function when the allowEmptyArrays option is enabled. When an object key contains special characters (such as &, =, or #) and its value is an empty array, the key is returned without encoding, allowing an attacker who controls a key name to inject arbitrary query-string parameters or URL fragments into the serialized output. A consumer that parses the resulting string will see attacker-controlled key-value pairs that were not present in the original object.

    How to fix Improper Encoding or Escaping of Output?

    Upgrade qs to version 6.16.2 or higher.

    >=6.12.0 <6.16.2
    • H
    Uncaught Exception

    qs is a querystring parser that supports nesting and arrays, with a depth limit.

    Affected versions of this package are vulnerable to Uncaught Exception via stringify when arrayFormat: 'comma' is used with array elements that have a non-callable toString property. Such elements - as produced by JSON.parse, or by qs.parse under allowPrototypes or plainObjects (which yields null-prototype objects) - cause Array.prototype.join or utils.encode to throw a TypeError: Cannot convert object to primitive value, crashing the process.

    Note: This is only exploitable if the arrayFormat: 'comma' option is explicitly set.

    How to fix Uncaught Exception?

    Upgrade qs to version 6.16.1 or higher.

    >=6.7.0 <6.16.1
    • M
    Uncaught Exception

    qs is a querystring parser that supports nesting and arrays, with a depth limit.

    Affected versions of this package are vulnerable to Uncaught Exception in the isBuffer() function in lib/utils.js, which calls obj.constructor.isBuffer(obj) without checking that it is callable, reached from stringify() at lib/stringify.js:127. An attacker can throw an uncaught TypeError that fails each request with HTTP 500, and terminates the worker process when stringify() runs in an unguarded async context, by supplying a query string such as x[constructor][isBuffer]=y that sets constructor.isBuffer to a non-function value. This requires the application to call qs.parse() with plainObjects: true or allowPrototypes: true, which preserves the constructor own property, and to then pass the parsed result to qs.stringify().

    How to fix Uncaught Exception?

    Upgrade qs to version 6.16.0 or higher.

    >=2.2.5 <6.16.0
    • M
    NULL Pointer Dereference

    qs is a querystring parser that supports nesting and arrays, with a depth limit.

    Affected versions of this package are vulnerable to NULL Pointer Dereference in the stringify() function, when processing arrays with the options arrayFormat: 'comma' and encodeValuesOnly: true that contain null or undefined elements. An attacker can cause errors by supplying mailcious input that results in these options being used with arrays containing null or undefined values. This only causes a crash if application code makes calls outside a request-handler error boundary (background jobs, startup paths, stream pipelines) or explicitly disables framework error handling.

    How to fix NULL Pointer Dereference?

    Upgrade qs to version 6.15.2 or higher.

    >=6.11.1 <6.15.2
    • H
    Allocation of Resources Without Limits or Throttling

    qs is a querystring parser that supports nesting and arrays, with a depth limit.

    Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the parseArrayValue function when the comma option is in use. An attacker can exhaust system memory by submitting a parameter containing a large number of comma-separated values, resulting in the allocation of excessively large arrays.

    Note: This is only exploitable if the comma option is explicitly set to true. arrayLimit is properly enforced for index and bracket notation.

    How to fix Allocation of Resources Without Limits or Throttling?

    Upgrade qs to version 6.14.2 or higher.

    >=6.7.0 <6.14.2