Saturday, November 14, 2026
Your coding agent's API key is now a C2 channel. Here's why it shouldn't also hold your cloud keys.


On 12 November, Darktrace's Signal Labs published research that every platform and security team running coding agents should read. In a lab, they turned a developer's Claude Code installation into a remotely controlled implant. They didn't use custom malware or a new C2 domain. They used nothing the network team would ever think to block.
The setup is worth understanding precisely, because the lesson is not "AI agents are dangerous." The lesson is narrower and more useful: an agent's AI-platform credential is now a command channel, so whatever else that agent can reach is the real blast radius.
What Darktrace actually showed
The attack starts after an ordinary compromise. The attacker already has a foothold on a Linux developer machine running Claude Code, and has stolen the user's Claude Console API credentials from it.
From there:
- A covert mailbox is set up. Using the stolen key, the attacker creates a memory store in the victim's Claude workspace. Memory stores are a legitimate platform feature for cross-session agent memory. The store contains three files: a heartbeat file, an input file for instructions and an output file for results.
- Persistence comes from a systemd unit. A transient systemd unit repeatedly launches headless Claude Code sessions. Each one checks in, reads the next job from the input file, executes it with its normal tools and writes the results back.
- The operator gives plain-English tasks. Over nine jobs, the agent mapped the local network, enumerated services, pulled files from an anonymous FTP share, generated a username list and password-sprayed a domain controller. It then listed SMB shares with the cracked account and downloaded a 1 GB file.
- Exfiltration goes through the Files API. The file was split into chunks and uploaded to the AI provider's own Files API.
Every byte of command-and-control and exfiltration went to the AI provider's API endpoint. That is the same endpoint the agent legitimately talks to all day, and the one your egress policy already allows.
Two caveats matter, and Darktrace states them clearly. First, this is not a vulnerability in the Claude platform; it abuses legitimate features. Second, it has not been seen in the wild. It also requires a prior endpoint compromise and stolen credentials. Nobody should read this as "Claude Code is broken." It is a demonstration of what a stolen key plus a capable agent adds up to.
Why this is a step change, not a curiosity
Attackers have offloaded work to AI tools before; several 2025–26 credential stealers did exactly that. What was missing was a live feedback loop: send a task, see the result, adapt and send the next one. Building that loop normally means planting an implant and keeping a C2 connection alive, both of which are things defenders hunt for.
Darktrace's point is that the agent's own plumbing now provides the loop. Three consequences follow:
- Domain-based egress controls can't help. Traffic to your AI provider is allowlisted by design. The attacker's commands look like ordinary agent traffic.
- The skill bar drops. The operator doesn't write nmap flags or spraying scripts. They describe a goal and the agent works out the steps, with the privileges of a trusted insider.
- Detection becomes behavioural and hard. Darktrace recommends correlating agent process trees with network traffic. That means watching for headless sessions launched by systemd, unusual command-line arguments and odd upload ratios to the AI endpoint. That's worth doing, but it's detection after the fact, and most teams don't have that telemetry for developer machines today.
Treat your AI platform keys as production credentials, because an attacker will.
Now add cloud credentials to that machine
Here is where it gets uncomfortable for anyone running agents against infrastructure.
In Darktrace's lab, the hijacked agent stayed on the local network: FTP, SMB, a domain controller. Now picture the typical setup for an agent that does infrastructure work. The same machine, or the same agent session, often holds things like these:
- an AWS, Azure or GCP profile with broad permissions, because "Terraform needs it";
- a long-lived cloud API token in a
.envfile or shell history; - a kubeconfig pointing at production, or an MCP server wired to a cloud API.
In that world, the attacker's next plain-English job isn't "spray the domain controller." It's "Create an IAM user with admin rights and return the keys", or "Snapshot the production database and share it with this account", or simply "Delete the backups." The agent will treat that as one more task. It will pick the right CLI commands, handle the errors and report back through the same allowlisted channel.
We've already seen the non-malicious version. In April, an AI coding agent working on a staging task at PocketOS hit a credential mismatch. It found an API token with far broader scope than its job needed, and deleted a production volume and its backups in a single API call. No attacker was involved. The agent simply had reach it should never have had. A stolen-key scenario is the same reach with an adversary steering it.
So the question isn't whether your agent's API key can be stolen. The question is what that key can make happen in your cloud.
The design principle: agents propose, something else applies
The fix isn't better prompts or a stricter system message. PocketOS showed that an agent can recite its rules and break them anyway. The fix is architectural: the process that holds the AI credential should never also hold the cloud credential.
Concretely, that means:
- No cloud credentials in the agent's environment. Not in env vars, config files or a local profile. If the agent machine is compromised, there should be nothing cloud-side to steal.
- Agents submit proposed changes, not API calls. The output of an agent's infrastructure work is a plan or diff, submitted to a separate control plane.
- The control plane runs a fixed, versioned procedure. Every change goes through the same steps: plan, policy and compliance checks, and a blast-radius assessment. The agent can't skip a step by asking nicely.
- A human who is not the requester approves. This is four-eyes for agents. The person who asked the agent for the change, or whose credentials the agent runs under, can't also approve it. A hijacked agent can file as many proposals as it likes, and each one still lands in front of someone who didn't ask for it.
- Only the control plane applies, with short-lived scoped credentials. Apply credentials live in the control plane and are minted per change.
- Everything is recorded. Who or what proposed the change, what the checks said, who approved it and what was applied. When something looks wrong, the audit trail tells you whether it was the agent, the human or someone else.
This is the model we built Bugz around. Agents such as Claude Code, GitHub Copilot or any MCP-capable agent propose infrastructure changes. Bugz runs a versioned procedure with Checkov, Trivy and a blast-radius check. An approver who isn't the requester signs off before anything applies, and every step lands in the audit trail. Bugz is self-hosted, so the credentials and the record stay inside your environment.
What this does not fix, honestly
It's worth being precise about the boundary. In the Darktrace scenario, the damage happened on the local network: reconnaissance, password spraying and file theft over SMB. A change-approval control plane doesn't stop any of that. For that you need endpoint hygiene, behavioural detection of agent processes and short-lived, workspace-scoped AI credentials, which is exactly what Darktrace and others recommend.
What separating proposal from application does is cap the cloud blast radius. A hijacked agent can still do harm on the machine it runs on. It can't turn that foothold into IAM changes, deleted backups or a production teardown, because it never holds the keys and can't approve its own requests.
Defence in depth means both layers. Today most teams have neither for their agents.
Why regulators are heading the same way
This isn't only good engineering; it's where supervisors are converging.
- United States. The OCC's Bulletin 2026-54, issued on 4 November, tells bank examiners to scale scrutiny of agentic AI by consequence and reversibility. It expects agent credentials to be governed like privileged identities, with kill switches ready.
- India. CERT-In's recent advisories have formally classified autonomous AI agents as an attack surface. They cover agents exceeding authorised scope inside Indian organisations' live systems and attackers using agentic tools against the financial sector.
- EU. DORA already requires financial entities to control and evidence ICT change management. The AI Act's human-oversight (Art. 14) and logging (Art. 12) duties for high-risk systems point the same direction ahead of the December 2027 deadline.
Across all three, the common thread is that an agent acting on production systems needs bounded authority, a human gate proportional to the consequence and a record you can show an auditor.
A five-minute checklist for this week
If you run coding agents anywhere near infrastructure, check these:
- Inventory AI platform keys. Who has them and on which machines? Are any long-lived? Rotate them and move to short-lived, workspace-scoped credentials.
- Search agent machines for cloud credentials. Check
~/.aws,~/.kube,.envfiles, shell history and MCP server configs. Anything an agent session can read, assume an attacker can use. - Watch for headless agent sessions. Look for agent processes launched by systemd, cron or other non-interactive parents, especially with permission-bypass flags.
- Audit your AI workspace. Review memory stores and uploaded files you don't recognise.
- Put a gate between proposal and apply. Even a manual PR-based process with a separate approver is better than an agent holding apply rights. Better still is a control plane that enforces it for every agent, every time.
Bugz is a self-hosted control plane between AI agents and your cloud. Agents propose; Bugz checks; a different human approves; Bugz applies and records. Built for regulated teams in the EU and India. bugz.cloud
Sources
- Darktrace Signal Labs, Living off the AI: Shared Memories as a Covert C2 Channel (12 Nov 2026)
- Cloud Security Alliance, CISO Daily Briefing, 13 Nov 2026 (Darktrace analysis; OCC Bulletin 2026-54)
- Techzine, AI agent deleted production environment after acting autonomously (PocketOS)
- Inc42, CERT-In flags unauthorised AI agent access to Indian organisations' systems
- Inc42, CERT-In flags AI-driven cyberattacks on Indian BFSI
— Shekhar Gowda, Founder, Bugz