12

邮箱伪造详解 | WooYun知识库

 6 years ago
source link:
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

邮箱伪造详解

0x00 背景


邮箱伪造技术,可被用来做钓鱼攻击。

即伪造管理员或者IT运维部等邮箱发邮件,获取信任使对方打开附带的木马文件或者回复想要获取的敏感资料等。

0x01 细节


SMTP协议中,允许发件人伪造绝大多数的发件人特征信息。

这就导致了可以伪造别人发送邮件。

来看一下乌云上的案例:

WooYun: ifeng exchange伪造源地址漏洞

WooYun: 腾讯邮箱服务器允许源地址欺骗漏洞

WooYun: qq邮箱伪造发件地址,容易被钓鱼利用

网上还有个网站比较方便直接发送伪造邮件的:

http://emkei.cz/

0x02 防御


为了防止邮箱伪造,就出现了SPF。

SPF(或是Sender ID)是Sender Policy Framework的缩写。

当你定义了你域名的SPF记录后,接收邮件方会根据你的SPF记录来判断连接过来的IP地址是否被包含在SPF记录里面,如果在,则认为是一封正确的邮件,否则则认为是一封伪造的邮件。现在绝大部份反垃圾邮件系统都支持SPF过滤,这种过滤一般不会有误判,除非是邮件系统管理员自己把SPF记录配置错误或遗漏.

至于domain key则是由Yahoo所提出的。必需配合软件和加密技术,比较麻烦。目前使用的也不多。 Google目前所谓的支援domainkey也只是在寄信的时候加入,免得被yahoo退信,本身并没有要求寄件者要有domainkey。

正确设置后邮件头一般显示如下:

Received-SPF: pass (google.com: domain of [email protected]_domain.com designates 72.47.192.112 as permitted sender) client-ip=72.47.192.112;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected]_domain.com designates 72.47.192.112 as permitted sender) [email protected]_domain.com

关于SPF是否有设定的必要?一般认为有加上SPF比较好,怕万一碰到哪个收件服务器有采用SenderID机制来过滤信件的话就有用处了。

如何增加SPF记录,非常简单,在DNS里面添加TXT记录即可,可以使用下面两个SPF生成检查工具:

http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/default.aspx

http://old.openspf.org/wizard.html

enter image description here

a 你域名的A记录,一般选择yes,因为他有可能发出邮件,比如我上面提到的Wordpress的回信。
mx 一般也是yes,MX服务器会有退信等。
ptr 选择no,官方建议的。
inlude 如果有可能通过一个isp来发信,isp有自己的SPF记录,则填入这个isp的域名。比如你使用Google Apps,应该增加include:google.com记录,因为你的邮件时从Google服务器发出去的。
ip4: 你还有没有其他的ip发信?可能你的smtp服务器是独立出来的,那么就填入你的IP地址或者网段。
~all: 意思是除了上面的,其他的都不认可。当然是yes了。

查看SPF记录的方法

Windows下进入DOS模式后用以下命令

nslookup -type=txt 域名

enter image description here

Unix操作系统下用:

# dig -t txt 域名

enter image description here


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK