The bat for web3 agents
Why the wallet-drain attack against ElizaOS isn't about the user message — and what a deterministic tool-call guard actually has to check.
We watched a stock ElizaOS agent drain its own wallet on Solana devnet. The setup was three lines of YAML, a real LLM, a real key, a real attacker. The story is on the demo page — this post is the architectural argument behind why we built the connector that prevents it.
The interesting failure mode
Most prompt-injection writeups in 2026 focus on the same surface: a user types something nasty into a chat box, the model behaves badly. That’s the easy case — you wrap the text input with a validator and you’re done.
Web3 agents have a different shape. The injection doesn’t arrive as the message the user just typed — it arrives as state. In the ElizaOS case, an unauthenticated write path let anyone put a message into the store the transfer handler later reads. And here is the honest finding: a payload planted only in the agent’s character bio never reached the transfer at all, because the handler is scoped to the message table — a real architectural strength of ElizaOS. The drain needs a poisoned recipient in the corpus the handler actually reads.
From the validator’s point of view, the conversation looks benign. The malicious bytes arrived earlier, through a different door, and persisted into the state the agent consults at signing time. A guardrail that only wraps the chat box doesn’t notice.
The bat at the plate
BonkLM doesn’t prevent every prompt injection — nothing does. It changes what an injection can do once it lands. The model is a pitcher with an unreliable arm; the guardrail is a bat that meets the ball before it crosses the plate, on the one pitch that matters. Most pitches you don’t need to swing at. The wallet-drain pitch you do.
The specific swing for the wallet-drain attack is a single semantic check: before signing, does the recipient address appear anywhere in the distinct user-authored message corpus for this room? If yes, the user has at some point typed or pasted this address themselves — the call proceeds. If no, the call is rejected with a critical risk-level. The user never explicitly approved this counterparty, so the signing wallet should not approve it either.
Why this specific check
Other defences we considered:
- Allow-list of recipient addresses. Brittle. Real users send to new counterparties constantly.
- LLM-based intent classifier on the tool call. Adds latency, adds cost, gets routed around by the same prompt-injection it’s supposed to detect.
- Cap per-transaction amount. Useful, but orthogonal — caps protect against large drains, not against many small ones.
The user-message-corpus check has the property we want: it’s deterministic, runs in microseconds, and the assumption it encodes (“the wallet owner has at some point explicitly named this counterparty”) is easy to defend to a security team. One bat, one pitch, one swing — and the LLM’s bad day stops being the user’s bad day.
Connector status
@blackunicorn/bonklm-elizaos ships today. The connector layers in across three ElizaOS extension points (composeState providers, tool-call args, memory-write hooks) with a single npx install. No agent code change required.
A walkthrough of the connector’s internals lives in the connectors docs.