Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Potential regex compilation failure or mismatch with variable-length lookbehind in PCRE patterns

オープン
#3,537 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp
領域
security

調査の方向性

まず SecRule の例を再現し、その後 src/utils/regex.cc を調べて、ModSecurity が PCRE と PCRE2 のコンパイルおよびマッチングをどのようにラップしているかに注目します。サポートされていない可変長 lookbehind と、サポートされている構成での動作を比較します。サポートされている場合はパターンがマッチし、サポートされていない場合は明確なコンパイルエラーが生成されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

3.x

Summary
I am experiencing issues when using regular expressions containing variable-length lookbehind assertions (e.g., (?<!.(?:target|origin).{0,20})\bhaving\b) in ModSecurity v3. The pattern fails to match as expected, likely due to limitations in the underlying PCRE library integration or configuration within src/utils/regex.cc.

Steps to Reproduce
Create a SecRule using a variable-length lookbehind:

SecRule ARGS "@rx (?<!.(?:target|origin).{0,20})\bhaving\b" "id:12345,phase:2,deny,status:403"
Send a request with a payload that should match (e.g., ?data=select having count).

Observe that the rule is not triggered.

Actual Behavior
The regex fails to match the input. In some environments, no explicit compilation error is shown in the debug log, leading to "silent failure" where the rule is simply ignored.

Expected Behavior
The regex should either:

Match the input if the linked PCRE library (PCRE2 10.30+) supports variable-length lookbehind.

Provide a clear compilation error in the ModSecurity log indicating that the pattern is unsupported by the current PCRE version.

Technical Context
Looking at src/utils/regex.cc, ModSecurity wraps PCRE/PCRE2. However:

Most PCRE1 versions (still common in many distros) strictly forbid non-fixed-width lookbehind (errors like lookbehind assertion is not fixed length).

If ModSecurity is compiled with PCRE2, it should theoretically support this, but the implementation may not be passing the necessary JIT or match options to handle complex lookbehind depth.

主要言語
C++
スター
9.8k
フォーク
1.8k
平均マージ
2時間 46分
マージ済み PR(30日)
1

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

owasp-modsecurity/ModSecurity のほかの issue

owasp-modsecurity/ModSecurity の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。