Skip to content

Instantly share code, notes, and snippets.

@airween
Created April 27, 2020 21:40
Show Gist options
  • Save airween/6c9241ee80a0ba5c41f9bfffaf87cf84 to your computer and use it in GitHub Desktop.
Save airween/6c9241ee80a0ba5c41f9bfffaf87cf84 to your computer and use it in GitHub Desktop.
ModSecurity regression test for CRS rul 920420
[
{
"enabled":1,
"version_min":300000,
"title":"OWASP CRS id:920420",
"client":{
"ip":"200.249.12.31",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"User-Agent": "ModSecurity CRS 3 Tests",
"Host": "localhost",
"Content-Type": "application/soap+xml"
},
"uri":"/",
"method":"OPTIONS"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"http_code":200
},
"rules":[
"SecRuleEngine On",
"SecRule &TX:allowed_request_content_type \"@eq 0\" \"id:901162,phase:1,pass,setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|multipart/related|text/xml|application/xml|application/soap\\+xml|application/x-amf|application/json|application/octet-stream|application/csp-report|application/xss-auditor-report|text/plain'\"",
"SecRule REQUEST_HEADERS:Content-Type \"@rx ^[^;\\s]+\" \"id:920420,phase:2,block,deny,capture,t:none,chain\"",
"SecRule TX:0 \"!@rx ^%{tx.allowed_request_content_type}$\" \"t:none,ctl:forceRequestBodyVariable=On,setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'\""
]
},
{
"enabled":1,
"version_min":300000,
"title":"OWASP CRS id:920420",
"client":{
"ip":"200.249.12.31",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"User-Agent": "ModSecurity CRS 3 Tests",
"Host": "localhost",
"Content-Type": "application"
},
"uri":"/",
"method":"OPTIONS"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"http_code":403
},
"rules":[
"SecRuleEngine On",
"SecRule &TX:allowed_request_content_type \"@eq 0\" \"id:901162,phase:1,pass,setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|multipart/related|text/xml|application/xml|application/soap\\+xml|application/x-amf|application/json|application/octet-stream|application/csp-report|application/xss-auditor-report|text/plain'\"",
"SecRule REQUEST_HEADERS:Content-Type \"@rx ^[^;\\s]+\" \"id:920420,phase:2,block,deny,capture,t:none,chain\"",
"SecRule TX:0 \"!@rx ^%{tx.allowed_request_content_type}$\" \"t:none,ctl:forceRequestBodyVariable=On,setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'\""
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment