Back to Intelligence

Docker Sandboxes API Key Leak: Detecting and Blocking Malicious AI Agent Kit Updates

SA
Security Arsenal Team
December 1, 2026
9 min read

Docker Sandboxes — Docker's isolation layer purpose-built for running AI coding agents such as third-party 'agent kits' — has been found to carry a flaw that lets an attacker distributing a malicious update to a third-party agent kit exfiltrate the developer's API keys out of the sandbox. That is precisely the failure mode the product was supposed to prevent: Sandboxes exist so that semi-trusted AI agents can execute code, install packages, and call tools without touching the host's secrets.

The blast radius here is larger than it first appears. These sandboxes routinely hold OpenAI, Anthropic, GitHub, and cloud-provider tokens injected as environment variables so the agent can function. A single malicious update to a popular community agent kit could harvest keys from thousands of developers in one sweep — a classic supply-chain amplification attack, delivered through a channel (auto-update) that users are conditioned to trust. If your developers run AI coding agents inside Docker Sandboxes, treat this as an active credential-exposure incident until proven otherwise.

Technical Analysis

Affected Products and Platforms

  • Docker Sandboxes — the isolated execution environment for AI coding agents, distributed with current Docker tooling (Docker Desktop / Docker CLI sandbox features) on Windows, macOS, and Linux developer workstations.
  • Third-party 'agent kits' — community-distributed packages that add AI agent capabilities, fetched and updated from external sources rather than from Docker's signed distribution channel.

The vulnerable population is developers who have installed third-party agent kits and who allow those kits to update themselves (or whose kits update automatically) from attacker-influenceable sources.

How the Attack Works (Defender's View)

The attack chain, reconstructed for detection purposes:

  1. Trust assumption: Docker Sandboxes isolate the agent's code execution, but the sandbox's update/egress path for agent kits is not held to the same trust bar. A kit can reach out to its own update infrastructure.
  2. Malicious update: The attacker poisons or distributes a malicious update to a third-party agent kit — via a compromised update server, a typosquatted package source, or a hijacked repository. The sandbox pulls and applies it.
  3. Secret access: Once inside, the updated kit runs with the sandbox's injected environment, which includes API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GITHUB_TOKEN, AWS_*, etc.).
  4. Exfiltration: The kit's code (or a child process it spawns — typically curl/wget or a script interpreter) reads the environment or mounted config and sends the keys to an attacker-controlled endpoint over HTTPS.

No CVE identifier was published in the source reporting at time of writing; the issue is tracked through Docker's advisory channel referenced below. Exploitation status: the weakness is documented with a working attack path against real-world agent-kit update flows; it requires no host compromise — only that the developer install an affected third-party kit and accept an update.

Why This Is a Supply-Chain Problem, Not Just a Bug

The durable lesson mirrors what we see in every package-ecosystem compromise: the update channel is a deployment primitive. An agent kit's updater effectively has code execution inside your secret-bearing sandbox — which makes every third-party kit a tier-1 dependency that should be version-pinned, hash-verified, and egress-restricted.

Detection & Response

SIGMA Detection Rules

The highest-fidelity behaviors are: (1) sandbox/agent processes fetching 'updates' from non-Docker, non-allowlisted domains, and (2) shells/network tools spawned inside the sandbox context reading credential material or POSTing outbound. Both rules below are tuned to the sandbox/agent-kit process lineage to keep false positives low.

YAML
---
title: Docker Sandbox Agent Kit Update Retrieval from Untrusted Source
id: 3f8a2b71-6c44-4d19-9e27-8a1b2c3d4e5f
status: experimental
description: Detects Docker sandbox/agent-kit processes fetching updates or payloads from domains outside Docker's official distribution and common package registries, consistent with a malicious agent-kit update chain.
references:
  - https://www.bleepingcomputer.com/news/security/docker-sandboxes-bug-could-leak-ai-api-keys-via-malicious-updates/
  - https://attack.mitre.org/techniques/T1195/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.initial_access
  - attack.t1195.002
logsource:
  category: network_connection
  product: windows
detection:
  selection_parent:
    Initiated: 'true'
    Image|contains:
      - '\docker\'
      - '\sandbox\'
  selection_downloaders:
    Image|endswith:
      - '\curl.exe'
      - '\wget.exe'
      - '\node.exe'
      - '\python.exe'
      - '\pwsh.exe'
  filter_allowlisted:
    DestinationHostname|contains:
      - 'docker.com'
      - 'docker.io'
      - 'github.com'
      - 'pypi.org'
      - 'npmjs.com'
      - 'openai.com'
      - 'anthropic.com'
  condition: (selection_parent or selection_downloaders) and not filter_allowlisted
falsepositives:
  - Legitimate agent kits updating from their own documented infrastructure (allowlist per kit)
level: high
---
title: Suspicious Child Process Reading API Credentials Inside AI Sandbox
id: 9c1e4d02-7b58-4a63-bf31-2d8e9f0a1b2c
status: experimental
description: Detects shell or network utility processes spawned by AI coding agent / sandbox processes with command lines referencing API key environment variables or credential files, indicating attempted secret harvesting by a malicious agent-kit update.
references:
  - https://www.bleepingcomputer.com/news/security/docker-sandboxes-bug-could-leak-ai-api-keys-via-malicious-updates/
  - https://attack.mitre.org/techniques/T1552/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.credential_access
  - attack.t1552.001
  - attack.exfiltration
logsource:
  category: process_creation
  product: windows
detection:
  selection_lineage:
    ParentImage|contains:
      - '\docker\'
      - '\sandbox\'
      - 'agent'
  selection_secrets:
    CommandLine|contains:
      - 'OPENAI_API_KEY'
      - 'ANTHROPIC_API_KEY'
      - 'GITHUB_TOKEN'
      - 'AWS_SECRET'
      - '.env'
      - '/proc/self/environ'
      - '/proc/1/environ'
  condition: selection_lineage and selection_secrets
falsepositives:
  - Agent startup routines legitimately echoing injected config (rare; tune by agent name)
level: critical
---
title: Outbound Exfiltration from AI Agent Sandbox Process
id: 5b7c8f93-1a62-4c55-ae84-6f3d2e1b0c9a
status: experimental
description: Detects sandboxed AI agent processes initiating HTTPS connections to rare/external endpoints shortly after process start, consistent with stolen API key exfiltration following a malicious kit update.
references:
  - https://www.bleepingcomputer.com/news/security/docker-sandboxes-bug-could-leak-ai-api-keys-via-malicious-updates/
  - https://attack.mitre.org/techniques/T1041/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.exfiltration
  - attack.t1041
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    Initiated: 'true'
    DestinationPort:
      - 443
      - 8443
      - 4443
    Image|contains:
      - '\docker\'
      - '\sandbox\'
      - 'agent'
  filter_ai_endpoints:
    DestinationHostname|contains:
      - 'openai.com'
      - 'anthropic.com'
      - 'api.github.com'
      - 'docker.com'
  condition: selection and not filter_ai_endpoints
falsepositives:
  - Agent kits that call self-hosted LLM gateways or private model endpoints (allowlist internal gateways)
level: high

Microsoft Sentinel / Defender KQL Hunt

Hunt for sandbox/agent processes making outbound connections to destinations that are neither Docker distribution infrastructure nor known AI provider endpoints, joined against process creation for download-utility child processes:

KQL — Microsoft Sentinel / Defender
let AI_Endpoints = dynamic(["api.openai.com", "api.anthropic.com", "api.github.com", "docker.com", "docker.io", "pypi.org", "registry.npmjs.org"]);
let SandboxNet = DeviceNetworkEvents
| where TimeGenerated > ago(24h)
| where InitiatingProcessFileName has_any ("docker", "sandbox", "agent")
    or InitiatingProcessFileName in~ ("curl.exe", "wget.exe", "node.exe", "python.exe")
| where RemoteUrl !has_any (AI_Endpoints) and RemoteIP !startswith "10." and RemoteIP !startswith "192.168."
| summarize Connections=count(), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated)
    by DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, RemoteUrl, RemoteIP
| where Connections >= 1;
let SandboxProc = DeviceProcessEvents
| where TimeGenerated > ago(24h)
| where ProcessCommandLine has_any ("OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GITHUB_TOKEN", ".env", "/proc/1/environ")
| summarize FirstSeen=min(TimeGenerated) by DeviceName, FileName, ProcessCommandLine, InitiatingProcessFileName;
SandboxNet
| join kind=leftouter SandboxProc on DeviceName
| project DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, RemoteUrl, RemoteIP, ProcessCommandLine, FirstSeen, LastSeen
| order by FirstSeen asc

Run the left half (network) and right half (secret-touching processes) independently too — either one alone on a developer workstation warrants triage.

Velociraptor VQL Hunt

Collect live processes on developer endpoints whose environment contains AI API keys and that hold outbound connections to non-allowlisted destinations:

VQL — Velociraptor
-- Hunt: sandboxed AI agent processes holding API keys with outbound connections
LET procs <= SELECT Pid, Name, CommandLine, Exe, Username
  FROM pslist()
  WHERE CommandLine =~ 'docker|sandbox|agent|curl|wget|node|python'

LET conns <= SELECT Pid, Family, Type, Laddr, Raddr, Status, Pid as ConnPid
  FROM netstat()
  WHERE Status =~ 'ESTAB'
    AND Raddr !~ '^(10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.|127\.)'

SELECT procs.Pid AS Pid,
       procs.Name AS ProcessName,
       procs.Username AS User,
       procs.CommandLine AS CommandLine,
       conns.Raddr AS RemoteAddress,
       conns.Status AS ConnStatus
FROM procs
JOIN conns ON procs.Pid = conns.ConnPid
WHERE CommandLine =~ 'OPENAI_API_KEY|ANTHROPIC_API_KEY|GITHUB_TOKEN|\.env'
   OR ProcessName =~ 'docker|sandbox'

Deploy as a hunting artifact across your developer fleet via a Velociraptor hunt; export matches for IR scoping.

Remediation & Hardening Script

Run on developer Linux/macOS workstations (or via MDM) to enumerate sandboxes, verify Docker is current, pin agent kits, and audit for exposed keys in shell profiles:

Bash / Shell
# 1. Verify Docker engine/desktop version — update to the latest release that
#    ships the Docker advisory fix for the sandbox update path
docker version --format '{{.Server.Version}}' 2>/dev/null
# Compare against: https://docs.docker.com/desktop/release-notes/

# 2. List running sandboxes / agent containers to scope exposure
docker ps --filter 'label=com.docker.sandbox' --format '{{.ID}} {{.Image}} {{.Status}}'

# 3. Audit which third-party agent kits are installed and their sources
#    (adjust path to your kit install root)
find ~/.docker/sandboxes ~/.config -maxdepth 3 -name '*.json' -exec grep -l 'update' {} \; 2>/dev/null

# 4. Check for API keys sitting in plain-text profiles (rotation candidates)
grep -REn 'OPENAI_API_KEY|ANTHROPIC_API_KEY|GITHUB_TOKEN' \
  ~/.bashrc ~/.zshrc ~/.profile ~/.env 2>/dev/null

# 5. Egress hardening: block sandbox traffic to everything except an allowlist
#    (example with iptables for the docker sandbox bridge; adapt to your CNI)
# sudo iptables -A OUTPUT -o <sandbox-if> -d api.openai.com -j ACCEPT
# sudo iptables -A OUTPUT -o <sandbox-if> -d api.anthropic.com -j ACCEPT
# sudo iptables -A OUTPUT -o <sandbox-if> -j DROP

# 6. Force re-pull of pinned, hash-verified kit versions instead of auto-update
#    Disable any kit auto-update flag, e.g.:
#    export AGENT_KIT_AUTO_UPDATE=0

Remediation

  1. Update Docker immediately. Apply the Docker Desktop/CLI release carrying the sandbox fix — monitor Docker's release notes and security advisories at https://docs.docker.com/security/ and the disclosure coverage at the BleepingComputer source URL. Until patched, the update channel of any third-party kit is untrusted code execution inside a secret-bearing sandbox.
  2. Rotate the keys — assume exposure. Any API key that has ever been injected into a Docker Sandbox running a third-party agent kit should be rotated now: OpenAI, Anthropic, GitHub PATs, cloud keys. Prioritize keys on workstations that installed community kits in the last 90 days.
  3. Disable auto-update for agent kits. Pin kit versions, verify signatures/hashes where available, and only update through a reviewed, internally mirrored package source. Treat agent kits with the same vetting bar as production dependencies.
  4. Restrict sandbox egress. Sandboxes need API provider endpoints and package registries — nothing else. Enforce egress allowlists (DNS or proxy-based) so even a malicious kit update cannot reach an attacker's collector. This is the single control that neutralizes exfiltration even if the update path is compromised again.
  5. Stop injecting real production keys. Use scoped, short-lived, per-project keys with spend/rate limits for agents. Where supported, use a secrets broker that issues ephemeral credentials rather than placing long-lived keys in environment variables.
  6. Audit and inventory. Identify every developer workstation running third-party agent kits, the kits' update sources, and which secrets were available in those environments. Feed the Sigma/KQL logic above into your pipeline and hunt retroactively over at least 90 days.
  7. Monitor for key misuse. After rotation, watch provider dashboards (OpenAI/Anthropic usage, GitHub audit log) for the old keys' attempted use — attempted use of a rotated key is a high-confidence intrusion indicator.

Related Resources

Security Arsenal Red Team Services AlertMonitor Platform Book a SOC Assessment pen-testing Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.