- changed status to open
Postfix - non-SMTP command - Add signature
I’ve been watching in the maillog many scans on Postfix smtpd process:
Jun 21 12:00:56 acme postfix/submission/smtpd[20201]: warning: non-SMTP command from unknown[170.130.187.14]: GET / HTTP/1.1
Jun 21 14:31:24 acme postfix/submission/smtpd[22074]: warning: non-SMTP command from unknown[23.224.186.214]: \001\000\000i3t\000\000\000\000\000\022\000\020\000\000\rmy.i.p.p.p\000\005\000\005\001\000\000\0\000\005\000\005\001\000\000\0
It would be nice to have it added to the list.
I tried to modify the source but I’m lacking enough skills. It would be something like this:
/* postfix */
"warning: non-SMTP command".* { BEGIN(INITIAL); return POSTFIX_NON_SMTP_CMD; }
Comments (6)
-
-
reporter Yes, it doesn't have a reverse DNS record. I tried to copy some of the syntax from attack_scanner and attack_parser but I couldn't do it.
I got your gmail from FreeBSD ports however I preffered to contact you via Bitbucket.
Thanks!
-
reporter Would you like me to help you write a basic step by step guide so more people can add signatures?
-
Let me try to remember why I didn’t go ahead and commit my changes… hmm…
There is the "Add New Signatures" section in the contributors guide. Could you take a look and let me know what is missing?
-
reporter I tried to follow the steps in the page you linked. I would add:
. Steps to add a signature
. explain what a token does (lexical?)
. The name, the regular expression.
. Why the regular expression has BEGIN(zzzzz) and so…
Reading those files I one might understand what pieces to add however it would be more useful to understand the steps the program does and which steps from adding the signature impact in the steps of the parsing/detection.
-
- changed status to resolved
Added in 3de50c9, thanks.
- Log in to comment
Unfortunately, writing signatures requires a bit of working knowledge with lex/yacc. I should write a quick tutorial sometime.
Could you explain what 'unknown' is? Is it the reverse DNS of the host, replaced with 'unknown' if the query returns NXDOMAIN?
Could you also suggest a score for this attack? It’s not quite as serious as a “login failure”. In fact, I see this kind of “attack” all this time on enterprise networks that employ automated port scanners.
Here’s what I have so far. The meat of the change is:
Then, we need to teach the parser (attack_parser.y) about this new signature that we have lexical tokens for:
There are some places where we need to define lexical tokens and parser states:
It’s good to write tests: