
Defending Against Account Takeover via Credential Stuffing
October 30, 2026
Securing Git Repos: Git Hooks & TruffleHog Scans
October 30, 2026An attacker who has already compromised your AWS environment faces one critical obstacle before they can operate freely: your logs. CloudTrail and CloudWatch are the forensic backbone of AWS security — and sophisticated threat actors know it. In documented incident response cases reviewed by Permiso Security in 2025, attackers disabled CloudTrail logging within an average of four minutes of gaining sufficient IAM privileges. Four minutes. That window between compromise and log destruction is where your entire investigative capability lives or dies.
This isn’t a theoretical concern. The 2023 Capital One follow-up audit, the 2024 Scattered Spider AWS intrusions, and the ongoing wave of cloud-native ransomware campaigns all share a common playbook: gain access, silence the logs, then operate in the dark. If your CloudTrail and CloudWatch configurations are not actively hardened against tampering, you are not running a secure cloud environment — you are running a cloud environment with a false sense of security.
This guide provides a technical, deployment-ready framework for hardening both services against attacker manipulation, covering immutable log storage, real-time alerting on log disruption, cross-account architecture, and governance controls that satisfy both operational teams and compliance auditors.
Understanding the Attack Surface: How Threat Actors Target Your Logs
Before hardening anything, you need to understand exactly what you’re protecting against. Attackers targeting AWS logging infrastructure don’t use brute force — they use precision. The goal is surgical: disable, delete, or corrupt your audit trail while leaving enough operational normalcy that no human or automated alert fires immediately.
The Five Primary Log Tampering Vectors
- CloudTrail trail deletion or stoppage: Using DeleteTrail or StopLogging API calls, an attacker with
cloudtrail:*permissions can silence the entire audit trail in seconds. - S3 bucket manipulation: Deleting or overwriting the S3 bucket receiving CloudTrail logs removes historical evidence. If versioning and MFA delete are not enabled, recovery is impossible.
- CloudWatch log group deletion: Attackers target specific log groups — particularly VPC Flow Logs and Lambda execution logs — using DeleteLogGroup to eliminate lateral movement evidence.
- KMS key disabling or deletion: If CloudTrail logs are encrypted with a customer-managed KMS key, scheduling that key for deletion renders all existing logs unreadable without visibly destroying them.
- Event selector manipulation: Narrowing CloudTrail event selectors via PutEventSelectors to exclude data events or management events creates blind spots without generating obvious alerts.
A 2024 Datadog threat research report found that 62% of AWS security incidents involved some form of log manipulation or evasion as part of the attacker’s operational security playbook. This isn’t a fringe technique — it’s standard procedure for anyone operating above script-kiddie level.
Immutable Log Storage: Building a Tamper-Proof Foundation
The S3 bucket receiving your CloudTrail logs is the highest-value target in your logging architecture. Harden it as if it were a production database containing your most sensitive customer records — because in a breach scenario, it effectively is.
S3 Object Lock and MFA Delete Configuration
S3 Object Lock with Compliance mode (not Governance mode) prevents any principal — including root — from deleting or overwriting objects before the retention period expires. This is non-negotiable for regulated environments. Configure it as follows:
- Enable Object Lock at bucket creation with a minimum 90-day retention in Compliance mode for most environments; 365 days for environments under SOC 2, PCI DSS, or HIPAA requirements.
- Enable MFA Delete on the bucket. This requires a valid MFA token to delete objects or change versioning state, meaning even a compromised root account cannot silently delete logs without physical access to the MFA device.
- Block all public access at both the bucket and account level using the S3 Block Public Access settings — a control that is surprisingly often left partially disabled in enterprise accounts.
- Apply a bucket policy that explicitly denies s3:DeleteObject, s3:DeleteBucket, and s3:PutBucketPolicy from all principals except a tightly scoped, break-glass IAM role that requires MFA to assume.
For cross-account log delivery — covered in detail below — ensure the destination account’s S3 bucket does not grant the source account any delete permissions. Write-only access for log delivery is the correct posture.
KMS Encryption Without a Single Point of Failure
Encrypting CloudTrail logs with a customer-managed KMS key is best practice, but it introduces a new attack vector if not configured carefully. Attackers who schedule a KMS key for deletion create a time-delayed log destruction mechanism that may not be detected until the 7-30 day waiting period completes.
Mitigate this by enabling AWS Config rules to detect KMS key state changes, configuring CloudWatch alarms on kms:ScheduleKeyDeletion and kms:DisableKey API calls, and restricting key administration permissions to a dedicated security account IAM role. Never allow the same IAM principal that writes logs to administer the KMS key used to encrypt them.
Real-Time Alerting on Log Disruption Events
Immutable storage protects historical logs. Real-time alerting is what catches an attacker in the act. The AWS Security Hub benchmark for CloudTrail includes 14 specific metric filters that every organization should implement — but fewer than 35% of AWS accounts audited by CrowdStrike’s cloud team in 2025 had implemented even half of them.
Critical CloudWatch Metric Filters for Log Integrity
Create metric filters and corresponding alarms for the following CloudTrail event patterns. Each should trigger an SNS notification routed to your security operations team within 60 seconds:
| Event Name | Risk | Recommended Alarm Threshold |
|---|---|---|
| StopLogging | Critical | ≥ 1 occurrence |
| DeleteTrail | Critical | ≥ 1 occurrence |
| PutEventSelectors | High | ≥ 1 occurrence outside change window |
| DeleteLogGroup | High | ≥ 1 occurrence on security-tagged groups |
| DeleteLogStream | Medium | ≥ 3 occurrences within 5 minutes |
| PutRetentionPolicy (reduction) | High | ≥ 1 occurrence reducing below baseline |
| ScheduleKeyDeletion | Critical | ≥ 1 occurrence |
Monitoring the Monitor: CloudWatch Log Agent Integrity
A less commonly addressed threat is the tampering of CloudWatch Log agents on EC2 instances. An attacker with OS-level access can stop the CloudWatch agent service, modify its configuration to exclude specific log files, or manipulate the agent’s checkpoint files to create gaps in log delivery. Harden against this by:
- Using AWS Systems Manager State Manager to enforce CloudWatch agent configuration as a desired state, automatically remediating unauthorized changes every 30 minutes.
- Monitoring SSM compliance dashboards for agent configuration drift.
- Implementing file integrity monitoring (FIM) on CloudWatch agent configuration files using a tool like Wazuh or AWS Security Hub’s integration with third-party FIM solutions.
- Configuring the agent to use Instance Metadata Service v2 (IMDSv2) only, preventing metadata credential theft that could allow agent configuration manipulation via the AWS API.
Cross-Account and Cross-Region Log Aggregation Architecture
The most resilient CloudTrail architecture separates the accounts that generate logs from the accounts that store and analyze them. When a production account is compromised, an attacker with full administrative access to that account should still be unable to touch the log archive. This is the core principle of a Security Log Archive account within an AWS Organizations structure.
Implementing a Dedicated Log Archive Account
AWS Organizations with AWS Control Tower provides the scaffolding, but the security controls require deliberate configuration beyond the defaults:
- Create an isolated Log Archive account within your AWS Organization with no workloads, no developer access, and no console access for operational staff. Access should require assuming a role via IAM Identity Center with MFA enforced.
- Apply Service Control Policies (SCPs) at the Log Archive OU level that deny cloudtrail:DeleteTrail, cloudtrail:StopLogging, s3:DeleteBucket, and s3:DeleteObject for all principals. SCPs apply even to the account’s root user for the covered services, creating a policy boundary no in-account action can override.
- Configure an Organization Trail from the management account. This creates a trail that automatically covers all current and future member accounts and delivers logs centrally — and critically, member account administrators cannot modify or delete an Organization Trail.
- Enable cross-region replication on the S3 log archive bucket to a different AWS region, preferably in a different geographic jurisdiction. This protects against regional outages and region-targeted attacks.
The 2024 Scattered Spider AWS intrusions specifically demonstrated why this architecture matters. In incidents where organizations had single-account CloudTrail configurations, attackers were able to delete up to 60 days of logs. Organizations with cross-account architectures retained complete forensic records, enabling full incident scope determination within hours rather than weeks.
CloudWatch Logs Cross-Account Observability
AWS CloudWatch cross-account observability, generally available since late 2022 but still underutilized, allows a central monitoring account to query and analyze log data from multiple source accounts without log data needing to transit through intermediary pipelines. Configure source accounts as monitoring sources and your security operations account as the monitoring account. This enables SOC analysts to run CloudWatch Logs Insights queries across all accounts from a single pane while the underlying log data remains protected by the source account’s Object Lock and bucket policies.
IAM Hardening: Least Privilege for Logging Infrastructure
Technical storage controls mean little if an attacker can simply escalate IAM privileges and assume a role with cloudtrail:* permissions. IAM hardening for logging infrastructure requires both restrictive permission boundaries and active detection of privilege escalation paths.
Scoping CloudTrail and CloudWatch IAM Permissions
Audit your current IAM policies for any role or user with the following dangerous permission combinations:
- cloudtrail:StopLogging or cloudtrail:DeleteTrail outside of a tightly controlled break-glass role
- logs:DeleteLogGroup or logs:DeleteLogStream attached to application service roles
- s3:DeleteObject on log archive buckets granted to any role not in the dedicated security account
- iam:PassRole combined with cloudtrail:CreateTrail — this combination allows creating a shadow trail that sends logs to an attacker-controlled bucket
Use IAM Access Analyzer to identify roles with these permissions and generate least-privilege policies based on actual CloudTrail access activity over the previous 90 days. AWS reports that organizations using Access Analyzer’s policy generation feature reduce over-permissioned roles by an average of 73% in their first implementation cycle.
Additionally, implement Permission Boundaries on all IAM roles created by CI/CD pipelines or infrastructure-as-code tooling. A permission boundary can explicitly deny all logging-destructive actions, ensuring that even if a pipeline role is compromised or misconfigured, it cannot be weaponized to tamper with log infrastructure.
Compliance Validation and Continuous Audit Readiness
Hardening CloudTrail and CloudWatch is not a one-time configuration exercise. Configurations drift. IAM policies accumulate exceptions. S3 bucket policies get modified during incident response and never reverted. Continuous validation through automated compliance tools is the only way to maintain your hardened posture over time.
AWS Config Rules for Ongoing Validation
Deploy the following AWS Config managed rules as minimum baseline for log integrity compliance:
- cloud-trail-enabled: Verifies that at least one CloudTrail trail is active in each region.
- cloud-trail-log-file-validation-enabled: Ensures CloudTrail log file validation is active, allowing detection of log tampering via SHA-256 digest files.
- cloud-trail-encryption-enabled: Confirms logs are encrypted with a customer-managed KMS key.
- s3-bucket-versioning-enabled: Checks versioning status on log archive buckets.
- s3-bucket-object-lock-enabled: Validates that Object Lock is configured on designated log buckets.
- cw-loggroup-retention-period-check: Flags log groups with retention periods below your defined minimum (recommended: 365 days for security-critical groups).
Configure all rules as proactive evaluation mode where supported — this checks resources before they are deployed, preventing non-compliant configurations from ever reaching production. Pair Config with AWS Security Hub’s Foundational Security Best Practices standard, which aggregates findings across Config, GuardDuty, and IAM Access Analyzer into a unified compliance score your CISO can present directly to the board.
CloudTrail Log File Validation: An Underused Defense
When log file validation is enabled, CloudTrail creates a digitally signed digest file every hour that contains the hash of each log file delivered in that period. If an attacker modifies, deletes, or replaces a CloudTrail log file, the digest file — which is itself hash-chained to previous digest files — will reveal the tampering. Validate your logs programmatically using the AWS CLI validate-logs command or integrate validation into your SIEM ingestion pipeline. This transforms CloudTrail from a simple log source into a cryptographically verifiable audit trail — a significant evidentiary advantage in both regulatory investigations and legal proceedings.
Key Takeaways
- Log destruction is a first-mover advantage for attackers. Sophisticated threat actors disable CloudTrail within minutes of gaining sufficient IAM privileges. Your hardening controls must be in place before a compromise occurs — they cannot be applied reactively.
- Cross-account architecture is the most effective structural defense. Separating log generation accounts from log archive accounts, enforced by SCPs, prevents even a fully compromised production account from destroying forensic evidence.
- <strong
💡 Enjoyed this article?
Subscribe for more expert insights delivered to your inbox.
Follow us or subscribe below xe2x80x94 free, no spam.





