T05 · Unauthorized Access and Privilege Escalation
- Location
references/agent-usage.md:8- Finding
Unrestricted Unattended Agent Execution with Permission Checks Disabled
- Content
View full analysis
Vulnerability Details
File Location:
references/agent-usage.md, lines 8–11
Vulnerability Type: Unauthorized access and privilege escalation through disabled permission controls
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 workflow starts an unbounded autonomous loop and invokes Claude Code with
--dangerously-skip-permissions. This option disables the interactive permission checks intended to control filesystem access and command execution.The agent repeatedly consumes instructions from
prd.json, which is mutable project content rather than a trusted executable policy. If an attacker can create or modify that file, a malicious story can instruct the agent to perform operations beyond PRD management. Because permission checks are disabled, generated shell commands and file operations may run without user approval and with the privileges of the account that launched Claude Code.The infinite
while :loop further increases risk by repeatedly invoking the agent without an iteration limit, timeout, or reliable external stop condition. This can amplify destructive actions and cause excessive consumption of compute, API, or system resources.Attack Path
- A victim checks out or opens a project containing an attacker-controlled
prd.json, or an attacker modifies an existing PRD. - The PRD includes a story or acceptance criterion that induces unsafe commands, sensitive-file access, or unrelated system modifications.
- The victim starts the documented unattended loop.
- Claude Code reads and interprets the attacker-controlled PRD.
- The
--dangerously-skip-permissionsoption suppresses normal approval boundaries. - Agent-generated commands execute with the invoking user's operating-system privileges.
- The ...[truncated 756 chars]
- A victim checks out or opens a project containing an attacker-controlled
- Remediation
View remediation
Remediation Suggestions
- Remove
--dangerously-skip-permissionsand retain interactive approval for command execution, sensitive-file access, network operations, and writes outside the project workspace. - Replace
while :with a bounded runner that enforces a maximum number of iterations, execution timeout, and explicit failure handling. - Require human approval before each story is implemented and before any commit, migration, package installation, network request, or destructive command.
- Treat
prd.json,prompt.md, andprogress.txtas untrusted input. Validate them against a strict schema and reject shell commands, requests for secrets, instructions outside the repository, and attempts to override agent safety controls. - Run the agent in an isolated container or sandbox with a read-only host filesystem, a dedicated non-privileged account, minimal environment variables, no unnecessary credentials, and restricted network access.
- Apply command and path allowlists. Restrict writes to the intended worktree and prevent access to SSH keys, cloud credentials, shell configuration, system directories, and unrelated repositories.
- Add a deterministic stop condition outside the model, and stop immediately when no incomplete story remains, validation fails, or behavior deviates from the declared PRD scope.
- Log and review every generated command and file change before merging or deploying the result.
- Remove
