Project

General

Profile

Actions

Security #8684

closed
PA PA

detect/pcre: quadratic complexity in stream processing

Security #8684: detect/pcre: quadratic complexity in stream processing

Added by Philippe Antoine 5 months ago. Updated 7 days ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Label:
CVE:
Git IDs:

f87b8e64a5fb80788897f7a9073c5407a2f5bc96

Severity:
LOW
Disclosure Date:
10/30/2026

Description

https://issues.oss-fuzz.com/u/0/issues/518668540

Reproducer is alert ip any any -> any any (pcre:"/.*mc|\H+$/"; sid:4;)


Files

lol.pcap (150 KB) lol.pcap Philippe Antoine, 06/30/2026 07:42 AM
fuzz.yaml (1.89 KB) fuzz.yaml Philippe Antoine, 06/30/2026 07:42 AM

Subtasks 2 (0 open — 2 closed)

Security #8685: detect/pcre: quadratic complexity in stream processing (8.0.x backport)ClosedVictor JulienActions
Optimization #8686: detect/pcre: usage of \H (character that is not a horizontal white space character) is too slow (7.0.x backport)RejectedOISF DevActions

PA Updated by Philippe Antoine 5 months ago Actions #2

  • 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 Actions #3

  • Subtask #8685 added

OT Updated by OISF Ticketbot 5 months ago Actions #4

  • Label deleted (Needs backport to 8.0)

OT Updated by OISF Ticketbot 5 months ago Actions #5

  • Subtask #8686 added

OT Updated by OISF Ticketbot 5 months ago Actions #6

  • Label deleted (Needs backport to 7.0)

PA Updated by Philippe Antoine 5 months ago Actions #7

  • 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 Actions #9

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 Actions #10

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 Actions #11

  • 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 Actions #12

  • Severity set to HIGH

Setting to HIGH like #8272 for the moment

PA Updated by Philippe Antoine 3 months ago Actions #13

  • Disclosure Date set to 10/30/2026

PA Updated by Philippe Antoine 3 months ago Actions #14

  • Status changed from Assigned to In Review

Gitlab MR

JI Updated by Jason Ish about 1 month ago Actions #15

  • GHSA set to GHSA-rp9x-qmqg-qcq3

VJ Updated by Victor Julien about 1 month ago Actions #16

  • 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 Actions #18

  • Status changed from In Review to Resolved

JI Updated by Jason Ish 28 days ago Actions #19

  • Status changed from Resolved to Closed

JI Updated by Jason Ish 25 days ago Actions #20

  • Git IDs updated (diff)

JI Updated by Jason Ish 7 days ago Actions #22

  • Private changed from Yes to No
Actions

Also available in: PDF Atom