Actions
Security #8684
closed
PA
PA
detect/pcre: quadratic complexity in stream processing
Security #8684:
detect/pcre: quadratic complexity in stream processing
Affected Versions:
Label:
CVE:
Git IDs:
f87b8e64a5fb80788897f7a9073c5407a2f5bc96
Description
https://issues.oss-fuzz.com/u/0/issues/518668540
Reproducer is alert ip any any -> any any (pcre:"/.*mc|\H+$/"; sid:4;)
Files
PA Updated by Philippe Antoine 5 months ago
- Subject changed from detect/pcre: usage of \H (Unicode extended grapheme cluster) is too slow to detect/pcre: usage of \H (character that is not a horizontal white space character) is too slow
OT Updated by OISF Ticketbot 5 months ago
- Subtask #8685 added
OT Updated by OISF Ticketbot 5 months ago
- Label deleted (
Needs backport to 8.0)
OT Updated by OISF Ticketbot 5 months ago
- Subtask #8686 added
OT Updated by OISF Ticketbot 5 months ago
- Label deleted (
Needs backport to 7.0)
PA Updated by Philippe Antoine 5 months ago
- Subject changed from detect/pcre: usage of \H (character that is not a horizontal white space character) is too slow to detect/pcre: quadratic complexity in stream processing
PA Updated by Philippe Antoine 5 months ago
Actually the \H pattern seems to be just a factor 2 for time of processing
I think the problem is rather a 150kbytes pcap runs 6Mbyte through pcre
I debug print
diff --git a/src/detect-pcre.c b/src/detect-pcre.c
index cafcb37e58..1fec2455fd 100644
--- a/src/detect-pcre.c
+++ b/src/detect-pcre.c
@@ -78,12 +78,18 @@ static int pcre2_use_jit = 1;
// TODOpcre2 pcre2_jit_stack_create ?
+static size_t nb = 0;
+static size_t total = 0;
+
/* \brief Helper function for using pcre2_match with/without JIT
*/
static inline int DetectPcreExec(DetectEngineThreadCtx *det_ctx, const DetectPcreData *pd,
const char *str, const size_t strlen, int start_offset, int options,
pcre2_match_data *match)
{
+ nb++;
+ total += strlen;
+ printf("lole %d %d %d\n", nb, total, strlen);
return pcre2_match(pd->parse_regex.regex, (PCRE2_SPTR8)str, strlen, start_offset, options,
match, pd->parse_regex.context);
}
PA Updated by Philippe Antoine 5 months ago
- File lol.pcap lol.pcap added
- File fuzz.yaml fuzz.yaml added
- Assignee changed from Philippe Antoine to Victor Julien
Reproducer is ./src/suricata -S fuzz.rules -r lol.pcap -c fuzz.yaml -k none with fuzz.rules being alert ip any any -> any any (pcre:"/.*mc|\H+$/"; sid:4;)
Victor, is this similar to what you fixed in #8272 ?
PA Updated by Philippe Antoine 5 months ago
- Tracker changed from Optimization to Security
- Private changed from No to Yes
Is this a security issue ?
PA Updated by Philippe Antoine 3 months ago
- Severity set to HIGH
Setting to HIGH like #8272 for the moment
PA Updated by Philippe Antoine 3 months ago
- Disclosure Date set to 10/30/2026
PA Updated by Philippe Antoine 3 months ago
- Status changed from Assigned to In Review
Gitlab MR
JI Updated by Jason Ish about 1 month ago
- GHSA set to GHSA-rp9x-qmqg-qcq3
VJ Updated by Victor Julien about 1 month ago
- Assignee changed from Victor Julien to Philippe Antoine
- Severity changed from HIGH to LOW
Requires a bad ruleset. Setting to LOW.
PA Updated by Philippe Antoine about 1 month ago
Fix made public in https://github.com/OISF/suricata/pull/16487
PA Updated by Philippe Antoine about 1 month ago
- Status changed from In Review to Resolved
Actions