大网数据广告活动
服务器运维问答

SpamAssassin, Postfix, and Multiple Addresses in From Header

· 52CE 我爱测

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…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-01-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。