8000 XSS Bypass · Issue #2170 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

XSS Bypass #2170

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
lato333 opened this issue Aug 3, 2021 · 13 comments
Closed

XSS Bypass #2170

lato333 opened this issue Aug 3, 2021 · 13 comments
Assignees
Labels
PR available this issue is referenced by an active pull request 👍 Feature Request 🥇 good first issue Good for newcomers

Comments

@lato333
Copy link
lato333 commented Aug 3, 2021

Motivation

We run some sites having mod_security with the OWASP-Core Ruleset 3.3.0 enabled. (thanks for your work ;))
After doing some security analysis, we found out, that some requests bypassed modsecurity and led to successful XSS attacks.

Such an example request would be:
GET https://mysite.com/en/search/%3Cimg+src%3Dx+onerror%3Dalert%281%29%3B%3E

In my opinion, the XSS-Attacks are not checked against the Request-Path. (only COOKIES, ARGS, ARG_NAMES, XML, HEADERS, ...)

Proposed solution

Include REQUEST_FILENAME in the XSS-Detection rules. (in REQUEST-941-APPLICATION-ATTACK-XSS.conf)

e.g.

SecRule REQUEST_FILENAME|REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|XML:/* "@detectXSS" \
    "id:941100,\
...

After applying these changes, the XSS attacks were correctly blocked.

Alternatives

Additional context

@airween
Copy link
Contributor
airween commented Aug 3, 2021

Hi @lato333,

thanks for your report.

As I see you have sent a solution - don't you want to send a pull request?

If you do, please add some test cases - you can find here many other.

If you don't want to make any PR, please be patient, we will investigate this issue.

Thanks again.

@dune73
Copy link
Member
dune73 commented Aug 4, 2021

Hmm. It's definitely a false negative, but I wonder if adding REQUEST_FILENAME at PL1 won't lead to a lot of false negatives. We could add it o 941101 at PL2 where we currently scan the referer. Not sure if we have discussed this before.

@lifeforms: What is your stance on this?

@lato333
Copy link
Author
lato333 commented Aug 4, 2021

There was already a similar discussion in #1022 and REQUEST_FILENAME is already included in Rule-ID 941110.

Unfortunately, I am not that familiar with the rules, so I am not sure in which rule(s) the REQUEST_FILENAME should be included. (in view of false positives)

@dune73
Copy link
Member
dune73 commented Aug 4, 2021

Thank you for the pointer, I had this at the back of my head ...

941110 is nice, but it's a completely different rule. 941100 at PL1 and 941101 at PL2 use the same mechanics (the detectXSS operator provided by libinjection). We call this construct strict siblings. 941101 is a strict sibling to 941100. It's the same rule, but a bit tougher. Here we use the 941101 rule to include items where we expect more false positives. REQUEST_FILENAME can fall into that category and be added at PL2 in 941101, or we come to the conclusion PL1 is fine so we add it to PL1.

It's a pity we did not finish the discussion in #1022 years ago or you would not be facing this now.

@dune73
Copy link
Member
dune73 commented Aug 25, 2021

I have another report with the following payload that goes undetected in default install:

$ curl "http://localhost/index.html/\"\""

Adding REQUEST_FILENAME to 941100 or 941101 (PL2) does the trick.

@fzipi
Copy link
Member
fzipi commented Sep 1, 2021

@dune73 What path should we follow then? @lifeforms?

@dune73
Copy link
Member
dune73 commented Sep 3, 2021

We have not heard from @lifeforms, but I am strongly in favor of 941101 at PL2.

If we do not hear other opinions, somebody could provide a PR, or you add it to the agenda for Monday or the issue chat in two weeks.

@lifeforms
Copy link
Member

I have a vague recollection that years back I tried to add REQUEST_FILENAME to some XSS rules, and ultimately had to revert those changes because of many false positives, but I am not completely sure anymore. I am may be confusing it with a different scenario (we also had lots of trouble with XSS rules on the Referrer header which caused some reverts). I am trying desperately to find my old notes, but no luck.

Ideally we would enable XSS checks on filenames as much as we can.

It would be a workable compromise to add REQUEST_FILENAME in a stricter sibling at PL2 and see how it behaves in practice - with the option of reverting it before release if the false positive rate is unacceptable.

@RedXanadu
Copy link
Member

Note to self: re-read full issue, create PR, maybe also test case.

@dune73
Copy link
Member
dune73 commented Sep 20, 2021

Issue covered in the September issue chat.

@RedXanadu volunteered to do a PR. @lifeforms would like to get a ping then so he can test the PR in production and it's also a candidate for our incubator plugin where we want to test rules before we adopt them into the mainline.

@RedXanadu
Copy link
Member
RedXanadu commented Oct 13, 2021

I believe that #2208 will resolve this issue, by following the recommendation above of performing detectXSS on REQUEST_FILENAME at paranoia level 2 in a stricter sibling.

#2208 is ready to be merged, IMO.

@RedXanadu RedXanadu added the PR available this issue is referenced by an active pull request label Oct 13, 2021
@RedXanadu
Copy link
Member

This has now been resolved since PR #2208 was merged a few days ago.

@lifeforms: It was mentioned the other month that you may want to test this in production. (Summary: REQUEST_FILENAME added to rule 941101, at paranoia level 2, using the detectXSS operator. XSS attacks in filenames can now be caught at PL 2; added at PL2 to see how it behaves in practice as it has been suggested that this change could lead to false positives.)

@RedXanadu
Copy link
Member

Closing issue as resolved, unless there are any objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR available this issue is referenced by an active pull request 👍 Feature Request 🥇 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants
0