-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adds missing check for runtime ctl:ruleRemoveByTag (Issue #2099) #2102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
[ | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveById - issue 2099", | ||
"expected":{ | ||
"http_code":200 | ||
}, | ||
"client":{ | ||
"ip":"200.249.12.31", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/remote.php/webdav?bar=foo", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_FILENAME \"@contains /remote.php/webdav\" \"id:9003100,phase:2,pass,t:none,nolog,ctl:ruleRemoveByTag=attack-injection-php,ctl:ruleRemoveById=941000-942999,ctl:ruleRemoveById=951000-951999,ctl:ruleRemoveById=953100-953130,ctl:ruleRemoveById=920420,ctl:ruleRemoveById=920440\"", | ||
"SecRule ARGS \"@contains foo\" \"id:951001,phase:2,t:none,drop\"" | ||
] | ||
}, | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveById against - issue 2099", | ||
"expected":{ | ||
"http_code":403 | ||
}, | ||
"client":{ | ||
"ip":"200.249.12.31", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/remote.php?bar=foo", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_FILENAME \"@contains /remote.php/webdav\" \"id:9003100,phase:2,pass,t:none,nolog,ctl:ruleRemoveByTag=attack-injection-php,ctl:ruleRemoveById=941000-942999,ctl:ruleRemoveById=951000-951999,ctl:ruleRemoveById=953100-953130,ctl:ruleRemoveById=920420,ctl:ruleRemoveById=920440\"", | ||
"SecRule ARGS \"@contains foo\" \"id:951001,phase:2,t:none,drop\"" | ||
] | ||
}, | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveByTag - issue 2099", | ||
"expected":{ | ||
"http_code":200 | ||
}, | ||
"client":{ | ||
"ip":"200.249.12.31", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/remote.php/webdav?bar=foo", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_FILENAME \"@contains /remote.php/webdav\" \"id:1000001,phase:2,pass,t:none,nolog,ctl:ruleRemoveByTag=attack-injection-php,ctl:ruleRemoveById=1100000-2100000,ctl:ruleRemoveById=9990000\"", | ||
"SecRule ARGS \"@contains foo\" \"id:4400000,tag:'attack-injection-php',phase:2,t:none,msg:'test rule',drop\"" | ||
] | ||
}, | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveByTag against - issue 2099", | ||
"expected":{ | ||
"http_code":403 | ||
}, | ||
"client":{ | ||
"ip":"200.249.12.31", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/remote.php?bar=foo", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_FILENAME \"@contains /remote.php/webdav\" \"id:1000001,phase:2,pass,t:none,nolog,ctl:ruleRemoveByTag=attack-injection-php,ctl:ruleRemoveById=1100000-2100000,ctl:ruleRemoveById=9990000\"", | ||
"SecRule ARGS \"@contains foo\" \"id:4400000,tag:'attack-injection-php',phase:2,t:none,msg:'test rule',drop\"" | ||
] | ||
}, | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveTargetByTag - issue 2099", | ||
"expected":{ | ||
"http_code":200 | ||
}, | ||
"client":{ | ||
"ip":"1.2.3.4", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/test.php?a=a", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_URI \"@contains /test.php\" \"id:100,phase:1,nolog,pass,ctl:ruleRemoveTargetByTag=attack-injection-php;ARGS:a,ctl:ruleRemoveTargetByTag=attack-rce;ARGS:a\"", | ||
"SecRule ARGS \"@contains a\" \"id:4400000,tag:'attack-injection-php',phase:2,t:none,msg:'test rule',drop\"" | ||
] | ||
}, | ||
{ | ||
"enabled":1, | ||
"version_min":300000, | ||
"title":"Testing ctl:ruleRemoveTargetByTag against - issue 2099", | ||
"expected":{ | ||
"http_code":403 | ||
}, | ||
"client":{ | ||
"ip":"1.2.3.4", | ||
"port":123 | ||
}, | ||
"request":{ | ||
"headers":{ | ||
"Host":"localhost", | ||
"User-Agent":"curl/7.38.0", | ||
"Accept":"*/*" | ||
}, | ||
"uri":"/index.php?a=a", | ||
"method":"GET", | ||
"body": "" | ||
}, | ||
"server":{ | ||
"ip":"200.249.12.31", | ||
"port":80 | ||
}, | ||
"rules":[ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecRule REQUEST_URI \"@contains /test.php\" \"id:100,phase:1,nolog,pass,ctl:ruleRemoveTargetByTag=attack-injection-php;ARGS:a,ctl:ruleRemoveTargetByTag=attack-rce;ARGS:a\"", | ||
"SecRule ARGS \"@contains a\" \"id:4400000,tag:'attack-injection-php',phase:2,t:none,msg:'test rule',drop\"" | ||
] | ||
} | ||
] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @airween,
I am assuming that you have copy && paste the remove_rule check from the block just above. Indeed, that was missing. However you may have pasted in the wrong place, that may lead to unnecessary loops. Can you make it exactly in the same fashion as the others checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zimmerle, sorry, I don't know what do you think about - why is this a wrong place, and which loops could occures?
Do you mean that it needs a plus condition before the for loop, as the previous variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think about like this?
5497b86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. There are three loops that aiming to do the very same thing. There is no reason to have one different for the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks for the clarification.