Sub topic 9
The dangerous combination: private data, untrusted input, outbound channel
This chapter assumes you know the agent tool loop, the sources of untrusted content, and how indirect prompt injection works. Here we look at when an injection becomes data theft.
Three ingredients
An injected instruction does harm only if the agent can act on it. Data theft needs all three of these at once:
- Private data. The agent can read something the attacker cannot, such as source code in a private repository,
.envfiles, cloud credentials, or tokens in environment variables. - Untrusted input. Attacker-controlled text reaches the agent's context. Examples are an issue body, a pull request comment, a README in a dependency, or tool output.
- An outbound channel. The agent can send information somewhere the attacker can read it. Examples are an HTTP request, a rendered image URL, a comment on a public issue, a commit pushed to a public fork, or a tool call to an external service.
This combination is often called the lethal trifecta. Remove any one ingredient and the attack path breaks.
A worked example
Suppose an agent triages issues in a private repository. It can read the whole repository, including a config file with an API key. It reads each new issue and posts a comment. If the repository accepts issues from outside contributors, an attacker can file an issue that tells the agent to include the key in its reply.
- Private data: the repository and the key.
- Untrusted input: the issue body.
- Outbound channel: the comment. If the repository is public, anyone can read it. If it is private, the comment may still reach the attacker through email notifications or a linked integration.
Nothing in this chain is a software bug. Each part works as designed, and the harm comes from the combination.
Checking a workflow
You can audit a design by listing its capabilities. This small check reports whether a workflow has all three.
REQUIRED = {"private_data", "untrusted_input", "outbound"}
def has_trifecta(capabilities):
return REQUIRED <= set(capabilities)
print(has_trifecta({"private_data", "untrusted_input"}))
print(has_trifecta({"private_data", "untrusted_input", "outbound"}))The first call prints False and the second prints True. The code is simple on purpose. The hard part is finding the capabilities. Outbound channels are easy to miss, so include less obvious ones such as link previews, image rendering, and DNS lookups made by a tool.
Breaking the combination
Prefer removing an ingredient over trying to filter malicious text. Filters fail because the model cannot reliably tell instructions from data.
| Remove | Example change |
|---|---|
| Private data | Give the agent a token scoped to one public repository, with no secrets in its environment. |
| Untrusted input | Run the agent only on content from trusted maintainers. |
| Outbound channel | Block network access except for an allowlist, and disable posting of comments with links or images. |
Exercise
A coding agent runs in a sandbox with no network access. It reads untrusted pull requests from forks and can read a deploy token in its environment. Does it have the trifecta? What would change your answer?
Show answer
Not as described. It has private data (the token) and untrusted input (fork pull requests), but no outbound channel. Your answer changes if the agent can write comments, push commits, or make any network request, because any of those could carry the token to the attacker. Removing the token from the environment would also close the gap.