You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I give up the fight. If it's Regular Expression the E should be capitalised.
Anyway, ReDoS does look cooler so I guess we'll stick with it (Regexp DoS)
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Regexploit
2
2
3
-
Regular Expression Denial of Service (REDoS).
3
+
Regular Expression Denial of Service (ReDoS).
4
4
5
5
Most default regular expression parsers (non-deterministic finite automata) have unbounded worst-case complexity. Regex matching may be quick when presented with a matching input string. However, certain non-matching input strings can make the regular expression matcher go into crazy loops and take ages to process. This can cause denial of service, as the CPU will be stuck trying to match the regex.
6
6
7
7
This tool is designed to:
8
-
* find regular expressions which are vulnerable to REDoS
8
+
* find regular expressions which are vulnerable to ReDoS
9
9
* give an example malicious string which will cause catastrophic backtracking
10
10
11
11
Something something regexes are bad.
@@ -15,7 +15,7 @@ Something something regexes are bad.
15
15
This reflects the complexity of the regular expression matcher's backtracking procedure with respect to the length of the entered string.
16
16
17
17
Cubic complexity here means that if the vulnerable part of the string is doubled in length, the execution time should be about 8 times longer (2^3).
18
-
For exponential REDoS with starred stars e.g. `(a*)*$` a fudge factor is used and the complexity will be greater than 10.
18
+
For exponential ReDoS with starred stars e.g. `(a*)*$` a fudge factor is used and the complexity will be greater than 10.
19
19
20
20
For explotability, a cubic complexity or higher is typically required unless truly giant strings are allowed as input.
21
21
@@ -34,9 +34,9 @@ Final character to cause backtracking: [^[a-z]]
34
34
Example: 'ab' + 'c' * 3456 + '0'
35
35
```
36
36
37
-
The part `c*[a-z]+c+` contains three overlapping repeating groups. As showed in the line `Repeated character: [c]`, a long string of `c` will match this section in many different ways. The worst-case complexity is 3 as there are 3 infinitely repeating groups. An example to cause REDoS is given: it consists of the required prefix `ab`, a long string of `c` and then a `0` to cause backtracking. Not all REDoSes require a particular character at the end, but in this case, a long string of `c` will match the regex successfully and won't backtrack. The line `Final character to cause backtracking: [^[a-z]]` shows that a non-matching character not in the range `[a-z]` is required at the end to prevent matching and cause REDoS.
37
+
The part `c*[a-z]+c+` contains three overlapping repeating groups. As showed in the line `Repeated character: [c]`, a long string of `c` will match this section in many different ways. The worst-case complexity is 3 as there are 3 infinitely repeating groups. An example to cause ReDoS is given: it consists of the required prefix `ab`, a long string of `c` and then a `0` to cause backtracking. Not all ReDoSes require a particular character at the end, but in this case, a long string of `c` will match the regex successfully and won't backtrack. The line `Final character to cause backtracking: [^[a-z]]` shows that a non-matching character not in the range `[a-z]` is required at the end to prevent matching and cause ReDoS.
38
38
39
-
As another example, install a module version vulnerable to REDoS such as `pip install ua-parser==0.9.0`.
39
+
As another example, install a module version vulnerable to ReDoS such as `pip install ua-parser==0.9.0`.
40
40
To scan the installed python modules run `regexploit-python-env`.
For each vulnerable regular expression it prints one or more malicious string to trigger REDoS. Setting your user agent to `;0 Build/HuaweiA000000000000000...` and browsing a website using an old version of ua-parser may cause the server to take a long time to process your request, probably ending in status 502.
66
+
For each vulnerable regular expression it prints one or more malicious string to trigger ReDoS. Setting your user agent to `;0 Build/HuaweiA000000000000000...` and browsing a website using an old version of ua-parser may cause the server to take a long time to process your request, probably ending in status 502.
67
67
68
68
# Installation
69
69
@@ -94,7 +94,7 @@ or via a file
94
94
cat myregexes.txt | regexploit
95
95
```
96
96
97
-
Nothing is printed when no REDoS is found.
97
+
Nothing is printed when no ReDoS is found.
98
98
99
99
## Python imports
100
100
@@ -109,7 +109,7 @@ N.B. this doesn't parse the python code to an AST and will only find regexes com
109
109
110
110
## Python code
111
111
112
-
Parses Python code (without executing it) via the AST to find regexes (with some false positives). The regexes are then analysed for REDoS.
112
+
Parses Python code (without executing it) via the AST to find regexes (with some false positives). The regexes are then analysed for ReDoS.
This will use the bundled NodeJS package in `regexploit/bin/javascript` which parses your javascript as an AST with [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) and prints out all regexes.
122
122
123
-
Those regexes are fed into the python REDoS finder.
123
+
Those regexes are fed into the python ReDoS finder.
@@ -139,7 +139,7 @@ TODO: not so straight forward to extract the regexes because of the way they are
139
139
140
140
## Golang / anything using re2
141
141
142
-
Unless you specifically use a non-deterministic finite automata, Go code is not vulnerable to this type of REDoS. It uses `re2` which does not have catastrophic backtracking.
142
+
Unless you specifically use a non-deterministic finite automata, Go code is not vulnerable to this type of ReDoS. It uses `re2` which does not have catastrophic backtracking.
0 commit comments