T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/permission-guard.sh:84
- Finding
- Automatic Permanent Approval Bypasses Agent Permission Boundaries<![CDATA[ ## Vulnerability Details **File Location**: `scripts/permission-guard.sh:84-98`; related behavior in `scripts/watchdog.sh:198-219` and `scripts/watchdog.sh:1110-1127` **Vulnerability Type**: Automatic permission approval and unrestricted agent execution **Risk Level**: High ### Vulnerable Code ```bash tail_content=$($TMUX capture-pane -t "${SESSION}:${window}" -p 2>/dev/null | tail -8) || return if is_permission_prompt "$tail_content"; then ( flock -n 200 || { log "⏭ Skipped ${window} (locked)"; exit 0; } local recheck recheck=$($TMUX capture-pane -t "${SESSION}:${window}" -p 2>/dev/null | tail -8) || exit 0 if is_permission_prompt "$recheck"; then $TMUX send-keys -t "${SESSION}:${window}" "p" Enter set_cooldown "$safe_name" log "✅ Auto-approved permission in ${window}" fi ) 200>"${LOCK_DIR}/${safe_name}.lock" fi ``` The related Gemini startup logic defaults to unrestricted approval: ```bash # Gemini approval mode: yolo (auto-approve all), auto_edit, default GEMINI_APPROVAL_MODE="${GEMINI_APPROVAL_MODE:-yolo}" # ... tmux send-keys -t "$gemini_window" \ "${cd_cmd}${GEMINI} --approval-mode ${GEMINI_APPROVAL_MODE}" Enter ``` ### Technical Analysis The permission guard monitors terminal output and automatically sends `p` followed by Enter when a matching permission prompt appears. Based on the comments and matching rules, `p` represents permanent approval. Separately, the Gemini integration defaults to `yolo`, which automatically approves agent actions. This removes the human authorization boundary intended to protect filesystem access, shell execution, package installation, network requests, and other sensitive operations. Pattern matching and a second pane-content check reduce accidental keystrokes, but they do not determine whether the requested operation is safe. Continuous task routing requires the ability to submit tasks, but it does not inherently req ...[truncated 1644 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove permanent automatic approval. Never send `p` automatically. 2. Change the default Gemini mode from `yolo` to `default` or another interactive restricted mode. 3. Require explicit user confirmation for: - File deletion or overwrite operations. - Package installation and lifecycle scripts. - Network access or uploads. - Credential and configuration-file access. - Commands outside the configured project directory. 4. If limited auto-approval is necessary, parse and validate the requested operation against a strict allowlist rather than matching only generic prompt text. 5. Run coding agents in a sandbox with: - A dedicated low-privilege account. - A project-scoped filesystem mount. - No SSH, cloud, messaging, or keychain credentials. - Restricted outbound network access. 6. Make approval events visible and auditable, recording the exact command, resource, decision, and policy rule. 7. Require an explicit configuration flag and prominent warning before enabling any automatic approval feature. ]]>
