Binary data background showing AI coding agents

AI Coding Agents Expose Credentials on GitHub, Putting Organizations at Risk of Cyber Attacks

AI coding agents are inadvertently exposing thousands of database passwords, cloud keys, API tokens, and SSH root logins in public GitHub repositories during routine coding, creating a gaping security hole that attackers could exploit to target organizations.

According to Apiiro researchers, the credential exposure affected organizations ranging from student groups and startups to software agencies and established vendors. One organization contacted confirmed that the exposed credentials were live on a production system.

AI coding agents expose credentials in public GitHub repositories

Researchers at Apiiro analyzed 104,185 public repositories and discovered 1,122 real secrets, some of which could authenticate to real-world applications, databases, and cloud instances. One organization contacted confirmed the exposed credentials were live.

They showed how AI coding agents could expose secrets using Claude Code, Anthropic’s coding assistant, which saves secrets to project settings files that are eventually committed with other files.

“Nothing in the repo marks that file as private, so it gets committed with the rest of the code,” they warned.

According to the researchers, when Claude Code requests permission to run a command, developers can choose to save it so the coding assistant can execute it later without asking again.

However, this can inadvertently expose hardcoded credentials embedded in commands by storing them in plaintext in local configuration files, .claude/settings.local.json and .claude/settings.json.

“Ask Claude Code to check a database or call an API, and the command it proposes carries the secret from your config file,” the researchers noted.

When other developers fork or clone the repository, they also copy the authentication credentials. The researchers warned that removing the exposed credentials doesn’t resolve the problem, as earlier versions still contain them.

“A ‘don’t ask again’ prompt is a decision to write a credential into a file, and many developers clicking it likely don’t know that file exists,” warned Seemant Sehgal, founder and CEO of BreachLock. “Once it lands in a repository, it sits in a place many secret scanners were never built to check, which appears to be why some of these leaks slipped through. Apiiro found Claude coauthored commits in 539 of these repositories, and it also found secrets in agent transcripts and memory files that almost no one audits.

The researchers identified at least 63 exposed organizations, including student groups, startups, software agencies, and established vendors.

Of the 104,185 public repositories analyzed, 1,122 contained real secrets. Among them, 1,379 repositories contained distinct secrets, with 636 exposing “provider-specific keys and 743 passwords or tokens associated with public hosts.”

However, Claude Code tries to protect the configuration file by adding it to the Git ignore list, to prevent it from being included during routine commits. However, the rule does not propagate when the repository is copied onto another machine.

“The rule never goes into the repo’s own .gitignore, so nothing travels with the project to protect it,” they warned.

Consequently, they advised researchers to check whether their projects contain saved secrets, reset any exposed passwords, and rotate each token.

Meanwhile, Anthropic says it was working to prevent the AI coding assistant from exposing secrets. The AI giant was weighing trade-offs between implementing auto mode to catch credential exposure in real time, basic credential scanning, and more.

“As AI agents become more involved in software development, organizations need to recognize that source code isn’t the only thing they need to secure. Agent configuration files, transcripts, and execution histories can contain sensitive information, and traditional security checks may not catch everything,” said Ryan McCurdy, Vice President of Marketing, Liquibase.

According to John Strand, Owner, Black Hills Information Security, embedding API keys and passwords in public repositories was rampant: “What I find really exciting about these stories of AI embedding API keys and passwords in publicly accessible repositories is that this is exactly what humans do. We’ve been doing it for years. If you ask an AI agent, ‘Why did you hardcode these API keys and put them in a public GitHub repository?’ it’s going to look right back at us and say, ‘I learned it from you.’”

AI coding agents continue to perform unintended actions

The Claude Code credential exposure adds to a growing list of AI coding agents performing unintended actions. In October 2026, OpenAI said its AI coding agents disabled their monitoring guardrails to perform unauthorized actions and compromise Hugging Face’s production infrastructure, with one even lying about it.

Anthropic’s Claude Code AI coding agents, Opus 4.7 and Mythos 5, also escaped their sandbox testing environment by connecting to the Internet due to misconfigured testing environments, compromising three organizations.

Cybercriminals have also targeted AI coding agents to steal user credentials for resale on cybercrime forums, or perform distillation attacks to train other AI models at a fraction of the cost.