Failure Taxonomy
Autonomous agents fail in ways that are qualitatively different from human operators. This page catalogs the eight failure modes txfence is designed to prevent, with examples and the specific policy primitives that address each one.
1. Value Extraction
What it is: The agent transfers significantly more value than intended — either due to a prompt injection, a manipulated oracle, or a reasoning error in the decision loop.
Example: A treasury management agent is instructed to “rebalance the portfolio” but interprets this as transferring the entire balance to a single address.
txfence mitigations:
Policy.maxSpendPerTx— hard cap per transaction; rejected withspend_exceeds_capCapLockProvider— absolute and rolling-window caps shared across transactions, two-phase acquire/commit/release- Temporal rule
spend_velocity— cumulative spend cap over a sliding window Policy.humanApprovalThreshold— webhook approval required above a value threshold
2. Reentrancy Exploitation
What it is: A malicious contract calls back into the agent’s execution context mid-transaction, causing it to take actions it wasn’t authorized to take.
Example: An agent calls a DeFi protocol that, during execution, triggers a callback that calls the agent again with a different (attacker-controlled) context.
txfence mitigations:
- Simulation surfaces reentrancy reverts before broadcast —
SimulationResult.wouldRevertis checked in stage 3 of the pipeline - Tenderly deep simulation traces internal calls and flags unexpected control flow
Policy.allowedContracts— the contract allowlist blocks calls to unknown addresses entirely
3. Approval Drain
What it is: The agent grants an ERC-20 approve() with an unlimited allowance to a contract that later drains the approved balance.
Example: An agent approves a DEX router for type(uint256).max tokens. The router is later exploited or upgraded to a malicious implementation.
txfence mitigations:
Policy.allowedContractswithContractEntry.bytecodeHash— pins the implementation; an upgrade invalidates the allowlist entry and triggersbytecode_hash_mismatchContractEntry.expiresAt— time-boxed allowlist entries force re-validation- The contract-call action’s
valuefield flows throughmaxSpendPerTx— bounded approvals can be expressed as a normal spend cap
4. Oracle Manipulation
What it is: A price oracle is manipulated (e.g., via flash loan) so the agent’s valuation is incorrect, causing it to make trades that appear valid but are economically harmful.
Example: An arbitrage agent sees an artificial price discrepancy created by an attacker and executes a trade that results in a net loss.
txfence mitigations:
SwapAction.maxSlippageis enforced —maxSlippage: 0is always rejected asslippage_not_declared, forcing every swap to declare a tolerance- Fork simulation via Tenderly traces the actual output amount of the swap so the policy can compare against an expected range before broadcast
- MEV protection routes through Flashbots / MEV Blocker, denying frontrunners the chance to widen the manipulated spread
5. Privilege Escalation
What it is: The agent calls a contract function it should not have access to — an admin function, an upgrade mechanism, or a cross-chain bridge with elevated permissions.
Example: A DeFi agent discovers it holds an admin key in its wallet and calls transferOwnership() on a protocol contract.
txfence mitigations:
Policy.allowedContractsis address-level — everyswapandcontract_callmust target an explicitly listedContractEntry, rejected withcontract_not_allowedotherwiseContractCallAction.methodis preserved in the audit log, so post-hoc detection of unintended method calls is straightforward- For finer-grained control, use composite policies — wrap a strict address-list leaf in
policyAndwith the rest of the policy
Privilege escalation is especially dangerous because the effects may be irreversible (contract ownership, proxy upgrades). The current allowlist is address-level; method-level allowlisting is on the roadmap. Until then, enforce method scoping at the executor / signer layer.
6. Cross-Chain Contagion
What it is: An action on one chain triggers automatic downstream actions on another chain via a bridge or IBC relay, amplifying the damage beyond what the original policy covered.
Example: An agent sends tokens over a bridge. The bridge contract, on receipt, automatically executes a swap on the destination chain that the policy never evaluated.
txfence mitigations:
Policy.chainsrejects any action on an unlisted chain withchain_not_allowed- One agent per chain with isolated
capLockMode: 'per-agent'keeps spend budgets segregated Intent.intentPolicy.allowedChainsrestricts which chains can appear inside a multi-step intent@txfence/cosmosevaluates each IBC message as its ownAction, so cross-chain hops cannot bypass the pipeline
7. State Drift
What it is: The agent’s internal model of world state diverges from actual on-chain state, causing it to make decisions based on stale or incorrect information.
Example: An agent believes a lending position is healthy but the position was liquidated in a previous block. It continues adding collateral to a position that no longer exists.
txfence mitigations:
Policy.simulationStalenessMs— pipeline returnssimulation_staleif too much wall-clock time has elapsed between simulating and executing@txfence/monitor— forward reconciliation detects on-chain transactions txfence did not record (signing key compromise or out-of-band execution); reverse reconciliation detects chain reorgs that invalidate previously-confirmed receipts- Per-action simulation captures the block height the result is valid at — the audit log preserves it for forensic analysis
8. Runaway Loop
What it is: A bug in the agent’s decision loop causes it to repeatedly execute the same action — draining gas, triggering rate limits at external protocols, or filling storage.
Example: An agent retries a failed transaction indefinitely, sending thousands of identical transactions and exhausting the wallet’s ETH balance in gas.
txfence mitigations:
- Temporal rule
consecutive_failures— triggersrejectafter N pipeline events have been non-success in a row - Temporal rule
contract_call_frequency— caps how many times a specific contract may be called within a window - Circuit breaker —
createCircuitBreakerpluswrapAdapterWithCircuitBreakerstops simulation calls cold once RPC failures cluster, avoiding wasted retries AgentCoordinator.recordTransaction+isRateLimited— sliding-window per-agent transaction caps