APT恶意软件分析之从WORD中提取EXE技术

EXE恶意样本提取

Posted by 张嘉伟 on 2019-12-02        本文总阅读量

简介

本文章讲解的是一个word恶意样本的提取出来恶意EXE文件的方法。

恶意样本下载地址

注册登录后即可下载原始的word恶意样本

https://malwr.com/analysis/MjQxOTQ5NWNjMGZlNGFiZmJkYzcwOTlkNDE3ZDdhZTU/

分析工具准备工作

安装依赖包

1
2
3
4
5
6
7
wget https://bitbucket.org/decalage/olefileio_pl/downloads/olefile-0.41.zip

unzip oldfile - 0.41.zip

cd oldfile - 0.41

sudo python setup.py install

下载oledump

1
2
3
wget http://didierstevens.com/files/software/oledump_V0_0_4.zip

wget http://didierstevens.com/files/software/pecheck_v0_3_0.zip

word恶意样本分析

查看word恶意样本信息

1
python oledump.py 1.doc

结果说明: 模块7包含了一个宏

avatar

查看宏脚本

1
python oledump.py - s 7 - v  1.doc

输出内容:
avatar

查看word中插入的内容

1
python oledump.py - s 14  1.doc

结果:
avatar

宏内容解码

  • 解码脚本:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python

__description__ = '&H decoder for oledump.py'

__author__ = 'Didier Stevens'

__version__ = '0.0.1'

__date__ = '2014/12/19'



"""
Source code put in public domain by Didier Stevens, no Copyright
https://DidierStevens.com
Use at your own risk
History:
2014/12/19: start
Todo:

"""



import re


class cAmpersandHexDecoder(cDecoderParent):

name = '&H decoder'

def __init__(self, stream, options):
self.stream = stream
self.options = options
self.done = False



def Available(self):
return not self.done



def Decode(self):
decoded = ''.join([chr(int(s[2:], 16)) for s in re.compile('&H[0-9a-f]{2}', re.IGNORECASE).findall(self.stream)])
self.name = '&H decoder'
self.done = True
return decoded



def Name(self):
return self.name



AddDecoder(cAmpersandHexDecoder)
1
python oledump.py -s 14  -D decoder_ay.py 1.doc  | more
  • 进行解码

结果输出:
avatar

WORD样本中的EXE病毒样本导出

1
python oledump.py -s 14  -D decoder_ay.py -d 1.doc  >1.exe

查看virustotal结果

avatar

【原文】原链接