161 lines
6.1 KiB
Plaintext
161 lines
6.1 KiB
Plaintext
# ------------------------------------------------------------------------
|
|
# OWASP CRS ver.4.24.0-dev
|
|
# Copyright (c) 2006-2020 Trustwave and contributors. All rights reserved.
|
|
# Copyright (c) 2021-2026 CRS project. All rights reserved.
|
|
#
|
|
# The OWASP CRS is distributed under
|
|
# Apache Software License (ASL) version 2
|
|
# Please see the enclosed LICENSE file for full details.
|
|
# ------------------------------------------------------------------------
|
|
|
|
#
|
|
# -= Paranoia Level 0 (empty) =- (apply unconditionally)
|
|
#
|
|
|
|
# Skip all rules if RESPONSE_BODY is compressed.
|
|
SecRule RESPONSE_HEADERS:Content-Encoding "@pm gzip compress deflate br zstd" \
|
|
"id:953010,\
|
|
phase:4,\
|
|
pass,\
|
|
nolog,\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-PHP',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:953011,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:953012,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
#
|
|
# -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
|
|
#
|
|
|
|
#
|
|
# -=[ PHP Error Message Leakage ]=-
|
|
#
|
|
SecRule RESPONSE_BODY "@pmFromFile php-errors.data" \
|
|
"id:953100,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'PHP Information Leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-php',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/1',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-PHP',\
|
|
tag:'capec/1000/118/116',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
severity:'ERROR',\
|
|
setvar:'tx.outbound_anomaly_score_pl1=+%{tx.error_anomaly_score}'"
|
|
|
|
#
|
|
# -=[ PHP source code leakage ]=-
|
|
#
|
|
# Detect some common PHP keywords in output.
|
|
#
|
|
SecRule RESPONSE_BODY "@rx (?:\b(?:f(?:tp_(?:nb_)?f?(?:ge|pu)t|get(?:s?s|c)|scanf|write|open|read)|gz(?:(?:encod|writ)e|compress|open|read)|s(?:ession_start|candir)|read(?:(?:gz)?file|dir)|move_uploaded_file|(?:proc_|bz)open|call_user_func)|\$_(?:(?:pos|ge)t|session))\b" \
|
|
"id:953110,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'PHP source code leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-php',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/1',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-PHP',\
|
|
tag:'capec/1000/118/116',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
severity:'ERROR',\
|
|
setvar:'tx.outbound_anomaly_score_pl1=+%{tx.error_anomaly_score}'"
|
|
|
|
# Detect the presence of the PHP open tag "<? ", "<?= " or "<?php " in output.
|
|
#
|
|
# To prevent false positives (due to the short "<?" sequences), we also include,
|
|
# the space after it in an attempt to stop alerts in binary output.
|
|
# And we make it case insensitive.
|
|
#
|
|
SecRule RESPONSE_BODY "@rx (?i)<\?(?:=|php)?\s+" \
|
|
"id:953120,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'PHP source code leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-php',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/1',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-PHP',\
|
|
tag:'capec/1000/118/116',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
severity:'ERROR',\
|
|
setvar:'tx.outbound_anomaly_score_pl1=+%{tx.error_anomaly_score}'"
|
|
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:953013,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:953014,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
#
|
|
# -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
|
|
#
|
|
|
|
#
|
|
# -=[ PHP Error Message Leakage ]=-
|
|
#
|
|
# This is a stricter sibling of rule 953100.
|
|
# This stricter sibling checks for additional error messages which has a higher chance to appear in common language and uses regular
|
|
# expressions to reduce false positives where possible.
|
|
#
|
|
SecRule RESPONSE_BODY "@rx (?i)Empty string|F(?:ile size is|reeing memory)|Header (?:name )?\"|Invalid date|No active class|(?:Out of memor|cannot be empt)y|Pa(?:ir level|ssword is too long)|Re(?:ading file|starting!)|S(?:ession is not active|tatic function\b)|T(?:elling\.\.\.|he function\b)|(?:Unknown reas|invalid opti)on|e(?:mpty password|rror reading)" \
|
|
"id:953101,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'PHP Information Leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-php',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/2',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-PHP',\
|
|
tag:'capec/1000/118/116',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
severity:'ERROR',\
|
|
setvar:'tx.outbound_anomaly_score_pl2=+%{tx.error_anomaly_score}'"
|
|
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:953015,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:953016,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
#
|
|
# -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
|
|
#
|
|
|
|
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:953017,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:953018,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-953-DATA-LEAKAGES-PHP"
|
|
#
|
|
# -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
|
|
#
|
|
|
|
|
|
|
|
#
|
|
# -= Paranoia Levels Finished =-
|
|
#
|
|
SecMarker "END-RESPONSE-953-DATA-LEAKAGES-PHP"
|