-
Notifications
You must be signed in to change notification settings - Fork 11
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
Possible Timing Issues on Untrusted Patterns #1
Comments
Thanks! It's still sorta WIP, so I haven't had time to do any fuzzing myself just yet. Will take a look soon. |
Fixed some bugs in d19fb3d which seems to have improved performance on your example patterns by a lot. If you find more, or want to share the program you used for fuzzing that would be helpful. Thanks again! |
Thanks for the quick fixes. Would you like me to make a PR that adds a nested Also, the fuzzer found a few other issues:
|
Sure a cargo fuzz setup sounds good if you feel like it. Thanks! |
Hello, I saw this crate on Twitter and decided to fuzz it with a primitive algorithm: simply generate a random pattern and match it to the original input. After running for quite a while, it came up with an input that took 4 seconds that was only 177 characters. Therefore, there is most likely some point where the code is getting stuck. Sadly, I do not have time to profile and investigate further at this time. However, this might want to be reviewed if users are to use this crate on untrusted patterns as this could most likely be exploited further if the cause was pinpointed. Anyways, here is the PoC:
Also notice that it only takes a long time when the pattern itself is matched with the pattern. I believe this is so because the pattern's
*
and named entries are being consumed by themselves in the matching process. Although, this still does not explain the slowdowns.Thanks
Edit:
The following input string takes 800ms on my machine with 102 characters so it might help narrow down the issue:
The text was updated successfully, but these errors were encountered: