-
Notifications
You must be signed in to change notification settings - Fork 1.7k
mod_security 2.9.2 appears to truncate POST bodies when using mod_proxy_ajp and mod_jk when using ProcessPartial #1827
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 @markblackman, The configuration SecRequestBodyLimit limits the amount of bytes of the request body to be inspected. That in the expected behavior. |
Thanks. Sorry, if it wasn't clear. I am not referring to the inspection behaviour. I am referring to the proxying behaviours. I can completely live with only inspecting 4k bytes out of 8k bytes in an HTTP body and that's what I expect from ProcessPartial. What I can not live with and do not expect, is the 8K body getting truncated to 4k when it's passed to the backend Tomcat servers. Is this well known or well documented behaviour, truncating after inspection? |
To be even clearer, with ProcessPartial I expect the entire body to be proxied regardless of how much is inspected. Is this expectation misplaced? |
What is the version of your ModSecurity? |
[Mon Jul 02 17:51:54.562328 2018] [:notice] [pid 2380366:tid 140467527632640] ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/) configured. |
Is there any version mismatch in the dependencies? |
None that are flagged by modsecurity itself.
|
If there is some debugging to enable, we can do that. |
And just as a quick reminder, this only happens in the context of the following proxy modules.
However, it works fine in the context of the standard HTTP proxy module
I can imagine that Oracle would not play nicely with the Apache bucket brigade, but I assume mod_security does as well as mod_jk and mod_proxy_ajp. |
Any position from the Oracle Weblogic module? |
It is likely that ModSecurity is being called after the mod_wl. Therefore not being able to manipulate the request. |
That's possible, but how does that explain the mod_jk and mod_proxy_ajp behaviours? |
We still see this issue with mod_proxy_ajp and Tomcat backends. We'll provide more details of a reproducible setup with a RH7 environment. I would be grateful if you could consider trying to reproduce what we see. In summary, ignoring the weblogic problem, mod_proxy_ajp configurations exhibit this behaviour, but mod_proxy_http configurations do not. |
As a further data point, this issue only occurs with with Content-type: multipart/form-data although typically, this is what you would use for bigger bodies anyway. |
For the moment, we have addressed our issue by making this change From
To
For us, it is extremely counter-intuitive for modsecurity to permanently and irretrievably throw away body content after SecRequestBodyLimit. It should simply ignore the extra content, not throw it away, so that further filters can't see/pass the extra content. Is that body content discard really the designed/documented/desired behaviour? |
In other words, always buffer the entire request, but only process up to the point requested. Other filters may need that body. Buffering and processing are two very logically separate processes. Any generic body truncation should only be handled by core Apache directives. |
Despite these changes, we're still seeing problems with body content being discarded by modsecurity on a POST. In a case observed yesterday, modsecurity claimed a body size of 16315 '[30/Jan/2019:14:42:30 +0000] [server1.some.domain.com/sid#a72c368][rid#e1ac640][/dat/restservice/admin/userProvision][4] Input filter: Completed receiving request body (length 16315).' yet a following filter believed the POST body was was 22318 bytes
Why are mod_security and another input filter disagreeing about the body size? |
Fixed at #2092. |
We configure our POST body limit as follows
We can then see on the backend that the resulting request is truncated to the SecRequestBodyLimit 4096
The text was updated successfully, but these errors were encountered: