文章目录
- 环境说明
- [1 MS12_020 简介](#1 MS12_020 简介)
- [2 MS12_020 复现过程](#2 MS12_020 复现过程)
- [3 MS12_020 安全加固](#3 MS12_020 安全加固)
环境说明
- 渗透机操作系统:kali-linux-2024.1-installer-amd64
- 漏洞复现操作系统: cn_win_srv_2003_r2_enterprise_with_sp2_vl_cd1_X13-46432
1 MS12_020 简介
MS12_020 漏洞全称为:Microsoft Windows 远程桌面协议远程代码执行漏洞。 远程桌面协议(Remote Desktop Protocol,RDP),是一个多通道(mutil-channel)的协议,让用户(客户端或称"本地电脑")连上提供微软终端机服务的计算机(服务器端或称"远程计算机")。Windows 在处理某些对象是存在错误,可通过特制的 RDP 报文访问未初始化的或已经删除的对象,导致任意代码执行,进而控制系统。
2 MS12_020 复现过程
在开始之前请关闭靶机的防火墙, 关于渗透机和靶机环境可自行Bing。
靶机要开启3389端口,即开启远程桌面服务。这个很重要一定要开启!!!
不知道到怎么开启可以自行Bing
步骤01、
打开网络拓补,单机 "启动"按钮,启动实现虚拟机,如图所示。

步骤02、
使用ifconfig
和 ipconfig
命令分别获取渗透机和靶机的IP的地址,使用ping
命令进行网络 连通性测试,确保网络可达。
渗透机的IP 地址为 192.168.254.134,如图所示。
渗透机的IP地址

靶机的IP地址为 192.168.254.130,如图所示。
靶机的IP 地址

步骤03、
使用 msfconsole
命令打开 Metasploit 渗透测试平台,如图所示。
启动 Metasploit

步骤04、
使用 search
命令搜索 auxiliary/scanner/rdp/ms12_020_check 模块验证目标靶机是否存在此漏洞,如图所示。
搜索 MS12_020 相关模块

然后使用 use auxiliary/scanner/rdp/ms12_020_check
命令调用扫描模块,并使用 show options
命令查看模块的详细参数,如图所示。
查看配置参数

步骤05、
使用 set RHOSTS
命令设置靶机的地址,然后使用 exploit
和 run
命令运行扫描模块,如图所示。
运行检查脚本

步骤06、
检查发现目标靶机存在此漏洞,使用 use
命令调用 auxiliary/dos/windows/rdp/ms12_020_maxchannelids
漏洞利用模块,并对远程靶机的 IP 地址进行设置,如图所示。
查看设置参数

步骤07、
使用 set RHOSTS
命令设置远程靶机的地址,然后使用 run
或者 exploit
命令来运行该模块,如图所示。
运行检测脚本,成功了

根据执行 ms12_020 模块反馈信息可知,目标靶机系统已关闭,此时进入蓝屏状态,如图所示。
触发蓝屏错误

3 MS12_020 安全加固
步骤08、
对服务进行加固,在 Windows 操作系统中关闭远程桌面协议(Remote Desktop Services、Terminal Services、Remote Assistance 服务)实现加固,如图所示。
修改 TermServices 服务状态 (我靶机上没有其他服务不知道咋回事,有知道的可以留言)

步骤09、
再次对该系统的 3309 端口进行渗透测试,发现已无法成功,如图所示。
再次运行溢出模块

步骤10、
大多数客户已启用自动更新,无需采取任何操作,因为将自动下载并安装此安全更新。 未启用自动更新的客户需要检查更新并手动安装此更新。 有关自动更新中的特定配置选项的信息,请参阅 Microsoft 知识库文章294871。
对于管理员和企业安装,或想要手动安装此安全更新的最终用户,Microsoft 建议客户使用更新管理软件立即应用更新,或者检查使用 Microsoft 更新服务进行更新。
官方安全公告

步骤11、
在受影响的软件中,找到自己的操作系统,单击进入并下载相应的补丁安装包,本任务中使用的操作系统版本为 Windows Server 2003 R2,如图所示。
下载漏洞补丁

步骤12、
打开 Windows6.1-KB2621440-x64.msu 来安装补丁并重启计算机,如图所示。
安装补丁程序

步骤13、
使用 use auxiliary/scanner/rdp/ms_020_check
命令检查靶机是否存在MS12_020 漏洞,发现此时目标靶机服务器状态已经变成了 not exploitable(无法溢出),如图所示。
再次运行溢出模块

步骤14、
使用 nmap -sV -p 3389 -n -T4 靶机IP
命令来扫描靶机的3389 端口开放状态,如图所示。
扫描服务开放状态

步骤15、
再次调用 dos/windows/rdp/ms12_020_maxchannelids 模块,使用 exploit 命令运行溢出模块,发现已经无法对目标靶机进行利用,如图所示。
再次运行溢出模块
