trust-boundary-analysis
它能做什么
这项技能是针对命令行工具、IDE 扩展和插件系统的审计指南,这些工具会从当前文件夹读取设置。适合检查工具启动方式的开发人员和安全审查人员。
适用场景
- ✓当开发人员要求智能体检查命令行工具或 IDE 工具是否信任其打开的任意文件夹中的设置文件时。
- ✓当智能体追踪工具的启动顺序,以确定项目文件与用户文件之间哪个配置生效时。
- ✓当团队审查会从项目目录加载代码或 MCP 服务器的插件系统时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/trust-boundary/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的开发工具能否运行用户刚打开的项目文件夹中的设置文件里的命令?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体追踪工具如何查找配置文件,梳理哪些文件先被加载,并检查项目文件在运行命令之前是否经过信任确认。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Trust Boundary Analysis
This skill targets the vulnerability class that produced 5 RCE vectors in Google Gemini CLI from a single architectural flaw: missing workspace trust. Developer tools that auto-load configuration from untrusted directories are a rich attack surface.
When to Use
Apply this skill when the target:
- Loads
.env,settings.json, or config files from the current working directory - Has a plugin/extension system that auto-discovers and loads code
- Spawns child processes with configuration-controlled commands
- Is a CLI tool, IDE extension, language server, or build tool
- Uses MCP (Model Context Protocol) servers configured via project files
Startup Sequence Audit
For any CLI tool or developer application, trace the full initialization:
1. Config file discovery
grep -rn 'readFile\|readFileSync\|fs.read\|open(' --include='*.ts' --include='*.js' \
/workspace/target/src/ | grep -i 'config\|settings\|env\|rc\|\.json'
Map the search order. Common dangerous patterns:
cwd/.tool/config.json→cwd/.env→~/.tool/config→/etc/tool/config- If the local (cwd) config is loaded BEFORE the user's global config, the attacker's repo-level config wins.
Record each config loading point:
kg_add_node("code_location", "loadConfig() reads .env from cwd",
props={"file": "src/config/settings.ts", "line": 42, "trust_level": "untrusted"})
2. Environment variable injection
grep -rn 'process\.env\|os\.environ\|env::var\|getenv' --include='*.ts' \
--include='*.py' --include='*.rs' /workspace/target/src/
Check: Are env vars from .env files injected into process.env? Which vars
control dangerous behavior? Look for:
*_COMMAND,*_CMD,*_EXEC→ shell execution*_PROXY→ SSRF / network interception*_PATH,*_DIR→ path traversal*_URL→ open redirect / SSRFDEBUG,NODE_ENV→ bypass security controls
3. Workspace trust check
grep -rn 'trust\|isTrusted\|workspace.*safe\|folder.*trust' --include='*.ts' \
--include='*.js' /workspace/target/src/
Look for the pattern:
// DANGEROUS: trust disabled by default
if (!settings.folderTrustEnabled) {
return { isTrusted: true }; // ← All workspaces trusted
}
If no trust check exists, every config is loaded blindly. This is the root cause.
4. Command execution from config
grep -rn 'spawn\|exec\|execSync\|child_process\|subprocess\|os\.system\|Popen' \
--include='*.ts' --include='*.js' --include='*.py' /workspace/target/src/
For each spawn/exec call, check:
- Is
shell: trueset? → shell injection via crafted values - Does the command come from config? → attacker-controlled execution
- Is there any validation/allowlist on the command?
5. Plugin/tool auto-discovery
grep -rn 'discoverTools\|loadPlugins\|autoDiscover\|mcpServers\|toolDiscovery' \
--include='*.ts' --include='*.js' /workspace/target/src/
Check: Are plugins/tools loaded from project-level config BEFORE any user confirmation? MCP servers, language server plugins, and build tool extensions are common vectors.
Trust Boundary Graph Modeling
Map the attack flow as a chain in the knowledge graph:
ENTRYPOINT (malicious .env file in cloned repo)
→ enables → ENV_INJECT (process.env poisoned)
→ enables → SHELL_EXEC (spawn with shell:true)
→ reaches → CROWN_JEWEL (arbitrary code execution)
Use low edge weights (0.2–0.4) for automatic/silent steps. Use higher weights (1.0+) for steps requiring user interaction.
Then call plan_attack_chains(top_k=5) to surface the cheapest paths.
Shell Quoting Vulnerabilities
When config values flow into shell commands, check for:
- Direct interpolation:
`command ${userValue}`→ injection via; id - Single-quote escape:
osascript -e '${path}'→ escape via'in path - Env var in shell context:
PROXY_CMD="curl evil.com"→ executed as-is - Argument injection:
spawn('git', ['clone', userUrl])→--upload-pack=prefix
For each, the PoC pattern is:
- Craft input that breaks out of the quoting context
- Inject a command that proves execution (
id,env, write a sentinel file) - Use
validate_findingwith the sentinel as the success pattern
Negative Control
Always test: does the same code path execute WITHOUT the malicious config? The negative control is the same operation with a clean/empty config directory. If the behavior occurs regardless, it's no
常见问题
为什么当前文件夹很重要?
该技能指出,项目文件夹中可能包含工具会自动加载的配置,因此恶意的代码仓库可能影响用户。
什么是工作区信任?
该技能将其描述为:在使用文件夹中的设置或插件之前,先询问该文件夹是否可信的一项检查。
哪些工具适用于这项检查?
该技能列出了开发工具、命令行工具、IDE 扩展、语言服务器以及读取项目配置的构建工具。
详情
作者的原始描述
Trust boundary mapping and startup sequence audit for developer tools, CLI apps, and plugin systems. Load when the target is a developer tool, CLI, IDE extension, or any application that loads config from the current directory.
热度
- GitHub 星标
- 6.5k
- 排名
- #13979
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …