RAWS playbook · Evasion and guardrails
CloudTrail, GuardDuty or guardrails disabled
The attacker stops or narrows logging and detection before acting, or detaches the service control policies (SCPs) that prevent it. Restart the trail and detectors first, then rebuild the gap from event history, which keeps recording management events while a trail is stopped.
Look here
| Log | Search for |
|---|---|
CloudTrail, cloudtrail.amazonaws.com | Trail and event data store changes, which event history records even when the trail is stopped: StopLogging, DeleteTrail, UpdateTrail, PutEventSelectors, StopEventDataStoreIngestion, DeleteEventDataStore |
| CloudTrail, GuardDuty | Detector, filter and trusted IP list changes: DeleteDetector, UpdateDetector, DisassociateFromAdministratorAccount, DeletePublishingDestination, CreateFilter, UpdateFilter, CreateIPSet, UpdateIPSet |
| CloudTrail, EC2, AWS Config and S3 | Flow log, recorder and log bucket changes: DeleteFlowLogs, StopConfigurationRecorder, DeleteConfigurationRecorder, DeleteDeliveryChannel, and PutBucketPolicy or PutBucketLifecycle on the log bucket |
CloudTrail, organizations.amazonaws.com, us-east-1 | Policy changes, each logged in the account that made the call: DetachPolicy, UpdatePolicy, DeletePolicy, DisablePolicyType, LeaveOrganization |
| GuardDuty | Findings for logging turned off: Stealth:IAMUser/CloudTrailLoggingDisabled, DefenseEvasion:IAMUser/AnomalousBehavior, Stealth:S3/ServerAccessLoggingDisabled |
| CloudTrail status | Whether the trail logs now and when it stopped, from IsLogging and TimeLoggingStopped: aws cloudtrail get-trail-status --name <trail> |
| Event selectors | The trail's selectors, to compare against your baseline: aws cloudtrail get-event-selectors --trail-name <trail> |
Contain
| # | Item |
|---|---|
| 1 | Restart the trail from its home Region: aws cloudtrail start-logging --name <trail> --region <home-region> |
| 2 | Re-enable GuardDuty in each affected Region: aws guardduty update-detector --detector-id <id> --enable |
| 3 | If the attacker called DeleteDetector, create a new detector, then restore its features, filters and publishing destinations: aws guardduty create-detector --enable |
| 4 | Restart AWS Config: aws configservice start-configuration-recorder --configuration-recorder-name <name> |
| 5 | Recreate deleted flow logs: aws ec2 create-flow-logs --resource-type VPC --resource-ids <vpc-id> --traffic-type ALL --log-destination-type s3 --log-destination arn:aws:s3:::<bucket>/<prefix>/ |
| 6 | Reattach detached SCPs: aws organizations attach-policy --policy-id <p-id> --target-id <ou-or-account> |
| 7 | Contain the identity that made the changes, using credential leak or account takeover |
Eradicate and recover
| # | Item |
|---|---|
| 1 | Check trail log integrity for the window: aws cloudtrail validate-logs --trail-arn <arn> --start-time <utc-start> --end-time <utc-end> --verbose |
| 2 | Restore event selectors, GuardDuty filters, IP lists and publishing destinations to baseline |
| 3 | Record the gap in coverage and fill it from event history, GuardDuty and flow logs |
| 4 | Move logging to an organization trail that member accounts cannot change |
| 5 | Add SCPs that deny cloudtrail:StopLogging, cloudtrail:DeleteTrail, GuardDuty detector changes, config:StopConfigurationRecorder, config:DeleteConfigurationRecorder and config:DeleteDeliveryChannel |
Watch out
PutEventSelectorsoverwrites the existing selectors. A single call can silently drop data events or management events whileIsLoggingstays true.- For a multi-Region trail,
StopLoggingandStartLoggingwork only from the home Region.