AWS CloudTrail Stop Logging Detection
Detection of adversaries stopping CloudTrail logging to evade detection and operate stealthily within a compromised AWS environment.
This brief focuses on detecting the StopLogging event within AWS CloudTrail logs, a tactic used by attackers to evade detection and operate discreetly within compromised AWS environments. The detection excludes benign StopLogging actions originating from the AWS console and focuses on successful attempts performed programmatically or through the CLI. By stopping CloudTrail logging, adversaries aim to eliminate traces of their malicious activities, hindering incident response, forensic investigations, and potentially enabling unauthorized access or data exfiltration. This activity can occur after initial access and privilege escalation to allow for unfettered lateral movement and data compromise. The detection logic leverages event data from AWS CloudTrail, specifically focusing on the StopLogging event name and its associated parameters.
Attack Chain
- Initial Compromise: The attacker gains initial access to the AWS environment, potentially through compromised credentials or exploiting a vulnerability in an EC2 instance.
- Privilege Escalation: The attacker escalates their privileges within the AWS environment, potentially by exploiting misconfigured IAM roles or policies.
- Identify CloudTrail: The attacker identifies that CloudTrail is enabled and actively logging events within the AWS environment.
- Attempt StopLogging: The attacker attempts to stop CloudTrail logging using the AWS CLI or API, issuing the
StopLoggingcommand. - Successful StopLogging: The
StopLoggingcommand is successfully executed, disabling CloudTrail logging. The event is recorded in CloudTrail before logging is disabled. - Lateral Movement: With CloudTrail logging disabled, the attacker moves laterally within the AWS environment, accessing other resources and services without being monitored.
- Data Exfiltration: The attacker exfiltrates sensitive data from the AWS environment to an external location.
- Persistence: The attacker establishes persistence within the AWS environment, ensuring continued access even if their initial access method is revoked.
Impact
Successful disabling of CloudTrail logging allows attackers to operate undetected within an AWS environment, hindering incident response and forensic investigations. This can lead to significant data breaches, unauthorized access to sensitive resources, and long-term damage to the organization's reputation. The impact is magnified in environments with weak access controls and limited monitoring capabilities. Depending on the scope of access, the damage can range from data exfiltration to complete infrastructure compromise.
Recommendation
- Deploy the Sigma rule
AWS CloudTrail Stop Loggingto your SIEM and tune for your environment. - Investigate any
StopLoggingevents in AWS CloudTrail logs, especially those not initiated from the console. - Monitor AWS CloudTrail logs for suspicious activity and potential defense evasion techniques.
- Implement strong IAM policies to restrict access to sensitive AWS resources and prevent unauthorized modification of CloudTrail configurations.
Detection coverage 2
AWS CloudTrail Stop Logging
highDetects StopLogging events in AWS CloudTrail to identify potential defense evasion.
AWS CloudTrail Stop Logging - Non Console
mediumDetects StopLogging events in AWS CloudTrail excluding console actions
Detection queries are available on the platform. Get full rules →