jwardsmith/Malware-Analysis
GitHub: jwardsmith/Malware-Analysis
这是一个涵盖恶意软件分析与逆向工程技术的速查表,收录了静态分析、动态分析及针对特定文件格式的常用工具与命令。
Stars: 1 | Forks: 0
# 恶意软件分析
## 概述
0. - [在线资源](#0---online-resources)
1. - [静态分析](#1---static-analysis)
2. - [动态分析](#2---dynamic-analysis)
3. - [静态代码分析](#3---static-code-analysis)
4. - [动态代码分析](#4---dynamic-code-analysis)
5. - [其他文件类型](#5---other-file-types)
## #0. - 在线资源
- *恶意软件数据仓库: MalwareBazaar, VirusTotal*
- *多引擎防病毒扫描器: VirusTotal, MetaDefender*
- *文件信誉: Malware Hash Registry, HashSets, Winbindex*
- *自动化沙箱: ANY.RUN, CAPE, Intezer Analyze, Hybrid Analysis, FileScan.IO*
- *网站和 IP 调查: Quttera, urlscan.io, SecurityTrails*
- *威胁情报: Shodan, Open Threat Exchange, ThreatFox*
## #1. - 静态分析
### 概述
- *文件和节哈希*
- *加壳程序识别*
- *嵌入资源*
- *导入和导出*
- *加密引用*
- *数字证书*
- *可疑字符串*
### 字符串
- 提取 ASCII 和 Unicode 字符串
```
$ pestr
OR
$ strings -a
$ strings -a --encoding=l
```
### 完整静态属性分析
- 提取字符串、导入、导出、头信息、指标
```
https://www.winitor.com/download
OR
$ peframe
```
### 加壳程序识别
- 识别加壳程序
```
https://github.com/horsicq/detect-it-easy
$ diec
OR
https://github.com/ExeinfoASL/ASL
```
## #2. - 动态分析
### 任务管理器
- 管理进程
```
https://systeminformer.sourceforge.io/
https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
```
### 进程
- 记录进程与注册表、文件系统、网络以及其他进程的交互
```
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
```
### 注册表和文件系统
- 突出显示对注册表和文件系统的更改
```
https://sourceforge.net/projects/regshot/
```
### 进程可视化
- 可视化 Process Monitor 日志
```
https://procdot.com/
```
### 网络流量
- 嗅探网络并捕获数据包
```
https://www.wireshark.org/
```
- 解析主机名 (DNS)
```
https://code.activestate.com/recipes/491264-mini-fake-dns-server/
```
- 启动 HTTP Web 服务器
```
$ httpd start
```
- 启动 HTTPS Web 服务器
```
$ inetsim
```
- 使用 iptables 重定向流量
```
$ iptables -t nat -A PREROUTING -i eth0 -j REDIRECT
$ iptables -t nat -D PREROUTING -i eth0 -j REDIRECT
OR
$ accept-all-ips start
$ accept-all-ips stop
```
### 模拟
- 模拟 Windows 内核模式和用户模式恶意软件
```
https://github.com/mandiant/speakeasy
$ speakeasy -t -o speakeasy.json 2> speakeasy.txt
```
- 识别能力
```
https://github.com/mandiant/capa
$ capa
$ capa -vv
```
## #3. - 静态代码分析
### 反汇编器
- 反汇编可执行文件
```
https://github.com/NationalSecurityAgency/ghidra
Window -> Symbol References
Window -> Function Graph
Window -> Function Call Trees
Right-click on green text to review other display options -> Set Equate -> Choose from a list of constants that match the hex value
Right-click an archive in the Data Type Manager window -> Apply Function Data Types -> Analysis -> One Shot
To modify Ghidra's interpretation, right-click on the DAT label -> Data -> Select 'string'
Right-click a function name -> Edit Label -> Type a new name -> OK
Right click function name -> References -> Show References to FUN_004064c8
Window -> Defined Strings
Right-click on a string -> References -> Show References to u_Application_Data
Right-click -> Search for -> Current Region -> String references
Right-click -> Search for -> Current Region -> Intermodular calls
```
## #4. - 动态代码分析
### 调试器
- 调试可执行文件
```
https://x64dbg.com/
Single-step = execute one instruction at a time
Drill into functions or execute them in one step (step-over)
Set breakpoints to interrupt code execution when you wish e.g. SetBPX ReadFile, and then Debug -> Run (F9)
Use Debug -> Run to user code (really good to get to the non-Windows DLL caller)
Use Debug -> Execute till return (gets to the RET instruction), and then single-step
Use Debug -> Run until selection to pause at that instruction
```
## #5. - 其他文件类型
### PDF
- 扫描 PDF 中的可疑关键字
```
$ pdfid.py
```
- 解析 PDF,定位特定对象,并显示其内容
```
$ pdf-parser.py -a
$ pdf-parser.py -s /URI
$ pdf-parser.py -k /URI
$ pdf-parser.py -o 6
$ pdf-parser.py -o 6 -d object6.jpg
$ pdf-parser.py -r 6
```
### 宏
- 解析 OLE 文件
```
$ oledump.py -i
$ oledump.py -s A3 -v
$ oledump.py -s 5 -S
$ oledump.py -s 7 -d | base64dump.py
```
### Shellcode 模拟
- 模拟 shellcode 的执行
```
$ scdbgc /f /s -1
$ scdbgc /f /s -1 /foff 3B
$ scdbgc /f /s -1 /foff 3B /fopen
```
### Shellcode 执行
- 执行 shellcode
```
$ runsc32 -f -o 0x3B -d -n
```
### YARA 规则
- 对文件运行 YARA
```
$ yara-rules
```
### RTF
- 获取 RTF 的概览
```
$ rtfdump.py
$ rtfdump.py -s 7
rtfdump.py -s 5 -H -d >
```
- Shellcode 模式
- 搜索 shellcode 模式
```
$ xorsearch -W -d 3
```
### JavaScript
- 美化 JavaScript
```
$ js-beautify
```
- 去混淆 JavaScript
```
$ js -f
$ js -f /usr/share/remnux/objects.js -f
```
- 用于脚本去混淆的 AMSI
```
PS C:\> logman start AMSITrace -p Microsoft-Antimalware-Scan-Interface Event1 -o AMSITrace.etl -ets
PS C:\> cscript
PS C:\> logman stop AMSITrace -ets
PS C:\> AMSIScriptContentRetrieval
```
标签:ANY.RUN, Ask搜索, CAPE, CheatSheet, DAST, Detect It Easy, MalwareBazaar, Packer识别, PEframe, PE分析, Process Explorer, Procmon, Regshot, VirusTotal, 云安全监控, 云资产清单, 合规性检查, 威胁情报, 字符串提取, 工具集, 开发者工具, 恶意软件分析, 文件系统监控, 沙箱, 注册表监控, 系统底层分析, 网络安全, 网络连接监控, 脱壳, 自动回退, 逆向工具, 逆向工程, 隐私保护, 静态分析