qs@2.3.1 vulnerabilities

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

  • latest version

    6.13.1

  • latest non vulnerable version

  • first published

    13 years ago

  • latest version published

    1 months ago

  • licenses detected

  • Direct Vulnerabilities

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

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Prototype Poisoning

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

    Affected versions of this package are vulnerable to Prototype Poisoning which allows attackers to cause a Node process to hang, processing an Array object whose prototype has been replaced by one with an excessive length value.

    Note: In many typical Express 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.

    How to fix Prototype Poisoning?

    Upgrade qs to version 6.2.4, 6.3.3, 6.4.1, 6.5.3, 6.6.1, 6.7.3, 6.8.3, 6.9.7, 6.10.3 or higher.

    <6.2.4>=6.3.0 <6.3.3>=6.4.0 <6.4.1>=6.5.0 <6.5.3>=6.6.0 <6.6.1>=6.7.0 <6.7.3>=6.8.0 <6.8.3>=6.9.0 <6.9.7>=6.10.0 <6.10.3
    • H
    Prototype Override Protection Bypass

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

    Affected versions of this package are vulnerable to Prototype Override Protection Bypass. By default qs protects against attacks that attempt to overwrite an object's existing prototype properties, such as toString(), hasOwnProperty(),etc.

    From qs documentation:

    By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use plainObjects as mentioned above, or set allowPrototypes to true which will allow user input to overwrite those properties. WARNING It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.

    Overwriting these properties can impact application logic, potentially allowing attackers to work around security controls, modify data, make the application unstable and more.

    In versions of the package affected by this vulnerability, it is possible to circumvent this protection and overwrite prototype properties and functions by prefixing the name of the parameter with [ or ]. e.g. qs.parse("]=toString") will return {toString = true}, as a result, calling toString() on the object will throw an exception.

    Example:

    qs.parse('toString=foo', { allowPrototypes: false })
    // {}
    
    qs.parse("]=toString", { allowPrototypes: false })
    // {toString = true} <== prototype overwritten
    

    For more information, you can check out our blog.

    How to fix Prototype Override Protection Bypass?

    Upgrade qs to version 6.0.4, 6.1.2, 6.2.3, 6.3.2 or higher.

    <6.0.4>=6.1.0 <6.1.2>=6.2.0 <6.2.3>=6.3.0 <6.3.2