Interview Prep/DevSecOps/Certificates, TLS and security incident response

During an incident you find CloudTrail has no events for a 6-hour window, and the trail shows a `StopLogging` call

AdvancedTroubleshootingCertificates, TLS and security incident response
Answer

Likely causes → The attacker had enough privilege to stop the trail to cover their tracks. Some evidence may also have been deleted from the log bucket.

Diagnose →

aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=StopLogging
aws cloudtrail get-trail-status --name main
aws cloudtrail validate-logs --trail-arn <arn> --start-time <t>   # detects missing or modified files

Event history (90 days of management events) is separate from the trail, so check it for the gap. Also use other sources: VPC Flow Logs, S3 access logs, GuardDuty and Config.

Fix → Restart logging, contain the principal that called StopLogging, and reconstruct the window from secondary sources.

Prevent → An organization trail owned by the management account (member accounts cannot stop it), an SCP denying cloudtrail:StopLogging/DeleteTrail, log file validation, a separate log-archive account with S3 Object Lock, and alerts on any CloudTrail configuration change.

All DevSecOps questions

More on Certificates, TLS and security incident response