How did encrypted instructions make a coding agent leak .env secrets?
Researchers at Adversa AI hid instructions on a web page as ciphertext, with two keys. To build one key, GitHub Copilot CLI read local files, including .env.prod. The real key decrypted instructions to send those contents to another URL. In autopilot mode, the chain took 28 seconds with no confirmation. Plain text versions were refused.
The breakdown
The research
Adversa AI published the finding on Oct 6, 2026, and CSO Online covered it on Oct 7. They call the technique cryptographic context injection: malicious instructions are shipped as ciphertext, and the agent is asked to decrypt them in its own runtime.
The setup
A developer runs GitHub Copilot CLI in autopilot mode and asks it to fetch a single web page. The page says its content is encrypted, asks the agent to decrypt it with Python, and offers two candidate keys.
The theft
One key is not a real key. It is a template the agent can only fill in by reading local files. In the demo the agent read a .env.prod file to build it. Adversa notes that this read is the theft, and it happens before any decryption works.
The send
That key fails by design. The agent falls back to the real key, which decrypts instructions to fetch another URL carrying the file contents. Adversa reports the full chain took 28 seconds, with no confirmation and no point in the transcript naming the destination host.
Why encryption matters
The same instructions in plain text were caught as prompt injection and refused. Encrypted, they came out as the output of code the agent ran itself, and it treated them as trusted. It also depended on the model: one model ran the chain in half of Adversa's runs, while two others refused.
What GitHub said
GitHub's bug bounty team validated the finding but declined to treat it as a vulnerability, because the user asked the agent to fetch the content while giving it full permission to act on its own.
What stops it
Adversa's advice sits outside the model: trace every tool call with resolved arguments, alert on the sequence of untrusted content, code execution, file reads and a new outbound host, and require approval for new network destinations. In autopilot, deny them by default.
The question at the end of the video: Should an agent on autopilot ever fetch a page you didn't write?
Sources
- Adversa AI, Rony Utevsky, Oct 6, 2026: GitHub Copilot CLI vulnerability, Cryptographic Context Injection steals developer secrets
- CSO Online, Shweta Sharma, Oct 7, 2026: Encrypted instructions trick Copilot CLI into spilling developer secrets
FAQ
What is cryptographic context injection?
It is a prompt injection technique where the malicious instructions are encrypted. The agent decrypts them in its own runtime, so the instructions appear as output of code it ran, and it trusts them as its own.
Which files did the agent leak?
In Adversa AI's demo it read a .env.prod file. The researchers say the target pattern lives in the payload, so it could be any file the agent can read, including files outside the working directory.
Does this work on every Copilot CLI session?
No. It needs autopilot mode and a permissive model. In Adversa's tests one model ran the chain in 50% of runs and two others refused the same payload.
How do I protect a coding agent from this?
Do not let an agent on autopilot fetch pages you did not write. Require approval for new network destinations, keep secrets out of what the agent can read, and log every tool call with its real arguments.
































