# all.conf # Check Content-Length and reject all non numeric ones SecRule REQUEST_HEADERS:Content-Length "!^\d+$" \ "deny,log,auditlog,severity:'2',id:'96029',status:406\ msg:'Content-Length HTTP header is not numeric'" # Do not accept GET or HEAD requests with bodies SecRule REQUEST_METHOD "^(?:GET|HEAD)$" \ "chain,phase:2,t:none,deny,log,auditlog,status:406,severity:'2',\ id:'96024',msg:'GET or HEAD requests with bodies',\ tag:'PROTOCOL_VIOLATION/EVASION'" SecRule REQUEST_HEADERS:Content-Length "!^0?$" t:none # Require Content-Length to be provided with every POST request. SecRule REQUEST_METHOD "^POST$" \ "chain,phase:2,t:none,deny,log,auditlog,status:406,id:'96025',\ msg:'POST request must have a Content-Length header',\ tag:'PROTOCOL_VIOLATION/EVASION',severity:'4'" SecRule &REQUEST_HEADERS:Content-Length "@eq 0" t:none # Don't accept transfer encodings we know we don't know how to handle SecRule REQUEST_HEADERS:Transfer-Encoding "!^$" \ "phase:2,t:none,deny,log,auditlog,status:406,id:'96026',severity:'3',\ msg:'ModSecurity does not support transfer encodings',\ tag:'PROTOCOL_VIOLATION/EVASION'" # Proxy access attempt SecRule REQUEST_URI_RAW ^\w+:/ \ "phase:2,t:none,deny,log,auditlog,status:406,severity:'2',id:'96027',\ msg:'Proxy access attempt',\ tag:'PROTOCOL_VIOLATION/PROXY_ACCESS'" # Restrict type of characters sent SecRule REQUEST_FILENAME|REQUEST_HEADERS_NAMES|REQUEST_HEADERS|!REQUEST_HEADERS:Referer \ "@validateByteRange 1-255" \ "log,auditlog,deny,status:406,severity:'2',id:'96028',t:urlDecodeUni,phase:1,\ msg:'Request Missing an Accept Header'" # Restricted HTTP headers SecRule REQUEST_HEADERS_NAMES "\.(?:Lock-Token|Translate|If)$" \ "deny,log,status:406,auditlog,id:'96030',severity:'4',\ msg:'HTTP header is restricted by policy'" SecRule HTTP_User-Agent \ "(?:\b(?:m(?:ozilla\/4\.0 \(compatible\)|etis)|webtrends security analyzer|pmafind)\b|n(?:-stealth|sauditor|essus|ikto)|b(?:lack ?widow|rutus|ilbo)|(?:jaascoi|paro)s|internet explorer|webinspect|\.nasl)" \ "deny,status:406,log,auditlog,id:'96031',severity:'2',\ msg:'Request Indicates a Security Scanner Scanned the Site'" SecRule REQUEST_HEADERS_NAMES "\bacunetix-product\b" \ "deny,status:406,log,auditlog,id:'96034',severity:'2',\ msg:'Request Indicates a Security Scanner Scanned the Site'" SecRule REQUEST_FILENAME "^/nessustest" \ "deny,status:406,log,auditlog,id:'96035',severity:'2',\ msg:'Request Indicates a Security Scanner Scanned the Site'" SecRule REQUEST_HEADERS:User-Agent \ "(?:m(?:ozilla\/(?:4\.0 \(compatible; advanced email extractor|2\.0 \(compatible; newt activex; win32\))|ailto:craftbot\@yahoo\.com)|e(?:mail(?:(?:collec|harves|magne)t|(?: extracto|reape)r|siphon|wolf)|(?:collecto|irgrabbe)r|xtractorpro|o browse)|a(?:t(?:tache|hens)|utoemailspider|dsarobot)|w(?:eb(?:emailextrac| by mail)|3mir)|f(?:astlwspider|loodgate)|p(?:cbrowser|ackrat|surf)|(?:digout4uagen|takeou)t|(?:chinacla|be)w|hhjhj@yahoo|rsync|shai|zeus)" \ "deny,status:406,log,auditlog,id:'96033',severity:'2',\ msg:'Rogue web site crawler'" # Session fixation SecRule REQUEST_FILENAME|REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer \ "@pm set-cookie .cookie" \ "phase:2,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:compressWhiteSpace,\ t:lowercase,pass,nolog,skip:1,id:15000" SecAction phase:2,pass,nolog,skipAfter:96017,id:15001 SecRule REQUEST_FILENAME "(?:\.cookie\b.*?;\W*?(?:expires|domain)\W*?=|\bhttp-equiv\W+set-cookie\b)" \ "phase:2,t:none,t:htmlEntityDecode,t:compressWhiteSpace,t:lowercase,\ capture,ctl:auditLogParts=+E,log,auditlog,logdata:'%{TX.0}',severity:'2',\ msg:'Session Fixation',id:'96007',\ tag:'WEB_ATTACK/SESSION_FIXATION'" SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer "(?:\.cookie\b.*?;\W*?(?:expires|domain)\W*?=|\bhttp-equiv\W+set-cookie\b)" \ "phase:2,t:none,t:urlDecodeUni,t:htmlEntityDecode,severity:'2',id:'96017',\ t:compressWhiteSpace,t:lowercase,capture,ctl:auditLogParts=+E,log,auditlog,\ msg:'Session Fixation',\ tag:'WEB_ATTACK/SESSION_FIXATION',logdata:'%{TX.0}'" # Blind SQL injection SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer \ "@pm sys.user_triggers sys.user_objects @@spid msysaces instr \ sys.user_views sys.tab charindex sys.user_catalog constraint_type \ locate select msysobjects attnotnull sys.user_tables sys.user_tab_columns \ sys.user_constraints waitfor mysql.user sys.all_tables \ msysrelationships msyscolumns msysqueries" \ "phase:2,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,\ t:replaceComments,t:compressWhiteSpace,pass,nolog,skip:1,id:15002" SecAction phase:2,pass,nolog,skipAfter:96016,id:15003 SecRule REQUEST_HEADERS|!REQUEST_HEADERS:Referer \ "(?:\b(?:(?:s(?:ys\.(?:user_(?:(?:t(?:ab(?:_column|le)|rigger)|object|view)s|c(?:onstraints|atalog))|all_tables|tab)|elect\b.{0,40}\b(?:substring|ascii|user))|m(?:sys(?:(?:queri|ac)e|relationship|column|object)s|ysql.user)|c(?:onstraint_type|harindex)|attnotnull)\b|(?:locate|instr)\W+\()|\@\@spid\b)" \ "phase:2,capture,t:none,t:htmlEntityDecode,t:lowercase,t:replaceComments,\ t:compressWhiteSpace,ctl:auditLogParts=+E,log,auditlog,id:'96006',\ logdata:'%{TX.0}',severity:'2',\ msg:'Blind SQL Injection Attack',\ tag:'WEB_ATTACK/SQL_INJECTION'" SecRule REQUEST_HEADERS|!REQUEST_HEADERS:Referer \ "\b(?:(?:s(?:ys(?:(?:(?:process|tabl)e|filegroup|object)s|c(?:o(?:nstraint|lumn)s|at)|dba|ibm)|ubstr(?:ing)?)|user_(?:(?:(?:constrain|objec)t|tab(?:_column|le)|ind_column|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id)|pg_(?:attribute|class)|column_(?:name|id)|(?:dba|mb)_users|xtype\W+\bchar|rownum)\b|t(?:able_name\b|extpos\W+\())" \ "phase:2,capture,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,\ id:'96016',t:replaceComments,t:compressWhiteSpace,ctl:auditLogParts=+E,\ log,auditlog,logdata:'%{TX.0}',severity:'2',\ msg:'Blind SQL Injection Attack',\ tag:'WEB_ATTACK/SQL_INJECTION'" SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer \ "@pm substr xtype textpos all_objects rownum sysfilegroups sysprocesses \ user_group sysobjects user_tables systables pg_attribute user_users \ user_password column_id attrelid user_tab_columns table_name pg_class \ user_constraints user_objects object_type dba_users sysconstraints \ mb_users column_name atttypid object_id substring syscat user_ind_columns \ sysibm syscolumns sysdba object_name" \ "phase:2,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:replaceComments,\ t:compressWhiteSpace,t:lowercase,pass,nolog,skip:1,id:15004" SecAction phase:2,pass,nolog,id:15005 SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer \ "\b(?:(?:s(?:ys(?:(?:(?:process|tabl)e|filegroup|object)s|c(?:o(?:nstraint|lumn)s|at)|dba|ibm)|ubstr(?:ing)?)|user_(?:(?:(?:constrain|objec)t|tab(?:_column|le)|ind_column|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id)|pg_(?:attribute|class)|column_(?:name|id)|(?:dba|mb)_users|xtype\W+\bchar|rownum)\b|t(?:able_name\b|extpos\W+\())" \ "phase:2,capture,t:none,t:urlDecodeUni,t:htmlEntityDecode,\ t:replaceComments,t:compressWhiteSpace,t:lowercase,ctl:auditLogParts=+E,\ log,auditlog,id:'96020',logdata:'%{TX.0}',severity:'2',\ msg:'Blind SQL Injection Attack',\ tag:'WEB_ATTACK/SQL_INJECTION'" # XSS SecRule REQUEST_FILENAME|REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer \ "@pm jscript onsubmit copyparentfolder javascript meta onmove onkeydown \ onchange onkeyup activexobject expression onmouseup ecmascript onmouseover \ vbscript: