AuthSecAuthSec
← All articles
Security

We Turned an AI Pentester Loose on AWS. Here's What AuthSec Caught.

AI agents hold credentials, call cloud APIs and can wander outside their lane. We ran a purple-team exercise in a disposable AWS lab to see whether AuthSec's agent-runtime IGA could discover those agents, catch them misbehaving, contain them and gate their tool calls. Four of six attacks were detected in 11 to 24 seconds. Here is everything, including what we missed.

AT
AuthSec Team
Nov 26, 2026 · 10 min read
We Turned an AI Pentester Loose on AWS. Here's What AuthSec Caught.

Why We Attacked Our Own AI Agents

AI agents are now real users of your cloud. They hold credentials, call AWS APIs, read secrets and invoke models, often with nobody watching each step. If one is compromised or simply drifts outside its job, it behaves like any other attacker with a valid key.

So we asked a direct question: can AuthSec's agent-runtime IGA actually govern AI agents on AWS? Not on a slide, but against real attacker actions in a real account.

To find out, we ran an authorised purple-team exercise in a disposable AWS lab account. We set out to prove four things:

  • Discover: AuthSec finds the AI-agent identities in the account and classifies them.
  • Detect: AuthSec raises the right alert, for the right identity, when an agent misbehaves.
  • Contain: AuthSec can quarantine a misbehaving agent and release it again.
  • Gate: AuthSec can allow or deny an agent's tool call through a policy gateway.

Meet ARTEX: An AI Pentester That Is Also an AI Agent

ARTEX is an autonomous, LLM-driven penetration-testing platform. A planner breaks a goal into steps, worker agents run real security tools, and every finding is tied to the captured request and response that proves it.

In this exercise ARTEX played two roles at once. It was the attacker whose actions we replayed against the lab. It was also exactly the kind of identity AuthSec is built to govern: an autonomous agent that holds credentials, calls cloud APIs, and can escalate or leave its lane.

That double role is the point. The tools attackers use are becoming agents, and the agents you deploy can be turned into attackers. Both look the same from the cloud's point of view: a non-human identity making API calls.

The Lab: Every Agent Gets Its Own Identity

The test ran against a disposable AWS lab account connected to AuthSec. The subjects were the IAM identities already in that account: AI-agent roles, tool roles and a base user. Because each agent has its own identity, every AWS action maps back to the identity that made it.

Identities in the lab account
IDENTITY KIND ROLE IN THE TEST AUTHSEC LABEL AcmeRagAgentRole IAM role A RAG AI agent classified_agent DemoAgentRole IAM role Quarantined in the containment test ai_workload c-lab-tester IAM user The "stolen key" attacker ai_workload SharedToolRole IAM role Tool-calling workloads discovered openai-api-key Secrets Manager The secret targeted by the attacker -
Identities in the lab account

No code had to run inside the agents. AuthSec reads the account's CloudTrail activity through its agent-events stream and evaluates detections server-side. The system under test was simply the AuthSec AWS connector plus that event stream.

How We Ran the Test

We worked through the full governance loop, in order. Every attack ran inside the lab account against throwaway resources, so AuthSec had real activity to catch rather than synthetic events.

Before anything ran, a safety check confirmed the AWS CLI was pointed at the lab account. Any other account would have stopped the run.

  • Connect and scan: connect the AWS account and run an on-demand discovery scan.
  • Discover and classify: confirm AuthSec finds the identities and labels the AI agents.
  • Replay attacks: perform real attacker actions (read a secret, disable logging, change IAM, probe roles, bulk delete).
  • Watch detections: confirm the matching alert fires, measure attack-to-alert time, and check it names the right identity with evidence.
  • Contain: quarantine a misbehaving agent through preview, contain, verify and release.
  • Gate: register a gateway and allow or deny an agent's tool call through policy.

Result 1: AuthSec Discovered and Classified the AI Agents

Pass. The connector was active and on-demand scans completed. AuthSec found the identities and classified the AI agents correctly. The RAG agent role was labelled a classified agent, and the model-calling workloads were labelled AI workloads.

Each classification came with the signals behind it, all with fresh timestamps:

  • AI config hints: configuration that points at model providers or agent frameworks.
  • AI network traffic: calls to model endpoints.
  • Model-key secrets: stored API keys for model providers, such as the lab's OpenAI key.
  • Long-lived keys: static access keys that make an identity a higher-value target.

Result 2: Four of Six Attacks Detected in Seconds

We replayed six attacks and timed each one from the attacker's API call to the alert appearing in AuthSec.

Attack replays and detections
ATTACK WHAT IT DOES DETECTION RESULT TIME Read secret Agent reads a secret outside its job D1 read-secret (high) PASS ~15 s Leave its lane Burst of refused / new-role probes D5 acted-outside-grant (medium) PASS ~24 s Disable logging Turns off model-invocation logging D4 weakened-logging (high) PASS ~11 s Change IAM Creates a role and attaches admin D3 changed-IAM (high) PASS ~12 s LLMjacking Stolen key tries to run models Model invoke denied by IAM PARTIAL - Bulk delete Deletes a table and a bucket None (events logged, no alert) GAP -
Attack replays and detections

Every alert named the acting identity and carried the exact CloudTrail event as evidence: event name, source IP and event ID. An analyst does not have to go hunting through logs to confirm what happened.

Here is how each detected attack played out:

  • Read secret: the attacker identity called GetSecretValue on the lab's OpenAI key. D1 fired at high severity in about 15 seconds, with the event and source IP attached.
  • Leave its lane: a burst of 12 assume-role calls to roles that do not exist, the kind of probing an agent does when it explores beyond its grant. D5 fired in about 24 seconds.
  • Disable logging: we deleted the Bedrock model-invocation logging configuration, a classic step to blind defenders before abusing models. D4 fired at high severity in about 11 seconds.
  • Change IAM: we created a throwaway role and attached AdministratorAccess. D3 fired at high severity in about 12 seconds.

Result 3: Containment and the Policy Gateway Worked

Containment passed. Against DemoAgentRole we first previewed the blast radius, which returned the subject and the workloads it would affect. We then contained the agent at the model level and watched the state move from containing to contained, then released it. The full quarantine-and-release lifecycle worked end to end.

Verification came back as unverifiable, which is the expected answer: DemoAgentRole makes no model calls, so there was no model traffic to confirm the block against.

The gateway passed too. We registered a lab gateway, which received its own credential. The policy decision point authenticates with that gateway credential, not an admin token. We then evaluated an agent's MCP tool call in this shape:

Tool-call evaluation request (shape)
{ "subject": { "type": "agent" }, "action": { "name": "tools/call" }, "resource": { "type": "mcp_tool", "server": "demo", "tool": "search_web" } }
Tool-call evaluation request (shape)

With no policy in place the call returned permit (default_allow). After we created a deny tool-policy for the search_web tool on the demo server, the same call returned deny (policy_deny), naming the policy that blocked it.

The decision log recorded metadata only. No prompts, tool arguments or model completions were stored, so the audit trail does not become a new place for sensitive data to leak.

What We Missed, and Why We're Publishing It

A test that only reports passes is a demo. Here is what did not go to plan.

  • Bulk delete has no dedicated detection yet. We created and then deleted a DynamoDB table and an S3 bucket. The delete events appeared in AuthSec's activity timeline, but no alert fired. This is a real gap and is next on our list.
  • LLMjacking was only partly exercised. The stolen key could list foundation models, but model invocation was denied by IAM in every region. Only the recon step ran, so no model-usage alert could fire. We need a test identity with invoke permission to drive this fully.
  • Attribution went to the base user, not the agent role. The attacker user lacked sts:AssumeRole, so the attacks ran as that user (which AuthSec still labelled an AI workload). Granting assume-role would attribute the events to the agent identity, as a real compromise would.

Cleanup

When the run finished we removed everything it created. The tool-policy was deleted, the gateway revoked, the admin policy detached, the throwaway role deleted and the containment released. The throwaway table and bucket had already been deleted by the attack. The local AWS profile and API token were removed from the test machine.

What This Means for Teams Running AI Agents on AWS

AI agents are non-human identities, and they need the same lifecycle you already expect for people: discovered, monitored, contained when they misbehave, and gated before they act.

In this exercise AuthSec's agent-runtime IGA discovered the AI agents in an AWS account, detected four of six replayed attacks in 11 to 24 seconds with CloudTrail evidence attached, quarantined and released an agent, and enforced allow and deny decisions at the gateway with a metadata-only decision log.

One real detection gap (bulk delete) and two test-setup limits came out of it. Those are the next things we will close, and we will re-run the exercise when they are done.

If you want to see how AuthSec would treat the agents in your own AWS account, book a demo and we will walk through the same loop with you.

A pentest that only reports passes is a demo. We published the gap too, because that is the list we work from next.

— AuthSec Team
DOCUMENTATION
AuthSec SDK Reference
Read the docs →
TAGGEDAI AgentsPenetration TestingAWSAgentic IGANon-Human IdentityPurple TeamCloudTrail
AT
AuthSec Team
Writing about identity, security, and developer tools at AuthSec.
KEEP READING