wstg icon indicating copy to clipboard operation
wstg copied to clipboard

Add test for regular expression denial of service (ReDoS)

Open cvas22 opened this issue 3 weeks ago • 2 comments

What would you like added?

There's nothing on regular expression denial of service (ReDoS) in the guide. A single request with a crafted string can pin a CPU when input is checked with a regex that backtracks badly, like ^(a+)+$ or the email and URL patterns copied around, and it often shows up in validation for email, usernames and search fields, both on the server and in browser code.

A test would cover spotting regex-based validation (error messages, client-side JavaScript, known library versions), timing a request with growing input such as aaaa...! to see whether the response time grows exponentially, and doing it carefully so it doesn't take down a shared environment. Remediation would point to linear-time engines (RE2, Go's regexp, .NET's NonBacktracking), match timeouts and input length limits.

It could go in 4.10 Business Logic next to the application misuse pages, or in 4.7 Input Validation, whichever fits better.

Would you like to be assigned to this issue? Check the box if you will submit a PR to add the proposed content. Please read CONTRIBUTING.md.

  • [x] Assign me, please!

cvas22 avatar Nov 10 '26 18:11 cvas22

Moved this to 4.7 as INJT-27 in #1661, it fits better next to the other input validation tests than in BUSL.

cvas22 avatar Nov 13 '26 15:11 cvas22

Small correction, it's INJT-28 now since #1676 already has 27.

cvas22 avatar Nov 13 '26 15:11 cvas22