106 lines
4.1 KiB
Plaintext
106 lines
4.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:956010,\
|
|
phase:4,\
|
|
pass,\
|
|
nolog,\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-RUBY',\
|
|
ver:'OWASP_CRS/4.24.0-dev',\
|
|
skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:956011,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:956012,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
#
|
|
# -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
|
|
#
|
|
|
|
#
|
|
# -=[ RUBY Error Message Leakage ]=-
|
|
#
|
|
SecRule RESPONSE_BODY "@pmFromFile ruby-errors.data" \
|
|
"id:956100,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'RUBY Information Leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-ruby',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/1',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-RUBY',\
|
|
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:956013,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:956014,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
|
|
|
|
# Detect the presence of the Ruby ERB templates "<%", "<%= " and slim interpolation "#{}" in output.
|
|
#
|
|
# To prevent false positives (due to the short "<%" sequences), we also check for [#=\s] after an opening tag.
|
|
#
|
|
# This rule is placed at PL-2 since it also matches common templating format with various JavaScript templating engines.
|
|
#
|
|
SecRule RESPONSE_BODY "@rx (?i)(?:<%[=#\s]|#\{[^}]+\})" \
|
|
"id:956110,\
|
|
phase:4,\
|
|
block,\
|
|
capture,\
|
|
t:none,\
|
|
msg:'Ruby source code leakage',\
|
|
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}',\
|
|
tag:'application-multi',\
|
|
tag:'language-ruby',\
|
|
tag:'platform-multi',\
|
|
tag:'attack-disclosure',\
|
|
tag:'paranoia-level/2',\
|
|
tag:'OWASP_CRS',\
|
|
tag:'OWASP_CRS/DATA-LEAKAGES-RUBY',\
|
|
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:956015,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:956016,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
#
|
|
# -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
|
|
#
|
|
|
|
|
|
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:956017,phase:3,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:956018,phase:4,pass,nolog,tag:'OWASP_CRS',ver:'OWASP_CRS/4.24.0-dev',skipAfter:END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|
|
#
|
|
# -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
|
|
#
|
|
|
|
|
|
|
|
#
|
|
# -= Paranoia Levels Finished =-
|
|
#
|
|
SecMarker "END-RESPONSE-956-DATA-LEAKAGES-RUBY"
|