coreruleset: Rule 920100 Fails Due to PCRE Limits Error

Description

Rule 920100 fails for long URLs due to MSC_PCRE_LIMITS_EXCEEDED. The URL is long, but not unreasonable.

How to reproduce the misbehavior (-> curl call)

curl -H "x-format-output: txt-matched-rules" https://sandbox.coreruleset.org/robots.txt?q=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
920100 PL1 Invalid HTTP Request Line
200005 PL1 ModSecurity internal error flagged: TX:MSC_PCRE_LIMITS_EXCEEDED
980170 PL1 Anomaly Scores: (Inbound Scores: blocking=3, detection=3, per_pl=3-0-0-0, threshold=5) - (Outbound Scores: blocking=0, detection=0, per_pl=0-0-0-0, threshold=4) - (SQLI=0, XSS=0, RFI=0, LFI=0, RCE=0, PHPI=0, HTTP=0, SESS=0, COMBINED_SCORE=3)

Confirmation

  • I have removed any personal data (email addresses, IP addresses, passwords, domain names) from any logs posted.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (24 by maintainers)

Most upvoted comments

I did some experimenting with this.

  1. If I remove rule 920100 entirely, the URL works with nothing logged.
  2. If I use rule 920100, it logs rule 920100 and rule 200005 (MSC_PCRE_LIMITS_EXCEEDED) and is blocked.
  3. If I flip !@rx to @rx, it does not log rule 920100, but does log rule 200005 (MSC_PCRE_LIMITS_EXCEEDED). The request is NOT blocked.

My theory is that rule 920100 is triggering MSC_PCRE_LIMITS_EXCEEDED (otherwise experiment 1 would log rule 200005 too) and it’s probably the ModSecurity library’s handling of failed regular expressions that is buggy. I think that the rule is triggering MSC_PCRE_LIMITS_EXCEEDED, but the library is saying that because it’s checking if the regular expression did NOT match, it says that it didn’t match due to the internal error and hence saying the URL doesn’t match the regular expression when in reality, it is unknown whether it matches or not.

So I think there are 2 bugs:

  1. The library probably should handle !@rx differently when the regex failed. I feel like it should not trigger the rule.
  2. Something in this rule is triggering the regex library to fail. The 3.3.5 version did not have this issue.