T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:64- Finding
Unrestricted Coding-Agent Execution with Exposure of the User Environment
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 64–71; the unrestricted permission option is also used at line 29
Vulnerability Type:T05: Unauthorized Access and Privilege Escalation
Risk Level: HighVulnerable Code
bash # Non-interactive mode recommended for parallel tasks cd /path/to/worktree claude --permission-mode bypassPermissions --print 'Task description' # Note: source the shell configuration first to load environment variables source ~/.zshrc && claude --permission-mode bypassPermissions --print 'Task description'A duplicate unrestricted launch pattern appears earlier:
bash cd ../project-feature-a && claude --permission-mode bypassPermissions --print 'Implement user login functionality'Technical Analysis
The documented
--permission-mode bypassPermissionsoption disables the coding agent's normal permission and approval boundary. This gives agent-generated operations broader authority than is necessary to perform development inside a Git worktree. Git worktrees provide source-tree separation, but they do not sandbox processes or prevent access to the user's other files, credentials, network resources, or commands.The second command compounds this exposure by sourcing
~/.zshrcbefore starting the unrestricted agent. A shell configuration can export API keys, cloud credentials, repository tokens, database connection strings, and other sensitive values. It can also execute startup commands or define wrappers and aliases. Consequently, the agent may inherit sensitive credentials and the user's full ambient authority while operating without normal approval prompts.This becomes exploitable if the agent processes malicious repository instructions, adversarial task content, compromised build scripts, or prompt-injection material embedded in source files. No malicious payload is embedded in this project itself; the risk arises from the unsafe execution procedure it explicitly recommends.
Attac
...[truncated 1896 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--permission-mode bypassPermissionsfrom every example, including the command at line 29 and the Claude Code examples at lines 67 and 70. - Use the agent's default interactive approval mode or a narrowly scoped allowlist permitting only commands required for the assigned task.
- Do not source the complete
~/.zshrcbefore launching an agent. Provide only explicitly required environment variables through a minimal environment file or per-command variable assignments. - Ensure secrets are not inherited unless indispensable. Use short-lived, task-specific credentials with minimal repository and service permissions.
- Run each coding agent in a sandbox or container that restricts filesystem access to its assigned worktree.
- Restrict network access by default and require explicit approval for package downloads, remote API access, pushes, and pull-request creation.
- Require user confirmation for destructive commands, dependency installation, credential access, and modifications outside the assigned worktree.
- Treat repository files, task descriptions, dependency output, and build logs as untrusted content that may contain prompt-injection instructions.
- Document that Git worktrees isolate working directories but do not provide a process-level security boundary.
- Remove
