Coding Agents: Malicious Instructions
Forever Security reported on October 22, 2026, that it blocked a coding agent from installing a known malicious package after the agent followed an AGENTS.md file found in a customer’s Downloads folder. The researchers could not establish how the file originally arrived on the machine. Source: Forever Security’s incident report.
The company subsequently described controlled reproductions involving planted instruction files and changes to agent configuration. Those demonstrations should be distinguished from the original incident: they illustrate possible attack paths, not proof of the customer’s initial compromise route. Source: Forever Security’s controlled demonstrations.
I have not independently reproduced the findings. My concern is the boundary they expose between information an agent reads and authority to act.
Where the trust boundary is crossed
In the researchers’ reconstructions, the planted instructions sought persistent configuration changes that would register an attacker-controlled tool server, with execution triggered through agent startup. That reconstruction is not proof that every stage occurred on the customer’s machine. Source: Forever Security’s reconstruction.
I separate the chain into three decisions: whether to read the file, whether to authorize a configuration change, and whether to execute the resulting integration. The last two should not inherit permission from the first. This is my interpretation of the reported mechanism, not an additional incident finding.
Reading instructions must not grant permission
OWASP describes indirect prompt injection as external content, including files and websites, altering a model’s behavior in unintended ways. Its guidance recommends separating untrusted content, restricting privileges, and requiring human approval for high-risk operations. Source: OWASP’s prompt-injection guidance.
My position is that project instructions can explain how to perform an authorized task. They should not independently authorize new software, access to credentials, or persistent changes to the agent’s environment.
A recognizable filename is not a sufficient basis for that decision.
The safeguards I would prioritize
Separate intake from execution. I would inspect unfamiliar repositories and instruction files before allowing an agent to act on them. For untrusted projects, I would favor an isolated, restricted environment rather than my everyday working session. This is my practical recommendation in response to the report, not a claim that moving files out of Downloads prevents the attack. Context: Forever Security’s report.
Limit access. I would expose only the files and capabilities required for the task, following OWASP’s recommendation to minimize tools and permissions. Source: least privilege.
Approve sensitive actions separately. I would require a specific decision for installations and persistent configuration changes, applying OWASP’s recommendation for human approval of high-impact actions. Source: approval guidance.
Enforce authorization outside the model. I would follow OWASP’s complete-mediation guidance: downstream systems must check requests against policy rather than trust the model’s permission judgment. Source: authorization guidance.
Keep execution records. I would log tool activity and relevant configuration changes. OWASP treats monitoring as damage limitation, not prevention. Source: monitoring guidance.
A reproducible authorization demonstration
For this article, I include a small Node.js demonstration with instructions and limitations. It uses a fictional document and explicitly scripted requests. No model reads the document, and no real agent configuration is accessed.
The comparison is deliberately narrow. An unrestricted mock executor accepts a helper-registration request even though the displayed context says separate approval is required. A restricted executor checks authorization outside the request before touching its in-memory state. The warning is not an evaluated prompt defense: there is no model here whose compliance is being tested.
The executed demonstration passed eight scripted checks. Its complete JSON transcript records the following results:
| Scripted case | Decision | In-memory writes |
|---|---|---|
| Warning only, no authorization check | Allowed | 1 |
| Policy enforced, no approval | Blocked | 0 |
| Request claims it is approved | Blocked | 0 |
| Preauthorized draft edit | Allowed | 1 |
| Approval does not match the requested value | Blocked | 0 |
| Matching approval from the trusted driver | Allowed | 1 |
| Reuse of that consumed approval | Blocked | 0 |
| Unknown tool | Blocked | 0 |
The trusted driver deliberately approves one fictional helper change to demonstrate the legitimate path. That is not a recommendation to approve suspicious setup instructions. In this implementation, permission is bound to the tool, target, and value, and consumed once. A request claiming its own approval cannot issue a grant.
The replay check also counts writes: setting the same value again could leave the final state unchanged while still performing an unauthorized operation. Checking only the final value would miss that distinction.
To reproduce it from a copy of this site’s repository, run:
node assets/examples/agent-authorization-demo.mjs
It prints the transcript and exits unsuccessfully if an assertion fails. The script uses only Node’s built-in assertion module; it does not install packages, execute shell commands, read or write files, make network requests, or use real credentials.
These results verify the specified behavior of a toy authorization gateway, not resistance to prompt injection. They do not measure attack success rates, test an operating-system sandbox, or reproduce Forever Security’s incident. The independent contribution is the inspectable boundary and its checks, not a claim that a coding agent has been secured.
Bound autonomy rather than assume trust
OWASP does not identify a foolproof prevention method for prompt injection; its recommendations focus on mitigation and limiting impact. I would therefore treat these safeguards as complementary layers, not a guarantee. Source: OWASP’s mitigation guidance.
I want coding agents to carry out useful work, but permission must remain separate from whatever content they encounter. A document may provide context. It should not acquire authority over my machine simply because an agent reads it.