作者:Luke Jennings ([email protected] - @jukelennings)
公司:Countercept (@countercept)
一套 Python2 脚本,用于扫描 IP 列表,检测由 Shadow Brokers 泄露的 DOUBLEPULSAR 植入程序的 SMB 和 RDP 版本。支持单 IP 检测和文件 IP 列表的多线程扫描。SMB 版本还支持远程卸载植入程序以进行修复,该功能得益于 @zerosum0x0 对操作码机制的逆向研究。
鉴于这些漏洞已在野外传播并被用于针对组织,本早期版本旨在帮助人们发现其网络中的受感染系统。它重新实现了植入程序的 ping 命令(可远程使用,无需身份验证),以判断系统是否已被感染。支持植入程序的 SMB 和 RDP 版本。
并非所有操作系统版本都经过测试,有些版本目前会失败。例如,Windows 2012 会拒绝 SMB 序列,返回 ACCESS_DENIED。然而,该系统并不易受 ETERNALBLUE 漏洞利用的影响,且 DOUBLEPULSAR 植入程序在尝试 ping 目标时也会收到同样的错误。因此,针对某些 Windows 版本的错误可能表明系统未被入侵。
root@kali:~# python detect_doublepulsar_smb.py --ip 192.168.175.128
[-] [192.168.175.128] No presence of DOUBLEPULSAR SMB implant
root@kali:~# python detect_doublepulsar_smb.py --ip 192.168.175.128
[+] [192.168.175.128] DOUBLEPULSAR SMB IMPLANT DETECTED!!!
root@kali:~# python detect_doublepulsar_rdp.py --file ips.list --verbose --threads 1
[*] [192.168.175.141] Sending negotiation request
[*] [192.168.175.141] Server explicitly refused SSL, reconnecting
[*] [192.168.175.141] Sending non-ssl negotiation request
[*] [192.168.175.141] Sending ping packet
[-] [192.168.175.141] No presence of DOUBLEPULSAR RDP implant
[*] [192.168.175.143] Sending negotiation request
[*] [192.168.175.143] Server chose to use SSL - negotiating SSL connection
[*] [192.168.175.143] Sending SSL client data
[*] [192.168.175.143] Sending ping packet
[-] [192.168.175.143] No presence of DOUBLEPULSAR RDP implant
[*] [192.168.175.142] Sending negotiation request
[*] [192.168.175.142] Sending client data
[*] [192.168.175.142] Sending ping packet
[+] [192.168.175.142] DOUBLEPULSAR RDP IMPLANT DETECTED!!!
root@kali:~# python2 detect_doublepulsar_smb.py --ip 192.168.175.136 --uninstall
[+] [192.168.175.136] DOUBLEPULSAR SMB IMPLANT DETECTED!!! XOR Key: 0x7c3bf3c1
[+] [192.168.175.136] DOUBLEPULSAR uninstall successful
# target network (adapt this to your network)
NETWORKRANGE=192.168.33.0/24
# install the required scanning tools
brew install masscan || apt-get install masscan
git clone https://github.com/countercept/doublepulsar-detection-script.git
cd doublepulsar-detection-script
# scan open ports
masscan -p445 $NETWORKRANGE > smb.lst
masscan -p3389 $NETWORKRANGE > rdp.lst
# clean the list of IPs
sed -i "s/^.* on //" smb.lst
sed -i "s/^.* on //" rdp.lst
# check vulnerabilities on the hosts who have the service open
python detect_doublepulsar_smb.py --file smb.lst
python detect_doublepulsar_rdp.py --file rdp.lst
# Or, if you have the python netaddr library
python detect_doublepulsar_smb.py --net 192.168.0.1/24
本仓库还包含三个 Snort 签名,可用于检测 SMB ping 工具使用的未实现 SESSION_SETUP Trans2 命令及其不同的响应情况。虽然我们不建议依赖签名进行有效的攻击检测(因为签名很容易被绕过),但这些规则具有很高的特异性,应该能提供一定的检测能力,可用于检测新威胁组织未经修改地复用这些漏洞和植入程序。
https://www.countercept.com/our-thinking/analyzing-the-doublepulsar-kernel-dll-injection-technique/
https://zerosum0x0.blogspot.co.uk/2017/04/doublepulsar-initial-smb-backdoor-ring.html