The vulnerability stems from insufficient security invariants within the Infrastructure-as-Code (IaC) components responsible for creating the AWS S3 bucket for audit logs. The analysis of the patch commit 03a46b9a13d11c792fc8470444dac6feaf3119f4 reveals that the SecureBucket component, and by extension the AccountFoundation component that consumes it, were the sources of the vulnerability.
Prior to the patch, the SecureBucket.constructor had three main flaws:
- It did not prevent the
forceDestroy option from being enabled on production-tier (startup-hardened) audit buckets, allowing for the complete deletion of audit logs upon stack destruction.
- It did not enforce a tamper-resistance mechanism like a deny-delete bucket policy, making existing audit logs deletable by any principal with S3 delete permissions.
- For
sandbox tier deployments, it skipped the creation of a CloudTrail-Lake EventDataStore, which serves as an independent, immutable mirror of the audit trail.
The AccountFoundation.constructor was also identified as a vulnerable function because it directly utilized the flawed SecureBucket component and exposed its weaknesses, such as the forceDestroy option, to end-users.
The patch rectifies these issues by introducing new invariants within the SecureBucket constructor. These invariants are keyed on the bucket's declared function (awsServiceLogDelivery) rather than just its deployment tier. This ensures that any bucket designated as an audit log sink receives the necessary tamper-resistance protections, such as blocking forceDestroy and applying a scoped deny-delete bucket policy, regardless of whether it's in a startup-hardened or sandbox environment. It also ensures the CloudTrail-Lake EventDataStore is created for all audit buckets, restoring immutability for sandbox accounts.