mirror of
https://github.com/alibaba/higress.git
synced 2026-02-25 13:10:50 +08:00
1938 lines
92 KiB
Plaintext
1938 lines
92 KiB
Plaintext
# ------------------------------------------------------------------------
|
||
# OWASP ModSecurity Core Rule Set ver.4.0.0-rc1
|
||
# Copyright (c) 2006-2020 Trustwave and contributors. All rights reserved.
|
||
# Copyright (c) 2021-2022 Core Rule Set project. All rights reserved.
|
||
#
|
||
# The OWASP ModSecurity Core Rule Set is distributed under
|
||
# Apache Software License (ASL) version 2
|
||
# Please see the enclosed LICENSE file for full details.
|
||
# ------------------------------------------------------------------------
|
||
|
||
#
|
||
# -= Paranoia Level 0 (empty) =- (apply unconditionally)
|
||
#
|
||
|
||
|
||
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:942011,phase:1,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 1" "id:942012,phase:2,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
#
|
||
# -= Paranoia Level 1 (default) =- (apply only when tx.detection_paranoia_level is sufficiently high: 1 or higher)
|
||
#
|
||
|
||
#
|
||
# References:
|
||
#
|
||
# SQL Injection Knowledgebase (via @LightOS) -
|
||
# http://websec.ca/kb/sql_injection
|
||
#
|
||
# SQLi Filter Evasion Cheat Sheet -
|
||
# http://websec.wordpress.com/2010/12/04/sqli-filter-evasion-cheat-sheet-mysql/
|
||
#
|
||
# SQL Injection Cheat Sheet -
|
||
# http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/
|
||
#
|
||
# SQLMap's Tamper Scripts (for evasions)
|
||
# https://svn.sqlmap.org/sqlmap/trunk/sqlmap/tamper/
|
||
#
|
||
|
||
#
|
||
# -=[ LibInjection Check ]=-
|
||
#
|
||
# There is a stricter sibling of this rule at 942101. It covers REQUEST_BASENAME and REQUEST_FILENAME.
|
||
#
|
||
# Ref: https://libinjection.client9.com/
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@detectSQLi" \
|
||
"id:942100,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:utf8toUnicode,t:urlDecodeUni,t:removeNulls,\
|
||
msg:'SQL Injection Attack Detected via libinjection',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
multiMatch,\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ Detect DB Names ]=-
|
||
#
|
||
# Regular expression generated from regex-assembly/942140.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942140
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:d(?:atabas|b_nam)e[^0-9A-Z_a-z]*\(|(?:information_schema|m(?:aster\.\.sysdatabases|s(?:db|ys(?:ac(?:cess(?:objects|storage|xml)|es)|modules2?|(?:object|querie|relationship)s))|ysql\.db)|northwind|pg_(?:catalog|toast)|tempdb)\b|s(?:chema(?:_name\b|[^0-9A-Z_a-z]*\()|(?:qlite_(?:temp_)?master|ys(?:aux|\.database_name))\b))" \
|
||
"id:942140,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack: Common DB Names Detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ SQL Function Names ]=-
|
||
#
|
||
# This rule has a stricter sibling to this rule (942152) that checks for SQL function names in
|
||
# request headers referer and user-agent.
|
||
#
|
||
# Regular expression generated from regex-assembly/942151.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942151
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:a(?:dd(?:dat|tim)e|es_(?:de|en)crypt|s(?:cii(?:str)?|in)|tan2?)|b(?:enchmark|i(?:n_to_num|t_(?:and|count|length|x?or)))|c(?:har(?:acter)?_length|iel(?:ing)?|o(?:alesce|ercibility|llation|(?:mpres)?s|n(?:cat(?:_ws)?|nection_id|v(?:ert(?:_tz)?)?)|t)|r32|ur(?:(?:dat|tim)e|rent_(?:date|time(?:stamp)?|user)))|d(?:a(?:t(?:abase|e(?:_(?:add|format|sub)|diff))|y(?:name|of(?:month|week|year)))|count|e(?:code|grees|s_(?:de|en)crypt)|ump)|e(?:lt|n(?:c(?:ode|rypt)|ds_?with)|x(?:p(?:ort_set)?|tract(?:value)?))|f(?:i(?:el|n)d_in_set|ound_rows|rom_(?:base64|days|unixtime))|g(?:e(?:ometrycollection|t_(?:format|lock))|(?:r(?:eates|oup_conca)|tid_subse)t)|hex(?:toraw)?|i(?:fnull|n(?:et6?_(?:aton|ntoa)|s(?:ert|tr)|terval)|s(?:_(?:(?:free|used)_lock|ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull))|null))|json(?:_(?:a(?:gg|rray(?:_(?:elements(?:_text)?|length))?)|build_(?:array|object)|e(?:ac|xtract_pat)h(?:_text)?|object(?:_(?:agg|keys))?|populate_record(?:set)?|strip_nulls|t(?:o_record(?:set)?|ypeof))|b(?:_(?:array(?:_(?:elements(?:_text)?|length))?|build_(?:array|object)|object(?:_(?:agg|keys))?|e(?:ac|xtract_pat)h(?:_text)?|insert|p(?:ath_(?:(?:exists|match)(?:_tz)?|query(?:_(?:(?:array|first)(?:_tz)?|tz))?)|opulate_record(?:set)?|retty)|s(?:et(?:_lax)?|trip_nulls)|t(?:o_record(?:set)?|ypeof)))?|path)?|l(?:ast_(?:day|inser_id)|case|e(?:as|f)t|i(?:kel(?:ihood|y)|nestring)|o(?:ad_file|ca(?:ltimestamp|te)|g(?:10|2)|wer)|pad|trim)|m(?:a(?:ke(?:_set|date)|ster_pos_wait)|d5|i(?:crosecon)?d|onthname|ulti(?:linestring|po(?:int|lygon)))|n(?:ame_const|ot_in|ullif)|o(?:ct(?:et_length)?|(?:ld_passwo)?rd)|p(?:eriod_(?:add|diff)|g_(?:client_encoding|sleep)|o(?:(?:lyg|siti)on|w)|rocedure_analyse)|qu(?:arter|ote)|r(?:a(?:dians|nd|wtohex)|elease_lock|ow_(?:count|to_json)|pad|trim)|s(?:chema|e(?:c_to_time|ssion_user)|ha[1-2]?|in|oundex|pace|q(?:lite_(?:compileoption_(?:get|used)|source_id)|rt)|t(?:arts_?with|d(?:dev_(?:po|sam)p)?|r(?:_to_date|cmp))|ub(?:(?:dat|tim)e|str(?:ing(?:_index)?)?)|ys(?:date|tem_user))|t(?:ime(?:_(?:format|to_sec)|diff|stamp(?:add|diff)?)|o(?:_(?:base64|jsonb?)|n?char|(?:day|second)s)|r(?:im|uncate))|u(?:case|n(?:compress(?:ed_length)?|hex|i(?:str|x_timestamp)|likely)|(?:pdatexm|se_json_nul)l|tc_(?:date|time(?:stamp)?)|uid(?:_short)?)|var(?:_(?:po|sam)p|iance)|we(?:ek(?:day|ofyear)|ight_string)|xmltype|yearweek)[^0-9A-Z_a-z]*\(" \
|
||
"id:942151,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:lowercase,\
|
||
msg:'SQL Injection Attack: SQL function name detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/1',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ PHPIDS - Converted SQLI Filters ]=-
|
||
#
|
||
# https://raw.github.com/PHPIDS/PHPIDS/master/lib/IDS/default_filter.xml
|
||
#
|
||
# The rule 942160 prevents time-based blind SQL injection attempts
|
||
# by prohibiting sleep() or benchmark(,) functions:
|
||
#
|
||
# * The sleep command takes a number of seconds as an argument.
|
||
# * The benchmark command executes the specified expression multiple times.
|
||
#
|
||
# Using a long sleep time or high number of executions, you can create a delay
|
||
# with the response from the server. This allows to determine whether the
|
||
# query has been executed or not. A high response time proves that the SQLi
|
||
# worked successfully. It can now be equipped with the real payload.
|
||
#
|
||
# Therefore this rule does not prevent the attack itself, but blocks an
|
||
# attacker from using the standard utils to tinker with blind SQLi.
|
||
#
|
||
# A positive side effect is that it prevents certain DoS attacks via the directives
|
||
# described above.
|
||
#
|
||
SecRule REQUEST_BASENAME|REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:sleep\(\s*?\d*?\s*?\)|benchmark\(.*?\,.*?\))" \
|
||
"id:942160,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects blind sqli tests using sleep() or benchmark()',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942170.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942170
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:select|;)[\s\v]+(?:benchmark|if|sleep)[\s\v]*?\([\s\v]*?\(?[\s\v]*?[0-9A-Z_a-z]+" \
|
||
"id:942170,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects SQL benchmark and sleep injection attempts including conditional queries',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942190.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942190
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\"'`](?:[\s\v]*![\s\v]*[\"'0-9A-Z_-z]|;?[\s\v]*(?:having|select|union\b[\s\v]*(?:all|(?:distin|sele)ct))\b[\s\v]*[^\s\v])|\b(?:(?:(?:c(?:onnection_id|urrent_user)|database|schema|user)[\s\v]*?|select.*?[0-9A-Z_a-z]?user)\(|exec(?:ute)?[\s\v]+master\.|from[^0-9A-Z_a-z]+information_schema[^0-9A-Z_a-z]|into[\s\v\+]+(?:dump|out)file[\s\v]*?[\"'`]|union(?:[\s\v]select[\s\v]@|[\s\v\(0-9A-Z_a-z]*?select))|[\s\v]*?exec(?:ute)?.*?[^0-9A-Z_a-z]xp_cmdshell|[^0-9A-Z_a-z]iif[\s\v]*?\(" \
|
||
"id:942190,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:removeCommentsChar,\
|
||
msg:'Detects MSSQL code execution and information gathering attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Magic number crash in PHP strtod from 2011:
|
||
# https://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
||
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ^(?i:-0000023456|4294967295|4294967296|2147483648|2147483647|0000012345|-2147483648|-2147483649|0000023456|2.2250738585072007e-308|2.2250738585072011e-308|1e309)$" \
|
||
"id:942220,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Looking for integer overflow attacks, these are taken from skipfish, except 2.2.2250738585072011e-308 is the \"magic number\" crash',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942230.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942230
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\s\v\(-\)]case[\s\v]+when.*?then|\)[\s\v]*?like[\s\v]*?\(|select.*?having[\s\v]*?[^\s\v]+[\s\v]*?[^\s\v0-9A-Z_a-z]|if[\s\v]?\([0-9A-Z_a-z]+[\s\v]*?[<->~]" \
|
||
"id:942230,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects conditional SQL injection attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942240.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942240
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)alter[\s\v]*?[0-9A-Z_a-z]+.*?char(?:acter)?[\s\v]+set[\s\v]+[0-9A-Z_a-z]+|[\"'`](?:;*?[\s\v]*?waitfor[\s\v]+(?:time|delay)[\s\v]+[\"'`]|;.*?:[\s\v]*?goto)" \
|
||
"id:942240,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL charset switch and MSSQL DoS attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:merge.*?using\s*?\(|execute\s*?immediate\s*?[\"'`]|match\s*?[\w(),+-]+\s*?against\s*?\()" \
|
||
"id:942250,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MATCH AGAINST, MERGE and EXECUTE IMMEDIATE injections',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)union.*?select.*?from" \
|
||
"id:942270,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Looking for basic sql injection. Common attack string for mysql, oracle and others',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942280.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942280
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)select[\s\v]*?pg_sleep|waitfor[\s\v]*?delay[\s\v]?[\"'`]+[\s\v]?[0-9]|;[\s\v]*?shutdown[\s\v]*?(?:[#;\{]|/\*|--)" \
|
||
"id:942280,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects Postgres pg_sleep injection, waitfor delay attacks and database shutdown attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942290.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942290
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\[?\$(?:n(?:e|in?|o[rt])|e(?:q|xists|lemMatch)|l(?:te?|ike)|mod|a(?:ll|nd)|(?:s(?:iz|lic)|wher)e|t(?:ype|ext)|x?or|div|between|regex|jsonSchema)\]?" \
|
||
"id:942290,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Finds basic MongoDB SQL injection attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule has a stricter sibling (942321) that checks for MySQL and PostgreSQL procedures / functions in
|
||
# request headers referer and user-agent.
|
||
#
|
||
# Regular expression generated from regex-assembly/942320.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942320
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)create[\s\v]+(?:function|procedure)[\s\v]*?[0-9A-Z_a-z]+[\s\v]*?\([\s\v]*?\)[\s\v]*?-|d(?:eclare[^0-9A-Z_a-z]+[#@][\s\v]*?[0-9A-Z_a-z]+|iv[\s\v]*?\([\+\-]*[\s\v\.0-9]+,[\+\-]*[\s\v\.0-9]+\))|exec[\s\v]*?\([\s\v]*?@|(?:lo_(?:impor|ge)t|procedure[\s\v]+analyse)[\s\v]*?\(|;[\s\v]*?(?:declare|open)[\s\v]+[\-0-9A-Z_a-z]+|::(?:b(?:igint|ool)|double[\s\v]+precision|int(?:eger)?|numeric|oid|real|(?:tex|smallin)t)" \
|
||
"id:942320,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL and PostgreSQL stored procedure/function injections',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942350.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942350
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)create[\s\v]+function[\s\v].+[\s\v]returns|;[\s\v]*?(?:alter|(?:(?:cre|trunc|upd)at|renam)e|d(?:e(?:lete|sc)|rop)|(?:inser|selec)t|load)\b[\s\v]*?[\(\[]?[0-9A-Z_a-z]{2,}" \
|
||
"id:942350,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL UDF injection and other data/structure manipulation attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule has two stricter sibling: 942361 and 942362.
|
||
# The keywords 'alter' and 'union' led to false positives.
|
||
# Therefore they have been moved to PL2 and the keywords have been extended on PL1.
|
||
# The original version also had loose word boundaries and context checksum cause further false positives.
|
||
# Because fixing those introduced bypass, the original variant was moved to PL2 as 942362.
|
||
#
|
||
# Sources for SQL ALTER statements:
|
||
# MySQL: https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-data-definition.html
|
||
# Oracle/PLSQL: https://docs.oracle.com/apps/search/search.jsp?q=alter&size=60&category=database
|
||
# PostgreQSL: https://www.postgresql.org/search/?u=%2Fdocs&q=alter
|
||
# MSSQL: https://docs.microsoft.com/en-us/sql/t-sql/statements/statements
|
||
# DB2: https://www.ibm.com/support/knowledgecenter/en/search/alter?scope=SSEPGG_9.5.0
|
||
#
|
||
# Regular expression generated from regex-assembly/942360.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942360
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:(?:alter|(?:(?:cre|trunc|upd)at|renam)e|de(?:lete|sc)|(?:inser|selec)t|load)[\s\v]+(?:char|group_concat|load_file)\b[\s\v]*\(?|end[\s\v]*?\);)|[\s\v\(]load_file[\s\v]*?\(|[\"'`][\s\v]+regexp[^0-9A-Z_a-z]|[\"'0-9A-Z_-z][\s\v]+as\b[\s\v]*[\"'0-9A-Z_-z]+[\s\v]*\bfrom|^[^A-Z_a-z]+[\s\v]*?(?:(?:(?:(?:cre|trunc)at|renam)e|d(?:e(?:lete|sc)|rop)|(?:inser|selec)t|load)[\s\v]+[0-9A-Z_a-z]+|u(?:pdate[\s\v]+[0-9A-Z_a-z]+|nion[\s\v]*(?:all|(?:sele|distin)ct)\b)|alter[\s\v]*(?:a(?:(?:ggregat|pplication[\s\v]*rol)e|s(?:sembl|ymmetric[\s\v]*ke)y|u(?:dit|thorization)|vailability[\s\v]*group)|b(?:roker[\s\v]*priority|ufferpool)|c(?:ertificate|luster|o(?:l(?:latio|um)|nversio)n|r(?:edential|yptographic[\s\v]*provider))|d(?:atabase|efault|i(?:mension|skgroup)|omain)|e(?:(?:ndpoi|ve)nt|xte(?:nsion|rnal))|f(?:lashback|oreign|u(?:lltext|nction))|hi(?:erarchy|stogram)|group|in(?:dex(?:type)?|memory|stance)|java|l(?:a(?:ngua|r)ge|ibrary|o(?:ckdown|g(?:file[\s\v]*group|in)))|m(?:a(?:s(?:k|ter[\s\v]*key)|terialized)|e(?:ssage[\s\v]*type|thod)|odule)|(?:nicknam|queu)e|o(?:perator|utline)|p(?:a(?:ckage|rtition)|ermission|ro(?:cedur|fil)e)|r(?:e(?:mot|sourc)e|o(?:l(?:e|lback)|ute))|s(?:chema|e(?:arch|curity|rv(?:er|ice)|quence|ssion)|y(?:mmetric[\s\v]*key|nonym)|togroup)|t(?:able(?:space)?|ext|hreshold|r(?:igger|usted)|ype)|us(?:age|er)|view|w(?:ork(?:load)?|rapper)|x(?:ml[\s\v]*schema|srobject))\b)" \
|
||
"id:942360,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects concatenated basic SQL injection and SQLLFI attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# -=[ Detect MySQL in-line comments ]=-
|
||
#
|
||
# MySQL in-line comments can be used to bypass SQLi detection.
|
||
#
|
||
# Ref: https://dev.mysql.com/doc/refman/8.0/en/comments.html:
|
||
# SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE ...
|
||
# CREATE TABLE t1(a INT, KEY (a)) /*!50110 KEY_BLOCK_SIZE=1024 */;
|
||
# SELECT /*+ BKA(t1) */ FROM ... ;
|
||
#
|
||
# http://localhost/test.php?id=9999+or+{if+length((/*!5000select+username/*!50000from*/user+where+id=1))>0}
|
||
#
|
||
# The minimal string that triggers this regexp is: /*!*/ or /*+*/.
|
||
# The rule 942500 is related to 942440 which catches both /*! and */ independently.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:/\*[!+](?:[\w\s=_\-()]+)?\*/)" \
|
||
"id:942500,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'MySQL in-line comment detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/1',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# This rule catches an authentication bypass via SQL injection that abuses semi-colons to end the SQL query early.
|
||
# Any characters after the semi-colon are ignored by some DBMSes (e.g. SQLite).
|
||
#
|
||
# An example of this would be:
|
||
# email=admin%40juice-sh.op';&password=foo
|
||
#
|
||
# The server then turns this into:
|
||
# SELECT * FROM users WHERE email='admin@juice-sh.op';' AND password='foo'
|
||
#
|
||
# Regular expression generated from regex-assembly/942540.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942540
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ^(?:[^']*'|[^\"]*\"|[^`]*`)[\s\v]*;" \
|
||
"id:942540,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:replaceComments,\
|
||
msg:'SQL Authentication bypass (split query)',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/1',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# This rule tries to match JSON SQL syntax that could be used as a bypass technique.
|
||
# Referring to this research: https://claroty.com/team82/research/js-on-security-off-abusing-json-based-sql-to-bypass-waf
|
||
#
|
||
# Regular expression generated from regex-assembly/942550.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942550
|
||
#
|
||
SecRule REQUEST_FILENAME|REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx [\"'`][\[\{].*[\]\}][\"'`].*(::.*jsonb?)?.*(?:(?:@|->?)>|<@|\?[&\|]?|#>>?|[<>]|<-)|(?:(?:@|->?)>|<@|\?[&\|]?|#>>?|[<>]|<-)[\"'`][\[\{].*[\]\}][\"'`]|json_extract.*\(.*\)" \
|
||
"id:942550,\
|
||
phase:2,\
|
||
block,\
|
||
t:none,t:urlDecodeUni,t:lowercase,t:removeWhitespace,\
|
||
msg:'JSON-Based SQL Injection',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/1',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl1=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:942013,phase:1,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 2" "id:942014,phase:2,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
#
|
||
# -= Paranoia Level 2 =- (apply only when tx.detection_paranoia_level is sufficiently high: 2 or higher)
|
||
#
|
||
|
||
|
||
#
|
||
# -=[ String Termination/Statement Ending Injection Testing ]=-
|
||
#
|
||
# Identifies common initial SQLi probing requests where attackers insert/append
|
||
# quote characters to the existing normal payload to see how the app/db responds.
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
SecRule REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx (?:^\s*[\"'`;]+|[\"'`]+\s*$)" \
|
||
"id:942110,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:utf8toUnicode,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack: Common Injection Testing Detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ SQL Operators ]=-
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942120.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942120
|
||
#
|
||
SecRule ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx (?i)!=|&&|\|\||>[=->]|<(?:<|=>?|>(?:[\s\v]+binary)?)|\b(?:(?:xor|r(?:egexp|like)|i(?:snull|like)|notnull)\b|collate(?:[^0-9A-Z_a-z]*?(?:U&)?[\"'`]|[^0-9A-Z_a-z]+(?:(?:binary|nocase|rtrim)\b|[0-9A-Z_a-z]*?_))|(?:likel(?:ihood|y)|unlikely)[\s\v]*\()|r(?:egexp|like)[\s\v]+binary|not[\s\v]+between[\s\v]+(?:0[\s\v]+and|(?:'[^']*'|\"[^\"]*\")[\s\v]+and[\s\v]+(?:'[^']*'|\"[^\"]*\"))|is[\s\v]+null|like[\s\v]+(?:null|[0-9A-Z_a-z]+[\s\v]+escape\b)|(?:^|[^0-9A-Z_a-z])in[\s\v\+]*\([\s\v\"0-9]+[^\(-\)]*\)|[!<->]{1,2}[\s\v]*all\b" \
|
||
"id:942120,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:utf8toUnicode,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack: SQL Operator Detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ SQL Tautologies ]=-
|
||
#
|
||
# Boolean-based SQL injection or tautology attack. Boolean values (True or False) are used to carry out
|
||
# this type of SQL injection. The malicious SQL query forces the web application to return a different result de-
|
||
# pending on whether the query returns a TRUE or FALSE result.
|
||
#
|
||
# The original 942130 was split in two rules:
|
||
# - 942130 targets tautologies using equalities (e.g. 1 = 1)
|
||
# - 942131 targets tautologies using inequalities (e.g. 1 != 2)
|
||
#
|
||
# We use captures to check for (in)equality in the regexp. So TX.1 will capture the left hand side (LHS) of the inequality,
|
||
# and TX.2 will capture the right hand side (RHS) of the logical query.
|
||
#
|
||
# Regular expression generated from regex-assembly/942130.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942130
|
||
#
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\s\v\"'-\)`]*?\b([0-9A-Z_a-z]+)\b[\s\v\"'-\)`]*?(?:=|<=>|(?:sounds[\s\v]+)?like|glob|r(?:like|egexp))[\s\v\"'-\)`]*?\b([0-9A-Z_a-z]+)\b" \
|
||
"id:942130,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:replaceComments,\
|
||
msg:'SQL Injection Attack: SQL Boolean-based attack detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{TX.942130_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.942130_lhs=%{TX.1}',\
|
||
setvar:'tx.942130_matched_var_name=%{matched_var_name}',\
|
||
chain"
|
||
SecRule TX:942130_lhs "@streq %{TX.2}" \
|
||
"t:none,\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Rule Targeting logical inequalities that return TRUE (e.g. 1 != 2)
|
||
#
|
||
#
|
||
# We use captures to check for (in)equality in the regexp. So TX.1 will capture the left hand side (LHS) of the inequality,
|
||
# and TX.2 will capture the right hand side (RHS) of the logical query.
|
||
#
|
||
# Regular expression generated from regex-assembly/942131.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942131
|
||
#
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\s\v\"'-\)`]*?\b([0-9A-Z_a-z]+)\b[\s\v\"'-\)`]*?(?:![<->]|<[=->]?|>=?|\^|is[\s\v]+not|not[\s\v]+(?:like|r(?:like|egexp)))[\s\v\"'-\)`]*?\b([0-9A-Z_a-z]+)\b" \
|
||
"id:942131,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:replaceComments,\
|
||
msg:'SQL Injection Attack: SQL Boolean-based attack detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{TX.942131_MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
multiMatch,\
|
||
setvar:'tx.942131_lhs=%{TX.1}',\
|
||
setvar:'tx.942131_matched_var_name=%{matched_var_name}',\
|
||
chain"
|
||
SecRule TX:942131_lhs "!@streq %{TX.2}" \
|
||
"t:none,\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# -=[ SQL Function Names ]=-
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942150.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942150
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:json(?:_[0-9A-Z_a-z]+)?|a(?:bs|(?:cos|sin)h?|tan[2h]?|vg)|c(?:eil(?:ing)?|h(?:a(?:nges|r(?:set)?)|r)|o(?:alesce|sh?|unt)|ast)|d(?:e(?:grees|fault)|a(?:te|y))|exp|f(?:loor(?:avg)?|ormat|ield)|g(?:lob|roup_concat)|h(?:ex|our)|i(?:f(?:null)?|if|n(?:str)?)|l(?:ast(?:_insert_rowid)?|ength|ike(?:l(?:ihood|y))?|n|o(?:ad_extension|g(?:10|2)?|wer(?:pi)?|cal)|trim)|m(?:ax|in(?:ute)?|o(?:d|nth))|n(?:ullif|ow)|p(?:i|ow(?:er)?|rintf|assword)|quote|r(?:a(?:dians|ndom(?:blob)?)|e(?:p(?:lace|eat)|verse)|ound|trim|ight)|s(?:i(?:gn|nh?)|oundex|q(?:lite_(?:compileoption_(?:get|used)|offset|source_id|version)|rt)|u(?:bstr(?:ing)?|m)|econd|leep)|t(?:anh?|otal(?:_changes)?|r(?:im|unc)|ypeof|ime)|u(?:n(?:icode|likely)|(?:pp|s)er)|zeroblob|bin|v(?:alues|ersion)|week|year)[^0-9A-Z_a-z]*\(" \
|
||
"id:942150,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:lowercase,\
|
||
msg:'SQL Injection Attack: SQL function name detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# -=[ SQL Authentication Bypasses ]=-
|
||
#
|
||
# Authentication bypass occurs when the attacker can log in as another user
|
||
# without knowing the user's password. The example bypass could look like this:
|
||
#
|
||
# x' OR 'x
|
||
#
|
||
# Because of the quantity of different rules they are split into:
|
||
# - 942540 PL1
|
||
# - 942180 PL2
|
||
# - 942260 PL2
|
||
# - 942340 PL2
|
||
# - 942520 PL2
|
||
# - 942521 PL2
|
||
# - 942522 PL2
|
||
|
||
# Regular expression generated from regex-assembly/942180.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942180
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:/\*)+[\"'`]+[\s\v]?(?:--|[#\{]|/\*)?|[\"'`](?:[\s\v]*(?:(?:x?or|and|div|like|between)[\s\v\-0-9A-Z_a-z]+[\(-\)\+-\-<->][\s\v]*[\"'0-9`]|[!=\|](?:[\s\v -!\+\-0-9=]+.*?[\"'-\(`].*?|[\s\v -!0-9=]+.*?[0-9]+)$|(?:like|print)[^0-9A-Z_a-z]+[\"'-\(0-9A-Z_-z]|;)|(?:[<>~]+|[\s\v]*[^\s\v0-9A-Z_a-z]?=[\s\v]*|[^0-9A-Z_a-z]*?[\+=]+[^0-9A-Z_a-z]*?)[\"'`])|[0-9][\"'`][\s\v]+[\"'`][\s\v]+[0-9]|^admin[\s\v]*?[\"'`]|[\s\v\"'-\(`][\s\v]*?glob[^0-9A-Z_a-z]+[\"'-\(0-9A-Z_-z]|[\s\v]is[\s\v]*?0[^0-9A-Z_a-z]|where[\s\v][\s\v,-\.0-9A-Z_a-z]+[\s\v]=" \
|
||
"id:942180,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 1/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942200.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942200
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i),.*?[\"'\)0-9`-f][\"'`](?:[\"'`].*?[\"'`]|(?:\r?\n)?\z|[^\"'`]+)|[^0-9A-Z_a-z]select.+[^0-9A-Z_a-z]*?from|(?:alter|(?:(?:cre|trunc|upd)at|renam)e|d(?:e(?:lete|sc)|rop)|(?:inser|selec)t|load)[\s\v]*?\([\s\v]*?space[\s\v]*?\(" \
|
||
"id:942200,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL comment-/space-obfuscated injections and backtick termination',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942210.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942210
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:&&|\|\||and|between|div|like|n(?:and|ot)|(?:xx?)?or)[\s\v\(]+[0-9A-Z_a-z]+[\s\v\)]*?[!\+=]+[\s\v0-9]*?[\"'-\)=`]|[0-9](?:[\s\v]*?(?:and|between|div|like|x?or)[\s\v]*?[0-9]+[\s\v]*?[\+\-]|[\s\v]+group[\s\v]+by.+\()|/[0-9A-Z_a-z]+;?[\s\v]+(?:and|between|div|having|like|x?or|select)[^0-9A-Z_a-z]|(?:[#;]|--)[\s\v]*?(?:alter|drop|(?:insert|update)[\s\v]*?[0-9A-Z_a-z]{2,})|@.+=[\s\v]*?\([\s\v]*?select|[^0-9A-Z_a-z]SET[\s\v]*?@[0-9A-Z_a-z]+" \
|
||
"id:942210,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects chained SQL injection attempts 1/2',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942260.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942260
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\"'`][\s\v]*?(?:(?:and|n(?:and|ot)|(?:xx?)?or|div|like|between|\|\||&&)[\s\v]+[\s\v0-9A-Z_a-z]+=[\s\v]*?[0-9A-Z_a-z]+[\s\v]*?having[\s\v]+|like[^0-9A-Z_a-z]*?[\"'0-9`])|[0-9A-Z_a-z][\s\v]+like[\s\v]+[\"'`]|like[\s\v]*?[\"'`]%|select[\s\v]+?[\s\v\"'-\),-\.0-9A-\[\]_-z]+from[\s\v]+" \
|
||
"id:942260,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 2/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942300.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942300
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\)[\s\v]*?when[\s\v]*?[0-9]+[\s\v]*?then|[\"'`][\s\v]*?(?:[#\{]|--)|/\*![\s\v]?[0-9]+|\b(?:b(?:inary[\s\v]*?\([\s\v]*?[0-9]|etween[\s\v]+[\s\v]*?[0-9A-Z_a-z]+\()|cha?r[\s\v]*?\([\s\v]*?[0-9]|(?:and|n(?:and|ot)|(?:xx?)?or|div|like|r(?:egexp|like))[\s\v]+[\s\v]*?[0-9A-Z_a-z]+\()|(?:\|\||&&)[\s\v]+[\s\v]*?[0-9A-Z_a-z]+\(" \
|
||
"id:942300,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL comments, conditions and ch(a)r injections',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942310.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942310
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:\([\s\v]*?select[\s\v]*?[0-9A-Z_a-z]+|coalesce|order[\s\v]+by[\s\v]+if[0-9A-Z_a-z]*?)[\s\v]*?\(|\*/from|\+[\s\v]*?[0-9]+[\s\v]*?\+[\s\v]*?@|[0-9A-Z_a-z][\"'`][\s\v]*?(?:(?:[\+\-=@\|]+[\s\v]+?)+|[\+\-=@\|]+)[\(0-9]|@@[0-9A-Z_a-z]+[\s\v]*?[^\s\v0-9A-Z_a-z]|[^0-9A-Z_a-z]!+[\"'`][0-9A-Z_a-z]|[\"'`](?:;[\s\v]*?(?:if|while|begin)|[\s\v0-9]+=[\s\v]*?[0-9])|[\s\v\(]+case[0-9]*?[^0-9A-Z_a-z].+[tw]hen[\s\v\(]" \
|
||
"id:942310,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects chained SQL injection attempts 2/2',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# -=[ SQL Injection Probings ]=-
|
||
#
|
||
# This is a group of three similar rules aiming to detect SQL injection probings.
|
||
#
|
||
# 942330 PL 2
|
||
# 942370 PL 2
|
||
# 942490 PL 3
|
||
# Regular expression generated from regex-assembly/942330.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942330
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\"'`][\s\v]*?(?:x?or|div|like|between|and)[\s\v]*?[\"'`]?[0-9]|\x5cx(?:2[37]|3d)|^(?:.?[\"'`]$|[\"'\x5c`]*?(?:[\"'0-9`]+|[^\"'`]+[\"'`])[\s\v]*?(?:and|n(?:and|ot)|(?:xx?)?or|div|like|between|\|\||&&)[\s\v]*?[\"'0-9A-Z_-z][!&\(-\)\+-\.@])|[^\s\v0-9A-Z_a-z][0-9A-Z_a-z]+[\s\v]*?[\-\|][\s\v]*?[\"'`][\s\v]*?[0-9A-Z_a-z]|@(?:[0-9A-Z_a-z]+[\s\v]+(?:and|x?or|div|like|between)[\s\v]*?[\"'0-9`]+|[\-0-9A-Z_a-z]+[\s\v](?:and|x?or|div|like|between)[\s\v]*?[^\s\v0-9A-Z_a-z])|[^\s\v0-:A-Z_a-z][\s\v]*?[0-9][^0-9A-Z_a-z]+[^\s\v0-9A-Z_a-z][\s\v]*?[\"'`].|[^0-9A-Z_a-z]information_schema|table_name[^0-9A-Z_a-z]" \
|
||
"id:942330,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects classic SQL injection probings 1/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942340.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942340
|
||
#
|
||
# Note that part of 942340.data is already optimized, to avoid a
|
||
# Regexp::Assemble behaviour, where the regex is not optimized very nicely.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)in[\s\v]*?\(+[\s\v]*?select|(?:(?:(?i:N)?AND|(?i:X)?(?i:X)?OR|DIV|LIKE|BETWEEN|NOT)[\s\v]+|(?:\|\||&&)[\s\v]*)[\s\v\+0-9A-Z_a-z]+(?:regexp[\s\v]*?\(|sounds[\s\v]+like[\s\v]*?[\"'`]|[0-9=]+x)|[\"'`](?:[\s\v]*?(?:[0-9][\s\v]*?(?:--|#)|is[\s\v]*?(?:[0-9].+[\"'`]?[0-9A-Z_a-z]|[\.0-9]+[\s\v]*?[^0-9A-Z_a-z].*?[\"'`]))|[%-&<->\^]+[0-9][\s\v]*?(?:=|x?or|div|like|between|and)|(?:[^0-9A-Z_a-z]+[\+\-0-9A-Z_a-z]+[\s\v]*?=[\s\v]*?[0-9][^0-9A-Z_a-z]+|\|?[\-0-9A-Z_a-z]{3,}[^\s\v,\.0-9A-Z_a-z]+)[\"'`]|[\s\v]*(?:(?:(?i:N)?AND|(?i:X)?(?i:X)?OR|DIV|LIKE|BETWEEN|NOT)[\s\v]+|(?:\|\||&&)[\s\v]*)(?:array[\s\v]*\[|[0-9A-Z_a-z]+(?:[\s\v]*!?~|[\s\v]+(?:not[\s\v]+)?similar[\s\v]+to[\s\v]+)|(?:tru|fals)e\b))|\bexcept[\s\v]+(?:select\b|values[\s\v]*?\()" \
|
||
"id:942340,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 3/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule is a stricter sibling of 942360.
|
||
# The keywords 'alter' and 'union' led to false positives.
|
||
# Therefore they have been moved to PL2 and the keywords have been extended on PL1.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:^[\W\d]+\s*?(?:alter|union)\b)" \
|
||
"id:942361,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL injection based on keyword alter or union',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule is a stricter sibling of 942360.
|
||
# The loose word boundaries and light context led to false positives.
|
||
# Because the stricter variant does miss quite a few legitimate payloads, the loose version was moved to PL2.
|
||
#
|
||
# Regular expression generated from regex-assembly/942362.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942362
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:alter|(?:(?:cre|trunc|upd)at|renam)e|de(?:lete|sc)|(?:inser|selec)t|load)[\s\v]+(?:char|group_concat|load_file)[\s\v]?\(?|end[\s\v]*?\);|[\s\v\(]load_file[\s\v]*?\(|[\"'`][\s\v]+regexp[^0-9A-Z_a-z]|[^A-Z_a-z][\s\v]+as\b[\s\v]*[\"'0-9A-Z_-z]+[\s\v]*\bfrom|^[^A-Z_a-z]+[\s\v]*?(?:create[\s\v]+[0-9A-Z_a-z]+|(?:d(?:e(?:lete|sc)|rop)|(?:inser|selec)t|load|(?:renam|truncat)e|u(?:pdate|nion[\s\v]*(?:all|(?:sele|distin)ct))|alter[\s\v]*(?:a(?:(?:ggregat|pplication[\s\v]*rol)e|s(?:sembl|ymmetric[\s\v]*ke)y|u(?:dit|thorization)|vailability[\s\v]*group)|b(?:roker[\s\v]*priority|ufferpool)|c(?:ertificate|luster|o(?:l(?:latio|um)|nversio)n|r(?:edential|yptographic[\s\v]*provider))|d(?:atabase|efault|i(?:mension|skgroup)|omain)|e(?:(?:ndpoi|ve)nt|xte(?:nsion|rnal))|f(?:lashback|oreign|u(?:lltext|nction))|hi(?:erarchy|stogram)|group|in(?:dex(?:type)?|memory|stance)|java|l(?:a(?:ngua|r)ge|ibrary|o(?:ckdown|g(?:file[\s\v]*group|in)))|m(?:a(?:s(?:k|ter[\s\v]*key)|terialized)|e(?:ssage[\s\v]*type|thod)|odule)|(?:nicknam|queu)e|o(?:perator|utline)|p(?:a(?:ckage|rtition)|ermission|ro(?:cedur|fil)e)|r(?:e(?:mot|sourc)e|o(?:l(?:e|lback)|ute))|s(?:chema|e(?:arch|curity|rv(?:er|ice)|quence|ssion)|y(?:mmetric[\s\v]*key|nonym)|togroup)|t(?:able(?:space)?|ext|hreshold|r(?:igger|usted)|ype)|us(?:age|er)|view|w(?:ork(?:load)?|rapper)|x(?:ml[\s\v]*schema|srobject)))\b)" \
|
||
"id:942362,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects concatenated basic SQL injection and SQLLFI attempts',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/2',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# This rule is a sibling of 942330. See that rule for a description and overview.
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942370.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942370
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:Referer|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\"'`](?:[\s\v]*?(?:(?:\*.+(?:x?or|div|like|between|(?:an|i)d)[^0-9A-Z_a-z]*?[\"'`]|(?:x?or|div|like|between|and)[\s\v][^0-9]+[\-0-9A-Z_a-z]+.*?)[0-9]|[^\s\v0-9\?A-Z_a-z]+[\s\v]*?[^\s\v0-9A-Z_a-z]+[\s\v]*?[\"'`]|[^\s\v0-9A-Z_a-z]+[\s\v]*?[^A-Z_a-z].*?(?:#|--))|.*?\*[\s\v]*?[0-9])|\^[\"'`]|[%\(-\+\-<>][\-0-9A-Z_a-z]+[^\s\v0-9A-Z_a-z]+[\"'`][^,]" \
|
||
"id:942370,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects classic SQL injection probings 2/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942380.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942380
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:having\b(?:[\s\v]+(?:[0-9]{1,10}|'[^=]{1,10}')[\s\v]*?[<->]| ?(?:[0-9]{1,10} ?[<->]+|[\"'][^=]{1,10}[ \"'<-\?\[]+))|ex(?:ecute(?:\(|[\s\v]{1,5}[\$\.0-9A-Z_a-z]{1,5}[\s\v]{0,3})|ists[\s\v]*?\([\s\v]*?select\b)|(?:create[\s\v]+?table.{0,20}?|like[^0-9A-Z_a-z]*?char[^0-9A-Z_a-z]*?)\()|select.*?case|from.*?limit|order[\s\v]by|exists[\s\v](?:[\s\v]select|s(?:elect[^\s\v](?:if(?:null)?[\s\v]\(|top|concat)|ystem[\s\v]\()|\bhaving\b[\s\v]+[0-9]{1,10}|'[^=]{1,10}')" \
|
||
"id:942380,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942390.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942390
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:or\b(?:[\s\v]?(?:[0-9]{1,10}|[\"'][^=]{1,10}[\"'])[\s\v]?[<->]+|[\s\v]+(?:[0-9]{1,10}|'[^=]{1,10}')(?:[\s\v]*?[<->])?)|xor\b[\s\v]+(?:[0-9]{1,10}|'[^=]{1,10}')(?:[\s\v]*?[<->])?)|'[\s\v]+x?or[\s\v]+.{1,20}[!\+\-<->]" \
|
||
"id:942390,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Regular expression generated from regex-assembly/942400.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942400
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\band\b(?:[\s\v]+(?:[0-9]{1,10}[\s\v]*?[<->]|'[^=]{1,10}')| ?(?:[0-9]{1,10}|[\"'][^=]{1,10}[\"']) ?[<->]+)" \
|
||
"id:942400,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
# The former rule id 942410 was split into three new rules: 942410, 942470, 942480
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# Regular expression generated from regex-assembly/942410.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942410
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:a(?:(?:b|co)s|dd(?:dat|tim)e|es_(?:de|en)crypt|s(?:in|cii(?:str)?)|tan2?|vg)|b(?:enchmark|i(?:n(?:_to_num)?|t_(?:and|count|length|x?or)))|c(?:ast|h(?:ar(?:(?:acter)?_length|set)?|r)|iel(?:ing)?|o(?:alesce|ercibility|(?:mpres)?s|n(?:cat(?:_ws)?|nection_id|v(?:ert(?:_tz)?)?)|(?:un)?t)|r32|ur(?:(?:dat|tim)e|rent_(?:date|time(?:stamp)?|user)))|d(?:a(?:t(?:abase|e(?:_(?:add|format|sub)|diff)?)|y(?:name|of(?:month|week|year))?)|count|e(?:code|(?:faul|s_(?:de|en)cryp)t|grees)|ump)|e(?:lt|nc(?:ode|rypt)|x(?:p(?:ort_set)?|tract(?:value)?))|f(?:i(?:eld(?:_in_set)?|nd_in_set)|loor|o(?:rmat|und_rows)|rom_(?:base64|days|unixtime))|g(?:et_(?:format|lock)|r(?:eates|oup_conca)t)|h(?:ex(?:toraw)?|our)|i(?:f(?:null)?|n(?:et6?_(?:aton|ntoa)|s(?:ert|tr)|terval)?|s(?:_(?:(?:free|used)_lock|ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull))|null)?)|l(?:ast(?:_(?:day|insert_id))?|case|e(?:(?:as|f)t|ngth)|n|o(?:ad_file|ca(?:l(?:timestamp)?|te)|g(?:10|2)?|wer)|pad|trim)|m(?:a(?:ke(?:date|_set)|ster_pos_wait|x)|d5|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:d|nth(?:name)?))|n(?:ame_const|o(?:t_in|w)|ullif)|o(?:ct(?:et_length)?|(?:ld_passwo)?rd)|p(?:assword|eriod_(?:add|diff)|g_sleep|i|o(?:sition|w(?:er)?)|rocedure_analyse)|qu(?:arter|ote)|r(?:a(?:dians|nd|wto(?:hex|nhex(?:toraw)?))|e(?:lease_lock|p(?:eat|lace)|verse)|ight|o(?:und|w_count)|pad|trim)|s(?:chema|e(?:c(?:ond|_to_time)|ssion_user)|ha[1-2]?|ig?n|leep|oundex|pace|qrt|t(?:d(?:dev(?:_(?:po|sam)p)?)?|r(?:cmp|_to_date))|u(?:b(?:(?:dat|tim)e|str(?:ing(?:_index)?)?)|m)|ys(?:date|tem_user))|t(?:an|ime(?:diff|_(?:format|to_sec)|stamp(?:add|diff)?)?|o_(?:base64|n?char|(?:day|second)s)|r(?:im|uncate))|u(?:case|n(?:compress(?:ed_length)?|hex|ix_timestamp)|p(?:datexml|per)|ser|tc_(?:date|time(?:stamp)?)|uid(?:_short)?)|v(?:a(?:lues|r(?:iance|_(?:po|sam)p))|ersion)|we(?:ek(?:day|ofyear)?|ight_string)|xmltype|year(?:week)?)[^0-9A-Z_a-z]*?\(" \
|
||
"id:942410,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# The former rule id 942410 was split into three new rules: 942410, 942470, 942480
|
||
#
|
||
# Regular expression generated from regex-assembly/942470.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942470
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)autonomous_transaction|(?:current_use|n?varcha|tbcreato)r|db(?:a_users|ms_java)|open(?:owa_util|query|rowset)|s(?:p_(?:(?:addextendedpro|sqlexe)c|execute(?:sql)?|help|is_srvrolemember|makewebtask|oacreate|p(?:assword|repare)|replwritetovarbin)|ql_(?:longvarchar|variant))|utl_(?:file|http)|xp_(?:availablemedia|(?:cmdshel|servicecontro)l|dirtree|e(?:numdsn|xecresultset)|filelist|loginconfig|makecab|ntsec(?:_enumdomains)?|reg(?:addmultistring|delete(?:key|value)|enum(?:key|value)s|re(?:ad|movemultistring)|write)|terminate(?:_process)?)" \
|
||
"id:942470,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# The former rule id 942410 was split into three new rules: 942410, 942470, 942480
|
||
#
|
||
# Regular expression generated from regex-assembly/942480.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942480
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\b(?:(?:d(?:bms_[0-9A-Z_a-z]+\.|elete\b[^0-9A-Z_a-z]*?\bfrom)|(?:group\b.*?\bby\b.{1,100}?\bhav|overlay\b[^0-9A-Z_a-z]*?\(.*?\b[^0-9A-Z_a-z]*?plac)ing|in(?:ner\b[^0-9A-Z_a-z]*?\bjoin|sert\b[^0-9A-Z_a-z]*?\binto|to\b[^0-9A-Z_a-z]*?\b(?:dump|out)file)|load\b[^0-9A-Z_a-z]*?\bdata\b.*?\binfile|s(?:elect\b.{1,100}?\b(?:(?:.*?\bdump\b.*|(?:count|length)\b.{1,100}?)\bfrom|(?:data_typ|from\b.{1,100}?\bwher)e|instr|to(?:_(?:cha|numbe)r|p\b.{1,100}?\bfrom))|ys_context)|u(?:nion\b.{1,100}?\bselect|tl_inaddr))\b|print\b[^0-9A-Z_a-z]*?@@)|(?:collation[^0-9A-Z_a-z]*?\(a|@@version|;[^0-9A-Z_a-z]*?\b(?:drop|shutdown))\b|'(?:dbo|msdasql|s(?:a|qloledb))'" \
|
||
"id:942480,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Injection Attack',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# [ SQL Injection Character Anomaly Usage ]
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
# This rules attempts to gauge when there is an excessive use of
|
||
# meta-characters within a single parameter payload.
|
||
#
|
||
# Expect a lot of false positives with this rule.
|
||
# The most likely false positive instances will be free-form text fields.
|
||
# This will make it necessary to disable the rule for certain known parameters.
|
||
# The following directive is an example to switch off the rule globally for
|
||
# the parameter foo. Place this instruction in your configuration after
|
||
# the include directive for the Core Rules Set.
|
||
#
|
||
# SecRuleUpdateTargetById 942430 "!ARGS:foo"
|
||
#
|
||
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx ((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){12})" \
|
||
"id:942430,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Restricted SQL Character Anomaly Detection (args): # of special characters exceeded (12)',\
|
||
logdata:'Matched Data: %{TX.1} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ Detect SQL Comment Sequences ]=-
|
||
#
|
||
# Example Payloads Detected:
|
||
# -------------------------
|
||
# OR 1#
|
||
# DROP sampletable;--
|
||
# admin'--
|
||
# DROP/*comment*/sampletable
|
||
# DR/**/OP/*bypass deny listing*/sampletable
|
||
# SELECT/*avoid-spaces*/password/**/FROM/**/Members
|
||
# SELECT /*!32302 1/0, */ 1 FROM tablename
|
||
# ‘ or 1=1#
|
||
# ‘ or 1=1-- -
|
||
# ‘ or 1=1/*
|
||
# ' or 1=1;\x00
|
||
# 1='1' or-- -
|
||
# ' /*!50000or*/1='1
|
||
# ' /*!or*/1='1
|
||
# 0/**/union/*!50000select*/table_name`foo`/**/
|
||
# -------------------------
|
||
#
|
||
# Regular expression generated from regex-assembly/942440.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942440
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx /\*!?|\*/|[';]--|--(?:[\s\v]|[^\-]*?-)|[^&\-]#.*?[\s\v]|;?\x00" \
|
||
"id:942440,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Comment Sequence Detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
chain"
|
||
SecRule MATCHED_VARS "!@rx ^ey[A-Z-a-z0-9-_]+[.]ey[A-Z-a-z0-9-_]+[.][A-Z-a-z0-9-_]+$" "t:none,\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ SQL Hex Evasion Methods ]=-
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i:\b0x[a-f\d]{3,})" \
|
||
"id:942450,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQL Hex Encoding Identified',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ Detect SQLi bypass: backticks ]=-
|
||
#
|
||
# Quotes and backticks can be used to bypass SQLi detection.
|
||
#
|
||
# Example:
|
||
# GET http://localhost/test.php?id=9999%20or+{`if`(2=(select+2+from+wp_users+where+user_login='admin'))}
|
||
#
|
||
# The minimum text between the ticks or backticks must be 2 (if, for example) and a maximum of 29.
|
||
# 29 is a compromise: The lower this number (29), the lower the probability of FP and the higher the probability of false negatives.
|
||
# In tests we got a minimum number of FP with {2,29}.
|
||
#
|
||
# Base64 encoding detection:
|
||
# (?:[A-Za-z0-9+/]{4})+ #match any number of 4-letter blocks of the base64 char set
|
||
# (?:[A-Za-z0-9+/]{2}== #match 2-letter block of the base64 char set followed by "==", together forming a 4-letter block
|
||
# | # or
|
||
# [A-Za-z0-9+/]{3}= #match 3-letter block of the base64 char set followed by "=", together forming a 4-letter block
|
||
# )?
|
||
#
|
||
# The minimal string that triggers this regexp is: `if`
|
||
#
|
||
# The rule 942510 is related to 942110 which catches a single ' or `
|
||
#
|
||
# The rule 942511 is similar to this rule, but triggers on normal quotes
|
||
# ('if'). That rule runs in paranoia level 3 or higher since it is prone to
|
||
# false positives in natural text.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:`(?:(?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)`)" \
|
||
"id:942510,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQLi bypass attempt by ticks or backticks detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# Regular expression generated from regex-assembly/942520.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942520
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)[\"'`][\s\v]*?(?:(?:is[\s\v]+not|not[\s\v]+(?:like|glob|(?:betwee|i)n|null|regexp|match)|mod|div|sounds[\s\v]+like)\b|[%-&\*-\+\-/<->\^\|])" \
|
||
"id:942520,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 4.0/4',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# Complementary rule to PL2 942520 that block and/or-based bypasses.
|
||
# It blocks data with odd number of quotes and then (and|or).
|
||
#
|
||
# The rule uses the expression ^b*a*(b*a*b*a*)* to odd number of a's. It's not
|
||
# vulnerable to ReDos as it executes linearly many steps compared to input size.
|
||
#
|
||
# Regular expression generated from regex-assembly/942521.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942521
|
||
#
|
||
SecRule REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)^(?:[^']*?(?:'[^']*?'[^']*?)*?'|[^\"]*?(?:\"[^\"]*?\"[^\"]*?)*?\"|[^`]*?(?:`[^`]*?`[^`]*?)*?`)[\s\v]*([0-9A-Z_a-z]+)\b" \
|
||
"id:942521,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 4.1/4',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.942521_lhs=%{TX.1}',\
|
||
chain"
|
||
SecRule TX:942521_lhs "@rx ^(?:and|or)$" \
|
||
"t:none,\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
# Complementary rule to PL2 942521 that block escaped quotes followed by (and|or)
|
||
#
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx ^.*?\x5c['\"`](?:.*?['\"`])?\s*(?:and|or)\b" \
|
||
"id:942522,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects basic SQL authentication bypass attempts 4.1/4',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# This is a sibling of rule 942100 that adds checking of the path.
|
||
#
|
||
# REQUEST_BASENAME provides the last url segment (slash excluded).
|
||
# This segment is the most likely to be used for injections. Stripping out
|
||
# the slash permits libinjection to do not consider it as a payload starting
|
||
# with not unary arithmetical operators (not a valid SQL command, e.g.
|
||
# '/9 union all'). The latter would lead to do not detect malicious payloads.
|
||
#
|
||
# REQUEST_FILENAME matches SQLi payloads inside (or across) other segments
|
||
# of the path. Here, libinjection will detect a true positive only if
|
||
# the url leading slash is considered as part of a comment block or part
|
||
# of a string (with a quote or double quote after it). In these circumstances,
|
||
# previous slashes do not affect libinjection result, making it able to detect
|
||
# some SQLi inside the path.
|
||
#
|
||
SecRule REQUEST_BASENAME|REQUEST_FILENAME "@detectSQLi" \
|
||
"id:942101,\
|
||
phase:1,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:utf8toUnicode,t:urlDecodeUni,t:removeNulls,\
|
||
msg:'SQL Injection Attack Detected via libinjection',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# -=[ SQL Function Names ]=-
|
||
#
|
||
# This rule is a stricter sibling of 942151.
|
||
# This rule 942152 checks for the same regex in request headers referer and user-agent.
|
||
#
|
||
# Regular expression generated from regex-assembly/942152.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942152
|
||
#
|
||
SecRule REQUEST_HEADERS:Referer|REQUEST_HEADERS:User-Agent "@rx (?i)\b(?:a(?:dd(?:dat|tim)e|es_(?:de|en)crypt|s(?:cii(?:str)?|in)|tan2?)|b(?:enchmark|i(?:n_to_num|t_(?:and|count|length|x?or)))|c(?:har(?:acter)?_length|iel(?:ing)?|o(?:alesce|ercibility|llation|(?:mpres)?s|n(?:cat(?:_ws)?|nection_id|v(?:ert(?:_tz)?)?)|t)|r32|ur(?:(?:dat|tim)e|rent_(?:date|time(?:stamp)?|user)))|d(?:a(?:t(?:abase|e(?:_(?:add|format|sub)|diff))|y(?:name|of(?:month|week|year)))|count|e(?:code|grees|s_(?:de|en)crypt)|ump)|e(?:lt|n(?:c(?:ode|rypt)|ds_?with)|x(?:p(?:ort_set)?|tract(?:value)?))|f(?:i(?:el|n)d_in_set|ound_rows|rom_(?:base64|days|unixtime))|g(?:e(?:ometrycollection|t_(?:format|lock))|(?:r(?:eates|oup_conca)|tid_subse)t)|hex(?:toraw)?|i(?:fnull|n(?:et6?_(?:aton|ntoa)|s(?:ert|tr)|terval)|s(?:_(?:(?:free|used)_lock|ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull))|null))|json(?:_(?:a(?:gg|rray(?:_(?:elements(?:_text)?|length))?)|build_(?:array|object)|e(?:ac|xtract_pat)h(?:_text)?|object(?:_(?:agg|keys))?|populate_record(?:set)?|strip_nulls|t(?:o_record(?:set)?|ypeof))|b(?:_(?:array(?:_(?:elements(?:_text)?|length))?|build_(?:array|object)|object(?:_(?:agg|keys))?|e(?:ac|xtract_pat)h(?:_text)?|insert|p(?:ath_(?:(?:exists|match)(?:_tz)?|query(?:_(?:(?:array|first)(?:_tz)?|tz))?)|opulate_record(?:set)?|retty)|s(?:et(?:_lax)?|trip_nulls)|t(?:o_record(?:set)?|ypeof)))?|path)?|l(?:ast_(?:day|inser_id)|case|e(?:as|f)t|i(?:kel(?:ihood|y)|nestring)|o(?:ad_file|ca(?:ltimestamp|te)|g(?:10|2)|wer)|pad|trim)|m(?:a(?:ke(?:_set|date)|ster_pos_wait)|d5|i(?:crosecon)?d|onthname|ulti(?:linestring|po(?:int|lygon)))|n(?:ame_const|ot_in|ullif)|o(?:ct(?:et_length)?|(?:ld_passwo)?rd)|p(?:eriod_(?:add|diff)|g_(?:client_encoding|sleep)|o(?:(?:lyg|siti)on|w)|rocedure_analyse)|qu(?:arter|ote)|r(?:a(?:dians|nd|wtohex)|elease_lock|ow_(?:count|to_json)|pad|trim)|s(?:chema|e(?:c_to_time|ssion_user)|ha[1-2]?|in|oundex|pace|q(?:lite_(?:compileoption_(?:get|used)|source_id)|rt)|t(?:arts_?with|d(?:dev_(?:po|sam)p)?|r(?:_to_date|cmp))|ub(?:(?:dat|tim)e|str(?:ing(?:_index)?)?)|ys(?:date|tem_user))|t(?:ime(?:_(?:format|to_sec)|diff|stamp(?:add|diff)?)|o(?:_(?:base64|jsonb?)|n?char|(?:day|second)s)|r(?:im|uncate))|u(?:case|n(?:compress(?:ed_length)?|hex|i(?:str|x_timestamp)|likely)|(?:pdatexm|se_json_nul)l|tc_(?:date|time(?:stamp)?)|uid(?:_short)?)|var(?:_(?:po|sam)p|iance)|we(?:ek(?:day|ofyear)|ight_string)|xmltype|yearweek)[^0-9A-Z_a-z]*\(" \
|
||
"id:942152,\
|
||
phase:1,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,t:lowercase,\
|
||
msg:'SQL Injection Attack: SQL function name detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# This rule is a stricter sibling of 942320.
|
||
# It checks for the same regex in request headers referer and user-agent.
|
||
#
|
||
# Regular expression generated from regex-assembly/942321.ra.
|
||
# To update the regular expression run the following shell script
|
||
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
|
||
# crs-toolchain regex update 942321
|
||
#
|
||
SecRule REQUEST_HEADERS:Referer|REQUEST_HEADERS:User-Agent "@rx (?i)create[\s\v]+(?:function|procedure)[\s\v]*?[0-9A-Z_a-z]+[\s\v]*?\([\s\v]*?\)[\s\v]*?-|d(?:eclare[^0-9A-Z_a-z]+[#@][\s\v]*?[0-9A-Z_a-z]+|iv[\s\v]*?\([\+\-]*[\s\v\.0-9]+,[\+\-]*[\s\v\.0-9]+\))|exec[\s\v]*?\([\s\v]*?@|(?:lo_(?:impor|ge)t|procedure[\s\v]+analyse)[\s\v]*?\(|;[\s\v]*?(?:declare|open)[\s\v]+[\-0-9A-Z_a-z]+|::(?:b(?:igint|ool)|double[\s\v]+precision|int(?:eger)?|numeric|oid|real|(?:tex|smallin)t)" \
|
||
"id:942321,\
|
||
phase:1,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects MySQL and PostgreSQL stored procedure/function injections',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'paranoia-level/2',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:942015,phase:1,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 3" "id:942016,phase:2,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
#
|
||
# -= Paranoia Level 3 =- (apply only when tx.detection_paranoia_level is sufficiently high: 3 or higher)
|
||
#
|
||
|
||
|
||
#
|
||
# [ SQL HAVING queries ]
|
||
#
|
||
# This pattern was split off from rule 942250 due to frequent
|
||
# false positives in English text. Testing showed that SQL
|
||
# injections with HAVING should be detected by libinjection
|
||
# (rule 942100).
|
||
#
|
||
# This is a stricter sibling of rule 942250.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?i)\W+\d*?\s*?\bhaving\b\s*?[^\s\-]" \
|
||
"id:942251,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects HAVING injections',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
||
|
||
# This rule is a stricter sibling of 942330. See that rule for a
|
||
# description and overview.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx [\"'`][\s\d]*?[^\w\s]\W*?\d\W*?.*?[\"'`\d]" \
|
||
"id:942490,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Detects classic SQL injection probings 3/3',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
||
|
||
#
|
||
# [ SQL Injection Character Anomaly Usage ]
|
||
#
|
||
# This rule attempts to gauge when there is an excessive use of
|
||
# meta-characters within a single parameter payload.
|
||
#
|
||
# It is similar to 942430, but focuses on Cookies instead of
|
||
# GET/POST parameters.
|
||
#
|
||
# Expect a lot of false positives with this rule.
|
||
# The most likely false positive instances will be complex session ids.
|
||
# This will make it necessary to disable the rule for certain known cookies.
|
||
# The following directive is an example to switch off the rule globally for
|
||
# the cookie foo_id. Place this instruction in your configuration after
|
||
# the include directive for the Core Rules Set.
|
||
#
|
||
# SecRuleUpdateTargetById 942420 "!REQUEST_COOKIES:foo_id"
|
||
#
|
||
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES "@rx ((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){8})" \
|
||
"id:942420,\
|
||
phase:1,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Restricted SQL Character Anomaly Detection (cookies): # of special characters exceeded (8)',\
|
||
logdata:'Matched Data: %{TX.1} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# This is a stricter sibling of rule 942430.
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx ((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){6})" \
|
||
"id:942431,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Restricted SQL Character Anomaly Detection (args): # of special characters exceeded (6)',\
|
||
logdata:'Matched Data: %{TX.1} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# [ Repetitive Non-Word Characters ]
|
||
#
|
||
# This rule attempts to identify when multiple (4 or more) non-word characters
|
||
# are repeated in sequence.
|
||
#
|
||
# The pattern may occur in some normal texts, e.g. "foo...." will match.
|
||
#
|
||
SecRule ARGS "@rx \W{4}" \
|
||
"id:942460,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Meta-Character Anomaly Detection Alert - Repetitive Non-Word Characters',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -=[ Detect SQLi bypass: quotes ]=-
|
||
#
|
||
# Quotes and backticks can be used to bypass SQLi detection.
|
||
#
|
||
# Example:
|
||
# GET http://localhost/test.php?id=9999%20or+{`if`(2=(select+2+from+wp_users+where+user_login='admin'))}
|
||
#
|
||
# The minimum text between the ticks or backticks must be 2 (if, for example) and a maximum of 29.
|
||
# 29 is a compromise: The lower this number (29), the lower the probability of FP and the higher the probability of false negatives.
|
||
# In tests we got a minimum number of FP with {2,29}.
|
||
#
|
||
# Base64 encoding detection:
|
||
# (?:[A-Za-z0-9+/]{4})+ #match any number of 4-letter blocks of the base64 char set
|
||
# (?:[A-Za-z0-9+/]{2}== #match 2-letter block of the base64 char set followed by "==", together forming a 4-letter block
|
||
# | # or
|
||
# [A-Za-z0-9+/]{3}= #match 3-letter block of the base64 char set followed by "=", together forming a 4-letter block
|
||
# )?
|
||
#
|
||
# The minimal string that triggers this regexp is: 'if'
|
||
#
|
||
# The rule 942511 is related to 942110 which catches a single ' or `
|
||
#
|
||
# The rule 942510 is similar to this rule, but triggers on backticks
|
||
# (`if`). That rule runs in paranoia level 2 or higher since the risk of
|
||
# false positives in natural text is still present but lower than this
|
||
# rule.
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:'(?:(?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)')" \
|
||
"id:942511,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQLi bypass attempt by ticks detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
||
|
||
# Detects ';
|
||
# ' Single quote. Used to delineate a query with an unmatched quote.
|
||
# ; Terminate a query. A prematurely terminated query creates an error.
|
||
# Explanation source:
|
||
# https://hwang.cisdept.cpp.edu/swanew/Text/SQL-Injection.htm
|
||
#
|
||
# Bug Bounty example: email=admin@juice-sh.op';&password=foo
|
||
#
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ';" \
|
||
"id:942530,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'SQLi query termination detected',\
|
||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/3',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'CRITICAL',\
|
||
setvar:'tx.sql_injection_score=+%{tx.critical_anomaly_score}',\
|
||
setvar:'tx.inbound_anomaly_score_pl3=+%{tx.critical_anomaly_score}'"
|
||
|
||
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:942017,phase:1,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
SecRule TX:DETECTION_PARANOIA_LEVEL "@lt 4" "id:942018,phase:2,pass,nolog,skipAfter:END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|
||
#
|
||
# -= Paranoia Level 4 =- (apply only when tx.detection_paranoia_level is sufficiently high: 4 or higher)
|
||
#
|
||
|
||
#
|
||
# [ SQL Injection Character Anomaly Usage ]
|
||
#
|
||
# This is a stricter sibling of rule 942420.
|
||
#
|
||
|
||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|!REQUEST_COOKIES:/_pk_ref/|REQUEST_COOKIES_NAMES "@rx ((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){3})" \
|
||
"id:942421,\
|
||
phase:1,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Restricted SQL Character Anomaly Detection (cookies): # of special characters exceeded (3)',\
|
||
logdata:'Matched Data: %{TX.1} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/4',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.inbound_anomaly_score_pl4=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# This is a stricter sibling of rule 942430.
|
||
#
|
||
# This rule is also triggered by the following exploit(s):
|
||
# [ SAP CRM Java vulnerability CVE-2018-2380 - Exploit tested: https://www.exploit-db.com/exploits/44292 ]
|
||
#
|
||
|
||
SecRule ARGS_NAMES|ARGS|XML:/* "@rx ((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){2})" \
|
||
"id:942432,\
|
||
phase:2,\
|
||
block,\
|
||
capture,\
|
||
t:none,t:urlDecodeUni,\
|
||
msg:'Restricted SQL Character Anomaly Detection (args): # of special characters exceeded (2)',\
|
||
logdata:'Matched Data: %{TX.1} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\
|
||
tag:'application-multi',\
|
||
tag:'language-multi',\
|
||
tag:'platform-multi',\
|
||
tag:'attack-sqli',\
|
||
tag:'OWASP_CRS',\
|
||
tag:'capec/1000/152/248/66',\
|
||
tag:'PCI/6.5.2',\
|
||
tag:'paranoia-level/4',\
|
||
ver:'OWASP_CRS/4.0.0-rc1',\
|
||
severity:'WARNING',\
|
||
setvar:'tx.inbound_anomaly_score_pl4=+%{tx.warning_anomaly_score}',\
|
||
setvar:'tx.sql_injection_score=+%{tx.warning_anomaly_score}'"
|
||
|
||
|
||
#
|
||
# -= Paranoia Levels Finished =-
|
||
#
|
||
SecMarker "END-REQUEST-942-APPLICATION-ATTACK-SQLI"
|