Skip to content

Commit 4b3e632

Browse files
airweenzimmerle
authored andcommitted
Fixed validateByteRange parsing method
1 parent 3dda0ea commit 4b3e632

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

src/operators/validate_byte_range.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ bool ValidateByteRange::init(const std::string &file,
101101
getRange(std::string(m_param, pos + 1, m_param.length() -
102102
(pos + 1)), error);
103103
} else {
104-
getRange(std::string(m_param, pos + 1, next_pos), error);
104+
getRange(std::string(m_param, pos + 1, next_pos - (pos + 1)), error);
105105
}
106106
pos = next_pos;
107107
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"enabled":1,
4+
"version_min":300000,
5+
"title":"Testing Byte ranges :: OWASP CRS id:920274",
6+
"client":{
7+
"ip":"200.249.12.31",
8+
"port":123
9+
},
10+
"server":{
11+
"ip":"200.249.12.31",
12+
"port":80
13+
},
14+
"request":{
15+
"headers":{
16+
"Host":"localhost",
17+
"Test": "ThisIsATest%60"
18+
},
19+
"uri":"/",
20+
"method":"GET"
21+
},
22+
"response":{
23+
"headers":{
24+
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
25+
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
26+
"Content-Type":"text/html"
27+
},
28+
"body":[
29+
"no need."
30+
]
31+
},
32+
"expected":{
33+
"http_code":400,
34+
"debug_log":"Invalid character in request headers"
35+
},
36+
"rules":[
37+
"SecRuleEngine On",
38+
"SecDefaultAction \"phase:2,deny,block,status:400,log\"",
39+
"SecRule REQUEST_HEADERS|!REQUEST_HEADERS:User-Agent|!REQUEST_HEADERS:Referer|!REQUEST_HEADERS:Cookie \"@validateByteRange 32,34,38,42-59,61,65-90,95,97-122\" \"id:920274,phase:2,block,t:none,t:urlDecodeUni,msg:'Invalid character in request headers (outside of very strict set)',logdata:'%{MATCHED_VAR_NAME}=%{MATCHED_VAR}',tag:'application-multi',tag:'language-multi',tag:'platform-multi',tag:'attack-protocol',tag:'OWASP_CRS/PROTOCOL_VIOLATION/EVASION',tag:'paranoia-level/4',ver:'OWASP_CRS/3.1.0',severity:'CRITICAL',setvar:'tx.msg=%{rule.msg}',setvar:'tx.anomaly_score_pl4=+%{tx.critical_anomaly_score}',setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/EVASION-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'\""
40+
]
41+
}
42+
]
43+

0 commit comments

Comments
 (0)