NewThe Mac app is out for Apple SiliconGet it →
Fenzi
blog, safety

What is the lethal trifecta?

The lethal trifecta is an AI agent that has three things at once: access to private data, exposure to untrusted content, and a way to send data out. With all three, text planted in something the agent reads can tell it to collect your data and send it to an attacker. The fix is to take one of the three away, and for an AI coding agent the way out is usually the one to cut.

By Boris Kwemo, , seven-minute read

Most people meet the term in a thread about an agent that leaked something. It is worth knowing exactly, because it turns a vague worry about AI agents into a check you can run on your own setup: which of the three does my agent have right now?

Where the name comes from

Simon Willison, who also coined the term prompt injection, named the lethal trifecta in a post of 16 June 2025. His three parts are access to your private data, exposure to untrusted content, and the ability to communicate externally in a way that could be used to steal that data.

If your agent combines these three features, an attacker can easily trick it into accessing your private data and sending it to that attacker.Simon Willison, The lethal trifecta for AI agents

The reason is how language models work. A model reads its instructions and the content it processes as one stream of text, and it cannot reliably tell which part came from you. A sentence in a web page, an email or an issue can read like an instruction, and sometimes the model follows it. That is prompt injection, and the trifecta describes the setup where following it costs you data.

The three parts, in an AI coding agent

The original post is about tools that any assistant might combine. On a developer's laptop, an AI coding agent such as Claude Code, Codex or OpenCode can have all three from the first command, unless a sandbox setting takes one away.

PartWhat it meansIn a coding agent
Private dataAnything you would not publishThe source code, a .env file, ~/.ssh, cloud credentials, tokens in the environment
Untrusted contentText someone else can writeA README, an issue, a dependency's files, a fetched page, test output
A way outAny channel that reaches a hostcurl, a package install, git push, a web fetch tool, a link or image URL

The second row is the uncomfortable one. A working agent needs to read the project, and reading the project means reading text that strangers wrote. The third row is the one you can shrink most without stopping the work, so that is where the defense starts.

What it looks like when it happens

Anthropic's advisory GHSA-x5gv-jw7f-j6xj, published 15 August 2025, is the trifecta in one bug. A list of commands that Claude Code ran without asking was too broad, so the agent could read a file and send its contents over the network with no confirmation. The precondition was untrusted content in the context window. Version 1.0.4 fixed it by narrowing the list.

Willison's post gives a second case with all three parts in a single tool: a GitHub integration that could read public issues anyone can file, read private repositories, and open pull requests. An issue carried the instructions, a private repository held the data, and a pull request carried it out. Our list of prompt injection examples walks through more published cases with the same shape.

His post also notes that vendors fixed most such reports by closing the exfiltration path, so stolen data had nowhere to go. That is the pattern to copy.

Why a better prompt or a filter does not close it

The first reflex is to tell the model not to follow instructions in content. It helps sometimes, which is the problem: a model is not deterministic, and an attacker can phrase the same request in endless ways. Detection layers that scan for injected text have the same limit. In his notes on two prompt injection papers from late 2025, Willison describes a study in which adaptive attacks got past twelve published defenses.

A defense that stops most attempts still loses to the attacker who keeps trying. So the trifecta is not solved inside the model. It is solved by what the process around the model can reach.

"We told the agent to ignore instructions in files."

Revision 1: the agent will sometimes follow them anyway. Take away the way out, and following them leaks nothing.

Cut one part, and start with the way out

Willison's talk Living dangerously with Claude makes the case for coding agents: controlling which files an agent can read and write is the easy half of a sandbox, and controlling its network connections is the hard half. The network is the exfiltration leg, so blocking it protects your data even when injected instructions get through.

The agents you already run have settings for it.

Claude Code. The sandboxed Bash tool sends shell commands through a proxy that checks each host against your list, and that list starts empty. The same page warns that a broad entry such as github.com can create paths for data exfiltration, and that the proxy decides from the hostname without inspecting encrypted traffic. It covers shell commands and their child processes, so tools that run outside it need their own limits, which is most of the answer to whether Claude Code can access the internet.

{
  "sandbox": {
    "enabled": true,
    "network": {
      "allowedDomains": ["registry.npmjs.org"]
    }
  }
}

Codex. In the default sandbox, network access is restricted unless you turn it on; the permission types in the Codex source set that default. Keep it off in your global config and turn it on for the task that needs it.

OpenCode. Its security policy says plainly that OpenCode does not sandbox the agent, and points to a container or a virtual machine for real isolation. The network limit then comes from that box.

Whatever you use, the test is the same: list the hosts the task needs, refuse the rest, and treat every host on the list as a possible way out. A host that accepts uploads, posts or arbitrary query strings can carry data.

Shrink the other two as well

Cutting the network rarely gets to zero, since the agent still has to reach its model and usually a package registry. So make the other two parts smaller too.

Less private data. Keep real secrets out of the folder and the environment the agent works in. A development key with little reach is better than a rule that hides a production key; our notes on the .claudeignore file show why a list of paths to ignore is weaker than a file that is not there.

Less untrusted content. You cannot stop a coding agent from reading the project, but you can be careful about what you point it at: a freshly cloned repository, an issue from a stranger, a page it fetched. Anthropic's sandboxing page adds the other half: Effective sandboxing requires both filesystem and network isolation. Without the file limit, an agent can change the files that later decide what it may reach.

Where the trifecta stops: the Rule of Two

The trifecta covers one outcome, stolen data. In the same notes on two papers, Willison describes Meta's Agents Rule of Two, published on 31 October 2025, which swaps the third part for something wider: changing state or communicating externally. An agent should have at most two of untrusted input, access to sensitive systems or data, and the ability to change state, within one session.

Changing state includes the things a coding agent does all day: deleting files, pushing a branch, running a migration. When a task needs all three, the rule asks for supervision, such as a person approving the step. Our notes on human in the loop for AI agents cover where that approval works and where it turns into a reflex. Willison adds one caveat of his own: untrusted input plus the power to change state can do harm even with no private data in reach.

Both models land on the same practice. Decide what an agent can read, where it can send and what it can change, before it starts, and widen it only when a person says yes. That is what agentic AI security means to us, and the list of AI agent security risks we answer comes back to the same three questions.

A side note on how we do it

We build Fenzi, which starts the agent inside an OpenShell sandbox with a copy of the project, a short list of read-only hosts and a placeholder instead of the real key, so the way out and the data it could carry are both small. The default access sheet lists them, including the limit that a read can still carry data in its address. A container or a virtual machine with a tight host list cuts the same part.

So, what is the lethal trifecta?

It is the moment an AI agent can read your secrets, read a stranger's text and reach the internet, all at once. On a bare laptop, many coding agents start that way. You cannot make the model ignore the stranger, so take away a part: the way out first, then the secrets within reach. Willison's original post on the lethal trifecta for AI agents is short, and the best next read.

One line to install.
One command to run.

curl -fsSL https://fenzi.dev/install.sh | sh

Then fenzi run claude. Ask it to open a pull request with the GitHub API, and watch the deny land.