CVE-2025-67442 分析报告
<h1>CVE-2025-67442 分析报告:CE 6.2.0-4 存在性评估</h1><blockquote>
<p><strong>分析日期</strong>:2026-05-15<br />
<strong>分析版本</strong>:EVE-NG CE 6.2.0-4<br />
<strong>分析方法</strong>:源码分析 + 三步过滤法(情境/链路/场景)</p>
</blockquote>
<hr />
<h2>1. CVE 概述</h2>
<table>
<thead>
<tr>
<th>项目</th>
<th>内容</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>CVE ID</strong></td>
<td>CVE-2025-67442</td>
</tr>
<tr>
<td><strong>原始报告</strong></td>
<td><a href="https://github.com/XunMInt/cve/blob/main/EVE-NG_20251207.md">XunMInt/cve</a></td>
</tr>
<tr>
<td><strong>影响版本</strong></td>
<td>EVE-NG 6.4.0-13-PRO(专业版)</td>
</tr>
<tr>
<td><strong>CVSS 3.1</strong></td>
<td>7.6 HIGH (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L)</td>
</tr>
<tr>
<td><strong>CWE</strong></td>
<td>CWE-22 — Path Traversal</td>
</tr>
<tr>
<td><strong>漏洞类型</strong></td>
<td>目录遍历(<code>/api/export</code> 接口)</td>
</tr>
</tbody>
</table>
<h3>漏洞描述</h3>
<p><code>/api/export</code> 接口在处理用户提交的文件路径参数时,未对 <code>..</code> 路径穿越序列做过滤。攻击者构造包含 <code>../../</code> 的 JSON 请求,可读取任意系统文件并打包到 ZIP 导出。</p>
<hr />
<h2>2. 源码验证</h2>
<h3>2.1 路由入口</h3>
<p><code>api.php:1236</code></p>
<pre><code class="language-php">$app -> post('/api/export', function() use ($app, $db) {
// ...
$p = json_decode(json_encode($event), True);
$output = apiExportLabs($p);
});
</code></pre>
<h3>2.2 漏洞函数</h3>
<p><code>api_labs.php:201-278</code> — <code>apiExportLabs()</code></p>
<h4>path 参数有校验(安全)</h4>
<p><code>api_labs.php:208</code></p>
<pre><code class="language-php">if (checkFolder(BASE_LAB.$p['path']) !== 0) {
// Path is not valid → 返回 400
}
</code></pre>
<p><code>functions.php:88-92</code> — <code>checkFolder()</code> 正则:</p>
<pre><code class="language-php">function checkFolder($s) {
if (preg_match('/^\/[\/A-Za-z0-9_\s-]*$/', $s) && is_dir($s)) {
return 0;
}
// ...
}
</code></pre>
<blockquote>
<p>✅ <code>path</code> 参数被正则保护,<code>.</code>, <code>..</code> 字符被禁止</p>
</blockquote>
<h4>element 参数无校验(漏洞)</h4>
<p><code>api_labs.php:224-258</code></p>
<pre><code class="language-php">foreach ($p as $key => $element) {
if ($key === 'path') {
continue;// 跳过 path,处理其他参数
}
$relement = substr($element, strlen($p['path']));
if ($relement != '/') {
$relement = '/'.$relement;
}
// ❌ 未对 $relement 做任何过滤,直接拼接到 is_file / zip 命令
if (is_file(BASE_LAB.$p['path'].$relement)) {
$cmd = 'zip '.$export_file.' ".' .$relement.'"';
exec($cmd, $o, $rc);
}
}
</code></pre>
<blockquote>
<p>❌ <code>element</code> 参数(如 <code>"1": "/../../../../../etc/passwd"</code>)没有经过 <code>checkFolder()</code> 或任何 <code>..</code> 过滤</p>
</blockquote>
<h3>2.3 调用链</h3>
<pre><code>POST /api/export
→ api.php:1236 路由
→ api_labs.php:201 apiExportLabs($p)
→ checkFolder(BASE_LAB.$p['path']) ← path 参数受保护
→ foreach: $relement = ... ← element 参数不受保护
→ is_file(BASE_LAB.$path.$relement) ← 路径穿越
→ exec('zip ... ".'.$relement.'"') ← 打包任意文件
</code></pre>
<hr />
<h2>3. 三步过滤法评估(适用于 CE 6.2.0-4)</h2>
<h3>第一层:情境过滤 — 多用户模型</h3>
<table>
<thead>
<tr>
<th>检查项</th>
<th align="center">结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>CVE 原始攻击者角色</td>
<td align="center"><code>regular user</code>(PRO 多用户)</td>
</tr>
<tr>
<td>CE 用户模型</td>
<td align="center">单用户(只有 admin)</td>
</tr>
<tr>
<td>CE 中是否有权限边界可跨越?</td>
<td align="center">❌ 无 — admin = root</td>
</tr>
<tr>
<td>结论</td>
<td align="center"><strong>CE 单用户下无提权路径</strong></td>
</tr>
</tbody>
</table>
<h3>第二层:链路过滤 — 前端盲区</h3>
<table>
<thead>
<tr>
<th>检查项</th>
<th align="center">结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>前端是否调用了此 API?</td>
<td align="center">✅<code>actions.js:1695</code>, <code>mainCtrl.js:474</code></td>
</tr>
<tr>
<td>前端是否允许用户手动输入路径?</td>
<td align="center">❌ 用 <code>data-path</code> 属性,非自由输入</td>
</tr>
<tr>
<td>API 是否可直接 curl 访问?</td>
<td align="center">✅ 带认证 cookie 即可</td>
</tr>
<tr>
<td>前端是否阻止 <code>..</code>?</td>
<td align="center">无此需求(data-path 不含 <code>..</code>)</td>
</tr>
<tr>
<td>结论</td>
<td align="center"><strong>API 层可绕过前端,但 CE 中攻击者已是 admin</strong></td>
</tr>
</tbody>
</table>
<h3>第三层:场景过滤 — 功能正确性</h3>
<table>
<thead>
<tr>
<th>检查项</th>
<th align="center">结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>导出系统文件(如 <code>/etc/passwd</code>)是否是用户意图?</td>
<td align="center">❌ 不是</td>
</tr>
<tr>
<td>这是否是代码缺陷?</td>
<td align="center">✅ 是(缺少输入校验)</td>
</tr>
<tr>
<td>admin 能否通过漏洞读到本不可读的文件?</td>
<td align="center">❌ 不能 — admin 已有完全文件访问权限</td>
</tr>
<tr>
<td>结论</td>
<td align="center"><strong>是代码质量缺陷,非 CE 安全漏洞</strong></td>
</tr>
</tbody>
</table>
<hr />
<h2>4. 最终结论</h2>
<table>
<thead>
<tr>
<th align="center">维度</th>
<th align="center">结论</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">漏洞代码是否存在?</td>
<td align="center">✅<strong>存在</strong> — <code>api_labs.php:235-237</code>,<code>element</code> 参数无 <code>..</code> 过滤</td>
</tr>
<tr>
<td align="center">CE 中能否从 Web UI POC?</td>
<td align="center">✅ 可行(curl + cookie)</td>
</tr>
<tr>
<td align="center"><strong>CE 中是否构成安全风险?</strong></td>
<td align="center"><strong>❌ 否</strong></td>
</tr>
<tr>
<td align="center">原因</td>
<td align="center">CE 单用户 admin = root,无权限边界可跨越</td>
</tr>
</tbody>
</table>
<h3>与之前 30→0 审计的关系</h3>
<p>本次分析与之前安全审计结论一致:CE 6.2.0-4 中的代码缺陷表现为 <strong>代码质量缺陷(缺少输入校验)</strong>,但 CE 单用户模型下<strong>不存在可被有效利用的安全攻击路径</strong>。</p>
<h3>修复建议(如需)</h3>
<p>若 CE 未来支持多用户,需在 <code>apiExportLabs()</code> 中添加 <code>$relement</code> 的 <code>..</code> 过滤:</p>
<pre><code class="language-php">// 在 api_labs.php:230 之后添加
if (strpos($relement, '..') !== false) {
continue;// 跳过含路径穿越的参数
}
</code></pre>
<p>或使用 <code>realpath()</code> 校验最终路径是否在 <code>BASE_LAB</code> 范围内。</p>
<hr />
<h2>5. 证据索引</h2>
<table>
<thead>
<tr>
<th>文件</th>
<th align="center">行号</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>api.php</code></td>
<td align="center">1236</td>
<td><code>/api/export</code> 路由注册</td>
</tr>
<tr>
<td><code>api_labs.php</code></td>
<td align="center">201-278</td>
<td><code>apiExportLabs()</code> 函数完整实现</td>
</tr>
<tr>
<td><code>api_labs.php</code></td>
<td align="center">208</td>
<td><code>checkFolder()</code> 保护 <code>path</code> 参数</td>
</tr>
<tr>
<td><code>api_labs.php</code></td>
<td align="center">235-237</td>
<td>❌<code>element</code> 参数无校验 → 路径穿越</td>
</tr>
<tr>
<td><code>functions.php</code></td>
<td align="center">88-92</td>
<td><code>checkFolder()</code> 正则(禁止 <code>.</code>)</td>
</tr>
<tr>
<td><code>actions.js</code></td>
<td align="center">1695-1700</td>
<td>前端调用 <code>/api/export</code>(data-path)</td>
</tr>
<tr>
<td><code>functions.js</code></td>
<td align="center">466-496</td>
<td>前端 <code>exportObjects()</code> 封装</td>
</tr>
</tbody>
</table>
页:
[1]