Your AI Agents Have Credentials. Do You Know What They Can Reach?

An old problem in unfamiliar infrastructure

It is tempting to frame AI agent security as a new discipline, and some of it genuinely is. Knowing which identities exist, and what they can do, is not. It is the oldest problem in identity security, showing up in new infrastructure.

What agents change is the speed. A platform team can stand up a dozen agent sandboxes in an afternoon. Each one carries whichever role was convenient at the time, often copied from a sandbox that already worked, and rarely gets a second look. OWASP names this directly: excessive permissions is one of the three root causes behind LLM06:2025, Excessive Agency, and its prevention measures include limiting permissions to the minimum necessary.

The role attached to a sandbox is a non-human identity: everything that runs inside acts with its permissions. On AgentCore, the agent itself runs in a sandbox too, and that one always has a role. The code interpreter and browser it uses as tools are sandboxes as well, with a role if the customer attaches one. A single agent can carry several of these identities.

Identity teams already know how to govern service accounts and API keys. The task is extending that same discipline to the roles AI agents run as.

Creating a code execution sandbox for an AI agent on a major cloud platform takes a single API call, and somewhere in that call is an optional field for an identity. On Amazon Bedrock AgentCore Code Interpreter, for instance, it is the execution role. Every session in that sandbox then runs with whatever role goes into that field, for as long as the sandbox exists.

Because the field is optional, two sandboxes built by the same team in the same week can carry entirely different access, or none at all. Under the shared responsibility model, choosing each sandbox’s role and scoping its permissions falls to the customer. In most organizations, no review process covers those roles yet.

So the useful question is: which of your AI agents have access to your cloud accounts, and what does that access let them do? Answering this decides your exposure, and most teams still cannot answer it quickly.

Why the inventory matters when something breaks

I found two vulnerabilities in the Amazon Bedrock AgentCore Python SDK that show how this plays out in practice. A crafted package name passed to the SDK’s package installation helper was read as a shell command inside the code interpreter, which gave an attacker code execution there. Credential exposure required three conditions to line up: attacker-influenced input reaching that helper, a vulnerable SDK version, and a code interpreter the customer had created with an execution role attached. AWS worked with us at Phantom Labs through coordinated disclosure, fixed both, and issued a CVE for each.

For security teams, the lesson has less to do with the bug itself, than with what decided how far it could go. The sandbox is a Firecracker microVM, and that isolation held. What made that code execution matter was the third condition: the role attached to the sandbox. That is exactly what an inventory should track. A role scoped to reading one input bucket limits an attacker to that bucket. A broader role turns the same bug into an incident. AWS’s default code interpreter comes with no role at all, so teams that used it had no credentials to steal.

When a bug like this is disclosed, teams that know which of their AI agents run code in a sandbox with a role attached can scope their exposure in an afternoon. The rest end up auditing every agent while the clock runs.

Three things worth doing

First, build the inventory. For every AI agent, record which roles and credentials it uses, what they can reach, and who granted them. Count every sandbox involved: the one the agent runs in and the ones it uses as tools. Refresh the inventory on a schedule across every account, and alert when a new agent or sandbox is created with a role attached so nothing slips in between refreshes.

Second, treat “does this need an identity at all?” as a real question with a real default. A code or browser sandbox needs cloud credentials only if what runs inside calls cloud APIs, and many do not. Make the credential-free option the default for these tools, and ask teams to justify any that needs a role. Every sandbox without a role is one fewer identity to track.

Third, give every role that remains only the permissions its agent actually uses. Service-level wildcards, unrestricted role-passing and privilege-escalation actions, are what turn a compromised agent into a compromised account. AWS documents a one-bucket example for AgentCore; start there rather than from an existing role that already works. Then recertify the role regularly. If an entitlement held by a contractor gets recertified every quarter, an entitlement held by an AI agent deserves at least the same attention. AWS’s own guidance for agentic workloads agrees and recommends reviewing agent permissions for drift every quarter.

None of this prevents the next input validation flaw, whichever SDK it turns up in. That is the point. Least privilege is defense in depth: when another layer fails, it limits the damage. But it only covers the identities you know about. Find them before an attacker does, keep the inventory current, and least privilege decides whether the next bug of this kind is a patch note or an incident.

_______

About Sergio Garcia

Sergio Garcia is a Security Researcher on the Phantom Labs® team at BeyondTrust. Sergio has a background in cloud security, identity-centric attack paths, automated threat detection, and AI agent security.

Join our LinkedIn group Information Security Community!

No posts to display