# ARTEX rules for ModSecurity / Coraza (CRS-compatible ID range 1009000-1009099) # ARTEX Hunting Pack - Sujay Adkesar - https://thelocalh0st.com - MIT licence # # Load after the OWASP Core Rule Set. CRS already covers SQL injection, traversal and most # exploit payloads; these rules add what is specific to ARTEX traffic. # Run with SecRuleEngine DetectionOnly for a few days first. # The counters in section 3 need persistent collections (ModSecurity 2.9, or libmodsecurity 3 # built with LMDB). Coraza and plain libmodsecurity 3 should use the nginx/HAProxy limits instead. # --- 1. strings from the ARTEX code and from published intrusions SecRule REQUEST_HEADERS:User-Agent "@rx (?i)artex-enrich/|spa-api-recon|artex-selfupdate|^norma/\d|reconprobe/|artexverify|\(artex\)|(?:probe|pentest|artx|artex)[-_]?i\d{3,6}" \ "id:1009001,phase:1,deny,status:403,log,auditlog,t:none,\ msg:'ARTEX user agent',logdata:'%{MATCHED_VAR}',tag:'artex/L1',severity:'CRITICAL'" SecRule REQUEST_URI "@rx (?i)^/zz|/artex-|zzartx|/artx_s\d+\.php|artx-nonexist|_probe_missing|^/nr\?zz|[?&]k=x9f3c2b7e" \ "id:1009002,phase:1,deny,status:403,log,auditlog,t:none,t:urlDecodeUni,\ msg:'ARTEX probe path, canary or webshell',logdata:'%{MATCHED_VAR}',tag:'artex/L1',severity:'CRITICAL'" SecRule ARGS|REQUEST_HEADERS:Authorization "@rx eyJhbGciOiJub25lI|eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lI|^notvalid" \ "id:1009003,phase:2,deny,status:403,log,auditlog,t:none,\ msg:'Unsigned JWT or forged OAuth state',logdata:'%{MATCHED_VAR_NAME}',tag:'artex/L2',severity:'CRITICAL'" SecRule ARGS "@rx (?i)169\.254\.169\.254|169\.254\.170\.2|metadata\.google\.internal|dnslog\.cn|\.oast\.(?:me|fun|pro|site|online|live)|webhook\.site|interact\.sh" \ "id:1009004,phase:2,deny,status:403,log,auditlog,t:none,t:urlDecodeUni,\ msg:'Metadata SSRF or out-of-band callback in parameter',logdata:'%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',tag:'artex/L2',severity:'CRITICAL'" # --- 2. self-declared testers and hand-written browser strings (log only) SecRule REQUEST_HEADERS:User-Agent "@rx (?i)pentest|authori[sz]ed[- ]|\(authori[sz]ed|read-?only|security-research|bounty" \ "id:1009010,phase:1,pass,log,t:none,setvar:tx.artex_label=1,\ msg:'Self-declared tester user agent',logdata:'%{MATCHED_VAR}',tag:'artex/L1',severity:'WARNING'" SecRule REQUEST_HEADERS:User-Agent "@rx ^Mozilla/5\.0$|Chrome/\d+(?:\.\d+){0,2}$|^Mozilla/5\.0 \((?:Windows NT|Macintosh|X11|Linux)[^)]*\)(?!.*(?:AppleWebKit|Gecko))" \ "id:1009011,phase:1,pass,log,t:none,\ msg:'Truncated or hand-written browser user agent',logdata:'%{MATCHED_VAR}',tag:'artex/L2',severity:'NOTICE'" # --- 3. per-client counters (needs persistent collections, see header) SecAction "id:1009020,phase:1,pass,nolog,initcol:ip=%{REMOTE_ADDR}" # 40+ refused responses in 5 minutes: a fuzzing round SecRule RESPONSE_STATUS "@rx ^40[1345]$" \ "id:1009021,phase:3,pass,nolog,setvar:ip.artex_refused=+1,expirevar:ip.artex_refused=300" SecRule IP:ARTEX_REFUSED "@gt 40" \ "id:1009022,phase:1,deny,status:429,log,\ msg:'ARTEX-style fuzzing: more than 40 refused requests in 5 minutes',tag:'artex/L2',severity:'ERROR'" # 20+ auth-endpoint requests in a minute SecRule REQUEST_FILENAME "@rx (?i)/(?:login|signin|sign_in|sso|oauth|saml|token|register|signup|forgot_password|password)" \ "id:1009023,phase:1,pass,nolog,setvar:ip.artex_auth=+1,expirevar:ip.artex_auth=60" SecRule IP:ARTEX_AUTH "@gt 20" \ "id:1009024,phase:1,deny,status:429,log,\ msg:'Auth endpoint burst',tag:'artex/L2',severity:'ERROR'" # a client that sends X-Forwarded-For straight to the origin is choosing its own address SecRule &REQUEST_HEADERS:X-Forwarded-For "@gt 0" \ "id:1009030,phase:1,pass,log,chain,msg:'Client-supplied X-Forwarded-For at the origin',tag:'artex/L2',severity:'NOTICE'" SecRule REMOTE_ADDR "!@ipMatch 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16" "t:none"