1

I really can't think of any, but could there be malicious effects of allowing users to run arbitrary regular expressions?

For example, say I have a website where people can try out regular expressions on a block of text -- is there anything I'd have to "sanitize" in the same way as for SQL statements?

amindfv
  • 8,438
  • 5
  • 36
  • 58

3 Answers3

2

Some regular expressions can be computationally very complex and/or require a lot of memory and running many of them could degrade performance or lead to a denial of service.

akton
  • 14,148
  • 3
  • 43
  • 47
1

Perl regular expressions can execute arbitrary code snippets. Even without that feature, a malicious regex could use up all the CPU/RAM on your server.

Sean McSomething
  • 6,376
  • 2
  • 23
  • 28
0

https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS

Pierre Ernst
  • 514
  • 3
  • 7
  • 1
    Excellent link, but a link-only answer is not really great (bitrot is just one of the problems). Could you summarize the information quickly in your answer? – Joachim Sauer Sep 05 '12 at 13:37