[Snort-devel] Potential vulnerabilities of some Snort regexes
asiri.rathnayake at ...2499...
Wed Jan 16 09:29:37 EST 2013
I'm a PhD student from the University of Birmingham, UK. Me and my
supervisor are conducting research around the topics of string pattern
matching and parsing .
We recently developed a static analysis for detecting exponential runtime
vulnerabilities of (backtracking) regular expression matchers; the analysis
and the implementation is described in  (paper under review). As part of
the work, we executed our analyzer on the Snort PCRE regex set (after
extracting them from the rule files), and we found several exponential
runtime vulnerabilities in some of these expressions. The linked file
"snort_sample.txt"  details a sample of these vulnerabilities, for an
example, one entry reads:
- Regex: /^SITE\s*(\w+\s*)+\x7c/smi
- Parse: Ok
- Kleene count: 6
+ Analysis: Completed
+ Vulnerable: Yes
+ Kleene: (\w+\s*)+
- Prefix: SITE9
- Pumpable: zz
- Suffix: (The empty string)
This means that for the regular expression /^SITE\s*(\w+\s*)+\x7c/smi, an
attack string can be formed in the following manner:
SITE9zzzzzzzzzzzzzzzzzzzzzz... (many copies of "zz")
Usually, for prefix "w", pumpable "x" and suffix "z", the attack string is
formed by repeating the pumpable string "x" many times, as in:
The paper argues that the runtime of a backtracking regular expression
matcher would be exponential in the number of copies of "x". The full
analysis of Snort regexes is given in the linked file "snort.log" .
While we're confident about the analysis, we're not familiar with the Snort
internal workings; thus we do not know how many of these vulnerabilities
are actually exploitable. We thought of writing to you and getting your
opinion about the quality of the results reported.
The source code for the analyzer (written in OCaml) along with test data
sets and results can be found at  (also linked from the paper).
Any comments would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Snort-devel