发新话题
打印

[讨论] 对一封垃圾邮件的分析

对一封垃圾邮件的分析

垃圾邮件的原始邮件头如下
Return-Path: <cmcsw@mx1.just4ukids.com>
Delivered-To: allmail@xxxxx.com
Received: from localhost (mail.xxxxx.com [127.0.0.1])
        by mail.xxxx.com (Postfix - by xxxx.com) with ESMTP id 954D3DC003
        for <xxxx@xxxx.com>; Wed, 24 Sep 2008 10:08:54 +0800 (CST)
X-Virus-Scanned: amavisd-new at xxxx.com
X-Spam-Flag: YES
X-Spam-Score: 7.968
X-Spam-Level: *******
X-Spam-Status: Yes, score=7.968 tagged_above=4 required=6.3
        tests=[HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.5,
        MIME_BASE64_TEXT=2.796, MIME_HTML_ONLY=1.672, RDNS_NONE=0.1,
        TVD_SPACE_RATIO=2.899]
Received: from mail.xxxxx.com ([127.0.0.1])
        by localhost (mail.xxxx.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id kKFAF9AdGo0g for <xxx@xxxx.com>;
        Wed, 24 Sep 2008 10:08:53 +0800 (CST)
Received: from mx1.just4ukids.com (unknown [208.77.98.164])
        by mail.xxxx.com (Postfix - by xxxxx.com) with SMTP id 52497DC002
        for <xxx@xxxx.com>; Wed, 24 Sep 2008 10:08:50 +0800 (CST)
Received: (qmail 21748 invoked by uid 508); 23 Sep 2008 17:52:20 -0500
Received: from 58.63.149.12 by mx1.just4ukids.com (envelope-from <cmcsw@mx1.just4ukids.com>, uid 500) with qmail-scanner-1.25-st-qms
(clamdscan: 0.87/3083. spamassassin: 3.1.8. perlscan: 1.25-st-qms.  
Clear:RC:0(58.63.149.12):SA:0(3.9/4.0):.
Processed in 1.809999 secs); 23 Sep 2008 22:52:20 -0000
X-Antivirus-RAPIDVPS-Mail-From: cmcsw@mx1.just4ukids.com via mx1.just4ukids.com
X-Antivirus-RAPIDVPS: 1.25-st-qms (Clear:RC:0(58.63.149.12):SA:0(3.9/4.0):. Processed in 1.809999 secs Process 21560)
Received: from unknown (HELO sozjuk) (root@58.63.149.12)
  by mx1.just4ukids.com with SMTP; 23 Sep 2008 17:52:17 -0500
From: =?GB2312?B?2MfI2b7q?= <cmcsw@mx1.just4ukids.com>
Subject: ***SPAM*** =?GB2312?B?NzE1OTa15NDNwM22r77At9e1xNSkt8A2MjM3?=
To: xxx@xxxxx.com
Content-Type: text/html;
        charset="GB2312"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Date: Wed, 24 Sep 2008 06:52:32 +0800
X-Antivirus-RAPIDVPS-Message-ID: <1222210338107121560@mx1.just4ukids.com>
Message-Id: <20080924020851.52497DC002@mail.xxxxxx.com>
邮件内容如图


以下是本人的拙见,请各位大大指点啊
首先描述一下,我看到这封垃圾的处理顺序
1、先使用浏览器打开  just4ukids.com ,ok可以打开,而且还是国外做email的啊。
有这样的宣传啊 Email For Kids - Safe Secure Kids Email, Spam & Virus Free. Free, SSL Secure Email, for Parents.
E 文不是很好啊,自己使用翻译软件看啊,这个网站。从邮件原始头,和这个网站看介绍的内容看,是国内的“某某”利用了just4ukids.com,在做坏事啊。

2、进行域名解析
> mx1.just4ukids.com
Server:  xx.xxx.com
Address:  xx.xx.xx.xx
Name:    mx1.just4ukids.com
Address:  208.77.98.173         ----查看ip 位置,美国的。

3、分析上面整封邮件的传递过程。
开始出来
Received: from unknown (HELO sozjuk) (root@58.63.149.12)
  by mx1.just4ukids.com with SMTP; 23 Sep 2008 17:52:17 -0500

使用just4ukids.com 封装

Received: (qmail 21748 invoked by uid 508); 23 Sep 2008 17:52:20 -0500
Received: from 58.63.149.12 by mx1.just4ukids.com (envelope-from <cmcsw@mx1.just4ukids.com>, uid 500) with qmail-scanner-1.25-st-qms
(clamdscan: 0.87/3083. spamassassin: 3.1.8. perlscan: 1.25-st-qms.  
Clear:RC:0(58.63.149.12):SA:0(3.9/4.0):.
Processed in 1.809999 secs); 23 Sep 2008 22:52:20 -0000
X-Antivirus-RAPIDVPS-Mail-From: cmcsw@mx1.just4ukids.com via mx1.just4ukids.com
X-Antivirus-RAPIDVPS: 1.25-st-qms (Clear:RC:0(58.63.149.12):SA:0(3.9/4.0):. Processed in 1.809999 secs Process 21560)

通过 just4ukids.com 中转到俺的服务器,postfix 处理,转给 amavisd
Return-Path: <cmcsw@mx1.just4ukids.com>
Delivered-To: allmail@xxxxx.com
Received: from localhost (mail.xxxx.com [127.0.0.1])
        by mail.xxxx.com (Postfix - by xxxx.com) with ESMTP id 954D3DC003
        for <xxxx@xxxx.com>; Wed, 24 Sep 2008 10:08:54 +0800 (CST)
X-Virus-Scanned: amavisd-new at xxxx.com
X-Spam-Flag: YES
X-Spam-Score: 7.968
X-Spam-Level: *******
X-Spam-Status: Yes, score=7.968 tagged_above=4 required=6.3
        tests=[HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.5,
        MIME_BASE64_TEXT=2.796, MIME_HTML_ONLY=1.672, RDNS_NONE=0.1,
        TVD_SPACE_RATIO=2.899]
Received: from mail.xxxx.com ([127.0.0.1])
        by localhost (mail.xxxx.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id kKFAF9AdGo0g for <xxx@xxxx.com>;
        Wed, 24 Sep 2008 10:08:53 +0800 (CST)
Received: from mx1.just4ukids.com (unknown [208.77.98.164])
        by mail.xxxx.com (Postfix - by xxxx.com) with SMTP id 52497DC002
        for <xxx@xxxx.com>; Wed, 24 Sep 2008 10:08:50 +0800 (CST)

ok.

4、那有什么方式可以“杀掉这个垃圾源” 呢?
一、拒绝对应的ip 连接 58.63.149.12  or  208.77.98.164
应该是 208.77.98.164 ,但208.77.98.164 只是中转地址,本身也是受害者,你这样杀的话,叫杀错了人。

二、把这个email 地址加入到 amavisd的黑名单。ok 这样用户收不到了,但这个也存在”误会“,因为这个地址本身就是被别人利用了 (cmcsw@mx1.just4ukids.com

三、仔细看了一下邮件原始头,发现一点  这份邮件的原始出处
Received: from unknown (HELO sozjuk) (root@58.63.149.12)
  by mx1.just4ukids.com with SMTP; 23 Sep 2008 17:52:17 -0500
红色字体 标出的helo 值,俺的服务器使用了 RHMS 中的提到的helo 值的一个正则表达式判定(原始作者是 木鸟)。谢谢RHMS 和作者 共享了这么好的功能。

想用它helo 值在 smtp 阶段就拒绝,但自己想想,好像 它不是直接和按的服务器联系,而是通过  just4ukids.com。想想,查看日志看一下,
翻看这个时段的日志

Sep 24 09:50:09 mail amavis[24044]: Internal decoder for .zip
Sep 24 09:50:09 mail amavis[24044]: No decoder for       .7z   tried: 7zr, 7za, 7z
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .rar  at /usr/bin/unrar
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .arj  at /usr/bin/unarj
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .arc  at /usr/bin/nomarch
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .zoo  at /usr/bin/zoo
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .lha  at /usr/bin/lha
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .cab  at /usr/bin/cabextract
Sep 24 09:50:09 mail amavis[24044]: No decoder for       .tnef tried: tnef
Sep 24 09:50:09 mail amavis[24044]: Internal decoder for .tnef
Sep 24 09:50:09 mail amavis[24044]: Found decoder for    .exe  at /usr/bin/unrar; /usr/bin/lha; /usr/bin/unarj
Sep 24 09:50:09 mail amavis[24044]: Using primary internal av scanner code for ClamAV-clamd
Sep 24 09:50:09 mail amavis[24044]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Sep 24 09:50:09 mail amavis[24044]: Creating db in /var/amavis/db/; BerkeleyDB 0.34, libdb 4.2
Sep 24 10:52:04 mail pop3d: Connection, ip=[::ffff:10.1.2.50]
Sep 24 10:52:04 mail pop3d: LOGIN, [email=user=xxx@xxxx.com]user=xxx@xxxx.com[/email], ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:52:04 mail pop3d: LOGOUT, [email=user=xxx@xxxx.com]user=xxx@xxxx.com[/email], ip=[::ffff:xx.xx.xx.xx], top=0, retr=0, rcvd=24, sent=254, time=0
Sep 24 10:52:24 mail postfix/anvil[24452]: statistics: max connection rate 1/60s for (smtp:202.123.214.8) at Sep 24 10:48:31
Sep 24 10:52:24 mail postfix/anvil[24452]: statistics: max connection count 1 for (smtp:202.123.214.8) at Sep 24 10:48:31
Sep 24 10:52:24 mail postfix/anvil[24452]: statistics: max cache size 2 at Sep 24 10:49:03
Sep 24 10:53:11 mail pop3d: Connection, ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:11 mail pop3d: LOGIN, [email=user=xxxx@xx.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:11 mail pop3d: LOGOUT, [email=user=sznet@dsreli.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx], top=0, retr=0, rcvd=24, sent=501, time=0
Sep 24 10:53:12 mail pop3d: Connection, ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:12 mail pop3d: LOGIN, [email=user=sznet@dsreli.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:12 mail pop3d: LOGOUT, [email=user=sznet@dsreli.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx], top=0, retr=0, rcvd=24, sent=501, time=0
Sep 24 10:53:13 mail pop3d: Connection, ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:13 mail pop3d: LOGIN, [email=user=sznet@dsreli.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx]
Sep 24 10:53:13 mail pop3d: LOGOUT, [email=user=sznet@dsreli.com]user=xxxx@xx.com[/email], ip=[::ffff:xx.xx.xx.xx], top=0, retr=0, rcvd=24, sent=501, time=0


这个时段的 (Wed, 24 Sep 2008 10:08:50 +0800 (CST) 左右的) 刚好没有,想想,那是刚添加网amavisd 的黑白名单,#amavisd reload  后自己查看日志,就只有 amavisd 启动日志了,后面一直没有啊,后来是#services syslog restart

才能看到日志啊。翻看了以前的日志,都没有这样的情况(我当时觉得有些异常,查看了其他的日志等,没有发现什么问题,就没有去管,今天,看到这份垃圾邮件,估计和这个有些联系)。搜索了 just4ukids.com ,也没有。


结合公司的实际情况。最终我使用的方法二、方法三啊,

希望各位大大,指点啊,问题、更好的方法啊等。谢谢了啊!




[ 本帖最后由 cnzg_y 于 2008-9-25 12:27 编辑 ]
附件: 您所在的用户组无法下载或查看附件

TOP

引用:
三、仔细看了一下邮件原始头,发现一点  这份邮件的原始出处
Received: from unknown (HELO sozjuk) (root@58.63.149.12)
  by mx1.just4ukids.com with SMTP; 23 Sep 2008 17:52:17 -0500
红色字体 标出的helo 值,俺的服务器使用了 RHMS 中的提到的helo 值的一个正则表达式判定(原始作者是 木鸟)。谢谢RHMS 和作者 共享了这么好的功能。
偶和木鸟一起熬夜才发现 HELO 检测居然可以非常有效的抵挡垃圾邮件(至少去掉了 50%)。
很高兴 iRedMail(以前是 rhms 项目)能够为大家带来帮助,也感谢木鸟和其它帮助 iRedMail 成长的朋友。

iRedMail 项目地址:http://www.iredmail.org/
iRedMail:功能完善的开源邮件服务解决方案。
http://www.iredmail.org/

TOP

helo的办法非常容易破点,随机产生1堆helo就封不住了,估计很快spamer就会这么干了
请引用或摘抄本站文章信息的朋友,保留本站链接及作者信息,保护版权,谢谢。

构建高性能大容量开源邮件系统- ExtMail

Postfix在中国官方网站

TOP

引用:
原帖由 hzqbbc 于 2008-9-26 00:46 发表
helo的办法非常容易破点,随机产生1堆helo就封不住了,估计很快spamer就会这么干了
这个可以再重新分析spam 邮件的helo 值,我以前也是用bbc 老大你们开发的 Spam Locker,效果蛮好的,就是误判的情况有点多啊,对perl 我是不太懂啊,在学习。没得办法啊,我只好忍痛割爱了。

现在使用的防spam方式是
1、上面提到的 helo的正则表达式判定
2、在postfix 中添加 rbl
3、使用amavisd-new 结合 SpamAssassin,ClamAV。把对垃圾邮件 pass 动作改为了D_BOUNCE,并定位到 特定的spam 邮件存储邮箱。并定期更新 amavisd 的黑白名单。
4、计划在加上 policyd v2 (还处在研究,实验阶段)

望上面两位老大指点啊。特别是bbc 老大,觉得 helo 值判定不太好。望bbc 指点更好的方法啊。
再次谢谢两位大大的回帖啊。

TOP

rbl的检测方法也有很大的几率误杀

TOP

引用:
原帖由 ruochen0926 于 2008-10-10 11:15 发表
rbl的检测方法也有很大的几率误杀
呵呵,是有这样的情况。看看下面这个,出自那里,就不记得了啊。原文如下
我在postfix里设置了rbl检查,我想问可不可以在postfix的main.cf里设置hash maps或者regrex maps例外某些被列入rbl的地址呢?

因为使用了rbl的确能把很多垃圾邮件地址挡掉,但我们公司有些客户的邮件系统地址也被列入rbl,申请撤离后没多久又被加入黑名单,故此想知道有没有办法可以既使用rbl功能,又对某些有用但被列入rbl的邮件地址进行例外通过。

之前用了一个办法: 将rbl整合到spamassassin里,不加到postfix直接当掉,但发现好像效果不佳,而且评分要抓的很小心。所以想问问有没有上面我所想的办法。



谢谢你的回复,你所说的是sender_access表吗? ,谢谢你所提供的思路。

问题已经解决,有两个解决办法。

方法一: 使用check_sender_access


CODE
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/rbl_pass

smtpd_client_restrictions = check_sender_access hash:/etc/postfix/rbl_pass


rbl_pass的内容(举例):
yahoo.com OK
sina.com OK
因为check_sender_access hash:/etc/postfix/rbl_pass放在rbl_check前所以可以被例外掉。


方法二: 使用ten老大在<a href="http://anti-spam.org.cn/forums/index.php?act=ST&f=13&t=3906" target="_blank">http://anti-spam.org.cn/forums/index.php?a...f=13&t=3906<;/a>所提供的信息。


CODE
smtpd_restriction_classes = from_freemail_host

from_freemail_host = check_client_access hash:/etc/postfix/freemail_hosts, reject

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/freemail_access

smtpd_client_restrictions = check_sender_access hash:/etc/postfix/freemail_access


/etc/postfix/freemail_access的格式
yahoo.com from_freemail_host

/etc/postfix/freemail_hosts的格式:
yahoo.com OK

以上办法证实是可行的,但要注意一点,如果你的postfix同时配置了防止假冒地址(Preventing sender spoofing)的话,以上动作会使从yahoo.com发过来的信都会显示:'554 5.7.1 <XXXX@yahoo.com>: Sender address rejected: Access denied'。

解决办法就是把yahoo.com的mx记录的ip地址也加入到freemail_access和freemail_hosts中去。

以上所说的方法同时适用于例外某些没有反解的但又需要正常联系的邮件地址。

TOP

发新话题