Skip to main content

AWS access key compromise response

How an AI SOC responds to a leaked or misused AWS access key: trace its calls in CloudTrail, find where it leaked, and deactivate it with approval.

Use case
Updated

The short answer

An access key compromise means someone other than its owner is calling AWS with a long-lived key. The response traces what the key did, finds how it leaked, and shuts it off. Cotool agents read CloudTrail and current AWS state, and a person approves the shutdown.[1][2][8]

The problem

Valid cloud credentials let an adversary act for initial access, persistence, privilege escalation, or defense evasion.[8]

A key's calls can span Regions and services, while LookupEvents returns one Region's last 90 days, so a fast answer depends on stored CloudTrail.[9]

How an AI SOC handles it

  1. Trace the key

    The agent queries aws_cloudtrail for every call made with the key: services, source IPs, user agents, and outcomes. CloudTrail records carry the caller's userIdentity and source IP.[1][10]

  2. Check current state

    Through the AWS CLI integration, the agent checks whether the key is still active and which policies its user holds.[3][11]

  3. Check GuardDuty

    Exported GuardDuty findings for the same principal and remote IP add AWS's own view.[1][12]

  4. Find the leak

    The agent reads recent commits, blame, and pull requests in GitHub to find where the key may have been exposed.[4]

  5. Shut it off with approval

    The agent proposes deactivating the key and asks in Slack; the change runs after a person approves.[2][5]

Example

Look up a key's recent callsbash
aws cloudtrail lookup-events \
  --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIAIOSFODNN7EXAMPLE \
  --max-results 50

LookupEvents filters on one attribute at a time, here the access key ID, and covers management events in the current Region from the last 90 days.[9][13]

What people approve

  • Deactivating the key and changing IAM are state-changing actions that can wait for approval in the app or in Slack.[2]
  • Response agents cannot close an alert as True Positive. When an agent confirms malicious activity, it escalates the alert and a person closes it.[6]

How Cotool handles it

  • Cotool's Detect page shows a coding agent building a detection for AWS access keys created outside Terraform, testing it on 30 days of logs, and deploying it.[7]

Integrations used

Sources

  1. AWS S3/SQS log ingest (Cotool docs) · accessed November 16, 2026
  2. AI SOC (Cotool) · accessed November 16, 2026
  3. Threat hunting (Cotool Hunt) · accessed November 16, 2026
  4. GitHub integration (Cotool docs) · accessed November 16, 2026
  5. Slack integration (Cotool docs) · accessed November 16, 2026
  6. Alerts (Cotool docs) · accessed November 16, 2026
  7. Detection engineering (Cotool Detect) · accessed November 16, 2026
  8. Valid Accounts: Cloud Accounts, T1078.004 (MITRE ATT&CK) · accessed November 16, 2026
  9. LookupEvents (AWS CloudTrail API Reference) · accessed November 16, 2026
  10. CloudTrail record contents (AWS CloudTrail User Guide) · accessed November 16, 2026
  11. SecurityAudit managed policy (AWS) · accessed November 16, 2026
  12. Exporting GuardDuty findings (Amazon GuardDuty User Guide) · accessed November 16, 2026
  13. LookupAttribute (AWS CloudTrail API Reference) · accessed November 16, 2026

Related use cases

All use cases

Related reading

Attackers are scaling with tokens

Cotool helps defenders operate at machine speed. See how security teams are scaling Detection & Response.

Book a demo