Two-Step AI Agent Privilege Escalation: Contact Mutation Chains & Fail-Open MCP Tools
DEV Community

Two-Step AI Agent Privilege Escalation: Contact Mutation Chains & Fail-Open MCP Tools

Originally published at naditu.com/blog/two-step-ai-agent-privilege-escalation-and-fail-open-mcp-tools.

Most enterprise MCP security reviews audit tools one at a time: "Does send_customer_email check that the recipient belongs to a verified CRM/ERP Account?" If the answer is yes, the tool passes review.

In production multi-turn agent loops, individually safe tools compose into a two-step privilege-escalation and exfiltration chain the moment the same catalog exposes a low-friction entity-update tool.

The Two-Step Contact-Mutation Exfiltration Chain

Suppose an AP or sales operations agent has access to two routine MCP tools:

  • update_account_contact(account_id, secondary_email) - treated as low-risk CRM hygiene and allowed without human sign-off.
  • send_customer_email(account_id, recipient_email, attachment_report) - restricted by a strict database check verifying recipient_email is registered on account_id.

When an untrusted inbound vendor PDF or support email injects instructions into the agent's context window:

  • Turn 1 (State Poisoning): The agent invokes update_account_contact to append au********@external-drop.example onto the legitimate Account row.
  • Turn 2 (Allowlist-Clean Exfiltration): The agent invokes send_customer_email with AR aging, contract pricing tiers, or customer records addressed to au********@external-drop.example. Because the database row now lists that address, the single-tool recipient check passes cleanly!

The exact same composition flaw applies to supplier bank IBAN updates + treasury payout staging and ship-to consignee edits + dispatch release.

Four Fail-Open MCP Tool Bugs Found in Production Code Audits

  • Fail-Open Confirmation Callbacks (catch { return true }): UI confirmation hooks (such as __event_call__ or webhook listeners) that catch timeout or serialization exceptions and return true - turning network hiccups or stateless HTTP runs into silent auto-approvals.
  • Inverted Gate Asymmetry (create_draft gated, send_email open): Teams carefully gate database draft creation behind human approval while leaving irreversible outbound side-effect tools (send_email, post_webhook, dispatch_einvoice) directly callable without a cryptographic nonce.
  • Volatile $search Positional Indexing: Tools accepting delete_item(search_rank: 1) instead of an immutable (entity_id, etag_sha256) pair - causing concurrent email or order arrivals to shift rank positions and mutate the wrong record.
  • Tokenless 401 Retry & Helpful Refusal Hints: Agent runtimes retrying HTTP 401 without an Authorization header (hitting anonymous/demo fallbacks) and verbose error hints ("Archive active child rows before deleting") that instruct autonomous agents how to bypass policy guards.

Stopping Compositional Escalation in an Operational Ontology

Attack Vector Naive Single-Tool Guard Governed Operational Ontology Defense
Contact / IBAN mutation -> exfiltration Checks current DB column value only UNVERIFIED_AGENT_MUTATION session taint: agent-written fields cannot satisfy downstream verified_recipient predicates without independent human approval
Confirmation timeout / stateless runner Client-side callback (fail-open risk) Fail-closed out-of-context CSPRNG/HMAC nonce withheld from LLM JSON responses
Direct side-effect tool invocation Separate CRUD + outbound mail tools Closed Declared ActionType catalog (Draft -> Human Evaluation -> Official ERP API)
Concurrent $search rank drift Positional index (1, 2, ...) Immutable canonical ObjectReference + snapshot etag precondition

Read the full engineering breakdown (with interactive Architectural Plate attack/defense sequence diagrams and OWASP/NSA primary-source footnotes) at naditu.com/blog/two-step-ai-agent-privilege-escalation-and-fail-open-mcp-tools.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.