Data deletion, ransomware and key destruction
The attacker deletes objects, snapshots and backups, schedules deletion of the KMS keys that protect them, or rewrites S3 objects under a key you do not control. A typical run disables versioning or adds an expiring lifecycle rule, deletes recovery points and snapshots, then leaves a ransom note in the bucket. Cancel pending key deletions and stop further deletes first, then protect the recovery points that survive.
Rewrites use a KMS key in an account the attacker controls, or server-side encryption with customer-provided keys (SSE-C), a key S3 never stores. The Codefinger campaign, reported in January 2025, used stolen keys to rewrite objects with SSE-C and set them to expire in seven days.
Look here
| Log | Search for |
|---|---|
| CloudTrail, S3 management events | Changes to versioning, lifecycle, encryption, Object Lock and policy: PutBucketVersioning, PutBucketLifecycle (the event name for PutBucketLifecycleConfiguration), PutBucketEncryption, PutBucketObjectLockConfiguration, DeleteBucket, PutBucketPolicy |
| CloudTrail, S3 data events (off by default) | Bulk deletes and rewrites, counted per principal: DeleteObject, DeleteObjects, PutObject, CopyObject. A CopyObject or PutObject that names a KMS key ARN from another account marks re-encryption |
| CloudTrail, SSE-C writes (S3 data events, off by default) | Objects rewritten with SSE-C: PutObject and CopyObject with SSEApplied of SSE_C in additionalEventData. In CloudTrail Lake: WHERE eventSource = 's3.amazonaws.com' AND element_at(additionalEventData, 'SSEApplied') = 'SSE_C' |
CloudTrail, kms.amazonaws.com | Key deletion, disabling and policy changes: ScheduleKeyDeletion, DisableKey, PutKeyPolicy, DeleteImportedKeyMaterial, CreateGrant. Use of a key in another account appears as GenerateDataKey or Decrypt in both accounts |
| CloudTrail, backups and snapshots | Deleted recovery points, vaults and snapshots: DeleteRecoveryPoint, DeleteBackupVault, DeleteBackupVaultLockConfiguration, UpdateRecoveryPointLifecycle, DeleteSnapshot, DeleteDBSnapshot, DeleteDBClusterSnapshot, DeleteDBInstance |
| Backup platform | Changes to backup plans and vault policies: DeleteBackupPlan, UpdateBackupPlan, DeleteBackupSelection, PutBackupVaultAccessPolicy. Also calls by the IAM role or keys of any third-party backup server, such as snapshot or repository object deletes |
| Key and object state | The state of each key and the key on each object. Check KeyState and DeletionDate with aws kms describe-key --key-id <key>, and SSEKMSKeyId with: aws s3api head-object --bucket <bucket> --key <key> |
| GuardDuty | Findings for unusual deletes and writes: Impact:S3/AnomalousBehavior.Delete, Impact:S3/AnomalousBehavior.Write, Impact:IAMUser/AnomalousBehavior, AttackSequence:S3/CompromisedData |
Contain
| # | Item |
|---|---|
| 1 | Cancel each pending key deletion: aws kms cancel-key-deletion --key-id <key> |
| 2 | Enable each canceled key, which stays disabled until you do: aws kms enable-key --key-id <key> |
| 3 | Contain the identity that made the calls with the IAM user access keys or root account playbook |
| 4 | Attach a service control policy (SCP) to the account that denies s3:DeleteObjectVersion, s3:PutBucketVersioning, s3:PutLifecycleConfiguration, kms:ScheduleKeyDeletion, kms:DisableKey, backup:DeleteRecoveryPoint, ec2:DeleteSnapshot and rds:DeleteDBSnapshot to all but the responder role |
| 5 | Add a bucket policy that denies PutObject unless this condition key equals your own key ARN: s3:x-amz-server-side-encryption-aws-kms-key-id |
| 6 | Block SSE-C writes on each bucket. Read the current setting with get-bucket-encryption and keep its default encryption in the rule: aws s3api put-bucket-encryption --bucket <bucket> --server-side-encryption-configuration '{"Rules":[{"BlockedEncryptionTypes":{"EncryptionType":["SSE-C"]}}]}' |
| 7 | Block SSE-C across accounts with a resource control policy (RCP) or SCP that denies s3:PutObject when this condition key is not null: s3:x-amz-server-side-encryption-customer-algorithm |
| 8 | Replace attacker lifecycle rules with the known-good configuration before the next expiration run: aws s3api put-bucket-lifecycle-configuration --bucket <bucket> --lifecycle-configuration file://known-good.json |
| 9 | Re-enable versioning where it was suspended: aws s3api put-bucket-versioning --bucket <bucket> --versioning-configuration Status=Enabled |
| 10 | Copy the surviving recovery points to a vault in a separate account before further loss, and see Ransomware |
Eradicate and recover
| # | Item |
|---|---|
| 1 | Find deleted and overwritten objects: aws s3api list-object-versions --bucket <bucket> --prefix <prefix> |
| 2 | Bring back the prior version of a deleted object by deleting its delete marker: aws s3api delete-object --bucket <bucket> --key <key> --version-id <delete-marker-id> |
| 3 | Restore objects re-encrypted under a foreign KMS key or an attacker SSE-C key from the prior version encrypted under your key |
| 4 | Restore deleted EBS snapshots that a Recycle Bin rule retained. The bin keeps only snapshots that matched a rule at deletion time. List them with aws ec2 list-snapshots-in-recycle-bin, then restore each one: aws ec2 restore-snapshot-from-recycle-bin --snapshot-id <snap> |
| 5 | Find recovery points in AWS Backup, then restore each one with aws backup start-restore-job: aws backup list-recovery-points-by-backup-vault --backup-vault-name <vault> |
| 6 | Rotate the credentials and roles of backup servers and operators, rebuild backup management servers from a known-good image, and keep copies in a logically air-gapped vault in a separate account |
| 7 | Protect what remains: Object Lock on critical versioned buckets, new or existing; MFA delete set by the root user with --mfa; Recycle Bin rules for snapshots and AMIs; and a vault lock |
| 8 | Delete object versions encrypted under the foreign key destructive once the restore is verified |
- A key in
PendingDeletionfails every cryptographic call. The waiting period is 7 to 30 days, 30 by default. After deletion, data encrypted under the key is unrecoverable, and a canceled key staysDisableduntil you enable it. DeleteImportedKeyMaterialtakes effect at once. The key works again only if you reimport the same key material.- Object Lock retention and legal holds protect object versions. A plain delete still adds a delete marker, which hides the object until you remove the marker. Object Lock cannot be turned off once on.
- A vault lock in compliance mode cannot be removed after its grace time of at least 3 days, even by the root user. Use governance mode during an incident.
- Since April 2026, S3 blocks SSE-C on new general purpose buckets in every Region except Middle East (Bahrain) and Middle East (UAE). It also blocked SSE-C on existing buckets in accounts that had no SSE-C objects. Accounts that had SSE-C objects kept their bucket settings, so check older buckets there.
AWS documentation: S3 CloudTrail events, configuring MFA delete, Object Lock, SSE-KMS and specifying SSE-KMS; KMS deleting keys, scheduling key deletion, CloudTrail log entry examples and cross-account key use; AWS Backup Vault Lock and CloudTrail logging; EBS Recycle Bin concepts and snapshot recovery; GuardDuty S3 and IAM finding types; S3 SSE-C, specifying SSE-C, blocking SSE-C and the default SSE-C setting FAQ; monitoring default encryption with CloudTrail; AWS Backup API operations and logically air-gapped vaults. Halcyon research on the Codefinger SSE-C campaign. The SSE-C default setting FAQ, blocking SSE-C, configuring Object Lock, AWS Backup Vault Lock, Recycle Bin concepts and GuardDuty finding types checked October 2026; other topics checked September 2026.