Recon Labs #2, a Weekly Recon series.

Last Friday was Recon Labs #1, the private S3 bucket that still leaks. Sunday was the CloudTrail tamper drill. This is Recon Labs #2, the leaked access key that still works.

Hands-on lab · about 45 minutes (about 5 of it waiting) · costs less than one cent · AWS CloudShell + console

Someone pastes an AWS access key into a ticket, a chat thread, a .env file, or a private gist. Long-term keys like that, the ones that start with AKIA, keep working until a person turns them off.

AWS will step in, but only if it learns about the leak. When a key shows up somewhere public it watches, like a public GitHub repo, AWS can attach a quarantine policy to the user, then alert you, email you and open a support case. In one public GitHub test Unit 42 published on September 21, 2026, AWS attached version V3 about 10 seconds after the push, and the alert, email and support case followed. Rapid7's write-up of the Crimson Collective group (October 7, 2025) shows the attacker's side: activity from TruffleHog, a tool that checks whether leaked keys still work, came first in the accounts it investigated, followed by attempts to create new users, and then data taken from S3, an RDS database snapshot and EBS disks.

The quarantine policy blocks a long list of risky actions, but it does not block everything, and it does not turn the key off. If the key leaked in Slack, a ticket or a private repo, assume AWS has not noticed. Then the response plan is you.

In this lab you'll play both sides in a sandbox:

  • 🔴 Red (attack): pick up a "leaked" key from a fake ticket and use it the way an attacker does: who am I, what can I see, read a file

  • 🔍 Spot it: find the key's calls in CloudTrail Event history, searching by the key ID

  • 🔵 Blue (defend): read the quarantine policy AWS uses and attach it yourself, without waiting for AWS

  • ✅ Prove it: S3 returns AccessDenied and names AWSCompromisedKeyQuarantineV4, while GetCallerIdentity still works and the key stays Active. Then make the key Inactive, and the lab's calls fail, including GetCallerIdentity

  • 🧹 Clean up: delete the user, key, policy and bucket, and check that nothing is left

Every result in the pictures is real output from a test run on November 18, 2026. The 27-page PDF has every step, command and screenshot. You can do the whole lab from the PDF in AWS CloudShell. The zip also has optional setup.sh and cleanup.sh scripts and a README. Please use a sandbox account. Do not run this in production. Region is US East (N. Virginia) us-east-1. Cost is less than one cent if you clean up the same day. The real risk is leaving an access key behind, so run the cleanup.

This lab uses AWSCompromisedKeyQuarantineV4, which AWS published on November 6, 2026. Older versions like V3 still exist and block less, so in a real incident check which one is on the user.

A few words you'll see

  • IAM user: an identity inside your AWS account. This lab's user has no console password and can only read one lab bucket.

  • Access key: a long-term ID and secret that belong to an IAM user. The ID starts with AKIA and is not secret on its own. Temporary keys start with ASIA, come with a session token, and expire on their own.

  • CloudShell: a command-line window built into the AWS console. Nothing to install.

  • CloudTrail Event history: AWS's built-in audit log of the last 90 days of management calls. It's on in every account, free, and you don't have to set anything up.

  • Quarantine policy: a Deny policy written and maintained by AWS. AWS can attach it when it learns a user's key was exposed, and you can attach it yourself. This lab uses the newest version, AWSCompromisedKeyQuarantineV4.

Before you start

You need a personal or sandbox AWS account, a sign-in with admin rights, and a web browser. Please don't use production. Pick Region US East (N. Virginia) us-east-1 from the region menu before you open CloudShell, and stay there.

💵 Cost: less than one cent, as long as you clean up. CloudShell, IAM users, keys, policies and Event history are free. There is one tiny S3 file. A live access key is a real risk, so please run the cleanup the same day.

The "leaked" key in this lab is one you create for a lab user. It stays in CloudShell. Nothing is posted anywhere.

The idea

  • A leaked AKIA key works until a person turns it off. It does not expire on its own.

  • AWS attaches a quarantine policy automatically only when it finds a key somewhere public that it watches. For a key in a ticket, a chat or a private repo, you attach it yourself.

  • After AWSCompromisedKeyQuarantineV4 is attached, S3 returns AccessDenied and the error names that policy. GetCallerIdentity still works, and the key stays Active.

  • After you set the key to Inactive, the lab's calls fail, including GetCallerIdentity, with InvalidClientTokenId or InvalidAccessKeyId. In a Nov 27 retest with no quarantine, three trials, Secrets Manager still returned a secret on some calls. The last success was 8.5 minutes after the key went Inactive, in the longest of those three, so rotate anything that key could read.

  • Search Event history by the key ID. IAM's last used field can lag, and an empty search does not prove a key is clean. File reads are data events, so they do not show up in Event history unless you turned those on beforehand.

  • In a real incident, make the key Inactive first, then attach the quarantine policy. The lab does quarantine first only so you can see what it does and doesn't block.

  • Temporary credentials the attacker made while the key worked keep working after you turn the key off. For sessions the key made with GetSessionToken, add a deny on the user for sessions issued before now. V2, V3 and V4 list GetSessionToken, and that listing does not stop the call, so set the key Inactive before you count on it. For any role the key assumed, use Revoke active sessions on that role too, because the deny on the user does not reach role sessions. Search Event history for AssumeRole and GetSessionToken calls to find both.

What you'll do

The PDF has the full command blocks, plus outputs and screenshots from the November 18 sandbox run. The short version is below.

Set up. In CloudShell you create a private bucket with a fake invoice, a lab user that can only read that bucket, and one access key. You write the key into a fake ticket file, the way a leak often looks. The setup script, if you use it, never prints or saves the key's secret.

Step 4: the leak is a ticket paste with a live key in it (secret hidden here)

The leak: a live key pasted into a ticket. The secret is hidden here.

Red. Pick the key up from the ticket and call GetCallerIdentity, then list buckets and read the file. GetCallerIdentity is the check TruffleHog uses, and TruffleHog activity is what Rapid7 saw first from Crimson Collective.

Step 7: the leaked key tells the attacker which account and user it belongs to

No login, no password, and the key already says whose it is

Step 8: the leaked key lists the buckets it can see and the file inside the lab bucket

The key lists the buckets it can see, then what's inside

Step 8: the fake invoice, read with the leaked key

The fake invoice, read with the leaked key

Spot it. Search CloudTrail Event history by the key ID. Event history opens with a Read-only = false filter, which hides look-but-don't-touch calls like the ones the attacker made, so change that filter to AWS access key first. Wait a few minutes if the events are not there yet. "Last used" on the key can still say None after the attacker has used it.

Step 10: Event history filtered by the leaked key ID shows GetCallerIdentity, then ListBuckets

Event history filtered by the leaked key ID: GetCallerIdentity, then ListBuckets (newest on top)

Step 10: the GetCallerIdentity record shows the lab user and the leaked key (account ID, IP and IDs masked)

The GetCallerIdentity record: the lab user, signing with the leaked key (account ID, IP and IDs masked here)

Blue. Read AWSCompromisedKeyQuarantineV4, then attach it to the lab user yourself.

Step 13: AWSCompromisedKeyQuarantineV4 attached next to the lab policy, key still Active

The quarantine policy sits next to the lab policy, and the key is still Active

Prove it. Wait about 15 seconds for the policy to land, then try the attacker's calls again. In the November 18 run, GetCallerIdentity still returned the lab user's ARN, the bucket list failed with AccessDenied, and the message named an explicit deny in AWSCompromisedKeyQuarantineV4. The key was still Active. Then, as yourself, set the key to Inactive. After about 10 seconds, GetCallerIdentity and the S3 calls failed with InvalidClientTokenId or InvalidAccessKeyId.

Step 15: the access key is now Inactive

The key is now Inactive. Last used still says None, even though the attacker used it

Clean up. Delete the user, key, policy and bucket, and check that those exact names are gone. The PDF and cleanup.sh have the exact-name checks. The refused calls made after the key was Inactive did not show up in Event history in the test run. The proof the key is dead is the error you see in CloudShell.

Which quarantine version is on your user, and what still gets through

AWS has four versions of this policy, and which one lands on your user changes what an attacker can still do. On Nov 27 I attached each one, V1 to V4, to a leaked key in a sandbox and ran the same calls through all of them, with the key and with a session the key had minted before the quarantine went on.

Table of what AWSCompromisedKeyQuarantine V1 to V4 blocked for a leaked key in a sandbox on Nov 27, 2026, and the three steps to cut off the key and its sessions.

Tested in a sandbox on Nov 27, 2026. AWS changes these policies, so recheck before you rely on it.

Going by the policy text on Nov 27, here is some of what each version added. The lists are examples, and the full action lists are longer:

  • V1 (2020): blocks launching EC2 instances, creating IAM users or access keys, and attaching policies.

  • V2 (2021, current document from 2024): S3 GetObject, Bedrock InvokeModel, PassRole, CloudTrail lookups, and GetFederationToken. It also lists GetSessionToken, and that listing does not stop the call.

  • V3 (2024, document updated Nov 9, 2026): Bedrock API keys, IAM service credentials, and scheduling a KMS key deletion.

  • V4 (created Nov 6, 2026 UTC, document updated Nov 9): Parameter Store and Secrets Manager GetSecretValue, AssumeRole, Lambda invoke, SSM SendCommand, and stopping or deleting a CloudTrail trail.

What still worked with V4 attached in my run:

  • One older version of one S3 object. GetObject was blocked, and I could still read the previous version of that file, because GetObjectVersion is on none of the lists. AWS documents that a request which names a version id, including the current version's id, is checked as GetObjectVersion. I tested one old version, and I did not test naming the current version's id.

  • CloudWatch Logs search still worked on the one log group in the lab, and logs are where other leaked keys tend to end up.

  • DynamoDB Scan on the one table in the lab.

  • GetSessionToken. V2, V3 and V4 all list it, and the call still returned a token every time I tried. AWS says policies can't control that call.

  • The role session I started with the key before quarantine could still read Parameter Store after I attached V4, set the key to Inactive, and added the session deny on the user.

This is the order I tested, and the order I use:

  1. Set the key to Inactive. In the first run, STS rejected that key 20 seconds after the log line I wrote just before the change. New GetSessionToken calls in that same run failed after STS started rejecting it. Secrets Manager was slower, which is below.

  2. Add an inline Deny on the user for anything where aws:TokenIssueTime is before the cutoff. That blocks later calls from GetSessionToken sessions issued before the cutoff. The long term key has no TokenIssueTime, which is why step 1 has to happen too. Pick a cutoff that covers the incident.

  3. Revoke active sessions on every role the user could assume. Search CloudTrail for its AssumeRole calls, including calls into other accounts. The deny on the user does not reach a role session. I revoked the one role in the lab, and I did not test a chain of roles.

Then delete the key and rotate the secrets, parameters and tokens it could read, including keys sitting in logs.

In the first run one Secrets Manager call returned a secret after containment, so I retested it. Eighteen trials finished, each with a new user and one fake secret. With no quarantine, an Inactive key still got the secret on 101 of 865 direct reads and 107 of 865 batch reads, across 3 trials. Successes and failures were mixed until the last success. The last success in each trial was 7.3, 8.5 and 7.7 minutes after the change, and then I saw none for the rest of a 12 minute watch. GetCallerIdentity on that same key had already failed within about 11 seconds. With V4 attached, a session minted earlier still got the secret on 300 of 1,903 direct reads and 290 of 1,903 batch reads, across 8 trials. Five of the 6 minute V4 trials still had a success within 36 seconds of the watch end, and only one of them ended on a successful final sample, so I can't say where those five ended. In the 3 trials I watched for 15 minutes, the last success was 6.2 to 7.4 minutes in, and then nothing for at least 7.5 minutes. After the TokenIssueTime deny, with no V4, the last direct GetSecretValue success came 5 to 9 seconds later, in 7 trials. BatchGetSecretValue still returned the secret on 141 of 1,764 reads, last at 4.2 to 5.6 minutes, and then stopped. The trials I watched past the last success all went quiet on their own. That fits some paths updating in minutes while others already returned denials, and it also fits some servers keeping a stale answer longer than others, because the successes were scattered between failures. I found no success after the quiet stretch, and I found no sign this kept working past that. A script can read a lot of secrets in 7 minutes. The retest only polled one fake secret per trial, so the rotation that follows is the response, and it is what I do for anything that key or those sessions were allowed to read. This was one region, one day, the default Secrets Manager key, and brand new keys.

AWS changes these policies over time, so check which version and which default is on the user before you rely on any of this. The lab's PDF has the get-policy-version command for V4, and it works for the other three if you change the name.

What to take away

  • A leaked AKIA key works until a person turns it off. It doesn't expire, and it can do whatever that user can do.

  • AWSCompromisedKeyQuarantineV4 blocks a long list of risky actions, and you can attach it yourself in seconds. It doesn't turn the key off, and it doesn't stop GetCallerIdentity. In a real incident, make the key Inactive first. Then add a TokenIssueTime deny on the user and use Revoke active sessions on any role the key assumed. Rotate the secrets the key could read too. In my Nov 27 retest those were three separate tests. Secrets Manager still returned a secret for minutes after the key went Inactive and after V4 went on. After the TokenIssueTime deny, batch reads still returned the secret for several minutes, and direct GetSecretValue stopped within about nine seconds. The longest success was 8.5 minutes.

  • Don't wait for AWS to notice. AWS steps in automatically when it finds a key somewhere public that it watches. For a key in a ticket, a chat or a private repo, assume AWS has not noticed.

  • Search by key ID in CloudTrail Event history. "Last used" lags, and an empty search doesn't prove a key is clean. An empty search also only covers that Region, and anything done with temporary credentials shows up under a different key ID, one starting with ASIA. In a real incident, search every Region that's enabled in the account.

  • File reads are data events. If you want to answer "what did they download?", turn on data events for your important buckets before you need them.

  • Prefer roles and short-lived credentials, IAM Identity Center for people and IAM roles for apps and servers, over long-term user keys.

The zip has the 27-page PDF, optional setup.sh and cleanup.sh scripts, and a README. The PDF is free.

Recon Labs #2, from Weekly Recon by Raajhesh Kannaa Chidambaram · join.defensive.works · tested in a real AWS sandbox on November 18, 2026, with the quarantine version map tested on November 27, 2026.