安全漏洞 / 严重 / 工具系统
electron/harness/tools/built-in/command.ts
project_memory.md 明确要求:
code-search must use execFile instead of exec to prevent command injection git tools must use execFile (not exec) to prevent command injection
但 RunCommandTool 仍使用 child_process.exec。exec 会经过 shell 解析,命令字符串中的 ; && | $() ` 等元字符会被 shell 解释,导致命令注入。
child_process.exec
;
&&
|
$()
`
即使 checkTokens 做了 token 分析,复杂的字符串拼接(如 r"m" -rf /)仍可绕过。
r"m" -rf /
import { execFile } from 'child_process'; // 修改前 exec(command, options, callback); // 修改后 execFile(command, argsArray, options, callback);
注意:
No dependencies set.
The note is not visible to the blocked user.
问题类型
安全漏洞 / 严重 / 工具系统
文件位置
electron/harness/tools/built-in/command.ts问题描述
project_memory.md 明确要求:
但 RunCommandTool 仍使用
child_process.exec。exec 会经过 shell 解析,命令字符串中的;&&|$()`等元字符会被 shell 解释,导致命令注入。即使 checkTokens 做了 token 分析,复杂的字符串拼接(如
r"m" -rf /)仍可绕过。影响
建议修复
注意: