Skip to content
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

inspect REQUEST_BODY when XML Processor is on #2087

Closed
theMiddleBlue opened this issue May 10, 2019 · 1 comment
Closed

inspect REQUEST_BODY when XML Processor is on #2087

theMiddleBlue opened this issue May 10, 2019 · 1 comment
Assignees

Comments

@theMiddleBlue
Copy link

theMiddleBlue commented May 10, 2019

Hi all,

we're trying to define few rules in order to start handling XXE payloads. The problem (as you can see here SpiderLabs/owasp-modsecurity-crs#1320 (comment)) is that when the request comes with a Content-Type that match the rule 200000, and the body processor is set to XML, we can't access the REQUEST_BODY and we can't also copy it elsewhere (something like setvar:tx.reqbody=%{REQUEST_BODY}).

We need it in order to match something like:
SecRule REQUEST_BODY "@rx <!ENTITY\s+[^\s]+\s+(?!:SYSTEM|PUBLIC)"

Do you have any idea about how to get the REQUEST_BODY content somewhere when XML Processor is active?

Thanks!

@victorhora victorhora self-assigned this May 10, 2019
@martinhsv
Copy link
Contributor

Hi @theMiddleBlue ,

To clarify, is the question here really only pertaining to v2.9?

In 3.x, REQUEST_BODY should successfully be populated even if the XML body processor has been engaged. (I believe this change of behaviour for when REQUEST_BODY has been populated was an intentional one for v3.x -- although, granted, question has been raised as to whether this is the best way forward ( #2146 ). )

For v2.9, if the XML body processor has been defined for that transaction, then I don't believe there is any way to also have REQUEST_BODY be populated.

There are some workarounds that might be usable in specific cases -- like a specific vulnerable url could turn off the XML parsing engine. If you're trying to write a CRS-style generic rule, however, that won't generally be a practical option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants