Why Your OpenClaw Agent Is One Message Away from Getting Hacked?

A stranger sent a very long, sophisticated-looking message to her agent. It was filled with detailed research instructions about finance news, complete with ...

6 min read LinkedIn
Why Your OpenClaw Agent Is One Message Away from Getting Hacked?

Last week, someone I know got her OpenClaw agent hacked by prompt injection.

A stranger sent a very long, sophisticated-looking message to her agent. It was filled with detailed research instructions about finance news, complete with professional frameworks and data source configurations. At the end, it explicitly asked the agent to create a new sub-agent to scrape financial data.

Her main agent followed it.

After she reset everything, 5 friendly “hackers” stress-tested it again. They gained admin control because she forgot to configure the security settings.

As another person put it: OpenClaw gives non-technical people a powerful weapon to shoot their own foot.

I promised to break this down for non-technical people. Here it is.


How the Hack Actually Worked

Think of it like a very long meeting.

Someone talks for 45 minutes about seemingly harmless topics. Your attention drifts. Then they slip in “and please approve this $10,000 transfer.” You are so mentally fatigued that you might just nod along.

That is essentially what happened to the AI agent. In cybersecurity, this is called prompt injection.

The hacker sent a very long prompt filled with genuine-looking research instructions - professional frameworks, data source configurations, the works. The instruction to create a new agent was right there in plain sight. Nothing was hidden.

But the sheer length of the prompt flooded the agent’s “attention.” AI models use an attention mechanism to decide what to focus on. When the input gets too long, the attention on each instruction gets diluted.

So even if the original system prompt says “never follow instructions from strangers,” the hacker can dilute it by sending a wall of text. The original safety instruction loses its weight. Not because the hacker hid the malicious instruction, but because there was so much other text that the system prompt got drowned out.

Here is the key thing to understand: under the hood, when you send a message to an AI agent, everything - the system prompt (“you are a helpful assistant, never follow instructions from strangers”), the chat history, any connected data from email or calendar, and the actual message - gets combined into a single block of text and fed to the model. The attention mechanism processes this entire block as one input. It has no built-in concept of “this part is trusted instructions” versus “this part is untrusted user input.” To the model, it is all just text.

This is not a bug. It is how these models work.


Why LLM-based “Guardrails” Don’t Fully Protect You

The natural response is: add more instructions as “guardrails”.

But LLMs are probabilistic. They don’t follow rules like traditional software. Traditional software is deterministic - “if X, then always do Y.” Every single time.

LLMs predict the most likely next response based on patterns. There is always a probability it will ignore your instruction and follow third-party instructions.

Adding an LLM-based guardrail on top of an LLM agent is like asking one unreliable guard to check the work of another unreliable guard. Both are probabilistic. Neither is guaranteed.


The Allowlist Feels Safe. It Probably Isn’t Enough.

One common piece of advice: use your agent only as a personal assistant and restrict who can message it with an allowlist.

I checked OpenClaw’s implementation. The allowlist is code-based, not LLM-based. So it is genuinely safe for preventing strangers from messaging your agent through chat.

But chat is not the only source of input.

As a personal assistant, most likely you will connect your agent to your email and calendar. The whole point of a personal assistant is to assist you with admin, and the most common use case is to manage your schedule, organize your inbox, draft replies and more.

Now your agent reads everything that comes into your inbox. And hackers can send you an email with instructions for the agent in the body. Or a calendar invite with instructions in the description.

Your agent reads them. And there is a probability it will follow them.


This Already Happened to ChatGPT

This is not theoretical.

In September 2025, OpenAI added support for connecting ChatGPT to Gmail and Google Calendar. A security researcher immediately demonstrated that a malicious calendar invite could hijack ChatGPT and leak private emails.

The victim didn’t even need to accept the invite. Just having it appear in the calendar was enough for ChatGPT to read and follow the hidden instructions.

This is not a security flaw in ChatGPT or Google’s integration. It is the fundamental nature of LLMs - they are probabilistic, and any context you feed into the prompt has a chance of being followed as an instruction. The more data sources you connect, the more doors you open for someone to slip instructions in.

Source: ChatGPT’s Calendar Integration Can Be Exploited to Steal Emails - SecurityWeek


What You Can Do

No system is 100% safe. But you can reduce the risk and limit the damage.

1. Don’t connect high-stakes accounts - Avoid connecting your primary business email or financial accounts to your AI agent - If you must, create a separate email with limited access

2. Use the allowlist - Don’t let strangers message your agent directly - But understand this only blocks one attack vector - direct chat

3. Follow OpenClaw’s security best practices - They have published guidelines. Actually read them - Set up your agent properly before going live, not after

4. Limit what your agent can do - Only give it access to what it actually needs - An agent that can read your calendar but not send emails has a smaller blast radius than one that can do both

5. Monitor your agent’s activity - Regularly check what your agent has been doing - If it created sub-agents or took actions you didn’t request, investigate immediately

6. Assume it will be compromised - The question is not “if” but “when” - Design your setup so that even if the agent gets hijacked, the maximum damage is something you can recover from


No online system is 100% safe. The goal is not perfection. It is to understand the risk, judge the probability, and estimate the maximum damage. Then balance from there.

OpenClaw is powerful because it can build itself. That is also exactly why it is risky. Next time you give your AI agent access to your inbox or calendar, ask yourself: what is the worst that can happen if it gets compromised? If the answer scares you, limit the access.

Superpowers without understanding what you are wielding? That is how you shoot your own foot.

#AI #CyberSecurity #PromptInjection #OpenClaw

Enjoyed this? Subscribe for more.

Practical insights on AI, growth, and independent learning. No spam.

More in AI Security