T07 · Tool Hijacking and Spoofing
- Location
scripts/request-secret.sh:102- Finding
Unauthenticated Local Service Can Hijack Secret Collection
- Content
View full analysis
/dev/null 2>&1 } if server_running; then : # Server already running else ``` ```bash REQUEST_OUTPUT=$(curl -sf -X POST "http://localhost:${PORT}/requests" \ -H "Content-Type: application/json" \ -d "$REQUEST_BODY" 2>&1) || { emit_error "Failed to create request via API" "REQUEST_FAILED" \ "Server may not be ready. curl output: ${REQUEST_OUTPUT:-empty}" exit 4 } LOCAL_URL=$(echo "$REQUEST_OUTPUT" | jq -r '.url // empty' 2>/dev/null || echo "") REQUEST_ID=$(echo "$REQUEST_OUTPUT" | jq -r '.id // empty' 2>/dev/null || echo "") REQUEST_HASH=$(echo "$REQUEST_OUTPUT" | jq -r '.hash // empty' 2>/dev/null || echo "") ``` ```bash POLL_ARGS=(--poll "$REQUEST_ID" --api-url "http://localhost:${PORT}") if [[ -n "$SERVICE" ]]; then POLL_ARGS+=(--service "$SERVICE") fi if [[ -n "$SAVE_PATH" ]]; then POLL_ARGS+=(--save "$SAVE_PATH") fi if [[ -n "$ENV_VAR" ]]; then POLL_ARGS+=(--env "$ENV_VAR") fi $JSON_OUTPUT && POLL_ARGS+=(--json) confidant_cmd request "${POLL_ARGS[@]}" ``` ### Technical Analysis The script treats any process responding successfully to `http://localhost:${PORT}/health` as a legitimate Confidant server. It does not authenticate the service, verify the server process owner or executable, use a per-run token, or validate that the returned request URL belongs to an expected origin. The response-controlled `.url`, `.id`, and `.hash` fields are subsequently trusted. In particular, the URL is displayed as the credential-submission form that the agent must share with the user. A malicious local service can therefore impersonate Confidant and substitute an attacker-controlled form. Using localhost does not establish service identity. Any ...[truncated 1420 chars]- Remediation
View remediation
