Lesson 13 of 19 · 25m
Cloud Forensics: CloudTrail, SaaS Logs & Ephemeral Evidence
Scope AWS and Microsoft 365 intrusions from control-plane logs — CloudTrail anatomy, the data-events gap, and retention clocks that expire mid-case.
The compromised host was a container node. There's no disk to image, the pod was rescheduled an hour ago, and the "server" is an API call away from existing at all. Cloud forensics flips the model: evidence isn't on a machine you seize — it's in control-plane logs the provider kept for you, until its retention deletes it.
CloudTrail is the flight recorder — if it was on
Every AWS API call writes a CloudTrail event: eventName, userIdentity.arn, sourceIPAddress, userAgent, requestParameters, responseElements, errorCode. The 90-day Event History is free and on by default, which creates the first trap: it only covers management events and only 90 days. A real investigation needs a trail writing JSON to S3 — and data events are off by default. GetObject on your secrets bucket leaves no CloudTrail record unless someone explicitly enabled S3 data events. An "empty" trail during a confirmed S3 exfil usually means the log never existed, not that the reads never happened.
# Who used this access key, and for what?
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIAEXAMPLE \
--max-results 50
# Console logins with failures, last day
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventName,AttributeValue=ConsoleLoginBefore concluding anything from an empty trail, verify what was being logged: aws cloudtrail get-event-selectors --trail-name org-trail shows whether data events were ever enabled — the difference between 'no evidence' and 'no logging' — and describe-trails plus get-trail-status report whether logging was on. StopLogging and DeleteTrail are themselves CloudTrail events, recorded in a log the attacker can't retroactively erase.
Querying S3-stored trails at scale is Athena's job — SELECT eventname, sourceipaddress FROM cloudtrail WHERE eventtime > '...' — not grep over a million JSON files.
What to read in a confirmed AWS compromise
userIdentity— which principal, and was itassumed-role? FollowsessionContext:AssumeRolechains are how one key becomes three identities.- Enumeration vs. theft —
DescribeInstances/ListBuckets/GetCallerIdentitybursts are the "keys jingling" phase;CreateAccessKey,PutBucketPolicytoPrincipal: *,AttachUserPolicyare the escalation. GuardDuty flagsExfiltration:S3/*andUnauthorizedAccess:IAMUser/*findings — if GuardDuty was enabled, which is its own scoping question. - The key itself —
aws iam list-access-keys --user-name+ CloudTrailCreateAccessKeyevents give you creation timestamps to correlate. Response nuance: deactivate the key (UpdateAccessKey Inactive), don't delete it — deletion loses the correlation ID and you can't undelete. - VPC Flow Logs — 5-tuples and bytes, no payload, off by default. Combined with CloudTrail they're your lateral-movement map.
Ephemeral evidence doesn't wait for you
The VM you're investigating can be a disposable instance; the container node was rescheduled an hour ago. In cloud, "capture RAM before disk" becomes "snapshot and isolate before the orchestrator reaps it": snapshot the EBS volume (or the node's managed disk), isolate the security group, snapshot before any rebuild — and do it before terminating, because termination deletes the root volume on most defaults. Kubernetes audit logs (/var/log/kubernetes/audit on the API server, control-plane logs in EKS/GKE), container logs under /var/log/containers/, and the node's own syslog all evaporate with the pod or node unless something ships them out.
SaaS and Microsoft 365: the clock is shorter
Microsoft Entra ID sign-in and audit logs retain 30 days on P1/P2, 7 days on Free — an exfil discovered on day 40 is partially unrecoverable regardless of effort. Export to a Log Analytics workspace or SIEM as part of the incident, not a quarterly project.
For mailbox and SharePoint forensics, the Unified Audit Log (Search-UnifiedAuditLog in Exchange Online PowerShell, or Purview) records MailItemsAccessed, Set-Mailbox forwarding rules, and file syncs — which is how you scope a BEC: which messages were read, which rules were added, which files synced down. Okta's System Log API is the equivalent for IdP events. Google Workspace splits admin audit and data-access logs the way AWS splits management and data events — same trap, same fix. GCP repeats the split exactly: Admin Activity audit logs are on for everyone with 400-day retention, while Data Access logs stay off by default — a third console, the same gap.
The meta-lesson
SaaS logs are perishable inventory. Entra: 7–30 days. Okta: ~90. CloudTrail Event History: 90. Any investigation that starts "pull the last quarter" of a log nobody exported is already over. The correct practice is boring: enable the trail, ship every log to somewhere you own, and during the incident export the window immediately — before retention does the attacker's cleanup for free.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
CVE-2025-62718: Critical Axios SSRF Vulnerability Explained
A critical SSRF flaw in Axios was used in a North Korean supply chain attack. Here's what it does and how to patch it today.
Attacks of UPS Devices are on the Rise warns CISA
Hackers have now begun to attack internet-connected universal power supply devices. They are targeting their control interfaces via multiple remote code execution vulnerabilities. In some of the cases, they changed the default usernames and passwords, according to an important advisory from the…
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.