Guest Post: “I leaked secrets”: One AI agent reported its own leak, another found a way around corporate restrictions

Two cases from NordLayer AI Scout’s dashboard highlight that AI agents don’t need to go rogue to become a security risk — they just need their actions to go undetected.

NordLayer AI Scout, an AI security and visibility solution, observed two cases in which AI agents leaked secrets and circumvented controls while completing a task the user asked them to do — one agent even reported its own data leak. The incidents highlight a widening blind spot for companies that are increasingly relying on AI: Compliant AI agent behavior can still create security exposure.

When OpenAI’s agents escaped a test sandbox and hacked their way into Hugging Face’s systems earlier this year, it became the defining story of AI agents “going rogue.” But the incidents NordLayer AI Scout observed suggest the more common risk is far more subtle — agents that don’t  break the rules but still introduce security risks along the way.

“I leaked secrets”

In the first case, a QA engineer asked an AI coding agent to review a merge request. The project instructions pointed the agent to a GitLab token stored in an .env file — a file that also contained production passwords for an internal admin tool, an HR system API token, and a BI client secret.

To retrieve that one token, the agent loaded the file across 10 sessions over three weeks, sending its full contents to a third-party AI service each time. In one of the sessions, the .env file was missing from a fresh copy of the project. Instead of stopping when the file wasn’t found, the agent printed the machine’s shell environment  — every password and key stored on the system — exposing even more secrets. Afterwards, the agent flagged its own leak, telling the user: “I leaked secrets into this session’s tool output… I’d rotate them.”

“Telling an AI agent to directly pull and use API tokens isn’t good practice, but unfortunately it’s a common habit among engineers — and that’s the core issue,” says Vakaris Noreika, cybersecurity expert at NordLayer, a toggle-ready network security platform for business. “Over time, agents even begin repeating this behavior on their own, compounding the exposure. Because the agent was simply doing what it was told, the leak went undetected for weeks.”

Workaround for MCP restriction

In another case observed by NordLayer AI Scout, an AI agent couldn’t access the company’s Confluence page via its MCP connection — the user suspected the company was blocking it. As a workaround, the user asked the agent if a generated API token would allow it to access Confluence pages — and the agent confirmed that it worked.

“Even if the employee knowingly bypassed a company block on the MCP connection, that doesn’t necessarily mean they acted maliciously. They may have simply been trying to get the job done more quickly, viewing the REST API as a practical workaround without the security training to recognize it was unauthorized,” says Vakaris Noreika. “When  employees using AI tools either don’t know the risks or overlook them to get the job done, exposure is almost inevitable.”

He notes that the main gap in this case was between what the company blocked — the official Confluence integration — and what the agent could still access through a personal API token.

“Security controls only ever cover the cases someone foresaw,” says Noreika. “Every company has rules, but agents simply don’t know them, because they are not employees who were trained at the company. This is a current technology limitation: Agents don’t retain rules between sessions, and sometimes even after getting specific instructions not to do something, they still do it.”

“You can list out all your rules to the agent, but there’s no guarantee that it will use them. Companies can’t write a rule for every path to complete a task an agent might take, but they need to observe the paths it actually does take to identify what rules security teams haven’t anticipated,” Noreika says.

Agents receive employee-level access without the security training

According to Noreika, the majority of organizations most likely would have a hard time answering what resources their AI agents can actually access. The incidents demonstrate how quickly an agent can accumulate access, how far that access can spread if the agent is left unobserved, and that controls are overestimated in their ability to limit access.

“The push to be ‘more productive’ with AI means agents are often given broad access to company systems through integrations and MCPs. As a result, they may read customer data, API keys, and other sensitive information, then share it with AI providers,” says Noreika. “No company would give employees that level of access and allow them to share all this data with external parties, especially without the necessary security training. That’s why organizations need to recognize that adopting AI must go hand in hand with securing these agents, monitoring how they work, and controlling what data they can access.”

To reduce the chance of experiencing AI-related security exposure, Noreika advises companies to:

1. Ensure proper credential hygiene for the AI era. Storing secrets in .env files is standard practice — the problem is that agents working alongside the code now read those files too. Keep task-specific tokens in separate files from production secrets and move high-value credentials into managed vaults where possible, ensuring that the agents can’t read them directly.

2. Accept that blocking access fails. As demonstrated by the MCP case, blocking access is not a solve-all solution. Instead of cutting off agent access, organizations should first check whether employees actually need the resources they’re considering blocking — and if so, provide a sanctioned route, so people don’t resort to potentially dangerous workarounds.

3. Keep an inventory of what AI agents can actually access. Most organizations grant agents ad-hoc access and therefore fail to get the full picture of what their agents can reach. An inventory that lists every agent and what systems, data, and credentials they can access allows security teams to stay alert and informed.

4. Establish visibility to monitor agent behavior and detect incidents as early as possible. This allows teams to set more accurate boundaries, detect when an agent accesses files or data beyond its task, and react before an incident escalates further.

ABOUT NORDLAYER

NordLayer offers reliable connection, protection, threat detection, and response for businesses needing strong network security. Part of the cybersecurity powerhouse Nord Security, home to renowned products like the world-leading VPN service NordVPN, NordLayer is a trusted cybersecurity platform that integrates easily with any network and technology stack, all with unmatched support. In March 2026, NordLayer officially launched the enterprise browser NordLayer Browser, and in October 2026, it launched NordLayer AI Scout, an AI visibility and security solution. For more information: https://nordlayer.com/.

Leave a Reply