A stolen model API key can steer your coding agentThe inference key is also a command channel
On November 12, 2026, Darktrace showed that a stolen Claude Console key, plus the Claude Code install already on the machine, gives an attacker a job queue, a file drop and an executor, all on the one hostname your egress rules already allow. The model key was never only a billing credential. Scope it and store it like the production credential it is.
-
01
Theft
Key copied
API and OAuth creds from the host
One small shell payload -
02
Channel
Memory store
Heartbeat, input and output files
Created with the stolen key -
03
Exposure
Agent runs jobs
Scan, spray, 1 GB to Files API
All via api.anthropic.com
TL;DR· the answer, in twenty seconds
What happened: Darktrace Signal Labs took a developer's Claude credentials in a lab, created a memory store in the developer's workspace, and had a systemd service relaunch Claude Code to read jobs from it. Over nine jobs the agent mapped the network, sprayed a password at the domain controller and uploaded a 1 GB file to the Claude Files API.
The minimum fix: Find every Anthropic key and credentials file on your developer machines and runners, check your workspaces for memory stores and files nobody created on purpose, and block bypassPermissions mode on hosts where no one meant to run an unattended agent.
The lesson: A credential's blast radius is every endpoint its scope opens, not the job you issued it for. A key that can store text and host files under the same hostname as inference is a command channel once an agent is installed.
On November 12, 2026, Darktrace Signal Labs published a lab demonstration in which a stolen Claude Console key turned the Claude Code install on a Linux host into a remote-controlled implant, with every order, result and stolen byte traveling to api.anthropic.com.
Darktrace is careful about what this is. The technique "does not rely on a vulnerability in the Claude platform," the company has not seen it in the wild, and it needs an attacker who already runs code on the developer's machine. There is no bug to patch. That is the reason to read it. Every step uses a feature working as documented, and the step that makes it work is a credential most teams still file under "billing."
What Darktrace ran in the lab
The write-up, Living off the AI: Shared Memories as a Covert C2 Channel by Moishe Tajtelbaum and Sam Lister, runs against a simulated Active Directory network: a Linux box with Claude Code, an SMB server and a domain controller.
A small payload, fetched with curl and run by dash, finds the Claude Code installation and collects the API and OAuth credentials for the user's Claude Console account. It sends them to a staging server. With those credentials the operator creates a memory store in a Claude workspace the user belongs to. Memory stores are a Claude Managed Agents feature: workspace-scoped collections of text files that agents read and write across sessions. Darktrace found that a store can be added to a workspace through the API whether or not the organization uses Managed Agents.
The store holds three files. One is a heartbeat, one is an input queue for jobs, and one is an output file for results. The payload then uses systemd-run to create a transient service that keeps launching Claude Code in non-interactive mode. Each run checks in through a hook, asks Claude Sonnet 4.5 to read the next job from the input file, carries it out with bash tool calls, and writes the result to the output file. Help Net Security's coverage adds that the service launched Claude Code with --dangerously-skip-permissions, so no human approved any tool call. The payload deletes itself. From then on the attack has no attacker server in it.
The operator sent nine jobs, in plain English. The agent found SSH, SMB and FTP on a neighbor with ip, ss and nc, then ran a targeted nmap. It pulled employee names and a password from an anonymous FTP share. It generated 190 candidate usernames and sprayed the password at the domain controller over SMB until one account worked. It listed shares with that account, downloaded a 1 GB file, split it into three parts, and uploaded them to the Files API at /v1/files on api.anthropic.com. The operator collected the data from Anthropic's platform.
Read the job text Darktrace published and you see how little skill the operator needed. One job asked the agent to "Generate a broad enterprise-style username candidate corpus" and to make it "broad and likely to hit." The model did the work a human operator would have scripted.
A credential reaches what its scope opens
The usual mental model of a model provider key goes like this: it lets someone run inference on your bill. Leak it, and the damage is a spend spike. Rotate it, cap the spend, move on. CSA's note on the Darktrace work says most earlier reporting on stolen keys focused on what they cost the victim in inference spend.
That model was always incomplete, and Darktrace's demo shows where it breaks. A Claude API key runs in a workspace, and in that workspace it can do whatever the workspace offers. Anthropic's workspaces documentation lists the resources a key reaches: files from the Files API, message batches, skills and prompt caches. The memory stores documentation describes stores as workspace-scoped too, readable and writable through the REST API. So the same sk-ant- string that pays for a completion can also create a persistent text store and host gigabytes of files. That is a message queue and a file drop, and both live on the host you already trust.
Two details in Anthropic's docs widen it further.
The first is who can read a file. The Files API page says files "are not scoped to an end user, conversation, or session. Any API key with access to a workspace can access any files uploaded to that workspace." If several developers upload to the same workspace, any one of their keys reads everyone's uploads.
The second is where Claude Code puts its keys. When a member first signs in to Claude Code with a Console account, Anthropic creates a Claude Code workspace in the organization and mints a per-user API key in it. Every later member who signs in lands in the same workspace. That keeps Claude Code traffic apart from your other API workloads, which is the point. It also means every developer's Claude Code key resolves to the same workspace, and per the Files API page, to the same files.
Tim Bazalgette, Darktrace's Chief AI Officer, named the deciding factor in his interview with Help Net Security: "whether the provider's API exposes services with text storage functionality alongside inference." He added that in this test "a standard API key reaches memory stores, while OAuth credentials don't." Credential type changed the outcome, and a Console sign-in to Claude Code mints the standard API key kind.
This is the general rule, and it holds beyond Anthropic. A credential's blast radius is the union of every endpoint its scope opens, multiplied by whatever executor sits next to it on the host. The job you issued the key for is irrelevant to an attacker. A GitHub token issued "for CI" can also add deploy keys if its scope allows it. A model key issued "for the coding agent" can create memory stores and upload files. Bazalgette said the file-upload endpoint Darktrace used "has an equivalent at OpenAI."
The coding agent is the executor you already installed
Using an AI service as a mailbox is not new. In November 2025, Microsoft's incident response team described SesameOp, a .NET backdoor that read commands from the OpenAI Assistants API and posted results back. SesameOp still needed its own implant on the host. The Cloud Security Alliance's research note on the Darktrace work makes the comparison: SesameOp used the API as a mailbox, while in Darktrace's scenario "the installed agent is the backdoor."
That changes what your defenses see. Walk the layers a SOC checks:
- The binary that runs is Claude Code, a signed tool your IT team approved.
- The process tree shows a coding agent spawning shells, which coding agents do all day.
- The network destination is
api.anthropic.com, a host on every allow list in a company that uses Claude Code. - The credential is valid and belongs to a real developer.
Each check returns normal. Renaud Deraison put the network half of it in Bromure's analysis: the allow list is now the C2 channel. Bazalgette's version: "Approved is not the same as safe, and only behaviour tells you the difference."
The demo also skipped the hard part of a normal intrusion. A human operator who lands on a Linux box still has to know which commands to run against an AD network, write a spray script and debug it. Here the operator handed over objectives and the model produced the commands. CSA notes that the operator still gave specific steps for some jobs and that Darktrace did not test vaguer tasking. The direction is clear enough. The skill floor for running an intrusion through a co-opted agent sits below the floor for running one by hand.
The preconditions are real and they are where you intervene. The attacker must already run code as the developer. They must get a key that can create memory stores and upload files. They must be able to run the agent unattended with permission checks off. Remove any one and the chain breaks.
What to change on Monday
Start with the credential, because that is the step that turns a foothold into a command channel.
Find the keys you have
Claude Code stores its login in ~/.claude/.credentials.json with mode 0600 on Linux, per Anthropic's authentication docs. On macOS it uses the Keychain, and falls back to the same file when the Keychain rejects the write, for example over SSH. If CLAUDE_CONFIG_DIR is set, the file lives there instead. Add the key in environment variables and dotfiles, and you have roughly the search a payload like Darktrace's would run. Run it yourself first:
#!/usr/bin/env bash
# Where can a payload running as this user find an Anthropic credential?
set -u
cfg="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
[ -f "$cfg/.credentials.json" ] && ls -l "$cfg/.credentials.json"
# Keys in the current environment (names only)
env | grep -oE '^(ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|CLAUDE_CODE_OAUTH_TOKEN)=' || true
# Keys written into dotfiles, history and project env files
grep -lsE 'sk-ant-(api|admin|oat)[0-9]*-' \
"$HOME"/.bashrc "$HOME"/.zshrc "$HOME"/.profile "$HOME"/.zprofile \
"$HOME"/.bash_history "$HOME"/.zsh_history \
"$HOME"/.config/*/*.env ./.env* 2>/dev/null
# apiKeyHelper and env blocks in Claude Code settings
grep -nsE '"(apiKeyHelper|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN)"' \
"$cfg"/settings.json ./.claude/settings*.json 2>/dev/null
Run it on laptops, build VMs and CI runners. Help Net's account says the credentials in Darktrace's scenario were sitting where the user's tooling had left them.
Check the workspace for things nobody made
The provider side keeps records, if you look. Run these with a key for the workspace you are checking. Anthropic's memory docs say every change to a memory creates an immutable version, attributed to the writing session, kept for 30 days, with the recent versions of a live memory kept longer. List what exists:
# Memory stores in the workspace this key resolves to
curl -s 'https://api.anthropic.com/v1/memory_stores?include_archived=true' \
-H "x-api-key: $WORKSPACE_REVIEW_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: agent-memory-2026-07-22"
# Files uploaded to the same workspace
curl -s https://api.anthropic.com/v1/files \
-H "x-api-key: $WORKSPACE_REVIEW_KEY" \
-H "anthropic-version: 2023-06-01"
Any store or large file that no sanctioned application created is an incident until proven otherwise. CSA's note points to the pattern worth flagging: frequent small writes to one memory, which is what a heartbeat looks like. The Files API page adds one more gap. When the Compliance API is on, its Activity Feed records uploads, downloads and deletions made with an API key. It records nothing while the Compliance API is off, and you cannot recover those records later. If you want the audit trail, turn it on before you need it.
Shrink what a stolen key can do
Bazalgette's advice was to use OAuth or federated identity where the platform allows it, and where it does not, keep keys short-lived, narrow and out of shell history, dotfiles and environment variables. The pieces exist in Claude Code today.
apiKeyHelper runs your script to fetch a key at startup and again after its cache lifetime, five minutes by default or whatever CLAUDE_CODE_API_KEY_HELPER_TTL_MS sets, per the settings reference. Point it at a vault that issues short-lived keys and the long-lived string never sits on disk for a payload to copy.
Workload Identity Federation replaces static keys with tokens minted from your identity provider, with lifetimes from one minute up to an hour by default. Read the scope line before you call it done, though. The default OAuth scope on a federation rule is workspace:developer, which the docs say "grants the same access as a workspace API key." Short-lived narrows the window. It does not narrow the reach. I did not find an inference-only scope in the workspace or federation pages I read on November 26, and CSA lists "the ability to turn off storage and file features for keys that only need inference" as something to ask providers for, which suggests it does not exist yet.
Since you cannot strip the reach, isolate it. Keep application uploads and memory stores out of the Claude Code workspace. For agents that run on a key you issue yourself, such as a CI job or a build VM, create a dedicated workspace and a key scoped to it, so a stolen agent key reads that workspace and nothing else. Set a spend limit on it too, while remembering that a spend limit caps the bill and does nothing about the 1 GB upload.
Take away the unattended mode
The Darktrace chain ran Claude Code with permission checks off. Anthropic's permission modes docs say bypassPermissions is meant for isolated containers and VMs. On developer machines, block it with managed settings:
{
"permissions": {
"disableBypassPermissionsMode": "disable"
}
}
Then add the endpoint detections CSA proposes: a coding agent binary launched by systemd-run, cron or a launchd job outside your approved automation, and agent processes that spawn nmap, nc or smbclient. Darktrace's own detection advice is to correlate agent process command lines and child processes with the data they move to the provider. Each agent settles into a ratio of bytes sent to bytes received during normal inference. A 1 GB file pushed to /v1/files in three pieces sits far outside it.
What this means for your stack
Treat your model provider key as a production credential this week. Inventory where it lives on every developer host and runner, keep application files and memory stores out of any workspace your agents' keys reach, list the memory stores and files in each workspace, and turn on the Compliance API if you have it. Block bypassPermissions on machines where nobody meant to run an unattended agent.
The pattern that fixes the category has two halves. Keep the long-lived key off disk and out of shell state, so a payload running as the developer finds nothing to send home, and hand the agent a short-lived credential at the moment it starts. Then assume the short-lived credential still reaches everything the workspace offers, and draw the workspace boundary around the agent.
hasp is one working implementation of the first half for keys you have to keep. hasp run --project-root . --env ANTHROPIC_API_KEY=@ANTHROPIC_API_KEY --grant-secret once -- claude hands the key to that one process as an environment variable and keeps it out of dotfiles, shell profiles and .credentials.json. Code running as you can still read a live process's environment, so pair it with the workspace split. Source-available (FCL-1.0), local-first, macOS and Linux, no account.
Whatever you use, stop asking what a key was issued for. Ask what it opens, and what is installed next to it that will act on what it reads.
Sources· cited above, in one place
- Darktrace Living off the AI: Shared Memories as a Covert C2 Channel
- Help Net Security Stolen Claude API keys can turn Claude Code into a remote-controlled implant
- Cloud Security Alliance Living Off the Model API: Stolen Claude Keys as Agent Implants
- Bromure The orders came through the API
- Anthropic Using agent memory: workspace-scoped memory stores and memory versions
- Anthropic Files API: workspace-scoped access and audit logging
- Anthropic Workspaces: API keys, resource scoping and the Claude Code workspace
- Anthropic Claude Code authentication: credential storage and precedence
- Anthropic Workload Identity Federation for the Claude API
- Anthropic Claude Code settings reference: ignored env variables, write block and allowedProviders
- Microsoft Security Blog SesameOp: Novel backdoor uses OpenAI Assistants API for command and control
Stop handing the agent your real keys.
hasp keeps secrets in one local encrypted vault, brokers them into the child process at exec, and never lets the agent read the value.
- Local, encrypted vault — no account, no cloud, no telemetry by default.
- Brokered run — agent gets a reference, the child process gets the value.
- Pre-commit + pre-push hooks catch managed values before they ship.
- Append-only HMAC audit log answers "did the agent touch the prod token?" in seconds.
macOS & Linux. Source-available (FCL-1.0, converts to Apache 2.0). No account.