Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Process runaway on some user agentsq #113

Open
mikesullivan63 opened this issue Apr 21, 2015 · 3 comments
Open

Process runaway on some user agentsq #113

mikesullivan63 opened this issue Apr 21, 2015 · 3 comments

Comments

@mikesullivan63
Copy link

When performing a security analysis on some of our servers, we noticed some performance issues related to the useragent detection logic. The code seemed to hang in the regex matching loop, on the find call on line 167 of AbstractUserAgentStringParser (version 201410).

Looking deeper the troublesome useragent is

invalid../../../../../../../../../../etc/passwd/././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././.

and some of the matching regex's are
.*\/.*CFNetwork\/(602|609|609\.1\.4) Darwin\/
.*\/.*CFNetwork\/(672\.0\.2|672\.0\.8|672\.1\.12|672\.1\.13|672\.1\.14|672\.1\.15) Darwin\/
.*\/.*CFNetwork\/(485\.2|485\.10\.2|485\.12\.7|485\.12\.30|485\.13\.9) Darwin\/

There are more issues, but running the detector against the current code / database locks up the CPU and thread until completed. I'm running it locally now in a test case and it still hasn't completed in 20 minutes.

@arouel
Copy link
Owner

arouel commented Jul 7, 2015

Could you provide your test cases via a Pull Request?

@HaraldWalker
Copy link
Contributor

@mallat since the regex comes from the database, this might be worth investigating in case the current version of the database still uses the same regex for CFNetwork.

@arouel
Copy link
Owner

arouel commented Jul 25, 2015

@mallat and @HaraldWalker that would be great if we fix this regular expression in case it still exists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants