mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +03:00
245 lines
6.4 KiB
JSON
245 lines
6.4 KiB
JSON
[
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser 1/2",
|
|
"expected":{
|
|
"debug_log": "Target value: \"bar\" \\(Variable: ARGS:json.foo\\)"
|
|
},
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Accept":"*/*",
|
|
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
|
"Content-Type": "application/json"
|
|
},
|
|
"uri":"/?key=value&key=other_value",
|
|
"method":"POST",
|
|
"body": [
|
|
"{",
|
|
" \"foo\":\"bar\",",
|
|
" \"mod\":\"sec\"",
|
|
"}"
|
|
]
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyAccess On",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule ARGS:json.foo \"bar\" \"id:'200441',phase:3,log\""
|
|
]
|
|
},
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser 2/2",
|
|
"expected":{
|
|
"debug_log": "Target value: \"bar\" \\(Variable: ARGS:json.first_level.first_key\\)"
|
|
},
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Accept":"*/*",
|
|
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
|
"Content-Type": "application/json"
|
|
},
|
|
"uri":"/?key=value&key=other_value",
|
|
"method":"POST",
|
|
"body": [
|
|
"{",
|
|
"\"first_level\":",
|
|
"{",
|
|
" \"first_key\":\"bar\",",
|
|
" \"second_key\":\"sec\"",
|
|
"}",
|
|
"}"
|
|
]
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyAccess On",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule ARGS \"bar\" \"id:'200441',phase:3,log\""
|
|
]
|
|
},
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser - issue #1822 (1/2)",
|
|
"expected":{
|
|
"debug_log": "Target value: \"0\" .Variable: REQBODY_ERROR."
|
|
},
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Accept":"*/*",
|
|
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
|
"Content-Type": "application/json"
|
|
},
|
|
"uri":"/?key=value&key=other_value",
|
|
"method":"POST",
|
|
"body": [
|
|
]
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyAccess On",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule REQBODY_ERROR \"0\" \"id:'200441',phase:3,log\""
|
|
]
|
|
},
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser - issue #1822 (2/2)",
|
|
"expected":{
|
|
"debug_log": "Target value: \"1\" .Variable: REQBODY_ERROR."
|
|
},
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Accept":"*/*",
|
|
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
|
"Content-Type": "application/json"
|
|
},
|
|
"uri":"/?key=value&key=other_value",
|
|
"method":"POST",
|
|
"body": [
|
|
"a"
|
|
]
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyAccess On",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule REQBODY_ERROR \"0\" \"id:'200441',phase:3,log\""
|
|
]
|
|
},
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser - depth not over limit",
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Content-Type":"application/json"
|
|
},
|
|
"uri":"/?foo=bar",
|
|
"method":"POST",
|
|
"body": [
|
|
"{",
|
|
" \"key1\":",
|
|
"{",
|
|
" \"key2\":",
|
|
"{",
|
|
" \"key3\":",
|
|
"{",
|
|
" \"key4\":",
|
|
"{",
|
|
" \"key5\":\"thevalue\"",
|
|
"}}}}}"
|
|
]
|
|
},
|
|
"expected":{
|
|
"debug_log": "json.key1.key2.key3.key4.key5",
|
|
"http_code":200
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyJsonDepthLimit 5",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule REQBODY_ERROR \"!@eq 0\" \"id:'200002', phase:2,t:none,log,deny,status:403,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}'\""
|
|
]
|
|
},
|
|
{
|
|
"enabled":1,
|
|
"version_min":300000,
|
|
"title":"Testing JSON request body parser - depth over limit",
|
|
"client":{
|
|
"ip":"200.249.12.31",
|
|
"port":123
|
|
},
|
|
"server":{
|
|
"ip":"200.249.12.31",
|
|
"port":80
|
|
},
|
|
"request":{
|
|
"headers":{
|
|
"Host":"localhost",
|
|
"User-Agent":"curl/7.38.0",
|
|
"Content-Type":"application/json"
|
|
},
|
|
"uri":"/?foo=bar",
|
|
"method":"POST",
|
|
"body": [
|
|
"{",
|
|
" \"key1\":",
|
|
"{",
|
|
" \"key2\":",
|
|
"{",
|
|
" \"key3\":",
|
|
"{",
|
|
" \"key4\":",
|
|
"{",
|
|
" \"key5\":\"thevalue\"",
|
|
"}}}}}"
|
|
]
|
|
},
|
|
"expected":{
|
|
"debug_log": "Failed to parse request body",
|
|
"http_code":403
|
|
},
|
|
"rules":[
|
|
"SecRuleEngine On",
|
|
"SecRequestBodyJsonDepthLimit 4",
|
|
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
|
"SecRule REQBODY_ERROR \"!@eq 0\" \"id:'200002', phase:2,t:none,log,deny,status:403,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}'\""
|
|
]
|
|
}
|
|
]
|