Skip to content
Pwnversity
DFIR-CLOUDadvanced · 9 min · upd. 2026-11

Cloud forensics

CloudTrailMicrosoft 365T1078.004

Cloud forensics reconstructs an incident from the logs the provider keeps: who called which API, from where, with which identity and against which resource. There is no disk to seize and no machine to unplug; the evidence is a collection of logs with short retention, many of them disabled by default and spread across services. Whatever was not enabled before the incident does not exist.

In the cloud, identity is the perimeter. Most incidents start with stolen credentials (access keys, tokens, user sessions), not an exploit, and the attacker uses the same APIs as the legitimate administrator. The questions change:

  • Which identity was used, from which IP and with which user agent?
  • Which APIs were called: creating users or keys, policy changes, reading data?
  • Which data was read or downloaded (and whether that kind of access was even logged)?
  • What persistence was left: new keys, roles, OAuth applications, mail forwarding rules?

Triage of the virtual machines is still needed, but it is only one part.

flowchart TD
    A["Control plane<br/>(management API)"] --> A1["CloudTrail · Activity Log<br/>Admin Activity · Unified Audit Log"]
    B["Data plane<br/>(reading and writing data)"] --> B1["Data events · Data Access<br/>MailItemsAccessed · Storage logs"]
    C["Identity"] --> C1["Entra ID sign-ins<br/>IAM Identity Center · Cloud Identity"]
    D["Network"] --> D1["VPC Flow Logs · NSG Flow Logs<br/>GCP VPC Flow Logs"]
    E["Workloads"] --> E1["VM disks · memory<br/>container logs"]
    A1 --> T["Incident timeline"]
    B1 --> T
    C1 --> T
    D1 --> T
    E1 --> T

The provider is responsible for the infrastructure; the customer, for enabling, retaining and reviewing their logs. The data plane is almost never logged by default, and it is exactly the one that answers “what did they take”.

What is logged by default and for how long

Section titled “What is logged by default and for how long”
Provider Log By default Default retention
AWS CloudTrail management events Yes, in Event history 90 days; beyond that, only if a trail or event data store exists
AWS CloudTrail data events (S3, Lambda, DynamoDB…) No; must be enabled on a trail and are billed Whatever is configured
AWS VPC Flow Logs, GuardDuty No Whatever is configured
Google Cloud Admin Activity and System Event Yes, cannot be disabled 400 days
Google Cloud Data Access No (except BigQuery) 30 days in the _Default bucket
Microsoft 365 Unified Audit Log (Purview Audit Standard) Yes 180 days since October 2023 (previously 90)
Microsoft 365 MailItemsAccessed Previously Premium licenses only; extended to Audit Standard after the Storm-0558 case Same as the rest of the log
Entra ID Sign-ins and audit Yes Short and license-dependent; export them to a SIEM or Log Analytics
Azure Activity Log (control plane) Yes 90 days

Retention and defaults change: check the provider’s documentation at the start of every case.

Ventana de terminal
# Event history: last 90 days of management events in one region
aws cloudtrail lookup-events --region eu-west-1 \
--lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIA... \
--start-time 2026-11-01T00:00:00Z --end-time 2026-11-03T00:00:00Z
# Supported lookup attributes: EventId, EventName, ReadOnly, Username,
# ResourceType, ResourceName, EventSource, AccessKeyId
  • Event history is per region: query every region, including those the organization does not use (the attacker can).
  • For serious analysis, query the trails stored in S3 with Athena or load them into the SIEM.
  • Snapshot the EBS volumes of affected instances and share them with an isolated forensic account for disk forensics.
Ventana de terminal
# Exchange Online PowerShell: Unified Audit Log search
Connect-ExchangeOnline
Search-UnifiedAuditLog -StartDate 2026-11-01 -EndDate 2026-11-03 `
-UserIds user@company.com -ResultSize 5000 -SessionCommand ReturnLargeSet
  • Open-source tools such as Microsoft-Extractor-Suite automate extraction of the Unified Audit Log, Entra ID sign-ins, mailbox rules, OAuth applications and consents.
  • What to look for: sign-ins from unusual IPs or countries, forwarding or deletion rules in mailboxes, consents to OAuth applications, newly registered MFA methods, mass MailItemsAccessed and FileDownloaded. Context in Microsoft 365 and Entra ID.
Ventana de terminal
gcloud logging read 'logName:"cloudaudit.googleapis.com%2Factivity"' \
--project my-project --freshness=30d --format=json > admin_activity.json
  • Admin Activity logs are kept for 400 days at no cost; Data Access logs only if they were enabled.
  • For longer retention, use sinks to BigQuery or Cloud Storage with a retention lock.
Phase Indicators in the logs
Initial access An identity signing in from a new IP, ASN or user agent; use of an old access key that had been idle for months
Reconnaissance Bursts of List*, Describe*, Get* calls from an identity that does not usually make them; chains of AccessDenied errors
Persistence CreateUser, CreateAccessKey, CreateLoginProfile, new roles or trust relationships; in Microsoft 365, OAuth applications, credentials added to service principals, mailbox rules
Escalation Policy changes (PutUserPolicy, AttachRolePolicy), privileged role assignments (IAM abuse)
Evasion StopLogging, DeleteTrail, UpdateTrail, disabling GuardDuty, deleting sinks or changing retention
Exfiltration Mass GetObject (if data events exist), snapshots shared with external accounts, MailItemsAccessed or mass downloads in SharePoint
Impact Deleting backups, encrypting buckets with attacker keys, mining with new instances in unused regions

Credentials stolen from an instance’s metadata service show up being used from IPs other than the instance’s own: one of the most reliable detections in AWS.

  • Disabling or deleting logging (StopLogging, DeleteTrail, changing retention): the event itself is recorded if logs are shipped to another account.
  • Using unusual regions nobody watches.
  • Operating only in the data plane, which is not logged by default.
  • Tokens instead of passwords: a stolen token stays valid after a password change until it is revoked (incident response).
  • The provider’s own infrastructure (machines in the same cloud, residential VPNs) so IPs do not stand out.
  • Storm-0558 (Microsoft, July 2023): a China-linked actor accessed the email of about 25 organizations in the US and Europe by forging tokens with a Microsoft consumer account signing key. A federal agency detected it thanks to enhanced logging, specifically MailItemsAccessed events, which until then were only available with Premium licenses. After the criticism, Microsoft extended that logging to Purview Audit Standard customers and raised its default retention from 90 to 180 days. Lesson: without data plane logging there is no way to know what was read.
  • Snowflake (Mandiant, June 2024): the actor UNC5537 accessed more than a hundred Snowflake customer environments with credentials stolen by infostealers, some from infections dating back to 2020. Mandiant attributed the success to missing MFA, credentials that had never been rotated and the absence of network restrictions by source. Lesson: in SaaS, the customer’s own sign-in and query logs are the main evidence, and the investigation starts with the credentials.
  • Immediately preserve logs close to expiry in a separate, protected account
  • Inventory what was enabled: trails, data events, Data Access, Flow Logs, Audit Premium
  • Every region, account, subscription and project included in scope
  • Compromised identities: sign-ins, IPs, user agents, access keys
  • Persistence: users, keys, roles, trust relationships, OAuth applications, mailbox rules
  • Changes to logging itself (StopLogging, DeleteTrail, retention)
  • Disk snapshots and, where applicable, memory of affected instances
  • Session and token revocation coordinated with containment
  • Everything in UTC and merged into the timeline