Defending S3 Against SSE-C Encryption Hijacking
Problem Framing
Cloud-native ransomware has evolved beyond data deletion. Attackers with compromised IAM credentials use the S3 CopyObject API with SSE-C (Server-Side Encryption with Customer-Provided Keys) to re-encrypt objects with attacker-controlled keys, permanently locking the data owner out. The original objects are overwritten, and without the attacker's key, the data is irrecoverable. Default encryption at rest (SSE-S3 or SSE-KMS) provides zero protection against this attack because CopyObject with SSE-C explicitly overrides existing encryption. The only durable defense is S3 Object Lock in Compliance Mode with WORM enforcement.
Relevant Nodes
- Topics: S3
- Standards: Object Lock / WORM Semantics
- Architectures: Write-Audit-Publish, Encryption / KMS
- Pain Points: SSE-C Encryption Hijacking, Vendor Lock-In
Decision Path
Understand the SSE-C hijacking attack chain. The attacker compromises IAM credentials (phishing, leaked keys, misconfigured role trust policies). Using those credentials, they call CopyObject with SSE-C, re-encrypting each object with a key only they possess. The original plaintext or KMS-encrypted object is replaced by an SSE-C-encrypted copy. The attacker then demands ransom for the encryption key.
- This attack does not require any special permissions beyond s3:GetObject and s3:PutObject on the target bucket.
- Versioning alone does not prevent the attack — versioned copies are also vulnerable to re-encryption.
Audit current IAM policies for CopyObject with SSE-C permissions. Review all IAM policies, bucket policies, and SCPs (Service Control Policies) for principals that have both s3:GetObject and s3:PutObject. Restrict SSE-C usage via SCP conditions:
- Deny
s3:PutObjectwhens3:x-amz-server-side-encryption-customer-algorithmis present, unless from known automation roles. - This condition blocks SSE-C writes while allowing SSE-S3 and SSE-KMS writes.
- Deny
Enable S3 Object Lock in Compliance Mode. Object Lock in Compliance Mode prevents any principal — including the root account — from deleting or overwriting objects during the retention period. This is the only mechanism that prevents CopyObject from replacing locked objects.
- Compliance Mode cannot be shortened or disabled once set. Plan retention periods carefully.
- Governance Mode allows privileged users to override locks — it is weaker but more flexible for non-critical data.
Configure retention periods. Set retention periods based on your data lifecycle. Critical data (financial records, audit logs, backups) should have retention periods matching regulatory requirements. Operational data may use shorter retention with Governance Mode.
Implement MFA Delete as secondary defense. MFA Delete requires multi-factor authentication to delete object versions or change versioning state. It adds a human-in-the-loop step that slows automated attacks.
- MFA Delete is configured at the bucket level and requires the root account to enable.
Set up CloudTrail monitoring for SSE-C CopyObject calls. Create CloudTrail event selectors for S3 data events. Alert on any CopyObject or PutObject call that includes SSE-C headers. In most environments, legitimate SSE-C usage is rare — any occurrence is a high-signal alert.
- Route alerts to a security monitoring system (GuardDuty, SIEM) for immediate investigation.
Test CI/CD compatibility with WORM constraints. Object Lock affects automated workflows that overwrite or delete objects. Test that your deployment pipelines, backup rotations, and data lifecycle policies work correctly with locked objects. Use Legal Hold for objects that need indefinite retention without a fixed expiration date.
What Changed Over Time
- S3 encryption at rest (SSE-S3, SSE-KMS) was widely adopted as a compliance checkbox but was never designed to defend against credential compromise.
- SSE-C was designed for customers who wanted to manage their own encryption keys. The attack vector — using CopyObject to re-encrypt with attacker keys — was identified as a theoretical risk but became a practical attack vector in 2024–2025.
- S3 Object Lock (2018) was originally positioned for compliance (SEC 17a-4, FINRA). Its ransomware defense properties were a secondary benefit that became the primary use case.
- Cloud security advisories now explicitly recommend Object Lock as a ransomware mitigation, not just a compliance tool.