-
-
Notifications
You must be signed in to change notification settings - Fork 402
False positive on parameter value XMLNS #2071
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
Comments
Hi @noneisland, thanks for your report. Your parameter is triggered by the pattern It looks to me, as if we could safely get rid of the false positive by ensuring a word boundary, as in: We could do the same for some other words in this file, I would propose to change it to:
The rule is an XSS rule. Since I don't have so much experience with XSS myself, I will discuss this with our dev team on our next meeting before proceeding, as I don't want to introduce vulnerabilities. Again thanks for the report and we will follow up soon. |
Hi @lifeforms , thank you for your quick response. I'm interested in contributing to fix the false positive if somebody can tell me how we build and test the changes to the coreruleset. I discovered these false positives when using coreruleset with my application logs. If somebody can give me some guidance, I probably will be able to fix these false positives quicker because they are a blocker for my use case. |
Normally you can just change the rule files in place, but in this case, it's a bit more complicated because rule 941130 is compressed from a series of regular expressions into one big regular expression. This helps us keep the number of rules lower and make processing faster while keeping related patterns in one rule. The source regexps can be found in the file regexp-941130.data. These are the ones that could be improved, using my example for instance. But this file is not directly used by web servers. We have to insert the compressed version into the *.conf rule file first. When you look at the comment on rule 941130 you find that we run a perl command to generate the compressed regexp, and the output of that perl script is the one that we put in the rule file. To compile the regexps into one, you need Perl and the Regexp::Assemble CPAN module. You can read more about it in our blog on Regexp::Assemble. With the updated .data file and the changed rule file, it is almost ready for a PR. The final step for a perfect PR is to add a test case for your false positive to our regression tests. This ensures that you definitely have fixed the problem and it protects us from reintroducing the error again in a future change. To do this, you add a section at the bottom of the test file 941130.yaml that contains your payload, but it should end with Good luck! |
hi @lifeforms , thanks for the information. I am wondering if this can be made easier, e.g., "make testruleset" will automatically tell you if your changes succeeds or fails. |
It's possible to run the tests with Docker but my setup is currently not working anymore so I hope someone else can pitch in on how to run the tests locally, @franbuehler or @fzipi ? |
Sure, it is possible. You need python3, docker, and docker-compose installed. The steps should be:
Will write a wiki page with this. |
@fzipi , thanks for the instructions. I followed the guide and set it up. But in the last step, it doesn't appear that any tests were actually ran. py.test -vs --tb=short tests/regression/CRS_Tests.py --config="modsec2-apache" --ruledir=./tests/regression/tests tests/regression/CRS_Tests.py::test_crs[ruleset0-test0] SKIPPED ==================================================================================================== 1 skipped in 0.01 seconds ================= |
I did some research. "xmlns" itself is not a XSS attack, it has to be combined with javascript in order to be an actual attack. |
I'm losing the overview here a bit. Can you guys tell me what the status is? |
Meeting decision: I will help the submitter by making the necessary changes myself. |
For the record: We talked about this issue at our recent project meeting. |
I know you are very busy @lifeforms, but can you still give us a status? |
Ping @lifeforms |
Description
GET /api/v1/query?q=7XMLNS triggered false positive because the parameter contains "XMLNS"
#16 4.565 Rule Id: 941130 phase: 2
#16 4.565 * Match, but no disruptive action: ModSecurity: Warning. Matched "Operator
Rx' with parameter
(?i)\s\S\b' against variableARGS:q' (Value:
7XMLNS' ) [file "/opt/coreruleset/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf"] [line "125"] [id "941130"] [rev ""] [msg "XSS Filter - Category 3: Attribute Vector"] [data "Matched Data: 7XMLNS found within ARGS:q: 7XMLNS"] [severity "2"] [ver "OWASP_CRS/3.3.0"] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-xss"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/152/242"] [hostname ""] [uri "/api/v1/query"] [unique_id "162043736477.530879"] [ref "o0,6v20,6t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls"]Your Environment
CRS version: default v3.4/dev
Paranoia level setting:
ModSecurity version : 3.0.4
Web Server and version :
Operating System and version: Amazon Linux 2
Confirmation
[ x] I have removed any personal data (email addresses, IP addresses,
passwords, domain names) from any logs posted.
The text was updated successfully, but these errors were encountered: