Cloudy With A Chance Of Compromise: How A Skid Ransoms Your Buckets
Preface
If you spend any amount of time in infosec circles, you’ll notice that the vast majority of offensive research is still centered around endpoint malware, Active Directory abuse, EDR evasion and auth-provider shenanigans. That makes sense though! That’s where the industry mostly grew up. The tooling ecosystem around AD alone is absurd; BloodHound, Mimikatz, Rubeus, Impacket, CrackMapExec, the list goes on and on.
Meanwhile, cloud offensive tooling is still pretty fragmented. There’s no unified kill chain equivalent to the BloodHound-to-Mimikatz-to-CrackMapExec pipeline that AD pentesters take for granted. SentinelOne noted there are “far fewer references to scripts designed to perform ransom attacks directly on cloud services” and 74% of organizations still report a shortage of qualified cloud security professionals1. Cloud security is still treated as the nerdy cousin nobody invites to dinner.

Thing is, the infrastructure has moved. SaaS revenue went from $31 billion in 2015 to over $300 billion in 20252. Cloud adoption is at 94% across enterprises3. Most companies founded in the last decade have never even touched on-prem. When Unit 42 looked at their IR engagements, 87% of intrusions spanned multiple attack surfaces including cloud infrastructure, SaaS and identity systems. The money moved to the cloud but the research didn’t.
And attackers have noticed. Supply chain attacks are increasingly designed to harvest cloud credentials and I’m not talking about obscure packages nobody’s heard of:
Mitigating the Axios npm supply chain compromise. Microsoft — Axios (70M weekly downloads) got backdoored. The RAT scraped AWS access keys (AKIAs), Azure creds and Github tokens.
Poisoned security scanner backdooring LiteLLM. Snyk — LiteLLM got hit through a poisoned Github Action. The payload ran on every Python process startup and went after AWS creds, Secrets Manager, IMDSv2, Kubernetes secrets and more.
And these aren’t isolated incidents either:
- TeamTNT evolved from basic cryptojacking to running enum scripts with 70+ AWS CLI commands against stolen accounts
- SCARLETEEL popped a k8s pod and pivoted straight into AWS through Terraform state files containing IAM keys
- There’s a whole market for this stuff with curated enterprise AWS access selling for thousands on dark web markets
But from what I’ve seen, once you get past the initial access stuff, the research gets real thin. There’s not a whole lot of published work on what actually happens once an attacker is sitting on valid IAM keys to some SaaS company’s production AWS account. What does cloud-native ransomware actually look like? How do you hold someone’s S3 data hostage without downloading a single byte? What logs would even catch it and does anyone actually have those logs turned on? And no, I’m not counting the dozen blogposts that are essentially reworded versions of Rhino Security’s S3 ransomware research.
So that’s what I’m doing here. If you’ve read my previous posts, you already know how I feel about CloudTrail data events and the lovely bill that comes with them. Turns out that blind spot gets a lot scarier when you start thinking about what an attacker can do inside of it.
The lab
To actually demonstrate all of this, I built a fake SaaS company’s AWS environment. 15 S3 buckets, ~920K objects, roughly 250GB of data spread across different teams with varying levels of “we actually gave a shit when configuring this.” Some buckets have KMS encryption and versioning, others have neither. You know, like a real company.
resource "aws_s3_bucket" "customer_data" {
bucket = "acmecorp-prod-customer-data-lake-us-east-1"
}
# enabling versioning so we can roll back objects if something goes wrong
resource "aws_s3_bucket_versioning" "customer_data" {
bucket = aws_s3_bucket.customer_data.id
versioning_configuration {
status = "Enabled"
}
}
# enabling SSE-KMS because "this is customer data and compliance requires
# encryption at rest with a managed key". bucket keys enabled to keep
# KMS costs down (caches a bucket-level key instead of calling KMS per object)
resource "aws_s3_bucket_server_side_encryption_configuration" "customer_data" {
bucket = aws_s3_bucket.customer_data.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
}
bucket_key_enabled = true
}
}
# blocking public access
resource "aws_s3_bucket_public_access_block" "customer_data" {
bucket = aws_s3_bucket.customer_data.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
Not all 15 buckets look this clean though. Some have versioning off, some use AES256 instead of KMS, and the media pipeline bucket somehow ended up with no encryption at all. The usual.
The monitoring stack
For monitoring, we’re going with what I’d call the “smart but cost sensitive” setup that a lot of companies actually run. All CloudTrail management events get forwarded to [REDACTED SIEM VENDOR] through an EventBridge rule set to ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS. If you’ve read my S3 squatting post, you already know why this matters. The short version is that ENABLED and ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS are not the same thing and the difference is massive:
| Event Category | ENABLED | ENABLED_WITH_ALL... |
|---|---|---|
Login events (ConsoleLogin, AssumeRole, GetSessionToken) | No | Yes |
IAM recon (GetRole, GetPolicy, ListRoles) | No | Yes |
KMS activity (DescribeKey, GetKeyPolicy) | No | Yes |
Secrets discovery (GetSecretValue, DescribeSecret) | No | Yes |
Storage recon (ListBuckets, GetBucketPolicy) | No | Yes |
S3 data events (GetObject, PutObject, DeleteObject) | No | No |
Basically all the stuff an attacker does first when they land in your account is missing from ENABLED. ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS dumps everything CloudTrail picks up on top of that. It does a LOT of carrying for the price of free (management events are included in the CloudTrail free tier). So our ACME Corp SOC team is at least not completely blind here.
What we’re not monitoring however is data events. No S3 GetObject/PutObject logging, no Lambda invocation logs, no DynamoDB item-level activity. Because as we’ve established, that stuff gets expensive fast and finance said no. This is going to be important later.
The Skid Attack
For this blogpost we’ll only target a single bucket.
The app permission examples, target searches, attack walkthrough and ransomware script are omitted.
A quick note on deleting versions
One thing worth noting here: s3:DeleteObject and s3:DeleteObjectVersion are two separate IAM actions even though they use the same API call4. Both show up as DeleteObject in CloudTrail though, and both are data events5. AWS really loves making things clear and simple.
In roughly 5 minutes, ~53K objects are encrypted. Just like that, the content of the bucket goes from this

To whatever this garbage is

So what did the SOC see?
Pretty much nothing. As we stated earlier, much of our visibility has effectively been nuked by the fact we don’t monitor data events.
But wasn’t the
ListBucketsevent a management event
Well yes it is but making a detection rule trigger on this event will be pretty unreliable.
If we pivot to our SIEM we can however notice something interesting. ✨ Something ✨ still happened! We seen a shit ton of Decrypt events and some GenerateDataKey sprinkled throughout.

Why is that? Well remember, some of our buckets use SSE-KMS for encryption at rest. When our script does a GetObject on one of those buckets, S3 needs to decrypt the object before handing it back to us. To do that, it calls kms:Decrypt behind the scenes to unwrap the data key that was used to encrypt the object.
Well Tony, wouldn’t you see the IP address or a weird user-agent on those Decrypt calls?
Simply put, no. We don’t call KMS ourselves, S3 does it on our behalf. Same thing on the write side: when we PutObject an encrypted file back into a KMS-encrypted bucket, S3 calls kms:GenerateDataKey to get a fresh data key for encrypting the new object at rest. Both of these show up as management events in CloudTrail.
These events will typically look like these:
{
"userIdentity": {
"type": "AssumedRole", // <--- our compromised ECS task role
"principalId": "AROA3XYZEXAMPLE12345:1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"arn": "arn:aws:sts::123456789012:assumed-role/acmecorp-prod-api-task-role/...",
"accessKeyId": "ASIA…", // <--- ASIA prefix = temporary creds (STS)
"invokedBy": "fas.s3.amazonaws.com" // <--- S3 made this KMS call on our behalf, not us directly
},
"eventName": "Decrypt", // <--- S3 decrypting the object so it can hand us the plaintext
"sourceIPAddress": "fas.s3.amazonaws.com",
"requestParameters": {
"encryptionContext": {
"aws:s3:arn": "arn:aws:s3:::acmecorp-prod-customer-data-lake-us-east-1" // <--- which bucket triggered this
},
"encryptionAlgorithm": "SYMMETRIC_DEFAULT"
},
"resources": [
{
"type": "AWS::KMS::Key",
"ARN": "arn:aws:kms:us-east-1:123456789012:key/cc36a069-..."
}
],
"managementEvent": true, // <--- this IS a management event, so we can see it
"eventCategory": "Management"
}
{
"userIdentity": {
"type": "AssumedRole",
"principalId": "AROA3XYZEXAMPLE12345:1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"arn": "arn:aws:sts::123456789012:assumed-role/acmecorp-prod-api-task-role/...",
"accessKeyId": "ASIA…",
"invokedBy": "fas.s3.amazonaws.com"
},
"eventName": "GenerateDataKey", // <--- S3 generating a new data key for encrypting our PutObject at rest
"sourceIPAddress": "fas.s3.amazonaws.com",
"requestParameters": {
"keyId": "alias/aws/s3", // <--- using the default aws/s3 managed key
"encryptionContext": {
"aws:s3:arn": "arn:aws:s3:::acmecorp-prod-customer-data-lake-us-east-1"
},
"keySpec": "AES_256" // <--- AES-256 data key
},
"resources": [
{
"type": "AWS::KMS::Key",
"ARN": "arn:aws:kms:us-east-1:123456789012:key/cc36a069-..."
}
],
"managementEvent": true,
"eventCategory": "Management"
}
So this does give us a bit of context. Sadly though, since the decrypt events stem from AWS itself, we don’t get any meaningful IOCs (IP address, user-agent). We could probably establish some form of pattern of life for our apps and establish a treshold for how many of these read/write events are expected and we could then set a threshold. Then again, it’s not a GREAT way of detecting these events but it’s definitely better than nothing. One thing worth highlighting is that despite those not making great detection events, they sure as shit can come in handy when doing forensic analysis without data events. Identifying large spike of these events retroactively isn’t too complicated.
Now all this is fine and dandy but after review my logs, I noticed something peculiar. I had less than 5000 decrypt events while over 52000 objects had been read. Why is that?
Remember the bucket_key_enabled = true in our Terraform config? That’s S3 Bucket Keys (which is now the default for new buckets6). When this is on, S3 generates a short-lived bucket-level key from KMS and caches it. That cached key then creates data keys locally for a bunch of objects without going back to KMS each time. AWS says this reduces KMS API calls by up to 99%6. So instead of 53,000 kms:Decrypt calls for 53,000 objects, you get a few thousand at most. The exact cache duration isn’t documented either, AWS just calls it “short-lived” and “time-limited.”
Without Bucket Keys (legacy setups), S3 does call KMS for every single object7. That would generate a noticeable spike in KMS events. But even then, kms:Decrypt and kms:GenerateDataKey are completely normal S3 operations that happen millions of times a day in any active AWS account. You’d need a very specific detection rule to distinguish “app doing normal reads/writes” from “attacker encrypting everything in sight.” And most SOC teams don’t have that rule.
So the only management events our attack generated were a single ListBuckets call and a handful of KMS Decrypt/GenerateDataKey calls that S3 made on our behalf. The ListBuckets is buried in noise, and the KMS events look identical to normal app activity. Not exactly a smoking gun.
Home grown tripwires
Now obviously the “better” fix here is highly dependent on the stack and how it works. We could arguable enforce S3 Object Locks, deny DeleteObjectVersion through an SCP and/or enforce cross-account replication of our data but that will vary too much from company to company so I won’t dig into this in this blogpost.
What we can do however is deploy some tripwires. What we’ve done in my S3 Squatting blogpost to detect public reads against S3 buckets can also be done at a very low cost “privately”.
The cheap version
The idea is simple: deploy a handful of buckets that look like they belong in the environment but that no legitimate service should ever touch. Name them something an attacker doing ListBuckets would absolutely want to hit:
locals {
canary_buckets = toset([
"acmecorp-prod-billing-exports-us-east-1",
"acmecorp-prod-pii-archive-us-east-1",
"acmecorp-prod-secrets-backup-us-east-1",
])
}
# deploy the canary buckets. keep them private, no objects needed.
# the mere act of someone listing objects or reading from these
# is suspicious since nothing legitimate should be touching them.
resource "aws_s3_bucket" "canary" {
for_each = local.canary_buckets
bucket = each.key
}
resource "aws_s3_bucket_public_access_block" "canary" {
for_each = local.canary_buckets
bucket = aws_s3_bucket.canary[each.key].id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
Then set up a CloudTrail trail that only monitors data events on these canary buckets. Same pattern from my S3 squatting post but pointed inward:
resource "aws_cloudtrail" "canary_tripwire" {
name = "canary-tripwire-trail"
s3_bucket_name = aws_s3_bucket.log_bucket.id
include_global_service_events = false
is_multi_region_trail = false
enable_log_file_validation = true
advanced_event_selector {
name = "S3DataEventsForCanaryBuckets"
field_selector {
field = "eventCategory"
equals = ["Data"]
}
field_selector {
field = "resources.type"
equals = ["AWS::S3::Object"]
}
field_selector {
// only monitor our canary buckets, keeps the cost at basically zero
// since no legitimate traffic should ever hit these
field = "resources.ARN"
starts_with = [for b in aws_s3_bucket.canary : "${b.arn}/"]
}
}
depends_on = [aws_s3_bucket_policy.log_bucket]
}
The cost of this is essentially zero. No legitimate traffic means no data events, which means no CloudTrail charges. But the moment someone runs ListObjectsV2, GetObject, or PutObject against one of these buckets, you’ve got a data event with their identity, IP, and user agent. Any event on these buckets is suspicious by definition so your detection rule is dead simple: if event exists, alert.
If we want to improve onto this even more and give us the best odds of catching this early, we can abuse the fact that ListBuckets returns buckets in alphabetical order (thanks @rad for pointing this out to me). Think about it: our skid script calls ListBuckets, gets back a sorted list, then iterates through them one by one. If your canary bucket sorts near the top of that list, it gets hit before the attacker even starts on the real buckets. S3 bucket names can start with numbers and numbers sort before letters, so something like 0000-acmecorp-prod-billing-exports-us-east-1 will (most likely) always be the very first bucket in the list regardless of what other buckets exist in the account. Your tripwire fires while the attacker is still enumerating, giving you a head start on response before any real data gets encrypted.
Knowing that our fake bucket is never meant to be interacted with and that no applications use it, it’s now much easier to leverage some early detection rules based on the events produced by our decoy bucket.
The paid approach (for my corpo readers out there)
WARNING: This is the part where I’ll be shilling for a product I love despite not being paid to do so If you wanna skip this part, I get it.
Now for my corpo friends reading this you’re probably going “bruuuuh I don’t wanna maintain all this shit 😭” which is absolutely fair. Canary buckets are great until the person who deployed them leaves the company and nobody knows they exist, the trail stops getting monitored, or someone accidentally deletes the Terraform stack in a cleanup sprint. Home grown tripwires work but they need babysitting.
Products like Tracebit handle this for you. They deploy decoy resources across your AWS accounts (S3 buckets, IAM roles, credentials, the works) and alert when anything touches them. Same concept as what we just built but they handle the deployment, rotation and alerting so it doesn’t slowly rot in a repo somewhere. What’s nice is they can spread canaries across hundreds of accounts in minutes and the detection is near real-time since they’re not waiting on CloudTrail’s 5 minute publishing cycle. They also rotate and refresh the decoys automatically so your canaries don’t go stale, which is the part that always falls apart when you DIY it.
Relying on “we’ll notice the outage” as your detection strategy for cloud ransomware is not a plan.
Final words
So what should you actually do about this? Two things stood out to me while writing this.
First, the decoy buckets. We showed that deploying a few canary buckets with a scoped CloudTrail trail costs you literally nothing and takes maybe 20 minutes to set up in Terraform. Name one 0-something so it sorts first in ListBuckets and any script that iterates through your account will trip on it before touching the real stuff. Is it bulletproof? No. But it’s free, it’s easy and it gives you a signal you currently don’t have at all.
Second, those KMS Decrypt and GenerateDataKey events. They were the only management events this attack left behind (other than a single ListBuckets call that’s impossible to alert on). Right now most of you probably aren’t doing anything with these. Start baselining them. Figure out what normal looks like for each role in your account. How many Decrypt calls does acmecorp-prod-api-task-role usually make in a day? If that number suddenly spikes from 200 to 5000 in an hour, something is probably wrong. It’s not a perfect detection by any stretch but it’s a hell of a lot better than finding out you got ransomed because your app started throwing errors.
https://www.fortinet.com/content/dam/fortinet/assets/reports/2025-cybersecurity-skills-gap-report.pdf ↩︎
https://www.saastr.com/gartner-saas-spend-is-actually-accelerating-will-hit-300-billion-in-2025/ ↩︎
https://www.cloudzero.com/blog/cloud-computing-statistics/ ↩︎
https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons3.html ↩︎
https://docs.aws.amazon.com/AmazonS3/latest/userguide/cloudtrail-logging-s3-info.html ↩︎
https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html ↩︎ ↩︎
https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html ↩︎