问题原文
原帖链接 · rickyboone · CC BY-SA 4.0
I'm working on a problem that I'm seeing with an email scanning server (MailScanner, Spamassassin, Postfix, etc.), and From header spoofing. Unfortunately, some of the versions of these components are old, so this may be a bug in one or more of them. Upgrades are planned, I'm just seeing if an interim solution is appropriate, or if this is a configuration/rule issue that would need to carry over to the upgraded environment.
Basically, I'm seeing messages that contain multiple addresses in the From header coming through. That in itself seems to be RFC compliant, with specific conditions that usually aren't being met as far as I can see, however nearly every example that I can find that our environment has logged, this is a spoofed/malicious message.
Here are a few examples, all from different messages, with names changed to protect the (possibly) innocent:
From: "[email omitted]" <[email omitted]> <[email omitted]>
From: John Doe <[email omitted]> <[email omitted]>
From: "Trusted Third Party Employee" <[email omitted]> <[email omitted]>
Email clients like Outlook seem to only display the first address. MailScanner/SpamAssassin use the last.
Basically, a regex like the following would seem to catch these (whether that is in a header_check in Postfix or a rule in Spamassassin):
^From: .*?<[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}>.*<[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}>
I'm sure that this regex is terrible and there are probably more elegant ways to match the examples like the ones above. ;)
I can share specific configuration snippets if relevant.
Any thoughts?
已采纳解答
原帖链接 · Hojendiz · CC BY-SA 4.0
Currently I'm fighting this kind of spam, and to complement the great answer of Deeepdigger currently I have this rule in my Spamassassin.
describe LOCAL_TWO_FROM_EMAILS The From has two emails, probably email spoofing
header LOCAL_TWO_FROM_EMAILS From =~ /<.*\@.*>\s+<.*\@.*>/i
score LOCAL_TWO_FROM_EMAILS 9.0 # Set this value at your discretion
The regex part needs to be improved, but this rule has helped me to stop the majority of email been spoofed by this malformed header.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
