n2h4@home:~$

AWS forensics: how to investigate a suspected S3 data breach with IRMind

Leer en español

dfir · cloud | aws · s3 · cloudtrail · athena · forensics · irmind

An alert flags reads from an Amazon S3 bucket outside normal hours. The role in the alert, ExportsReader, has permission to download reports. Were those requests part of normal operations? If they weren’t, what data may have left the environment?

I’ll reconstruct a fictional incident using CloudTrail events and S3 server access logs. The bucket is ejemplo-exportaciones-dfir, and the activity begins shortly after 09:00 UTC. First I’ll show how to find the reads in Athena and check what S3 served. Then I’ll investigate the same case in IRMind and show how to produce a case record that someone else can verify.

Preserve the logs and check their coverage

I’d start by collecting logs for the bucket’s account and Region, allowing time on either side of the alert. I’d record the time window in UTC, the account, the bucket and the exact paths of the collected files. I’d retain the files as delivered, record their SHA-256 hashes and work from copies. If the trail had log file validation enabled, I’d also retain the digest files and validate the original logs with aws cloudtrail validate-logs. CloudTrail log file integrity validation.

Next I’d check whether CloudTrail was configured to log object reads for the bucket and prefix during the incident. GetObject is a data event. Trails do not log data events by default, and CloudTrail Event history doesn’t show them. Turning on logging captures future activity. The gap in historical coverage remains. S3 data events in CloudTrail.

If the reads were still happening, I’d coordinate containment alongside evidence collection. In this case I’d look at how to limit the role’s access to the bucket and prevent new sessions from being issued through the same route. Revoking a role’s active sessions can disrupt other processes using it. I’d record what changed and when so the timeline accounts for the effects of containment. Revoking IAM role sessions.

Reconstruct the reads in Athena

The first query looks for GetObject requests to the bucket during the alert window. It includes denied requests so they appear in the same timeline. It assumes a cloudtrail_logs table that points to the trail’s files and follows the schema in the Athena documentation. If the table is partitioned, add filters for its Region and date partitions to avoid scanning unrelated records. CloudTrail table schema for Athena.

SELECT
    eventtime,
    useridentity.arn AS session_arn,
    useridentity.sessioncontext.sessionissuer.arn AS role_arn,
    useridentity.accesskeyid AS access_key_id,
    sourceipaddress AS source_ip,
    json_extract_scalar(requestparameters, '$.key') AS object_key,
    errorcode,
    requestid,
    eventid
FROM cloudtrail_logs
WHERE eventsource = 's3.amazonaws.com'
  AND eventname = 'GetObject'
  AND from_iso8601_timestamp(eventtime) >= from_iso8601_timestamp('2026-11-18T09:00:00Z')
  AND from_iso8601_timestamp(eventtime) < from_iso8601_timestamp('2026-11-18T09:20:00Z')
  AND json_extract_scalar(requestparameters, '$.bucketName') = 'ejemplo-exportaciones-dfir'
ORDER BY eventtime, eventid;

In this example, the requests point to the same ExportsReader session. I’d trace the credentials back through STS events and compare them with logs from the system that normally assumes the role, such as the export pipeline or identity provider. I’d then widen the window to look for other activity from the same session, using accessKeyId if present, and check for permission changes such as PutBucketPolicy. The ARN and IP help correlate activity. If a presigned URL was used, the logged identity may belong to the signer and the IP may belong to the person or system that used the URL. Investigating AWS credentials · Identifying presigned requests.

Check what data S3 served

To measure the scope, I’d match CloudTrail’s requestID with the Request ID in the S3 access log and check that the bucket and request agree. In the S3 log, Bytes Sent gives the response size excluding HTTP overhead. Object Size gives the size of the object, which can be larger than the response when the read covers only part of the object. S3 server access log format.

Time (UTC) Object HTTP Bytes sent
09:04:12 informes/ventas.csv 200 4,194,304
09:04:18 informes/clientes.csv 206 1,048,576
09:04:21 informes/nominas.csv 403 —

The first entry shows a 4 MiB response for ventas.csv. The second shows that S3 served 1 MiB of clientes.csv, an 8 MiB object. The third records a denied request for nominas.csv and is excluded from the total. The two successful responses account for 5 MiB sent by S3. Before adding up a larger set, I’d remove duplicate log entries for the same Request ID and check for retries or overlapping ranges. Separate responses can contain some of the same bytes.

Access logs can arrive late or be missing. If I had only CloudTrail, I’d report the operations I could see and leave the volume undetermined wherever I couldn’t corroborate it. If data events were missing too, I’d look for evidence in available application, proxy or CloudFront logs, where those services were in the request path. I’d document the time periods and routes covered by each source. S3 access log delivery.

Investigate the same case in IRMind

In IRMind v0.6.1 I’d open a local case with /new and use /ingest to add the CloudTrail management and data events alongside the native S3 server access logs. IRMind hashes each file and builds a local index. I’d keep the originals for verification at the end. If detection were ambiguous, I’d choose parser-json for the CloudTrail JSON export and parser-s3-access for the S3 log. IRMind getting started guide · Ingestion formats.

For this case I’d import the exported files. The Athena adapter in IRMind v0.6.1 is limited to the CloudTrail management events dataset. GetObject reads require object data events. Athena adapter coverage.

With a model configured through /settings model, I’d use the bundled aws-s3-data-exfiltration skill to ask for a timeline I can check against the original records. Skill methodology.

/aws-s3-data-exfiltration Review the ejemplo-exportaciones-dfir bucket on 18 November 2026 from 09:00 to 09:20 UTC. Check log coverage and reconstruct the ExportsReader activity. Match GetObject requests to S3 access log entries by Request ID. For each request, report the object, HTTP status and Bytes Sent. Cite the source hash and record index, and identify what evidence is missing to determine whether the reads were authorised.

I’d review the timeline with /timeline and go back to the original records cited by the model. In this example I’d verify that two responses carried data, one of those reads was partial, and the third request was denied. If a result is truncated, I’d narrow the window or inspect further pages before adding up the bytes. The analyst decides which findings to confirm. Reading original records in IRMind.

What I’d put in the report

Between 09:04:12 and 09:04:21 UTC, one session of the ExportsReader role requested three objects. S3 logged 5 MiB sent across two responses, including part of clientes.csv. The observed request for nominas.csv was denied. It remains unclear who controlled the session, whether the reads were authorised by the business and whether there were other requests outside the coverage of the logs reviewed.

I’d attach the request IDs, the query and the list of evidence sources to the report. To determine whether there was a breach and who was affected, I’d compare the reads with the role’s expected activity and classify the data in the object versions S3 served, where those versions can be identified.

In IRMind I’d use /verify <source-root> to check the files and /report to review the confirmed findings. Once the report is ready, /seal seals the case and /export creates a package. To check it on another machine, I’d use irmind verify-export <package> --expected-key <fingerprint> with the analyst key fingerprint recorded separately. Verification and export.