Coding Agent Security: Prompts Forbid Execution, but Configuration Invites It
A security firm's October 2026 reproduction report shows that the same attack chain succeeds against two independent coding agents, and no vendor patch can close it because the risk is a design property of AI agents rather than an implementation bug. This article breaks the chain into five steps — a webpage silently drops a project spec file into the download directory, the agent reads it and appends a malicious external tool block to the global config, gains file and command capabilities, then pulls in an impersonated package for persistence and data exfiltration — and maps each step to an inspectable check point. It then lays out five executable controls (entry control, config integrity, prompt/execution layering, egress whitelist, and rotate-on-discovery), an illustrative config-drift detection script, a control mapping table, and cloud implementation guidance.
1. A Problem No Vendor Patch Can Close
In October 2026, a security research organization published a reproduction report. Its conclusion is measured: the same class of attack succeeded across two independent coding agent toolchains, so there is no patch for any single vendor to ship. This is not an excuse for vendors — the attack surface comes from a design property of “what an agent is,” not from a flaw in a specific implementation.
The report offers an analogy that will feel familiar to QA engineers. When a browser renders a spoofed login page, the browser is doing exactly what it should; the vulnerability lives in the page, not in the browser. In the same way, an agent that strictly follows the project spec file sitting in its working directory is behaving exactly as designed. You may disagree with that framing, but it leads to an unavoidable conclusion: if you cannot wait for a patch, you have to turn this into a check in your own delivery gate.
2. Breaking Down the Chain: Five Actions, Five Check Points
The disclosed chain abstracts into five steps, each landing on a place you can inspect.
Step 1 — A webpage silently writes a spec file into the download directory. The download directory is one of the few places a page can write to on its own, with no click or confirmation, and the page controls both the filename and the content. Operating systems long ago closed the “auto-run downloaded executables” hole, but a project spec file is not an executable and falls outside any executable-focused guardrail.
Step 2 — The user launches the agent from the download directory. Telemetry cited in the report shows that roughly half of users have run a coding agent from the download directory, and about a quarter of sessions open a real browser. This path works not by coincidence but out of habit.
Step 3 — The agent reads the file and modifies the global configuration. The real sample is a 10-plus-KB “engineering work standard” document, with the malicious content buried in an inconspicuous “local development environment” subsection that instructs the agent to append an external tool service block to the global config.
Step 4 — The config takes effect, and the agent gains new tool capabilities: it can now read and write local files and execute commands.
Step 5 — An impersonated dependency package is pulled in to complete persistence and data exfiltration. In the report’s own testing, one chain executed a malicious package in more than 90% of runs; the other did so in about half.
3. Five Executable Detections
3.1 Entry control: treat the download directory as an untrusted input zone
- Prohibit launching coding agents directly from download, temp, or mounted shared directories; mark the source of the directory before launch.
- Perform source determination on newly created spec files: if a file’s creation time correlates with a web download event, downgrade it to “untrusted input” immediately.
- Add a minimal prompt at the terminal-launcher level: require explicit confirmation when the current directory contains spec files that are not under version control.
3.2 Config integrity: the global config must be verifiable
The global config is the real target of this chain, so bring it under version control and integrity checks.
- Establish a hash baseline for the global config file; treat any appended tool service block as drift.
- Allow config to be generated only through controlled templates, and prohibit the agent from writing to the global config at runtime.
- Project-level config must not declare external tool services or executable hooks.
3.3 Prompt and execution layering: a spec file is not an instruction
The core principle: a spec file in the repo may influence “suggestions” only, never “capabilities.”
- Inject spec file content as data, keeping it out of the high-priority instruction channel.
- Route any action that modifies the global config, installs dependencies, or starts an external service through separate approval.
- Statically scan spec files for imperative phrases such as “append config” or “install tools,” and alert on matches.
3.4 Egress whitelist: narrow the exfiltration channels
- Deny egress by default; allow only dependency repositories and the model API domains you actually need.
- Alert in real time on new domains, unusual ports, and long-lived upload connections.
- Install dependencies through internal mirrors with lockfile validation; prohibit dynamic pulls at runtime.
3.5 Rotate on discovery: treat credentials as already leaked
Once you confirm that a spec file has been injected, handle it as a leak: rotate tokens and keys, revoke sessions, roll back the global config, rebuild the workspace, and preserve the evidence chain.
4. A Config-Drift Check Script (Illustrative)
#!/usr/bin/env bash# Detect whether an external tool service block has been appended to the global configset -uCONF="$HOME/.config/agent/global.toml"BASELINE="$HOME/.config/agent/global.toml.sha256"if [ ! -f "$CONF" ]; then echo "no-config"; exit 0; fiif [ ! -f "$BASELINE" ]; thensha256sum "$CONF" > "$BASELINE"; echo "baseline-created"; exit 0fiif ! sha256sum -c "$BASELINE" >/dev/null 2>&1; thenecho "DRIFT: global config changed"grep -nE '^\[.*(server|tool|mcp).*\]' "$CONF" || trueexit 2fi# Warn on high-risk imperative phrases in project-level spec filesgrep -rniE 'append.*config|install.*(package|dependency)|write.*config' . \--include='*.md' | sed 's/^/WARN: /' || true
Attach this script at three points: before a session starts, before dependencies are installed, and as a wrap-up check after the session ends.
5. Control Mapping
| Risk stage | Control | Detection signal | Response |
|---|---|---|---|
| File write | No launch from download dir | Directory source marked | Refuse launch |
| Spec read | Data-form injection | High-risk imperative matched | Downgrade to suggestion |
| Config change | Global config read-only | Hash drift | Roll back and alert |
| Capability expansion | External service block whitelist | New service block | Block |
| Dependency install | Lockfile and internal mirror | Unexpected package name | Block |
| Data exfiltration | Egress whitelist | New domain / upload | Block and collect evidence |
| Credentials | Rotate on discovery | Injection confirmed | Full rotation |
6. Implementation Guidance
Split the controls above into three kinds of gates: a startup gate (directory and source), a change gate (config and dependencies), and an exit gate (egress and credentials). On the cloud, you can store config baselines in object storage, retain drift events in a logging service, handle real-time notifications through monitoring and alerting, and provide disposable workspaces through a container platform — turning a “non-patchable” design risk into measurable, regression-testable engineering checks.
