Keeping logs complete, central, protected and tamper-evident

Unit 2 of 5 in Cloud logging, detection and response.

You will be able to describe how to keep cloud audit logs complete, protected and checkable, and how to notice when someone tampers with them.

Lesson

Logs are the first thing a careful intruder tries to reduce

MITRE ATT&CK describes a technique called Disable or Modify Cloud Log. Its text says an adversary with sufficient permissions can disable or modify logging to avoid detection. In AWS it gives examples such as disabling the CloudWatch and CloudTrail integrations, removing the SNS topics tied to a trail, disabling multi-Region logging, or turning off the settings that validate or encrypt log files. In Microsoft 365 it names turning off mailbox audit logging for specific users.

The listed mitigation is plain: manage who may change logging policies, so only necessary users have permission to alter them. The page's detection note for AWS-style environments is to watch for cloud API calls that stop, delete or modify logging, such as StopLogging, DeleteTrail or UpdateSink operations by privileged users. Unit 3 turns this into an alert.

Make the record complete

AWS's best-practice page says Event history is not a permanent record and does not cover all event types, so for an ongoing record you must create a trail. It suggests one multi-Region trail for management events, with extra trails for specific resource event types such as storage buckets or functions, and an organization trail where AWS Organizations is used. A multi-Region trail captures activity in every enabled Region, which matters because activity in a Region nobody looks at is still activity.

The same page suggests sending trail events to CloudWatch Logs so you can alert on them, and using AWS Config rules to check that every trail is multi-Region and sends to CloudWatch Logs. Checking that logging is on, continuously, is itself a control.

Make the record protected and separate

The integrity, completeness and availability of audit logs matter for forensics and audits, AWS notes, so log to a dedicated and central storage bucket. It suggests a separate log archive account that only trusted administrators can reach, a bucket policy that grants least privilege, and server-side encryption with a managed key. The idea behind every one of these is separation of duties: the people and systems being watched should not be able to rewrite the record of what they did.

Each provider also has built-in help. Azure says you cannot change or delete activity log entries, and recommends a diagnostic setting for longer retention. Google says audit log entries are immutable. These protect the provider's copy; they do not replace keeping your own copy somewhere with a longer life.

Make the record tamper-evident

CloudTrail's log file integrity validation gives you a way to prove a log was not altered. When you turn it on, CloudTrail creates a SHA-256 hash for every log file it delivers. Every hour it also delivers a digest file that references the last hour of log files and contains a hash of each, and signs it with a private key. Each digest also carries the signature of the previous digest, so the digests form a chain.

That design answers two questions. Was a file changed or deleted after delivery? A changed file no longer matches its hash, and a deleted one is missing from a digest that lists it. Was nothing delivered for a period? A signed digest that lists no files lets you say positively that none were delivered. AWS delivers digest files into the same bucket but a separate folder, so you can apply stricter permissions to them.

Alert on the log itself

AWS Security Hub publishes a list of recommended log metric filters and alarms. One of them is for CloudTrail configuration changes. That is the AWS-flavoured version of the ATT&CK detection above: a change to logging is rare, important and worth a human look. The first class's habit still applies: also alert when a source goes quiet, because a stopped log looks exactly like a quiet network.

A last judgment call is volume. Data events are high volume and cost money, so decide which resources earn them (the buckets holding customer data, for instance) instead of logging everything or nothing. The lab on cutting log volume without losing a detection shows how to measure that choice.

Key points

Sources

Lecture

Incident-ready architecture: A talk on keeping logs safe and practising with the people involved before the incident, which this unit applies to cloud logs.

Practice in the labs

Detect and prevent tampering with cloud logs, prove a deleted file by its digest chain, and find the sources that went silent.

Knowledge check

  1. Why does AWS recommend a separate log archive account with a dedicated bucket? Answer: So the people and systems being logged cannot easily rewrite their own record. The best-practice page stresses the integrity, completeness and availability of logs for forensics and audit and suggests a separate account restricted to trusted administrators, which is separation of duties.
  2. What does a signed CloudTrail digest file let you do that a plain log file cannot? Answer: Show that a log file was changed or deleted, or that none were delivered in a period. Each digest lists and hashes the last hour of log files and is signed and chained to the previous digest, so a changed or missing file, or a period with no files, becomes provable.
  3. An alert fires because someone called StopLogging on a trail. What is the most useful first question? Answer: Was this a planned change by someone who should be able to make it?. ATT&CK describes stopping or modifying logging as a way to avoid detection, but legitimate administrators also change logging. The first job is to tell planned change from tampering, then check for what happened around it.

Back to the syllabus or see all classes.

Related