![[Report] [Won $20,000 at Pwn2Own Berlin 2026] Agent2Shell: Your AI Coding Agent Is Already Running the Attacker's Code - CODE BLUE 2026 #codeblue_jp #codeblue2026](https://devio2024-media.developers.io/image/upload/f_auto,q_auto/c_limit,w_1200/v1794835744/eyecatch/lwaeb6mt4ljjwzxqdkhi.jpg)
[Report] [Won $20,000 at Pwn2Own Berlin 2026] Agent2Shell: Your AI Coding Agent Is Already Running the Attacker's Code - CODE BLUE 2026 #codeblue_jp #codeblue2026
This page has been translated by machine translation. View original
Hello, this is Usuda.
Everyone, are you taking security measures? (Greeting)
This is a report on the following session held at CODE BLUE 2026.
It was a session on a problem where arbitrary code is executed even before prompt injection comes into play, an issue that users need to be even more careful about.
[Won $20,000 at Pwn2Own Berlin 2026] Agent2Shell: Your AI Coding Agent Is Already Running the Attacker's Code
You clone a repository and open it with an AI coding agent. You have not entered a single prompt and have not approved any tool execution. Even so, calc.exe is already running, and the attacker's shell is being executed.
Every AI coding agent is equipped with safety measures (a security story) such as a "Do you trust this folder?" dialog, permission approval prompts, and sandboxes. However, in Claude Code CLI, Cursor (IDE + CLI), and Gemini CLI, most of these measures are hollow (security theater). The attacker's code is executed with the user's full privileges from the workspace's local settings, before the trust confirmation gate, the approval layer, or the sandbox can make any decision.
We call this "pre-prompt RCE." Under the strict condition of "open a folder, launch the agent, and click 'Trust' at most once," we present more than 20 PoCs (proofs of concept) that launch calc.exe on Windows 11. Two of them are unpublished bugs in Cursor CLI, and the most powerful one executes before the "Trust" dialog is even displayed. We classify these primitives based on their final execution point, and reveal how cross-vendor configuration loading turns a single repository into a weapon targeting multiple agents. Furthermore, we present Claude Desktop, isolated in Anthropic's microVM (micro virtual machine), as a control, proving that this bug class can be addressed. We will also share a live demo and the coordinated vulnerability disclosure process.
Speakers: Satoki Tsuji 辻 知希
Report
Related information: Pwn2Own Berlin 2026: On the Ground with ZDI's Biggest AI Showdown Yet
- Also participated in Pwn2Own Ireland, and the prize money increased
- Conducts vulnerability research
- Responsible disclosure has been completed for today's content
- It may hint at related unfixed issues
- Do not attack environments without permission
- AI coding agents
- LLMs autonomously read and write files and execute commands
- Convenient, but also an attack surface
- What is the problem?
- They parse the workspace and also use tools
- Tools can be used with the AI agent's privileges
- Filters may stop things, but the very existence of access is dangerous
- A question for security engineers
- If a calculator is displayed on a colleague's screen
- Are they hacking something?
- Hackers use a calculator to test arbitrary code execution
- Today I have brought demos in which a calculator launches
- Today's talk
- Attacks on AI agents where a calculator launches before the LLM model even runs
- Things that prevent prompt injection are meaningless
- RCE succeeds before the prompt even arrives
- Demo of opening a directory with Codex
- Open a project folder
- The calculator launched even though nothing was instructed
- Workspace Trust as a security boundary
- When opening, you are asked "Do you trust this folder?"
- Opening an untrusted folder can sometimes trigger automatic execution
- This is the feature that stops that
- It's understandable that something malicious would be executed the moment you click OK
- But this time the problem is that execution happens without that confirmation
- Code execution across the security boundary
- There are several places where code is executed
- When opening files obtained from somewhere
- Such as .git/config
- Such as .vscode/tasks.json
- Such as .mpc.json
- Impact of attacks on AI agents
- A service where you upload a ZIP and have AI diagnose it
- Uploading a malicious ZIP leads to arbitrary code execution
- Running in a sandbox is important, but the problem is that it runs with the same privileges as the AI agent
- Attacks actually come from AI
- If similar mechanisms are planted, they can in some cases become attacks against pentest tools
- Can be used for hack-back against AI pentest tools
- Use with caution
- CASE-1: OpenAI Codex Desktop
- There are various paths to arbitrary code execution just by opening a folder
- Open an untrusted folder
- Opened in Electron
- There is a git branch display feature
- When symbolic-ref fails, it looks outside
- It is a feature that displays what branches exist, but RCE is possible from there
- Occurs on the failure path in
kd() - It looks at branch information on the remote, and one can write the ssh client launch in .git
- Replace that with calc.exe
- Fortunately .git/config is not directly downloaded in a normal clone, but care is needed
- Variant
- Change display in
_V() - Runs
git status - Checks file changes
- Commands specified by the attacker can be executed via attr.tree
- Malicious code can be executed via filter
- Change display in
- There are various paths to arbitrary code execution just by opening a folder
- There are many code execution paths from Git settings
- CVE-2026-19593
- Fixed after Berlin 2026
- But it was a brute-force fix
- Git splits at the first
= - What about names like
a=b? - The filter that was supposedly disabled comes back to life
- Just before Ireland 2026
- Trust is now displayed before opening any folder
- CASE-2: OpenAI Codex Desktop
- It is now displayed before opening a folder
- But what about the folder name?
- Noticed that the folder name is passed along when right-clicking a directory
- The path is obtained when an untrusted folder is opened
- It is put into arguments and launched
- I want to insert a double quote
- What should be one project path is interpreted as two launch arguments
- Specify
--utility-cmd-prefixand specify calc - Right-click and open Codex, and the calculator launches
- CVE-2026-110930
- CASE-3: Cursor
- Cursor is based on VS Code
- When opening a folder and enabling extensions, it runs
git status, so core.fsmonitor - Put it in
.git/config
- There's still more
- Tasks in the folder are also automatically executed
- Task execution feature derived from VS Code
- Passes the check that stops automatic tasks
- CASE-4: Anthropic Claude Code (CLI)
- The Trust dialog could not be turned off
- The
-poption is a non-interactive option - It was listed in the documentation but had been mixed into a different flow
- Pipes and redirects were not described in the documentation
- It is determined when the CLI is launched
- With settings.json, calc can be launched via a hook without trust confirmation
- In one's own services, execution using the
-poption often becomes common - If it gets mixed in there, arbitrary code is executed
- CASE-5: Google Gemini
- Too powerful
- This is by design, after all
- Hooks are executed from SessionStart after the warning
- There was originally a mechanism that warns when a dangerous hook exists, but it could be bypassed
- But the point is that allowing the directory itself is dangerous
- Discovering vulnerabilities in AI agents
- Reversing the real binary and confirming calc on a real machine are necessary, but ideas are given through prompts and instructions are given to the AI agent
- Built a diagnostic flow using Codex
- Had the AI do everything
- Conclusion
- Opening an untrusted folder with an AI agent executes the attacker's code
- There are attacks for which prompt injection countermeasures alone are ineffective
- AI agents themselves should be run in an isolated environment
Impressions
It was very interesting content. Trust popups have recently become hollow formalities, so this was something to be careful about.
Let's be careful.