Skip to content

Commit

Permalink
Heuristic python ast remove cronlike strings
Browse files Browse the repository at this point in the history
  • Loading branch information
b-c-ds authored and bcaller committed Dec 28, 2020
1 parent c069021 commit e28a595
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions regexploit/python_node_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def maybe_pattern(self, lineno: int, pattern: str):
if pattern.count("*") + pattern.count("+") >= 2:
# Could have REDoS
# Now check if it still looks like a docstring
if " * * *" in pattern:
return # Looks like cron (of course could just be really silly regex)
if pattern.count("\n") < 5 or "?" in pattern or "\\" in pattern:
self.patterns.append(PythonParsedRegex(lineno, pattern, 0, False))

Expand Down

0 comments on commit e28a595

Please sign in to comment.