Most enterprise security reviews evaluate Model Context Protocol (MCP) tools one endpoint at a time, which is why two-step AI agent privilege escalation inside MCP tool catalogs slips past code review so consistently. Security architects rightly refuse to give an assistant an unrestricted email sender or wire-transfer tool. Instead, they restrict outbound tools to verified addresses or bank accounts already stored on an approved CRM or ERP customer record, declare the exfiltration risk closed, and ship the integration to production.
That single-tool boundary collapses the moment the same MCP session also exposes a low-friction contact maintenance helper. When an untrusted vendor PDF or inbound support ticket triggers an indirect prompt injection1, the model does not need to break your outbound allowlist directly. It simply mutates the entity contact list in step one and dispatches sensitive receivables or contract files to its newly registered address in step two. Paired with fail-open confirmation callbacks, inverted approval gates, volatile search-rank indices, and tokenless retry fallbacks uncovered in production audits, isolated per-tool checks routinely fail against composed agent workflows.
The two-step entity contact-mutation exfiltration chain
Consider a typical order-to-cash or procurement copilot connected to an ERP and CRM backend. Engineering locks send_customer_email and submit_supplier_payout behind an entity-verified allowlist: the server runs a SQL check confirming that the target email address or payout IBAN belongs to the referenced Account record before allowing any message or payment draft to leave the perimeter.
In the very same tool catalog, however, developers also ship update_account_contact or add_entity_contact so sales coordinators can append a new billing clerk's address without opening five ERP screens. Because updating a contact row looks like a harmless internal CRM edit rather than an external side effect, nobody puts a human sign-off gate on it. That creates a textbook composition bug across two individually compliant tools2:
- Untrusted document ingestion: an accounts-payable or customer-operations agent parses an inbound vendor invoice PDF or support email containing hidden instructions embedded in document metadata or white-on-white footer text1.
- Step 1 (low-friction state mutation): following the injected instruction, the agent calls
update_account_contacton a legitimate customerAccountand appendsaudit-sync@external-drop.exampleas a secondary billing contact. The CRM database commits the row immediately because the caller holds routine account-edit permissions. - Step 2 (allowlist-compliant exfiltration): on the very next turn, the agent invokes
send_customer_emailwith full accounts-receivable aging tables, negotiated discount tiers, or signed contract PDFs addressed toaudit-sync@external-drop.example. When the outbound guard queries the database to verify whether that recipient belongs to the customer entity, the query returnstruebecause step one just wrote it there.
Neither tool malfunctioned on its own. Each endpoint enforced its local schema and row-level SQL predicate, yet composing a write primitive over security-relevant metadata with an outbound side-effect primitive turned a routine contact helper into an arbitrary data exfiltration channel. As we explored when adapting Palantir Ontology action types, multi-role links, and interfaces for ERP, operational safety cannot be reasoned about at the level of isolated CRUD wrappers when state changes alter downstream authorization predicates.
Four fail-open MCP and agent tool anti-patterns from production audits
Two-step contact poisoning rarely lives alone. Across security audits of custom MCP servers, open-source chat connectors, and internal ERP automations, four recurring implementation bugs turn nominal guardrails into fail-open execution paths3:
1. Fail-open confirmation callbacks (__event_call__ returning true)
Many custom tool wrappers implement human-in-the-loop prompts through asynchronous UI event callbacks such as __event_call__ in browser chat frontends or webhook listeners in internal bots4. Developers wrap that bridge in a broad try / catch so headless tests do not crash when no UI socket is attached. On a timeout, capability mismatch, or serialization exception, the handler logs a warning and returns true (or falls past the guard) instead of aborting. Worse, when confirmation cards invoke an approve_transfer tool in the same session without an out-of-context human secret, an autonomous runner can approve its own action.
2. Inverted gate asymmetry (gating drafts while firing side effects raw)
Teams often guard database writes while overlooking network egress. Audits repeatedly find create_draft locked behind confirmation prompts while sibling side-effect tools like send_email, post_webhook, notify_slack_channel, or dispatch_ubl_invoice fire unconfirmed. Once an injected prompt or confused model notices that draft creation stalls on review whereas outbound dispatch succeeds immediately, sensitive payloads route straight through the unconfirmed tool.
3. Volatile search-rank indexing ($search rank shift destruction)
To save tokens, mailbox and ERP queue tools often accept positional integers from a prior $search query, such as delete_message(index: 1) or reject_supplier_claim(row_number: 2). When a new order or urgent invoice arrives between turns, relevance scoring shifts the rank order, and re-running the query deletes or mutates the wrong production record instead of requiring an immutable message_id and etag.
4. Tokenless retry fallbacks and helpful refusal hints
Two protocol behaviors compound tool bugs, echoing the identity gaps analyzed in Nous Hermes Agent for enterprise bots: patterns and risks. First, when an MCP server returns HTTP 4014, some managed agent runtimes retry without an Authorization header, silently succeeding as a default user if a demo or anonymous fallback route exists. Second, verbose refusal hints that name which child task or credit hold blocks an edit (and which archive tool clears it) teach frontier models to autonomously archive blocking dependencies to force the rejected call through.
| Vulnerability Class | Naive MCP Tool Pattern | Exploit / Failure Mode | Operational Ontology Control |
|---|---|---|---|
| Two-Step Contact Mutation1 2 | Unconfirmed update_contact paired with allowlisted send_email | Indirect injection appends external address then passes DB allowlist check | UNVERIFIED_AGENT_MUTATION session taint + separate human sign-off |
| Fail-Open Callbacks & Gate Asymmetry4 | __event_call__ returns true on timeout while send_email skips draft gate | Headless/serialization errors auto-approve actions and outbound tools fire raw | Fail-closed out-of-context cryptographic nonces on every external side effect |
Volatile $search Indexing3 | delete_message(index: 1) resolved by re-running live $search | Concurrent arrival shifts rank order and destroys the wrong ERP or mail record | Immutable primary entity_id plus mandatory snapshot etag hash check |
| Tokenless Retry & Refusal Hints3 4 | Demo fallback on missing header plus verbose error remediation instructions | 401 retry lands on shared demo user and model archives blocking dependencies | Zero anonymous routes, strict OAuth 2.1 audience checks, and terse error codes |
Architectural fix: session taint provenance, ActionTypes, and etag nonces
Closing composed privilege escalation requires moving security enforcement out of individual wrapper scripts and into a stateful operational ontology layer. Four server-side invariants eliminate all five failure modes deterministically:
- Session taint and cooling-off provenance: every field feeding downstream routing or payment checks (emails, webhook URLs, tax IDs, supplier IBANs) tracks provenance. Agent-proposed edits carry
UNVERIFIED_AGENT_MUTATIONplussession_id, and downstream predicates requireprovenance == HUMAN_VERIFIEDfrom a separate human approver. - Closed declared ActionType catalogs: replace raw CRUD and SMTP/webhook helpers with declared
ActionTypecontracts where every external dispatch, UBL-TR invoice, or ledger post shares one mandatory approval pipeline. - Out-of-context cryptographic nonces (fail-closed): mint single-use nonces bound to the canonical parameter SHA-256 digest on an authenticated human surface outside model context, aborting with
HTTP 403on any timeout or error. - Immutable entity IDs, snapshot etags, and terse refusals: require primary
entityIdplusetaghashes (returningHTTP 409on rank drift), enforce strictHTTP 401with zero demo fallbacks, and return terse error codes likeDEPENDENCY_LOCKEDwithout remediation coaching.
{
"actionType": "dispatch_verified_customer_statement",
"parameters": {
"accountId": "uuid-9f31-44c0",
"accountEtag": "sha256-7b92e1d4",
"recipientContactId": "contact-8841",
"statementPeriod": "2026-11"
},
"serverPredicates": [
"Account.etag == parameters.accountEtag",
"Contact.accountId == parameters.accountId",
"Contact.provenance == 'HUMAN_VERIFIED'",
"Contact.mutatedInAgentSessionId == null"
],
"egressControl": {
"mode": "FAIL_CLOSED_OUT_OF_BAND_NONCE",
"nonceBinding": "sha256(callerSub + actionType + canonicalJson(parameters))",
"onTimeoutOrError": "DENY_403",
"refusalFormat": "CODE_ONLY_NO_REMEDIATION_HINTS"
}
}Enforcing field-level provenance taint, fail-closed cryptographic approval nonces, immutable etag concurrency checks, and strict OAuth 2.1 caller validation inside Naditu's enterprise AI security architecture stops indirect prompt injections from chaining harmless helper tools into unauthorized ERP mutations or external data leaks.