{"slug": "your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8", "title": "Your AI Coding Agent Just Leaked a Secret. Bots Found It on Docker Hub in 8 Seconds", "summary": "Stony Brook University researchers Billy Tsouvalas and Nick Nikiforakis found that bots pulled and exploited secrets planted in 300 honeypot container images across eight public registries, with the fastest planted AWS key used 7.86 seconds after its image went live and all 100 first-round AWS keys used within 15 minutes, according to research presented at the ACM Conference on Computer and Communications Security and reported by BleepingComputer on Nov. 17. The honeypot images were pulled more than 75,000 times and the planted AWS keys drew over 140,000 API calls from roughly 5,000 unique IP addresses, with a median time to first API call of 51.19 seconds. GitGuardian separately found 31,088 distinct secrets in Claude Code settings.local.json files on GitHub, which ship into container images unless .dockerignore excludes them because .gitignore does not affect the build context.", "body_md": "## **TL;DR**\n\n- **Bots read your Docker layers in 7.86 seconds** : Stony Brook researchers planted keys in 300 honeypot images. Every AWS key was used within 15 minutes, and the median first API call came after 51 seconds.\n- **Your AI agent's memory ships with your code** : Claude Code saves \"don't ask again\" commands, API keys included, to settings.local.json. GitGuardian found 31,088 distinct secrets in these files on GitHub, and a .gitignore will not keep them out of an image.\n- **Five fixes you can start today** : Rotate what those files held, update .dockerignore, scan every layer, and stop the leak at the agent with AI Hooks. See what to do before the next bot gets there first.\n\nOn Nov. 17, [__BleepingComputer reported__](https://www.bleepingcomputer.com/news/security/cloud-keys-leaked-in-docker-hub-images-are-stolen-within-seconds/?ref=blog.gitguardian.com) on research from Billy Tsouvalas and Nick Nikiforakis of Stony Brook University. They published [__300 honeypot images__](https://dl.acm.org/doi/epdf/10.1145/3830454.3846791?ref=blog.gitguardian.com) across eight public registries over four months and presented the findings at the most recent ACM Conference on Computer and Communications Security earlier this month. \n\nThe fastest planted AWS key was used 7.86 seconds after its image went live. That is far faster than any human or team could ever react.\n\nDevelopers commonly run AI coding agents, which make the same mistakes humans have been making for years: writing plaintext credentials into project config files. Those files follow the code into container builds. That is how Docker Hub secrets end up in front of the bots reading image layers.\n\nIn an era of [__Artex and the many variations of autonomous offensive security AI agents__](https://blog.gitguardian.com/ai-pentesting-tools-beyond-artex/), that means any keys shipped should be considered already compromised, and any connected systems already breached. \n\n## **How the ContainerBots study worked**\n\nOver four months, the researchers exposed API keys for AWS, OpenAI, and Anthropic, along with decoy SSH keys and various database credentials in honeypot images. These honeypots recorded whenever an image was built, run, or had a shell opened inside it. The results paint a startling picture of how fast secrets get abused.\n\nThe images were pulled more than 75,000 times. There is no legitimate reason anyone should have pulled them, but that is just part of the story. The planted AWS keys received over 140,000 API calls from about 5,000 unique IP addresses.\n\nAll 100 AWS keys in the first round were used within 15 minutes. The median time to the first API call was 51.19 seconds.\n\nHow the AWS keys were used ranged from simple validity checks to listing resources and, at times, actually consuming them. The OpenAI and Anthropic keys were used to drain the test accounts' balances, all within seconds.\n\nMonitoring rarely saw anyone run the honeypot images. The scanners most likely unpacked layers or queried the registry API directly. This is a common technique and abuses the fact that many developers forget to clean up old layers before they ship.\n\nThe researchers grouped the scanners under the name \"ContainerBots.\" They found no evidence that one operator coordinated them. The attacks come from all over the place, are automated, and seem commonplace. Moving ahead, we can conclude this is simply the reality of publishing any container images or code online: it will be scanned and leveraged for attacks at machine speeds.\n\n## **A gitignored file still ships unless .dockerignore stops it**\n\nContainer layers are files, and the bots simply read those files. The build context is the real exposure point. When the code is copied from the working tree into the image, it reads the directory on disk, ignoring the Git index entirely.\n\nA file that .gitignore keeps out of every commit still lands in the image unless .dockerignore excludes it. Developers who trust their .gitignore have no reason to suspect the image.\n\nRemoving the file is the logical step many developers take after alerts go off. However, without revoking those secrets, this fixes nothing that already shipped. Images pushed before the cleanup keep all their layers and any secrets they contain. Every tag built from that context carries the same secret.The ContainerBots findings give us a sense of scale and speed of credential harvesting on Docker Hub. To understand what is really at risk, we need to ask what real credentials make it into those layers. More and more, the answer is secrets from your AI coding agents.\n\n## **AI agent secrets leak into Docker Hub**\n\nGitGuardian researchers recently published their work about how often they are encountering secrets in [__Claude Code local files: settings.json and settings.local.json__](https://blog.gitguardian.com/claude-code-settings-local-json-secrets-docker-hub/) \n\nWhen Claude Code asks permission to run a shell command, choosing \"Yes, and don't ask again\" saves an allow rule to .claude/settings.local.json. The rule stores the full command string. A curl call with an API key in a header gets saved with the key. Claude Code keeps the file out of Git by default. Nothing in a repository enforces that, and nothing in a Docker build respects it.\n\nBetween January 2025 and early November 2026, on GitHub alone, GitGuardian counted over 89,000 instances of these files. The files held 31,088 distinct secrets across 23,276 repositories. 5,343 of those secrets were valid at the time of detection. We know this is just the tip of the iceberg, as code ends up in many places beyond GitHub. The same research also looked into the scale of the problem on Docker Hub.\n\nPublic images held 109,284 occurrences in settings.local.json and 29,613 in settings.json. The files held 613 distinct secrets, and 99 were valid. 72% of the files sat under /app, /workspace, or /usr/src, the typical landing spots for file system copies.\n\nClaude Code is only one agent among many. GitGuardian counted config files for 30 AI agents on public GitHub, and every one of them leaked. Most leaks were MCP server definitions with API keys in env blocks. CLAUDE.md files held 6,155 distinct secrets, and 2,537 of them were valid. That was the highest validity rate of any file in the study.\n\nKnowing that your AI agent config can unexpectedly leak online is the first step toward addressing the issue, which many teams are working to tackle at scale.\n\n## **AI agent configs are part of your credential layer**\n\nThe credential layer is where the full set of your credentials live.\n\nThese are all the secrets, API keys, certificates, and passwords that let code, machines, developers, and AI agents access systems. Accounting for the [__credential layer__](https://blog.gitguardian.com/credential-layer-security/) involves knowing where those credentials exist, if they should exist there, and where they can move. It spans repos, pipelines, and vaults. It reaches container images, developer endpoints, and collaboration tools, along with public code and AI workflows.\n\nAI coding agents add a whole new surface to our enterprise credential layer. It is one more place where secrets can sprawl, and also a new mechanism for spreading those credentials. A secret typed into a text file on a laptop becomes a line in a config file, which can join the build context and become a public Docker image layer. The whole trip can happen without anyone writing a secret into source code on purpose. Intent does not matter. The bots will likely still read it within a minute of publishing.\n\nPart of the research findings point to failures of detecting \"generic secrets,\" secrets that do not follow a specific pattern or use prefixes, like passwords, bearer tokens, and high-entropy strings. GitGuardian research found those generic detections accounted for 63% of settings.local.json occurrences. Scanners tuned only to provider key formats miss most of what agents write down.\n\n## **What you can do right now**\n\nIf you think you might be exposed, the GitGuardian research and the Stony Brook study point to the same remediation steps:\n\n1. **Rotate exposed credentials:** Rotate every credential a Claude Code settings file has ever held. Git history, forks, and image tags keep copies.\n2. **Exclude agent config folders from Git and Docker builds:** Add .claude/ to .dockerignore and .gitignore. Apply the same rule to .cursor/, .codex/, and .mcp.json.\n3. **Clean up allow rules:** Remove secret-bearing allow rules by editing the file or running /permissions. Reference secrets as variables such as $N8N_API_KEY, so rules store the name.\n4. **Scan every image layer:** Scan built images before pushing, including every layer.\n5. **Check logs for abuse:** Review cloud logs and AI provider usage from the date each exposed image was first pushed.\n\nStep 1 takes the most work. Many teams have no record of which allow rules held which secrets. A file that changed across dozens of tags may have carried a different credential in each one. Fortunately, mature tools are available to give you the visibility you need to remedy secrets sprawl at scale.\n\n## **Prevent, detect, and remediate across the whole organization**\n\nThe strongest programs do not rely on a single control. Adding defense in depth across the credential layer needs to work at least 3 levels: stop new secrets before they are written down, find the ones that already escaped, and shut down the ones that still work.\n\n### **Prevent secrets from sprawling in the first place**\n\nThe easiest secret to clean up is the one that never makes it to plaintext. This includes preventing the agents from using any secrets they encounter, which is exactly what [__GitGuardian AI Hooks__](https://blog.gitguardian.com/ai-hooks-ai-coding-assistants/) do. Delivered through ggshield, the GitGuardian CLI, these commands fire at multiple points across the AI coding agent's workflow. Before Claude Code runs a shell command, reads a file, or calls an MCP server, the hook checks it for secrets. \n\nThat curl command with an API key in the header gets stopped before anyone has the chance to click \"Yes, and don't ask again,\" so it never becomes a rule in settings.local.json. The same hook also keeps secrets in command output from flowing back to the agent.\n\nPrevention doesn't stop at the agent; you need to find and stop secrets wherever they appear. Pre-commit hooks can stop secrets from ever reaching a shared repository or becoming part of any git history. ggshield can also scan your Docker images in your CI pipelines, so a key baked into a layer gets caught before it ever reaches a registry, public or private. All AI and pre-commit protections, along with the other tools included with [__Developer Endpoint Protection__](https://www.gitguardian.com/developer-endpoint-protection?ref=blog.gitguardian.com), can be administered through [__MDM via Jamf, Intune, Iru, and more__](https://docs.gitguardian.com/endpoint-protection/deploy/deploy-with-jamf?ref=blog.gitguardian.com). You can ensure the same guardrails are deployed to every machine in your fleet. This is especially urgent when you consider that everyone in your org likely already has access to tools like Claude Code and Cowork, or similar tools, not just classically trained developers. \n\n### **Detect every occurrence of the secret**\n\nPrevention will catch a lot once in place, but sometimes secrets appear, or reappear, unexpectedly. People paste secrets into places they should not, and plenty of images were pushed long before anyone thought about agent config files. Those secrets are already out there, and you need to know where.\n\n[__GitGuardian's Public Secrets Monitoring__](https://www.gitguardian.com/monitor-public-github-for-secrets?ref=blog.gitguardian.com) keeps watch on the public places your code ends up, and that now includes Docker Hub. The [__Docker Hub source__](https://docs.gitguardian.com/public-monitoring/sources/dockerhub?ref=blog.gitguardian.com) scans the layers of public images and ties what it finds back to your organization. That works even when the image was pushed from a personal account by someone your security team has never heard of. \n\nEach incident points to the exact image and layer, so your team knows exactly where the secret lives. Docker Hub monitoring is currently available to select workspaces, so reach out to your Customer Success team to get it turned on.\n\nFor all of the internal surfaces where secrets end up, [__GitGuardian Secrets Monitoring__](https://www.gitguardian.com/monitor-internal-repositories-for-secrets?ref=blog.gitguardian.com) covers your private repos, CI/CD pipelines, and private container registries. Those are the places most of these images get built and stored before anyone decides to make them public. \n\nThe platform also scans systems around the software development lifecycle, like Jira, Slack, and Confluence. With Endpoint Protection, you can see what is on every laptop, stored in plaintext, outside of the vaults or secret managers.\n\n### **Remediate as fast as safety allows**\n\nFinding the secret is only the first part of the job when reacting to a leak. Where most teams' processes bog down is knowing what those leaked keys unlock and who is needed to fix it, without breaking production or the build pipeline. GitGuardian checks whether each exposed credential is still valid, so your team can start with the keys an attacker could use right now. But that's only part of the story.\n\n[__The GitGuardian Exploration Map__](https://docs.gitguardian.com/nhi-governance/discover-your-nhis?ref=blog.gitguardian.com#exploration-map) shows what each credential connects to, whether it is vaulted, and how it is stored. Each secret can easily be tracked back to an owner who can help speed or execute the remediation and revocation process. \n\nThe unified view of your secrets incidents turns a scary list of leaked secrets into a sorted, ordered set of fixes your team can work through. A live database password tied to production can be prioritized and handled before a valid test key.\n\n## **Your agents will remember everything**\n\nAI coding agents are built to remember what we approve. They now do this via local configuration files that often contain our secrets: those API keys we approved them to use, or that secrets.txt file we said it was OK to access.\n\nThose files can easily travel with our code and be copied into builds. When those builds end up in public registries, the evidence points to bots reading them and testing those secrets in seconds. A secret typed once into an agent prompt can easily outlive the project it was meant for.\n\nThe way forward will look familiar to anyone already fighting secrets sprawl: Know where your credentials live, stop new ones from leaking, and revoke the ones that already have. The only thing that has really changed is the urgency. The bots are not going to slow down, so your credential layer security program needs to keep pace.\n\nIf you don't know where to start to assess whether you are at risk from publicly exposed secrets, we invite you to take our free public GitHub Security Audit to start building your baseline of credential abuse risk.\n\n## FAQ\n\n## How fast do bots abuse secrets published in Docker Hub images?\n\nStony Brook University researchers Billy Tsouvalas and Nick Nikiforakis published 300 honeypot images across eight public registries over four months. The fastest planted AWS key was used 7.86 seconds after its image went live, all 100 AWS keys in the first round were used within 15 minutes, and the median time to the first API call was 51.19 seconds.\n\n## What did the ContainerBots study find?\n\nThe honeypot images were pulled more than 75,000 times, and the planted AWS keys received over 140,000 API calls from about 5,000 unique IP addresses. The OpenAI and Anthropic keys were quickly used to drain the test accounts' balances. The researchers found no evidence that one operator coordinated the scanners, which suggests automated credential harvesting is now commonplace.\n\n## Why does a file in .gitignore still end up in a Docker image?\n\nA Docker build copies files from the working tree on disk and ignores the Git index entirely. A file that .gitignore keeps out of every commit still lands in the image unless .dockerignore excludes it. Developers who trust their .gitignore have no reason to suspect the image.\n\n## How do AI coding agents leak secrets through config files?\n\nWhen Claude Code asks permission to run a shell command, choosing \"Yes, and don't ask again\" saves an allow rule to .claude/settings.local.json that stores the full command string. A curl call with an API key in a header is saved with the key. Claude Code keeps the file out of Git by default, but nothing in a repository enforces that and nothing in a Docker build respects it.\n\n## How many secrets from AI agent config files has GitGuardian found?\n\nBetween January 2025 and early November 2026, GitGuardian counted over 89,000 secret occurrences in Claude Code settings files on GitHub. settings.local.json alone held 31,088 distinct secrets across 23,276 repositories, and 5,343 of those secrets were valid at detection. On Docker Hub, public images held 109,284 occurrences in settings.local.json and 29,613 in settings.json, with 613 distinct secrets, 99 of them valid. Config files for all 30 AI agents GitGuardian counted on public GitHub leaked secrets.\n\n## Why do scanners miss secrets in AI agent config files?\n\nGeneric secrets such as passwords, bearer tokens, and high-entropy strings do not follow a specific pattern or prefix. GitGuardian found that generic detections accounted for 63% of settings.local.json occurrences, so scanners tuned only to provider key formats miss most of what agents write down.\n\n## What should I do if my Docker images contain AI agent config files?\n\nRotate every credential a settings file has ever held, since Git history, forks, and image tags keep copies. Add .claude/, .cursor/, .codex/, and .mcp.json to .dockerignore and .gitignore, and remove secret-bearing allow rules by editing the file or running /permissions. Reference secrets as variables so rules store the name, scan built images including every layer before pushing, and review cloud logs and AI provider usage from the date each exposed image was first pushed.\n\n## Does deleting the file or pushing a new image fix the exposure?\n\nNo. Images pushed before the cleanup keep all their layers and any secrets they contain, and every tag built from that context carries the same secret. Without revoking the secrets, removing the file fixes nothing that already shipped.\n\n## How does GitGuardian help prevent, detect, and remediate secrets in container images?\n\nAI Hooks delivered through ggshield check shell commands, file reads, and MCP calls before they run, so a key never becomes an allow rule. ggshield also scans Docker images in CI pipelines before they reach a registry. Public Secrets Monitoring now covers Docker Hub for select workspaces, tying layers back to your organization, while validity checks, the Exploration Map, and ownership context help teams remediate the keys an attacker could use right now.", "url": "https://wpnews.pro/news/your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8", "canonical_source": "https://blog.gitguardian.com/docker-hub-secrets-ai-agentsuntitled/", "published_at": "2026-11-25 16:00:00+00:00", "updated_at": "2026-11-25 16:15:08.548360+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-safety", "developer-tools"], "entities": ["Stony Brook University", "Billy Tsouvalas", "Nick Nikiforakis", "BleepingComputer", "GitGuardian", "Claude Code", "Docker Hub", "ACM Conference on Computer and Communications Security"], "also_reported_by": [], "takeaway": "Secrets in container build contexts are exploited in seconds — the fastest planted AWS key was used 7.86 seconds after publication — so exclude agent config files like Claude Code's settings.local.json via .dockerignore and scan every image layer, since .gitignore does not keep them out.", "recommendation": {"advice": "Add agent config files such as settings.local.json to .dockerignore and scan every container layer for secrets before pushing; honeypot AWS keys were used within 7.86 seconds of publication.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8", "markdown": "https://wpnews.pro/news/your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8.md", "text": "https://wpnews.pro/news/your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8.txt", "jsonld": "https://wpnews.pro/news/your-ai-coding-agent-just-leaked-a-secret-bots-found-it-on-docker-hub-in-8.jsonld"}}