-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rule MULTIPART_UNMATCHED_BOUNDARY, id:'200003' fails on valid multipart/form-data submission #652
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
Even a parameter with a value starting with "--" causes the request being denied.
|
any hopes of triaging this and getting it fixed? This is causing us great grief at the moment :) |
Is this the rule causing the alert? |
Thanks for the response. Yes that is the rule and we are not permitted to disable the rule :( |
Are you not the website (ModSecurity) owner? |
Nope, just the developer |
I am affected by this bug as well. The rule that triggers this is: |
Any updated comments on resolving this bug? :) |
I am not familiar with Modsecurity code, but... Problem description: Affected versions: Root cause: /* Do we have something that looks like a boundary? */
if ( msr->mpd->buf_contains_line
&& (strlen(msr->mpd->buf) > 3)
&& (*(msr->mpd->buf) == '-')
&& (*(msr->mpd->buf + 1) == '-') )
{
/* Does it match our boundary? */
if ( (strlen(msr->mpd->buf) >= strlen(msr->mpd->boundary) + 2)
&& (strncmp(msr->mpd->buf + 2, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) )
{
// ...
} else { /* It looks like a boundary but we couldn't match it. */
// ...
msr->mpd->flag_unmatched_boundary = 1;
}
} else { /* We do not think the buffer contains a boundary. */ Possible soulution: }
- msr->mpd->flag_unmatched_boundary = 1;
}
} else { /* We do not think the buffer contains a boundary. */ |
Same thing as rutgerbazen, with a couple of PDF uploads this rule triggers and had to disable it since the PDF encoding is out of our control. |
@AndreyMZ: This rule does what it says on the tin. Your suggested fix would essentially remove the entire check. The MULTIPART_UNMATCHED_BOUNDARY check is intended to detect uploads that would cause problems for a web application that does not properly check the full MIME boundary. If you are 100% confident that your application properly checks MIME boundaries, just disable the rule in your modsecurity.conf with
Remember that many rules that try to protect against common programming errors will also trip on legitimate traffic, and as a security administrator, you will have to make the judgement call on whether or not the added security of keeping the rule enabled is worth the occasional false positive (or indeed, that you are sure that this particular programming error was not made anywhere on your system). I have personally seen badly written MIME parsers that fail when processing a file that contains a newline-dash-dash sequence, so I have seen the use case for having this rule first hand. |
We are experiencing the same issue (some uploaded files are being denied by this rule). and the rule: Some files are being denied but some others not... We're using modsecurity version 2.8.0 in Apache2.2.31 and I'm finding this issue as opened, so I'm wondering if this could be the reason of our problem. If it's already resolved, anyone has any clue? |
The solution is to disable this rule (it's id is According to @driehuis, this rule does what it should do. |
Documentation for MULTIPART_UNMATCHED_BOUNDARY which is checked by that rule currently states the following: "Change the rule from blocking to logging-only if many false positives are encountered." Also, the check with MULTIPART_UNMATCHED_BOUNDARY variable used to have ID 200003. The current version of modsecurity.conf-recommended uses ID 200004 for the same check. This was changed / updated with ModSecurity 2.8.x and it's worth upgrading the modsecurity.conf as there's a number of fixes and improvements since 2.7.9 |
Also happens on 3.x. For 3.x, instead of disabling 200003 or 200004, why not change 200004 to allow and log? Works for me. |
@iamenderst, I believe this should be solved as of 7def498. Check with the latest code from master. If it's still an issue please let us know and we'll have another look. Thanks! |
@victorhora @zimmerle just got a similar issue with a simplest multipart payload:
Error log:
I'm on a recent v3/master, nginx/1.15.5, connector from master. |
Hi @defanator, Please check #1924. |
Issue of @defanator is valid, the well-formed multipart upload is denied with "!@eq 0" operator. |
Same issue here. A sequence of dashes |
@chrisconlan could you show an example - headers, content and your relevant config? |
OS: AWS Linux HTML form sending POST processing as That's the best I can do as for details right now. Hope it helps. |
Yes, helped - sorry, 2.8 is (I guess) a little bit old version, I don't know that the fix exists for that... :( |
No problem. Thanks. |
I'm seeing this problem with 2.9.2 on fedora28. I've had this version installed since October, but only started seeing the error today after changing the virtual domain name. It looks like this was built back in Feb 2018. Is there something I can do to fix this without upgrading?
|
The MULTIPART_UNMATCHED_BOUNDARY rule fires, denying the request if the multipart/form data includes "--" at the beginning of a line. If there is anything else at the start of the line (e.g. " --") then the rule does not trigger.
This issue was identified against a Liferay 6.2 installation fronted by apache+modsecurity, submitting a freemarker code snippet.
A sample curl command:
Environment:
The form submission is valid, with this an obvious false positive. The workaround is to disable the rule. However, it would be better if this was catered for an didn't trigger the rule in the first place.
The text was updated successfully, but these errors were encountered: