-
Notifications
You must be signed in to change notification settings - Fork 727
Conversation
Update to support v3.1
Update date and add Travis badges
Fix typo my->may
Update REQUEST-920-PROTOCOL-ENFORCEMENT.conf
haha, this is the easier solution. |
wow this is coming along nicely |
The basic stuff is ready, I will try to write the tests somewhere in April, if the ftw issue with sending nulls still there I will keep the tests to just a very few use cases. |
can you refreash me on that ftw issue? |
This PR now mixes a proposal for a hybrid paranoia mode with malicious file upload detection. See the discussion in #1050. The way things stand now, this PR here should not be merged. |
Thank you for the stripping of the paranoia mode stuff. This nullifies my comments above. I have not tested this, but it looks good. A thing worth fixing is the uneven use of empty lines in the file. Please take a look at existing rule files to adopt that style. But that's really formal nitpicking by somebody who did not look into the rules themselves. |
@csanders-git it is not nulls it is \xac and \xed ftw issue 16 so it should not be a problem to write rules, I will just skip those if it was nulls that would be a problem as it is often used. @dune73 will take a look to style stuff, I suggest adding the empty line usage to CONTRIBUTING.md, this is not homogeneous, e.g. randomly opened 913 and there is no defined style and the travis checks do not complain on this either to flag something that is not 'in style'. |
Adding comments to 901180 causes conflicts I do not know why so I removed them
|
Does anyone know what is failing with travis? |
Hi @spartantri Here are a few answers (not all yet):
The crs-setup.conf is meant to adjust variables for your own installation. If a variable is not set in crs-setup.conf the 901-INITIALIZATION file sets a default value.
-> SecRule instead of SecAction This is also the answer for one of your next questions:
No, configurations are done in 900270 (crs-setup.conf), default initialization are done in 901-INITIALIZATION, but only if variable is empty:
|
BTW if this is too conflicting we can let only the executable part and leave everything after the |
That's a good proposal. I think it is a good idea to postpone the rules after BEGIN-REQUEST-914-FILE-UPLOAD-IMAGE to a later release. |
I have little time to do any testing as I have too many trips in the coming weeks so I prefer to simply commenting all those rules and we see afterwards like in October after my traveling spree is over. So we go to RC with what is already well tested and do not cause any more delays than what we already have. |
getting a bunch of these btw AH00526: Syntax error on line 308 of /etc/apache2/modsecurity.d/owasp-crs/rules/REQUEST-914-FILE-DETECTION.conf: |
@spartantri that's fine, thank you for all you're already doing for the project! Enjoy your trips. When you get a chance, rebase this against the v3.2/dev branch. We'll be updating it to match RC1 when it comes out so feel free to wait a bit but it'll be needed down the line. |
Hi @franbuehler, @csanders-git, I just got back to France after my tour over America and as discussed in the summit, I've disabled all image and document upload checks and left enabled only the exe, dll and elf file upload detection. |
Today is the end of the merge window for 3.1. I've tried to clean up this PR today and keep only the ELF/EXE/DLL rules. However, when testing them, I came up failing with my first .exe file (putty.exe). It starts with
This means that bytes 02 and 03 can basically be everything, forcing us to detect EXE files only by the I kept my attempt in https://github.com/lifeforms/owasp-modsecurity-crs/blob/spartantri-fileupload/rules/REQUEST-914-FILE-DETECTION.conf Some other changes I made versus this PR:
I tested using: We will need to revisit this for 3.2. |
We can improve the regex and add the null but \x00 cause it to break maybe using \0 instead could work |
I don't think a null will be enough, I think we can't assume anything about the third byte of the .exe But definitely we should figure out how to match null bytes in regexps.. You would think that |
@lifeforms nulls are supposed to be forbidden, it is the only forbidden char in PL1, that's why I didn't bother to make nulls work since the 920270 rule would hit it but I definitively won't block based only on MZ at least not in PL1. As you said the third byte may change so it is hard to tell based on that only byte without false positives that it is or is not a windows exe. However this is the first rule batch, and I think that there still a lot of work to do on this section, maybe liaising in exiftool or something like that as external script to check could be a cool feature for PL3 or 4 (as optional rule of course) can reduce false negatives. |
After discussion, sadly it seems most appropriate that we don't continue with this PR. :( First it is very big and therefore hard to review meaningfully. Second, as mentioned in my earlier comment, I already tried reducing the merge only to executable uploads detection, but found problems with the .exe MZ header signature. Therefore it seems to be a more prickly problem than we assumed, and we should only address it in small steps. We could restart with only the part for detecting ELF headers, which might be a more tractable problem and could still be very useful to our users. Then if that is merged, we could think of trying a next stab at detecting .exe uploads again, but we should do it carefully to not cause false positives. (PS: we can also do other things to detect against Windows exe uploads; for instance we already have a rule triggering on My thanks and apologies to everyone who worked hard on this PR, but I'll close it in its current form. To be continued...? |
Replacement for 994