T05 · Unauthorized Access and Privilege Escalation
- Location
references/agent-usage.md:10- Finding
Unrestricted Unattended Agent Execution
- Content
View full analysis
Vulnerability Details
File Location:
references/agent-usage.md, lines 10–13
Vulnerability Type: Unauthorized access and privilege escalation through disabled permission enforcement
Risk Level: HighVulnerable Code
bash while :; do claude --print --dangerously-skip-permissions \ "Read prd.json, find first story where passes=false, implement it, run checks, update passes=true if successful" doneTechnical Analysis
The documented command launches an infinite autonomous coding-agent loop with
--dangerously-skip-permissions. This option disables the agent's interactive permission safeguards while the agent reads project-controlledprd.jsoncontent, edits source files, and runs commands.This violates least-privilege principles because the Skill's declared purpose is to create and manage PRDs, yet the recommended workflow grants an implementation agent broad, unattended access under the invoking user's account. PRD fields must be treated as untrusted task data rather than trusted executable instructions. A malicious or compromised PRD could contain acceptance criteria or story text crafted to induce unsafe shell commands, access files outside the project, or perform unrelated operations.
The unbounded
while :loop compounds the risk by repeatedly invoking the agent without a maximum iteration count. Failed, destructive, or resource-intensive behavior may therefore recur indefinitely.Attack Path
- An attacker modifies or contributes a project
prd.json, including malicious instructions in a user story, description, acceptance criteria, or notes. - A user follows the documented unattended-loop example.
- Claude Code reads and interprets the attacker-controlled PRD content.
- The
--dangerously-skip-permissionsoption removes interactive authorization barriers for tool use. - The agent may execute attacker-influenced commands or file operations with the invoking user's effective privileges.
- The infinite ...[truncated 1245 chars]
- An attacker modifies or contributes a project
- Remediation
View remediation
Remediation Suggestions
- Remove
--dangerously-skip-permissionsfrom all documented commands and retain interactive approval for privileged tool operations. - Replace the infinite loop with a bounded workflow that processes one story per invocation or enforces a strict maximum iteration count.
- Require explicit human approval before:
- Executing shell commands.
- Accessing files outside the designated repository or worktree.
- Using the network.
- Reading credentials or sensitive configuration.
- Creating commits or changing branches.
- Treat all PRD fields as untrusted data. Add agent instructions stating that story content cannot override security constraints, expand filesystem scope, request secrets, or authorize unrelated commands.
- Validate the PRD against a strict schema and reject unexpected fields or instruction-like content that requests privileged behavior.
- Run autonomous implementation in an isolated container or restricted worktree with:
- No mounted credentials or secrets.
- Minimal filesystem permissions.
- Restricted or disabled network access.
- A non-privileged operating-system account.
- CPU, memory, execution-time, and process limits.
- Stop on failed checks or unexpected modifications rather than automatically retrying.
- Present a diff and command log for human review before marking a story complete or persisting repository changes.
- Remove
