IPBUF安全漏洞报告
English
CVE-2026-5007 CVSS 5.3 中危

CVE-2026-5007 mcp-docs-rag OS命令注入漏洞

披露日期: 2026-03-28

漏洞信息

漏洞编号
CVE-2026-5007
漏洞类型
OS命令注入
CVSS评分
5.3 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
kazuph mcp-docs-rag

相关标签

OS命令注入CVE-2026-5007mcp-docs-rag本地漏洞RCE

漏洞概述

kazuph mcp-docs-rag 0.5.0及之前版本中存在操作系统命令注入漏洞。该漏洞位于组件 add_git_repository/add_text_file 的 src/index.ts 文件中的 cloneRepository 函数。由于对用户输入缺乏有效过滤,攻击者可在本地利用该漏洞执行任意系统命令。目前漏洞利用代码已公开,且官方尚未发布修复补丁。

技术细节

该漏洞源于 src/index.ts 文件中的 cloneRepository 函数在处理仓库克隆操作时,直接将外部可控输入拼接到系统命令执行流中,未进行必要的清理或转义。攻击者只需拥有本地低权限账户(PR:L),且无需用户交互(UI:N),即可构造包含Shell元字符(如分号、管道符等)的恶意Payload。当应用程序执行 git clone 等操作时,恶意命令将被操作系统解析并执行。虽然攻击向量被限制为本地(AV:L),但成功的利用仍可能导致敏感信息泄露(C:L)、数据篡改(I:L)及服务中断(A:L)。

攻击链分析

STEP 1
1. 本地访问
攻击者获取目标系统的本地访问权限,或通过其他方式获得在本地执行脚本的能力。
STEP 2
2. 构造Payload
攻击者针对 cloneRepository 函数,构造包含Shell命令注入字符的恶意输入参数(如 '; touch /tmp/pwned')。
STEP 3
3. 触发漏洞
攻击者调用受影响的 add_git_repository/add_text_file 组件功能,将恶意Payload传递给 src/index.ts 中的 cloneRepository 函数。
STEP 4
4. 命令执行
应用程序未过滤输入直接拼接执行系统命令,导致攻击者注入的恶意命令在系统后台运行。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// PoC for CVE-2026-5007: OS Command Injection in mcp-docs-rag // Target: cloneRepository function in src/index.ts const vulnerableFunction = (repoUrl) => { // Simulating the vulnerable code pattern where user input is directly concatenated // Actual vulnerable code might look like: exec(`git clone ${repoUrl}`) const command = `git clone ${repoUrl}`; console.log(`Executing command: ${command}`); // In a real scenario, this would execute the command }; // Malicious payload to inject commands (e.g., creating a file or reversing shell) // Using semicolon to chain commands const maliciousPayload = "https://github.com/exploit/repo.git; touch /tmp/pwned; #"; console.log("[+] Triggering CVE-2026-5007..."); vulnerableFunction(maliciousPayload); console.log("[+] Check if /tmp/pwned exists to verify exploitation.");

影响范围

kazuph mcp-docs-rag <= 0.5.0

防御指南

临时缓解措施
由于官方尚未发布补丁,建议暂时禁用 add_git_repository/add_text_file 组件的功能。如果必须使用,应严格限制对相关API的调用来源,并在系统层面监控异常的Git进程或Shell命令执行行为。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表