The first thing attackers do after stealing AWS credentials: switch off your alarms
When someone gets hold of AWS credentials, the loud part comes later: the GPU fleet, the bucket download, the crypto miner. The quiet part comes first. A careful intruder checks what is watching the account and turns it off, because every alarm they silence buys them more time before anyone looks.
MITRE ATT&CK calls this Impair Defenses (T1562). In AWS it is a handful of API calls, every one of which lands in CloudTrail. That makes it one of the best things you can alert on: it is rare in normal operation, it is a strong signal when it happens, and the alert does not depend on guessing what the attacker will do next.
The events to watch
- GuardDuty:
DeleteDetectorremoves the detector outright.UpdateDetectorcan set it to disabled. Both stop findings from being generated in that region. - AWS Config:
StopConfigurationRecorder,DeleteConfigurationRecorderandDeleteDeliveryChannelstop the record of what changed in your account, which is the record you would use afterwards to see what the intruder did. - Security Hub:
DisableSecurityHubandBatchDisableStandardsturn off the aggregated findings and the checks behind them. - CloudWatch Logs:
DeleteLogGroupremoves logs, including application and VPC flow logs, after the fact. Deleting evidence is T1070 (Indicator Removal). - CloudTrail itself:
StopLoggingandDeleteTrail. The other events here are only visible because CloudTrail is recording, so these two deserve the same alert. - AWS Organizations:
LeaveOrganization,RemoveAccountFromOrganizationandDeleteOrganization. An account that leaves its organization escapes the service control policies, organization trails and delegated security tooling that were applied from above.
A rule you can copy
CloudTrail management events are delivered to the EventBridge default bus in every region without needing a trail, so you can match on them directly. Save this as pattern.json:
{
"source": ["aws.guardduty", "aws.config", "aws.securityhub", "aws.logs", "aws.cloudtrail", "aws.organizations"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"$or": [
{"eventSource": ["guardduty.amazonaws.com"], "eventName": ["DeleteDetector", "UpdateDetector"]},
{"eventSource": ["config.amazonaws.com"], "eventName": ["StopConfigurationRecorder", "DeleteConfigurationRecorder", "DeleteDeliveryChannel"]},
{"eventSource": ["securityhub.amazonaws.com"], "eventName": ["DisableSecurityHub", "BatchDisableStandards"]},
{"eventSource": ["logs.amazonaws.com"], "eventName": ["DeleteLogGroup"]},
{"eventSource": ["cloudtrail.amazonaws.com"], "eventName": ["StopLogging", "DeleteTrail"]},
{"eventSource": ["organizations.amazonaws.com"], "eventName": ["LeaveOrganization", "RemoveAccountFromOrganization", "DeleteOrganization"]}
]
}
}
Then create the rule and point it at an SNS topic that emails you:
aws events put-rule --name security-tooling-tamper --event-pattern file://pattern.json
aws events put-targets --rule security-tooling-tamper --targets "Id=1,Arn=arn:aws:sns:us-east-1:111122223333:security-alerts"
The SNS topic needs a resource policy that lets events.amazonaws.com publish to it, or the rule will match and nothing will arrive. Test it by stopping a Config recorder in a sandbox account and confirming that the email shows up.
Where this rule falls short
Three limits are worth knowing before you rely on it.
- It is regional. GuardDuty, Config, Security Hub and CloudWatch Logs are regional services, and the event arrives in the region where the call was made. An attacker will not disable GuardDuty in the region you are watching; they will pick the one you are not. The rule has to exist in every region you have enabled, not just the ones you use. Organizations calls are logged in us-east-1, so that region needs the rule regardless.
- It cannot report its own deletion. If the intruder deletes this rule, or removes its target, the rule is gone before it can match anything. We confirmed this when testing our own: the deletion of a rule is only visible to some other rule, some seconds later. Forward the events to a separate account's event bus, so that the account being attacked is not the only place the alert lives, and use a service control policy to restrict who can modify EventBridge rules and targets.
- Some matches are noise.
UpdateDetectorfires for any change to a detector, including harmless ones like changing the finding publishing frequency, andDeleteLogGroupfires whenever an automated cleanup removes a group. Expect to tune. A plain alert that fires too often gets ignored, and an ignored alert is no better than no alert.
It also only tells you that tooling was switched off. It does not tell you who did it, why, or what they did before and after. When one of these fires, look at the identity that made the call, where the request came from, and everything else that identity did in the previous hour. Our post on auditing for past compromise covers that investigation.
What to do when it fires
- Treat it as an incident until proven otherwise. Check whether anyone on your team made the change on purpose. If nobody did, assume the credentials behind it are compromised.
- Re-enable the tooling first. A disabled detector is blind for as long as it stays that way. Turn it back on, then investigate.
- Revoke and rotate. Disable the key, or use "Revoke active sessions" on the role so that sessions already issued stop working. Rotating alone does not end an issued session.
- Look backwards. What did the same identity do in the hour before it disabled the tooling? That hour is usually the reconnaissance.
How SpikeCatcher handles it
SpikeCatcher raises a finding on each of these events, in every region enabled in your account, so you do not have to maintain the rule above in every region yourself. Disabling GuardDuty, stopping Config or disabling Security Hub is rated high severity, leaving an organization is high, and deleting a log group is medium (ignored when an AWS service made the call, for example a managed cleanup). The same event stream feeds cost alerts, so a tampering event and an unusual spike in the same account show up together. You can build everything above yourself, and this post is meant to help you do that. If you would rather not, there is a 14-day free trial, with 5-minute setup and read-only IAM.
Related articles
How to audit AWS for signs of past compromise (after the Qubole breach)
A vendor's IAM credentials assumed customer roles for two weeks unnoticed. A step-by-step audit with commands: trusted roles, AssumeRole hunting, persistence.
The access key nobody retired: how to find and kill stale AWS keys
A vendor key, never retired, found in their environment. Audit commands to find unused AWS access keys, check what they did, and retire them safely.
Bought the wrong Savings Plan? You have a short window to return it
AWS lets you return a mistaken Savings Plan for a limited time. The exact rules, the calendar-month trap, and which plans cannot be returned.
Protect your AWS account — 14-day free trial
Real-time threat and cost anomaly detection. Detects credential theft, cryptomining, and runaway costs in under 15 minutes. 5-minute setup via CloudFormation.
No credit card. Cancel anytime.