Hunting Agentic AI Intrusions in AWS: CloudTrail Detections for Machine-Speed Recon

An AI-driven intrusion doesn't look like a human operator. It looks like hundreds of API calls across dozens of AWS services in half an hour, most of them denied, and one that isn't. How agentic attack frameworks behave in the cloud, the CloudTrail signals that give them away, and the controls that make a stolen key worthless.

8 min readAdvanced

For years, cloud intrusions moved at human speed. An operator with a stolen access key would run aws sts get-caller-identity, poke at S3, list a few roles, then go quiet while they worked out what they had. Detections were tuned for that rhythm.

Agentic attack frameworks don't work like that. Give an AI agent a credential and a goal, and it enumerates everything the key can reach, reasons over the responses, and pivots, all within minutes. In November 2026, Arctic Wolf Labs linked a series of AWS intrusions to infrastructure hosting AntiFox, an open-source agentic penetration-testing platform. In one case the activity generated hundreds of cross-service API calls in about 30 minutes, most of them denied, and ended with a successful read of a production secret from AWS Secrets Manager.

This article breaks down how these intrusions unfold, why their shape makes them easier to catch than a careful human, and the CloudTrail detections and controls that work against them. Queries are given in Amazon Athena SQL and in KQL for Microsoft Sentinel.

Anatomy of an agentic cloud intrusion

The reported AntiFox-linked activity followed two entry paths that converge on the same pattern.

  1. Web server to cloud key. Attackers compromised internet-facing IIS applications, planted ASPX web shells, and read database and AWS credentials from configuration files such as web.config. The initial vulnerability wasn't identified.
  2. Key first. In other cases, the intrusion simply began with a valid AWS access key of unknown origin: leaked in a repository, a CI log, or a developer laptop.

From there, the agent works through a recognisable loop:

Phase What it does CloudTrail evidence
Orient "Who am I?" GetCallerIdentity, GetUser
Map identity Users, roles, policies, keys ListUsers, ListRoles, ListPolicies, ListAccessKeys, ListKeys (KMS)
Sweep services Try every service the model knows about List* and Describe* across dozens of event sources, mostly AccessDenied
Pivot identities Switch to other credentials it finds Same burst pattern from a second and third access key
Collect Read whatever the key can reach ListSecrets, then GetSecretValue; S3 ListBuckets/GetObject
Monetise In some campaigns, AI model access itself is the prize Bedrock model listing and invocation calls

The key insight for defenders: an agent doesn't know your environment, so it tries everything. A human attacker who already knows what they want makes ten quiet calls. An agent makes three hundred noisy ones. That breadth, and the wall of denials it produces, is the strongest signal you'll get.

Why the denials matter

Most security teams treat AccessDenied errors as noise: misconfigured apps, developers testing permissions. In an agentic intrusion, the denials are the attack. A legitimate workload calls the same handful of APIs in a stable pattern, day after day. An agent sweeping your account calls many distinct services, gets refused by most of them, and keeps going. Least privilege is doing its job in that moment. Your detections should notice it happening.

The telemetry you need

Source Where Why it matters
CloudTrail management events Organisation trail to S3, CloudTrail Lake, or Sentinel AWSCloudTrail Every API call, including denied ones, with identity, source IP and user agent
CloudTrail data events Enabled per resource type S3 object reads and Lambda invocations; off by default and billed separately
Amazon GuardDuty Delegated administrator account Anomaly findings on IAM behaviour and credential exfiltration
Web server and endpoint logs IIS logs, EDR or Sysmon The web shell that leads to the key
AWS Config / IAM Access Analyzer Organisation-wide Which keys exist, how old they are, and what they can reach

Two gaps to close first. Use an organisation trail covering every region: agents sweep regions you don't use, and a single-region trail misses them. Retain at least 90 days in a queryable store; leaked keys are often used weeks after they're stolen.

Detections that hold up

1. One principal, many services, many denials

This is the core detection: a single access key or role session touching an unusual number of distinct AWS services in a short window, with a high share of denied calls.

Athena (CloudTrail table created from the standard CloudTrail partitioned schema):

sql
-- Principals that touched 15+ services in any 30-minute window, mostly denied
SELECT useridentity.arn                                   AS principal,
       useridentity.accesskeyid                           AS access_key,
       date_trunc('hour', from_iso8601_timestamp(eventtime)) AS hour,
       count(DISTINCT eventsource)                        AS services,
       count(*)                                           AS calls,
       count_if(errorcode IN ('AccessDenied', 'Client.UnauthorizedOperation',
                              'UnauthorizedOperation', 'AccessDeniedException')) AS denied,
       array_agg(DISTINCT sourceipaddress)                AS source_ips
FROM cloudtrail_logs
WHERE from_iso8601_timestamp(eventtime) > current_timestamp - INTERVAL '1' DAY
GROUP BY 1, 2, 3
HAVING count(DISTINCT eventsource) >= 15
   AND count_if(errorcode IS NOT NULL) * 1.0 / count(*) > 0.5
ORDER BY services DESC;

KQL (Microsoft Sentinel):

kusto
AWSCloudTrail
| where TimeGenerated > ago(1d)
| summarize Services = dcount(EventSource),
            Calls = count(),
            Denied = countif(ErrorCode in ("AccessDenied", "Client.UnauthorizedOperation",
                                           "UnauthorizedOperation", "AccessDeniedException")),
            IPs = make_set(SourceIpAddress, 10),
            Agents = make_set(UserAgent, 5)
          by UserIdentityArn, UserIdentityAccessKeyId, bin(TimeGenerated, 30m)
| where Services >= 15 and Denied * 1.0 / Calls > 0.5
| order by Services desc

Start with a threshold of 15 services and tune from there. Legitimate tools that also sweep accounts, such as CSPM scanners and IaC drift detection, will appear: allow-list them by role ARN and source, never by user agent, which an attacker controls.

2. The needle: a success hidden in a wall of denials

The outcome that matters is the one call that worked. Look for a sensitive read by a principal that was denied many times in the hour before.

kusto
let noisy = AWSCloudTrail
    | where TimeGenerated > ago(1d) and isnotempty(ErrorCode)
    | summarize Denied = count(), FirstDenied = min(TimeGenerated) by UserIdentityArn
    | where Denied >= 25;
AWSCloudTrail
| where TimeGenerated > ago(1d) and isempty(ErrorCode)
| where EventName in ("GetSecretValue", "BatchGetSecretValue", "GetParameter", "GetParameters",
                      "Decrypt", "GetObject", "CreateAccessKey", "AssumeRole")
| join kind=inner noisy on UserIdentityArn
| where TimeGenerated between (FirstDenied .. FirstDenied + 2h)
| project TimeGenerated, UserIdentityArn, EventName, EventSource, SourceIpAddress, Denied,
          RequestParameters
| order by TimeGenerated asc

A GetSecretValue success after dozens of denials is about as close to a guaranteed true positive as cloud detection gets. Treat it as an incident, not an alert.

3. A key used from somewhere it has never been

Keys that live in application configs are used from a small, stable set of addresses: your servers, your NAT gateways. The first call from a new network, especially a hosting provider, deserves attention.

sql
-- Access keys seen today from a source IP not seen for that key in the previous 30 days
WITH history AS (
  SELECT DISTINCT useridentity.accesskeyid AS k, sourceipaddress AS ip
  FROM cloudtrail_logs
  WHERE from_iso8601_timestamp(eventtime)
        BETWEEN current_timestamp - INTERVAL '31' DAY AND current_timestamp - INTERVAL '1' DAY
)
SELECT t.useridentity.accesskeyid AS access_key, t.useridentity.arn AS principal,
       t.sourceipaddress, min(t.eventtime) AS first_seen, count(*) AS calls
FROM cloudtrail_logs t
LEFT JOIN history h ON h.k = t.useridentity.accesskeyid AND h.ip = t.sourceipaddress
WHERE from_iso8601_timestamp(t.eventtime) > current_timestamp - INTERVAL '1' DAY
  AND t.useridentity.accesskeyid LIKE 'AKIA%'   -- long-lived IAM user keys
  AND h.k IS NULL
GROUP BY 1, 2, 3
ORDER BY calls DESC;

Long-lived keys start with AKIA; temporary session keys start with ASIA. Long-lived keys used from new networks are the highest-risk combination. Enrich the source IP with ASN data and weight hosting providers heavily. GuardDuty's UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS finding covers the related case of instance role credentials used from outside AWS.

4. The web shell that leads to the key

On the IIS side, the classic signal still works: the web server worker process starting a shell.

kusto
// Microsoft Defender for Endpoint / Sentinel
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where InitiatingProcessFileName =~ "w3wp.exe"
| where FileName in~ ("cmd.exe", "powershell.exe", "pwsh.exe", "certutil.exe", "whoami.exe",
                      "net.exe", "net1.exe", "rundll32.exe")
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine,
          InitiatingProcessCommandLine

Pair it with file monitoring for new .aspx, .ashx or .asmx files under web roots, and with reads of web.config by anything other than the web server. Then correlate: a web shell alert on a server, followed by that server's AWS key appearing from a new IP, is a single incident told in two log sources.

5. Somebody else spending your AI budget

Several of these campaigns enumerated Amazon Bedrock. Stolen keys with model access are resold for free LLM usage ("LLMjacking"), and the first sign is often the bill.

kusto
AWSCloudTrail
| where TimeGenerated > ago(1d) and EventSource == "bedrock.amazonaws.com"
| summarize Calls = count(), Events = make_set(EventName, 20), IPs = make_set(SourceIpAddress, 10)
          by UserIdentityArn
| join kind=leftanti (
    AWSCloudTrail
    | where TimeGenerated between (ago(30d) .. ago(1d)) and EventSource == "bedrock.amazonaws.com"
    | distinct UserIdentityArn
  ) on UserIdentityArn

Any principal calling Bedrock for the first time, especially ListFoundationModels, GetModelInvocationLoggingConfiguration or model invocation calls, should be checked against its owner's intent. Note that InvokeModel is a data event and needs to be enabled to appear.

Controls that make a stolen key worthless

Detection buys time. These controls remove the payoff, roughly in order of impact.

  1. No long-lived keys in application config. Workloads on EC2, ECS, EKS and Lambda should use IAM roles. On-premises servers can use IAM Roles Anywhere. A web.config with no secret in it gives a web shell nothing to steal. Find existing keys with IAM credential reports and remove any older than 90 days.
  2. Enforce IMDSv2 on every instance, so a server-side request forgery on the web tier can't simply read role credentials from the metadata service.
  3. Data perimeters. Use aws:SourceVpc, aws:SourceVpce or aws:SourceIp conditions in policies, and resource policies on Secrets Manager secrets and S3 buckets, so a valid key used from outside your network is refused. This is the single control that defeats "valid key, attacker's laptop".
  4. Least privilege, measured. IAM Access Analyzer's unused-access findings show the permissions and keys nobody uses. Remove them: every service an agent can't touch is one fewer path.
  5. Service control policies that deny regions you don't operate in, and deny Bedrock model access outside approved accounts.
  6. GuardDuty in every account and region, with findings routed to the same queue as your own detections.
  7. Secrets hygiene. Rotate secrets automatically, scope each secret's resource policy to the roles that need it, and alert on GetSecretValue by any principal outside that set.

Incident response checklist

When the detections above fire together, or a successful sensitive read follows a denial burst:

  1. Disable, don't delete, the access key (aws iam update-access-key --status Inactive), so evidence stays intact. For roles, revoke active sessions with an aws:TokenIssueTime deny policy.
  2. Scope the blast radius: pull every CloudTrail event for the key and any identities it pivoted to, across all regions, from first sighting.
  3. Rotate every secret the principal read, starting with anything returned by GetSecretValue or GetParameter, then any database credentials found in the compromised server's config.
  4. Check for persistence: new IAM users, access keys, login profiles, roles with external trust policies, Lambda functions, and changes to CloudTrail or GuardDuty settings.
  5. Clean the entry point: remove web shells, patch the IIS application, and rebuild the server if you can't establish its integrity.
  6. Check billing for Bedrock, EC2 or other usage spikes the intrusion may have caused.
  7. Find the source of the key if it didn't come from the web server: secret scanning across repositories, CI logs and developer machines.

MITRE ATT&CK mapping

Key takeaways

  • Agentic intrusions are loud by nature. An agent doesn't know your environment, so it tries everything: many services, many denials, very little time.
  • Stop treating AccessDenied as noise. A burst of denials across many services is the attack in progress, and least privilege is buying you time.
  • The success hidden among the failures is the incident. Alert on sensitive reads by a principal that was just denied dozens of times.
  • Remove the prize: no long-lived keys in config files, IMDSv2 everywhere, and data perimeters so a stolen key fails from outside your network.

Further reading

HackersRoot Research · Research team

The HackersRoot research team investigates attack techniques across AI systems, cloud and identity, and enterprise networks, then publishes the detections and hardening guidance that stop them.

More from HackersRoot →

Related research