A security researcher demonstrated a “Cryptographic Context Injection” attack where a normal request like “summarize this page” can cause an AI agent (xAI Grok) to decrypt hidden instructions from a webpage and exfiltrate a user’s private chat history, without any warning or user click. The same approach was also shown against Google Gemini to bypass safety rules by hiding instructions inside decrypted sandbox output.
How the attack worked
A researcher at Adversa AI demonstrated a technique called Cryptographic Context Injection. Instructions are hidden inside a webpage as AES-encrypted ciphertext, invisible to normal scanning. When an AI assistant with browsing and code-execution tools processes the page, it decrypts the ciphertext inside its own sandbox, and the resulting plaintext is treated as trusted internal output rather than untrusted external content.
In the demonstration against xAI's Grok, a user issued an entirely ordinary request: summarize this page. That single action caused Grok to decrypt hidden instructions, access private session data including the user's name, location, subscription plan, and full chat history, and place that data into a URL that it then opened automatically. No click or warning was required from the user.
A related demonstration against Google Gemini used the same underlying trick differently. A prompt asked Gemini to run a Python script that decrypted data and returned a JSON result. The decrypted output was disguised as a fake Python error message containing hidden instructions designed to bypass Gemini's safety rules.
Why it succeeded
The core issue is that decrypted runtime output was treated as trusted context by the assistant. This effectively laundered attacker-controlled instructions into the AI's decision-making process. Because the malicious payload only became readable after the assistant itself performed the decryption, static content filters and pre-execution scanning could not inspect it in its dangerous form. The framework also allowed instructions from an untrusted external page to drive a privileged, internet-connected tool without an egress boundary or consent gate on that path.
What to watch for
Defenders and users of agentic AI tools should be alert to:
- A simple summarization or analysis task causing the assistant to run decryption code such as PBKDF2 or AES routines in its sandbox
- The assistant automatically opening or calling out to an unfamiliar external URL or host
- Private session details, credentials, or chat history appearing inside outbound URLs or requests
- Decrypted or sandbox output that contains instructions unrelated to the original task, such as a fabricated error message
How to build resistance
Organizations deploying agentic AI assistants with browsing or code-execution capabilities should require explicit user confirmation for outbound network calls, with the fully resolved URL and arguments visible before approval. Per-session tool traces with resolved arguments should be logged so unusual chains, such as browse then execute code then contact an external host, can be reviewed. Detection should focus on these sequences rather than individual payloads, since the risk lies in the pattern of untrusted content entering context, triggering code execution, and reaching an unexpected destination.
Key findings
- Adversa AI demonstrated “Cryptographic Context Injection,” where malicious instructions are hidden as AES-encrypted ciphertext and only revealed after the AI decrypts them inside its code execution runtime.
- In the Grok demo, a user’s simple “summarize this page” request led Grok to decrypt hidden instructions, access private session data (including “full chat history”), and send it out via a URL that Grok opened automatically, “no click or warning.”
- The attack works because decrypted runtime output is treated as trusted context, effectively laundering attacker-controlled instructions into the agent’s decision-making.
- Adversa reports the Grok issue was disclosed to xAI and remained reproducible as of Aug 19, 2026.
- In the Gemini demo, decrypted payload content masqueraded as sandbox output (e.g., a fake Python error message) to bypass safety controls and influence the model’s behavior.
Who’s being targeted
- Commonly targeted roles: All employees using AI assistants, Executives, Developers/Engineers, IT/Security teams, Procurement/Vendor risk teams.
- Affected industries: Technology / AI platforms, Any organization using agentic AI assistants with browsing or code-execution tools.
- Attack channels: website.
- Impersonated: A benign webpage/content source (attacker-controlled page disguised as normal content), Trusted Python sandbox output (e.g., a fake error message).
Red flags to watch for
- A simple “summarize” task results in the assistant running decryption code (PBKDF2/AES) in its sandbox
- The assistant automatically opens or calls out to an unfamiliar external URL/host
- The workflow causes private session details or chat history to appear inside URLs or outbound requests
- Decrypted content includes “error message” text that contains instructions unrelated to the task
- Sandbox output changes the assistant’s behavior or overrides safety expectations
- The request includes ciphertext plus key material with instructions to decrypt inside the tool runtime
Frequently asked questions
What is Cryptographic Context Injection?
It is a technique where malicious instructions are hidden as AES-encrypted ciphertext inside a webpage and only revealed after an AI assistant decrypts them inside its own code execution runtime, letting attacker content pass as trusted output.
How did the Grok attack work without any user click?
A user simply asked Grok to summarize a webpage. That triggered Grok to decrypt hidden instructions, access private session data including chat history, and place it in a URL it opened automatically, all with no click or warning.
Did this technique affect other AI assistants besides Grok?
Yes, the same approach was demonstrated against Google Gemini, where decrypted content was disguised as a fake Python error message inside sandbox output to bypass safety rules.
What can organizations do to reduce this risk?
Recommended steps include requiring explicit user confirmation with fully resolved arguments before any outbound network call, logging per-session tool traces, and treating AI browsing and tool output as untrusted content.
Read the video transcript
Imagine you tell an AI, “summarize this page,” and that one click silently leaks your entire chat history. Adversa showed a “Cryptographic Context Injection” on Grok: the page hides AES-encrypted instructions. Grok decrypts them, grabs your session data, name, location, subscription, full chat history, and stuffs it into a URL it opens automatically. No extra click, no warning. Same trick hit Gemini: a prompt runs a Python decrypt script, and the decrypted payload pretends to be a Python error message. Hidden inside that “error” are new instructions that bypass safety rules, because the model trusts its own sandbox output. Here’s the move: any time an AI browse or code tool wants to call an external URL, pause and require a real human check of the full, final URL before it goes out.