-
-
Notifications
You must be signed in to change notification settings - Fork 402
New PL2/3 rule that catches mail (SMTP) injections #2206
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
I once wrote a rule for SMTP injection, maybe you can refer to it.
|
@NiceYouKnow Thank you very much for sharing your rule, we will definitely look at it! Anyway, it seems to be for IMAP, not SMTP. |
OK,that should be my mistake. I hope it can help. |
A quick pass at the SMTP standard gives me the commands Other commands like |
I would say that if we add POP3 also, we are mostly covered (SMTP + IMAP4 + POP3). |
Brillant idea. And really doable. |
For POP3, here is the commands list:
where
|
Good. We now have the full list of keywords. @NiceYouKnow is opening his regex with Is this necessary? I do not really know IMAP that well, but AFAICS, all 3 protocols end commands with CRLF. That means we can cut this down to something like this:
(Feel free to fix my regex. I'm sure we have a fancier way of expressing this these days, but I'm stuck in regex stone age.) It's still possible to cause FPs this way. So it's probably a good idea to use the non-English keywords like EHLO and RETR in PL2 and then do a stricter sibling at PL3 with the keywords such as FROM, MAIL, PASS, etc. |
@dune73 I'm doing the first tests, and for now I'm seeing this: maybe splitting in protocols is better than having just one rule per PL for all. Some of the commands have required parameters in SMTP. Some have a required tag like IMAP. Do you think we ignore this and just go for the command, or getting a more precise match will help lower FPs? |
It will definitely help lower FPs, but it's also more work. I'll let those who do the work take this decision. |
Closing in favor of PR at #2322. |
Description
CRS lacks a rule that detects SMTP protocol.
See #1991.
The text was updated successfully, but these errors were encountered: