libclamav: report skipped PCRE evaluation through AlertExceedsMax - #1803
libclamav: report skipped PCRE evaluation through AlertExceedsMax#1803AAH20 wants to merge 2 commits into
Conversation
val-ms
left a comment
There was a problem hiding this comment.
I am open to this change, although I would ask that you not call out the PCRE limit in the documentation/config/help-string. We already have similar alerts for other limits, not just the size and time limits. You can find a short list in the older release notes: https://github.com/Cisco-Talos/clamav/blob/main/NEWS.md#01041 So if anything, those documentation/config/help-string messages should really be more general about alerts on exceeded limits overall because I wouldn't want to call out every possible limit in those places.
Keep the libclamav PCRE reporting unchanged, but make the user-facing docs/help strings general so they do not call out individual limits. Addresses val-ms review feedback on Cisco-Talos#1803. Signed-off-by: Ahmed Hassan <th3reality72@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
AAH20
left a comment
There was a problem hiding this comment.
Thanks @val-ms — good call. I've generalized all four doc/help-string/config-sample locations so they no longer single out PCREMaxFileSize (or any individual limit). The libclamav reporting itself is unchanged — it still emits Heuristics.Limits.Exceeded.PCREMaxFileSize through the existing AlertExceedsMax path, matching the pattern the other limit heuristics already use.
Happy to iterate further.
Summary
Report
Heuristics.Limits.Exceeded.PCREMaxFileSizethrough the existingAlertExceedsMaxmechanism when the PCRE matcher skips subsignature evaluationbecause a file or buffer exceeds
PCREMaxFileSize.Closes #1785.
Root cause
Both PCRE size-limit branches return
CL_EMAXSIZE. The generic scanner resulthandler intentionally converts non-fatal max conditions to success so remaining
analysis can continue. Unlike
MaxFileSizeandMaxScanSize, the PCRE-specificlimit did not first append an exceeds-max heuristic or metadata record. A scan
could therefore report
OKwithout an operational indication that PCREsubsignatures were not evaluated.
Changes
cli_append_potentially_unwanted_if_heur_exceedsmaxfor both fmap and buffer PCRE paths.
AlertExceedsMaxis disabled.below-limit PCRE evaluation.
AlertExceedsMaxcoversPCREMaxFileSizeand that exceeding itreduces detection coverage.
Validation
python3 -m unittest -v clamscan.regex_test: 6 tests passed.git diff --checkpassed.