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

2015-01-04 15,983

0x00 简介

从本期开始我们会讲解APT攻击技术中的一些分析技术,主要会教大家如何分析word和pdf中的恶意程序等。本期讲解的是一个word恶意样本的提取出来恶意EXE文件的方法。

0x01 恶意样本下载地址

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

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

 

0x02 分析工具准备工作

1.      安装依赖包

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

2.      下载oledump

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

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

 


0x03  word恶意样本分析 

1. 查看word恶意样本信息

 

python oledump.py 1.doc

 

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

oledump_apt_1

2.查看宏脚本

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

输出内容: 

oledump_apt_2

3.查看word中插入的内容

 

python oledump.py -s 14  1.doc

 

结果:

oledump_apt_3

 

4.  宏内容解码

a) 解码脚本:

 

#!/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)

 

python oledump.py -s 14  -D decoder_ay.py 1.doc  | more

 

b) 进行解码

结果输出:

oledump_apt_4

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

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

 

6. 查看virustotal结果

oledump_apt_5

【原文:阿里巴巴cnbird SP小编发布 期待下篇放出“从流量中提取文件”的技巧】

 

本文作者:SP小编

本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/3792.html

Tags:
评论  (2)
快来写下你的想法吧!
  • qwe 2015-01-04 22:29:11

    涨姿势了。。

  • Pis 2015-01-05 0:02:02

    这直接写个oledump usage 哪有这么多事

SP小编

文章数:209 积分: 25

交流和分享以及愉快的玩耍

安全问答社区

安全问答社区

脉搏官方公众号

脉搏公众号