You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mod_security 2.9.2 appears to truncate POST bodies when using mod_proxy_ajp and mod_jk when using ProcessPartial #1827
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?
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 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
Activity
zimmerle commentedon Jul 2, 2018
Hi @markblackman,
The configuration SecRequestBodyLimit limits the amount of bytes of the request body to be inspected. That in the expected behavior.
markblackman commentedon Jul 2, 2018
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?
markblackman commentedon Jul 2, 2018
To be even clearer, with ProcessPartial I expect the entire body to be proxied regardless of how much is inspected. Is this expectation misplaced?
zimmerle commentedon Jul 2, 2018
What is the version of your ModSecurity?
markblackman commentedon Jul 2, 2018
[Mon Jul 02 17:51:54.562328 2018] [:notice] [pid 2380366:tid 140467527632640] ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/) configured.
zimmerle commentedon Jul 2, 2018
Is there any version mismatch in the dependencies?
markblackman commentedon Jul 2, 2018
None that are flagged by modsecurity itself.
markblackman commentedon Jul 2, 2018
If there is some debugging to enable, we can do that.
markblackman commentedon Jul 3, 2018
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.
zimmerle commentedon Sep 5, 2018
Any position from the Oracle Weblogic module?
zimmerle commentedon Sep 5, 2018
It is likely that ModSecurity is being called after the mod_wl. Therefore not being able to manipulate the request.
markblackman commentedon Sep 5, 2018
That's possible, but how does that explain the mod_jk and mod_proxy_ajp behaviours?
markblackman commentedon Dec 13, 2018
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.
markblackman commentedon Jan 10, 2019
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.
markblackman commentedon Jan 16, 2019
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?
markblackman commentedon Jan 16, 2019
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.
markblackman commentedon Jan 31, 2019
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
2019-01-30T14:42:30.4484+00:00 <390948215488593502> Going to get the post data of size=22318 clength=0Why are mod_security and another input filter disagreeing about the body size?
zimmerle commentedon May 27, 2019
Fixed at #2092.