利用swaks伪装邮件发送人
swaks (Swiss Army Knife SMTP) is a command-line tool written in Perl for testing SMTP setups; it supports STARTTLS and SMTP AUTH (PLAIN, LOGIN, CRAM-MD5, SPA, and DIGEST-MD5). swaks allows one to stop the SMTP dialog at any stage, e.g to check RCPT TO: without actually sending a mail.
Swks(瑞士军刀SMTP)是一个用Perl编写的命令行工具,用于测试SMTP设置;它支持STARTTLS和SMTP身份验证(普通、登录、CRAM-MD5、SPA和DIGEST-MD5)。Swks允许用户在任何阶段停止SMTP对话,例如检查RCPT to:而不实际发送邮件。
输入swaks --help
可以获取指南
伪造一份相关的邮件使用如下指令:
swaks --to rokig99758@wikfee.com --from abc@complany.com --header "just for a test"
=== Trying mail.wikfee.com:25...
=== Connected to mail.wikfee.com.
<- 220 c1bf3b2951b1 ESMTP Haraka/3.0.2 ready
-> EHLO kali
<- 250-c1bf3b2951b1 Hello Unknown [10.244.14.74]Haraka is at your service.
<- 250-PIPELINING
<- 250-8BITMIME
<- 250-SMTPUTF8
<- 250 SIZE 12580000
-> MAIL FROM:<abc@complany.com>
<- 250 sender <abc@complany.com> OK
-> RCPT TO:<rokig99758@wikfee.com>
<- 250 recipient <rokig99758@wikfee.com> OK
-> DATA
<- 354 go ahead, make my day
-> Date: Tue, 02 Jan 2024 21:37:01 -0500
-> To: rokig99758@wikfee.com
-> From: abc@complany.com
-> Subject: test Tue, 02 Jan 2024 21:37:01 -0500
-> Message-Id: <20240102213701.026469@kali>
-> X-Mailer: swaks v20201014.0 jetmore.org/john/code/swaks/
-> just for a test
->
-> This is a test mailing
->
->
-> .
<- 250 Message Queued (CB035C8C-2D1E-43AF-9FA7-3C68CBE079DC.1)
-> QUIT
<- 221 c1bf3b2951b1 closing connection. Have a jolly good day.
=== Connection closed with remote host.
可以看到:
成功了,但是和预想的不太一样,尝试进行修改并重新发送:
┌──(kali㉿kali)-[~/Desktop]
└─$ swaks --to yinofok238@wikfee.com --from abc@complany.com --header "subject:just for a test" --data 1.txt --body "body:just for a test"
出现了:
奇怪了,前面的东西反而没了,更改命令:
swaks --to yinofok238@wikfee.com --from abc@complany.com --header "subject:just for a test" --attach 1.txt --body "body:just for a testE"
有戏!
附件也是对的。至此,无SPF校验的邮件伪装就成功了:
--to 发送目标
--from 发件人
--attach 附件
--ehlo 发件人邮箱域名认证
--header 文件头 subject参数
--body 文件主体
--data 将正常源邮件的内容保存成TXT文件,再作为正常邮件发送
目前在临时邮箱以及139邮箱上可以测试成功,在QQ邮箱、阿里邮箱会被归入垃圾邮箱,但能发送成功,其他的如163邮箱,新浪都会被SPF以及其他的措施拦截,这里比较有意思的一点是,在上传文件改成压缩包后,QQ邮箱反而可以正常上传!!!