ACCESS KEYS
CLOUDTRAIL
NEW REGION
ENUMERATION
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting AWS Access Key Abuse in CloudTrail

A leaked access key looks like a legitimate API caller until you compare it to its own history. The first call from a new place is usually the one that matters.

Scroll

Long-lived access keys leak through public repositories, build logs, laptops and misconfigured servers, and attackers test them within minutes. CloudTrail records every call with the key ID, source IP, user agent and region, so each key has a behavioural fingerprint you can baseline. A new fingerprint plus an enumeration burst is the standard compromise pattern.

Signals at a Glance

SignalWhereATT&CK
Access key used from an IP or ASN never seen for that keyCloudTrailT1078.004
Call from a region the account does not normally useCloudTrailT1078.004
New or scripting user agent (python-requests, aws-cli, Boto3) on a key that used a console SDKCloudTrailT1078.004
GetCallerIdentity followed by List and Describe calls across servicesCloudTrailT1580
Instance-role credentials used from outside AWSCloudTrail, GuardDutyT1552.005

Baselining a Key

The Athena cloudtrail_logs table exposes useridentity.accesskeyid, sourceipaddress, useragent and awsregion. Compare the last day against the preceding month and keep keys whose source is new:

-- Athena SQL - access keys used from an IP never seen in the prior 30 days
WITH history AS (
  SELECT DISTINCT useridentity.accesskeyid AS keyid, sourceipaddress
  FROM cloudtrail_logs
  WHERE from_iso8601_timestamp(eventtime) BETWEEN current_timestamp - interval '30' day
                                               AND current_timestamp - interval '1' day
    AND useridentity.accesskeyid IS NOT NULL
),
recent AS (
  SELECT useridentity.accesskeyid AS keyid, useridentity.arn AS arn, sourceipaddress,
         awsregion, useragent, count(*) AS calls, min(eventtime) AS first_seen
  FROM cloudtrail_logs
  WHERE from_iso8601_timestamp(eventtime) > current_timestamp - interval '1' day
    AND useridentity.type = 'IAMUser'
    AND useridentity.accesskeyid IS NOT NULL
  GROUP BY 1, 2, 3, 4, 5
)
SELECT r.*
FROM recent r
LEFT JOIN history h ON r.keyid = h.keyid AND r.sourceipaddress = h.sourceipaddress
WHERE h.keyid IS NULL
ORDER BY calls DESC;
-- tune/validate: add partition predicates (year, month, day) for cost; exclude AWS service IPs (sourceipaddress like '%.amazonaws.com')

Enumeration and Honeytokens

After a successful call, attackers map what the key can do. A short burst of distinct read-only calls across many services, often starting with GetCallerIdentity, is the discovery signature. Many of these calls fail with AccessDenied, which is itself useful:

-- Athena SQL - enumeration burst: many distinct List/Describe/Get calls and denials from one key
SELECT useridentity.accesskeyid AS keyid, sourceipaddress,
       count(DISTINCT eventname) AS distinct_calls,
       count(DISTINCT eventsource) AS services,
       count_if(errorcode IN ('AccessDenied', 'UnauthorizedOperation', 'Client.UnauthorizedOperation')) AS denied,
       min(eventtime) AS first_call, max(eventtime) AS last_call
FROM cloudtrail_logs
WHERE from_iso8601_timestamp(eventtime) > current_timestamp - interval '1' day
  AND (eventname LIKE 'List%' OR eventname LIKE 'Describe%' OR eventname LIKE 'Get%')
  AND useridentity.accesskeyid IS NOT NULL
GROUP BY 1, 2
HAVING count(DISTINCT eventname) > 25 AND count(DISTINCT eventsource) > 4
ORDER BY distinct_calls DESC;
-- tune/validate: inventory and CSPM tools enumerate by design; allowlist their keys and roles
Vetted sources

Use AWS GuardDuty finding types for credential misuse, the AWS CloudTrail and Athena documentation, Elastic and SigmaHQ AWS rules, and Splunk ESCU analytics for unusual API activity. Baseline your own environment, because automation, CI systems and security tooling are the main sources of legitimate new IPs.

Build Detections That Fire

Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.

Detection EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
  • Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
  • 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026