← Research

APIsec Labs · Excerpt · Original article: 10 min read

Beyond the $175K Bankrbot Hack: Encoding Attacks Across Layers of the Agentic AI Stack

A prompt goes in, and money moves. The Bankrbot hack exposed a model-layer failure. Our research found the same weakness deeper in the stack, where agents interact with tools.

bankrbot hack

The assumption baked into most agentic systems is simple: safety lives at the model layer, so that's where you defend. But model and tool layers don't share a threat model, and attackers who know that can walk straight through the gap. The Grok Bankrbot incident made it visceral. Morse-coded prompt injection. $175,000 moved in seconds. The community called it a model-layer problem and moved on. They were half right. In security, what does the other half cost you?

The Incident Everyone Talked About, And the Layer They Missed

On May 4, 2026, an attacker drained roughly $175,000 worth of DRB tokens from Grok's auto-provisioned crypto wallet by sending a single tweet. No private key was stolen. No smart contract was exploited. The attacker simply asked an AI, politely, in Morse code.

Coverage focused on the Morse code trick, and rightly so. But the incident represents only one layer of a multi-layer problem. While the security community was analyzing model-layer prompt injection, our original research into MCP (Model Context Protocol) tool servers uncovered a structurally identical encoding technique operating one floor below, at the tool-execution layer. The two findings, taken together, reveal a threat model that most teams building agentic systems are not yet defending against.

The root failure was the loose coupling between AI-generated natural language output and real asset execution. Grok neither held private keys nor signed transactions directly; it just gave instructions, and those instructions were taken at face value.

Similar Attack Technique, One Layer Deeper

While the Bankrbot incident was playing out at the model layer, we discovered a parallel encoding vulnerability in a popular MCP server's run_command tool, a tool designed to execute only project-related development commands, with thousands of stars on Github.

Different Execution Layers at a Glance

The surface-level similarity between these two findings is real: both use encoding to bypass a safety mechanism, and both succeed. But encoding is doing different work in each case, and conflating them produces the wrong mental model, resulting in insufficient defenses.

CategoryBankrbot / Model LayerMCP / Tool Layer
What's being bypassedModel safety filter at inferenceInput validation at tool server
Encoding mechanismMorse code (natural language obfuscation)Hex-encoded Python (execution-time decode)
Who decodes itThe LLM, as part of normal inferenceThe Python interpreter, at runtime
Downstream impactFinancial agent executes unauthorized transactionHost OS executes arbitrary command
Requires model involvementYes, model is the attack surfaceNo, exploit hits tool layer directly
Existing mitigations bypassedContent filtering, LLM-to-LLM reply blocksCommand chaining restrictions

Neither defense addresses the other's attack surface. A model with robust prompt injection mitigations is still exposed if the MCP tools it calls have no input validation. A tool server with argument sanitization is still exposed if the model feeding it instructions has been compromised via encoding bypass.

How Both Findings Tie Together

Considered in isolation, each vulnerability has a bounded blast radius. The MCP tool-layer issue requires an attacker to have direct access to the tool server, or to control an agent that does. The model-layer issue requires the model to have downstream execution capabilities, wallet access, tool invocation, API calls that can be weaponized.

In a production agentic system, both conditions are routinely true at the same time.

This is the threat model that agentic AI security needs to address, with the end-to-end chain across both layers.

What This Means For You

The good news: both layers have tractable defenses. The challenge is that neither layer's team typically owns the other, which is where fixes fall through the gaps.

At the model layer:

  • Decode before you filter. Safety evaluation must operate on semantically resolved content, not surface form. A content filter that doesn't attempt to decode common encoding schemes (base64, hex, Morse, ROT13, Unicode escapes) will miss this class of attack by design.
  • Treat agent output as untrusted input. Any instruction an LLM passes to a downstream system should be validated against an explicit allowlist of permitted operations before execution, especially when real-world consequences (financial transactions, file writes, API calls) are possible.
  • Apply the principle of least privilege to wallet/tool permissions. Grok's wallet had no reason to accept unsolicited NFTs that elevated its permissions. Automatically accepted permission grants from external sources are a pre-attack surface worth closing before the injection arrives.

At the tool/MCP layer:

  • Implement binary allowlisting. MCP tools that invoke system commands should operate against an explicit list of permitted binaries. If python3 isn't required for the tool's function, it shouldn't be callable.
  • Validate arguments, not just command form. Checking for visible chaining syntax (&&, |, ;) is insufficient. Argument validation must account for interpreter-decoded payloads: validate what will be executed, not what was passed.
  • Sandbox tool execution. Tool server processes should run with minimal OS permissions. A tool that only needs to run npm install does not need access to os.system. Containers, restricted users, and seccomp profiles all apply here.

The Stack Is the Attack Surface

The Bankrbot incident got covered as a crypto story. It's actually a systems security story about what happens when an AI model with external tool access is treated as a trusted actor rather than an untrusted intermediary. The MCP tool-layer finding reinforces the same point from the other direction: a tool server that trusts its inputs (regardless of where those inputs came from) is one compromised model away from arbitrary OS execution.

Agentic AI systems are not just models and not just APIs. They're end-to-end pipelines where each component assumes the previous one handled security. Right now, most of them haven't. The encoding techniques in both cases are low-sophistication methods that happen to work because the safety checks they bypass operate at the wrong layer.

The common thread across both findings highlighted in this article is, visibility. You can't secure a model-to-tool boundary you don't know exists. That's why one of the first questions we ask when assessing agentic systems is deceptively simple: Where are the AI surfaces?APIsec AI Surface was built to help answer that question, automatically identifying AI components, agents, MCP servers, and model gateways before they quietly become part of your production attack surface.

For every application you run

Find what's deployed and prove which exploits are real.

Go to apisec.ai