如何使用Uchihash处理恶意软件中的嵌入式哈希
2023-03-07 09:07:03 时间
关于Uchihash
Uchihash是一款功能强大的实用工具,可以帮助广大研究人员处理和分析嵌入在恶意软件之中的各种哈希,以节省恶意软件分析所需的时间。
Uchihash支持的分析内容如下:
- 动态导入API(尤其是Shellcode中的);
- 检测正在运行的进程(分析工具的进程,反分析机制);
- 检测虚拟机或反病毒工具(反分析机制);
Uchihash可以使用广大研究人员自己定义的哈希算法生成哈希,在已生成的哈希映射中搜索哈希列表,还可以生成一个IDAPython脚本,并用相应的值对哈希进行注释,以便研究人员对其进行分析。
工具安装
广大研究人员可以使用下列命令将该项目源码克隆至本地,并安装好依赖组件:
$ git clone https://github.com/N1ght-W0lf/Uchihash.git
$ pip install -r requirements.txt
(向右滑动,查看更多)
工具使用
usage: uchihash.py [-h] [--algo ALGO] [--apis] [--keywords] [--list LIST] [--script SCRIPT] [--search SEARCH] [--hashes HASHES] [--ida]
optional arguments:
-h, --help show this help message and exit
--algo ALGO Hashing algorithm
--apis Calculate hashes of APIs
--keywords Calculate hashes of keywords
--list LIST Calculate hashes of your own word list
--script SCRIPT Script file containing your custom hashing algorithm
--search SEARCH Search a JSON File containing hashes mapped to words
--hashes HASHES File containing list of hashes to search for
--ida Generate an IDAPython script to annotate hash values
Examples:
* python uchihash.py --algo crc32 --apis
* python uchihash.py --algo murmur3 --list mywords.txt
* python uchihash.py --search hashmap.txt --hashes myhashes.txt
(向右滑动,查看更多)
参数选项
- --algo: 其中一个可用的哈希算法
- --apis: 对一个Windows API列表计算哈希 (可参考data/apis_list.txt)
- --keywords: 对恶意软件家族所使用的常见关键词计算哈希 (可参考data/keywords_list.txt)
- --list : 自定义关键词列表,每个关键词单独占一行 (可参考examples/mywords.txt)
- --script: 哈希函数必须由hashme() 调用,返回的值必须为十六进制格式0xDEADBEEF (可参考examples/custom_algo.txt)
- --search: 待搜索文件格式必须为JSON格式 (可参考examples/searchme.txt)
- --hashes: 每个哈希值单独占一行,必须为十六机制格式 (可参考examples/myhashes.txt)
可用的哈希算法
md4
md5
sha1
sha224
sha256
sha384
sha512
ripemd160
whirlpool
crc8
crc16
crc32
crc64
djb2
sdbm
loselose
fnv1_32
fnv1a_32
fnv1_64
fnv1a_64
murmur3
工具使用样例
我们以一个真实的恶意软件家族为例,在我们的例子中我们选择使用BuerLoader。
首先,我们需要在Python中实现哈希算法:
def ROR4(val, bits, bit_size=32):
return ((val & (2 ** bit_size - 1)) >> bits % bit_size) | \
(val << (bit_size - (bits % bit_size)) & (2 ** bit_size - 1))
def hashme(s):
res = 0
for c in s:
v3 = ROR4(res, 13)
v4 = c - 32
if c < 97:
v4 = c
res = v4 + v3
return hex(res)
(向右滑动,查看更多)
接下来,计算所有API的哈希值:
$ python uchihash.py --script custom_algo.py --apis
(向右滑动,查看更多)
最后,搜索BuerLoader在生成的hashmap中所使用的哈希值,我们还可以生成一个IDAPython脚本,并对响应API名称的哈希进行注释:
$ python uchihash.py --search output/hashmap.txt --hashes buer_hashes.txt --ida
(向右滑动,查看更多)
我们此时将会得到两个输出文件,其中一个为"output/search_hashmap.txt,它可以将BuerLoader中的所有哈希值映射为API名称:
{
"0x8a8b468c": "LoadLibraryW",
"0x302ebe1c": "VirtualAlloc",
"0x1803b7e3": "VirtualProtect",
"0xe183277b": "VirtualFree",
"0x24e2968d": "GetComputerNameW",
"0xab489125": "GetNativeSystemInfo",
.......
}
(向右滑动,查看更多)
另一个文件为"output/ida_script.py",它负责向你的idb中添加注释:
项目地址
Uchihash:https://github.com/N1ght-W0lf/Uchihash
相关文章
- 如何在 Linux 命令行中切换用户
- 在 Linux 中创建 LVM 分区的分步指南
- 在 Linux 命令行中使用 tcpdump 命令分析网络数据
- 微软 Windows 10 21H2 Build 19044.2132 (KB5020435) OOB 更新发布
- 预提交Hooks的DevOps工程师要知道如何控制Kubernetes资源
- Go语言如何自定义linter(静态检查工具)
- 两分钟小技巧!如何阻止 MacOS 的触底弹性滚动和双指手势导航
- 跟着小白一起学鸿蒙--写个简单的LED驱动(九)
- 提升Github使用体验的八个技巧
- 一看就懂的适配器设计模式
- useradd 命令和 adduser 命令都可以用来添加用户,那二者的区别是什么?
- 被Diss性能差,Dan连夜优化React新文档
- 服务器支持 IPv6 的原因
- 微软详解 Windows 11/10 Edge 浏览器 106 效率模式:支持平衡和最大省电
- 如何在 Fedora、CentOS、RHEL 中启用 RPM Fusion 仓库
- 如何在 Linux 命令行中查找 IP 地址
- 微软 Windows 11/10 免费工具集 PowerToys 将添加专用的 hosts 文件编辑器
- 基于OpenHarmony开发板的环境搭建及烧录过程(拓维Niobe开发板)
- 大数据 Hadoop 环境搭建图文详解
- OpenHarmony学生挑战赛参赛经验分享