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
- Disabling or modifying cloud logs is a documented ATT&CK technique; limit who may change logging.
- Event history is not a permanent record: create a multi-Region trail, ideally an organization trail.
- Keep logs in a separate, tightly controlled account and bucket with least-privilege access and encryption.
- Log file integrity validation uses hashes and a signed, chained hourly digest to reveal changed or missing files.
- Alert on changes to logging and on sources that go quiet.
Sources
- MITRE ATT&CK: Disable or Modify Cloud Log (T1685.002)
- AWS CloudTrail User Guide: Security best practices in AWS CloudTrail
- AWS CloudTrail User Guide: Validating CloudTrail log file integrity
- Google Cloud documentation: Cloud Audit Logs overview
- Microsoft Learn: Activity log in Azure Monitor
- AWS Security Hub User Guide: Security Hub CSPM controls for Amazon CloudWatch
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.
- Detect and prevent tampering with your AWS security logging (CloudTrail, GuardDuty, Config, flow logs): You build a detector for logging tampering and tune it from a noisy first version to a precise one, including the Terraform change that causes a false alert. Runs offline.
- Validate a CloudTrail-style digest chain and catch a deleted log (and see what it can't catch): You verify a signed digest by hand with openssl, then catch a deleted log file from the chain, and see what the chain cannot prove. Runs offline.
- Catch the silent failures in your detection pipeline (a telemetry-integrity monitor from scratch): You build a monitor that notices when a log source goes quiet or changes shape, the blind spot a pipeline hides from its owners. Runs offline.
- Cut SIEM log volume without losing a detection: measure every reduction against every rule: You measure which log reductions keep every detection working, the cost side of choosing which data events to record. Runs offline.
Knowledge check
- 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.
- 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.
- 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
- Cloud logging, detection and response
- Detect and prevent tampering with your AWS security logging (CloudTrail, GuardDuty, Config, flow logs)
- Validate a CloudTrail-style digest chain and catch a deleted log (and see what it can't catch)
- Catch the silent failures in your detection pipeline (a telemetry-integrity monitor from scratch)
- Cut SIEM log volume without losing a detection: measure every reduction against every rule
- All classes
- Free cyber labs