T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/claude-delegate.sh:128- Finding
Unenforced Unrestricted Execution Mode
- Content
View full analysis
Vulnerability Details
File Location:
scripts/claude-delegate.sh, lines 84-87, 128-145, and 192-195
Vulnerability Type: Unrestricted permission bypass without independently verified operator approval
Risk Level: HighVulnerable Code
bash --permission-mode) permission_mode="${2:?--permission-mode requires a mode}" shift 2 ;;bash if [[ -n "$permission_mode" ]]; then case "$permission_mode" in plan|acceptEdits|dontAsk|auto|bypassPermissions) ;; *) echo "--permission-mode must be plan, acceptEdits, dontAsk, auto, or bypassPermissions" >&2 exit 2 ;; esac else case "$sandbox" in read-only) permission_mode="plan" ;; workspace-write) permission_mode="acceptEdits" ;; danger-full-access) permission_mode="bypassPermissions" ;; esac fibash if [[ "$permission_mode" == "bypassPermissions" ]]; then # Make the bypass option available (recommended only for isolated sandboxes). cmd+=(--allow-dangerously-skip-permissions) fiTechnical Analysis
The wrapper accepts
bypassPermissionsdirectly through--permission-modeand also maps--sandbox danger-full-accessto that mode. It then supplies--allow-dangerously-skip-permissionsto Claude Code.Although
SKILL.mdstates that unrestricted mode should only be used on an isolated machine or container with explicit operator approval, the script does not enforce either condition. There is no trusted approval gate, environment isolation check, interactive confirmation, policy file, or caller authorization check before permission controls are disabled.Consequently, any caller able to influence the wrapper arguments can convert a delegated, prompt-driven task into unrestricted tool execution under the operating-system account running the wrapper. The supported
--add-diroption can further broaden the filesystem scope presented to Clau ...[truncated 1990 chars]- Remediation
View remediation
Remediation Suggestions
- Remove
bypassPermissionsanddanger-full-accessfrom the skill-facing interface unless unrestricted execution is an essential requirement. - Reject direct
--permission-mode bypassPermissionsoverrides by default. - If unrestricted execution must remain available, require an independently verified, operator-controlled opt-in that cannot be supplied by delegated prompt content or ordinary skill arguments.
- Add a trusted policy configuration outside the delegated workspace that identifies whether unrestricted execution is permitted.
- Require an interactive confirmation through a trusted terminal, or a short-lived authorization token generated outside the agent-controlled context.
- Run all unrestricted or write-capable tasks inside an isolated container or disposable virtual machine with:
- A narrowly mounted workspace.
- No host credential directories.
- A non-privileged user.
- Read-only system mounts.
- Restricted or disabled network access.
- Resource and execution time limits.
- Canonicalize and validate every
--add-dirpath against an operator-approved allowlist. Reject paths outside approved workspace roots and prevent symlink-based escapes. - Keep
planmode as the default and permitacceptEditsonly for tasks that explicitly require modifications. - Record security-relevant invocations, including permission mode, approved directories, caller identity, and approval source, while excluding prompts or data that may contain secrets.
- Treat prompts and repository contents as untrusted input and ensure they cannot change the authorization mode selected by the trusted orchestration layer.
- Remove
