最新消息:

邮箱伪造详解

安全知识 admin 2751浏览 0评论

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 wordpress@your_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 wordpress@your_domain.com designates 72.47.192.112 as permitted sender) smtp.mail=wordpress@your_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

 

 

Sender ID Framework SPF Record Wizard

This four-step wizard will guide you through the process of creating a new SPF record for your DNS domain.  You should add this DNS record to your domain’s DNS configuration.   Note that you may need to manually edit the SPF record created by this wizard if you want to use some of the more advance features of the SPF format.  For complete details please refer to the SPF record specification at http://www.microsoft.com/senderid.

How does Sender ID Framework work?

  1. Sender sends an e-mail to Receiver.
  2. Receiver’s inbound e-mail server receives e-mail and calls its Sender ID Framework.
  3. The Sender ID Framework looks up the SPF record of the domain that Sender is using for sending the mail.
  4. The receiving Mail Transfer Agent (MTA) determines if the outbound Mail Server IP address matches IP addresses that are authorized to send mail for the user.

 

 

 

转载请注明:jinglingshu的博客 » 邮箱伪造详解

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. SPF是(Sender Policy Framework) 的缩写,一种以IP地址认证电子邮件发件人身份的技术,是非常高效的垃圾邮件解决方案。接收邮件方会首先检查域名的SPF记录,来确定发件人的IP地址是否被包含在SPF记录里面,如果在,就认为是一封正确的邮件,否则会认为是一封伪造的邮件进行退回。
    admin12年前 (2013-12-14)回复
  2. 使用腾讯的企业邮箱后,腾讯会提示设置SPF来避免被退信。SPF是通过域名的TXT记录来进行设置的,使用腾讯企业邮箱可以设置TXT记录值为:v=spf1 include:spf.mail.qq.com ~all
    admin12年前 (2013-12-14)回复