Conditional Love for AWS Metadata Enumeration
AWS IAM policy condition keys such as aws:ResourceAccount and aws:ResourceTag can be used with string operators to enumerate account IDs, organisation IDs, and tag values of public or cross-account resources. An attacker with a role that can attach policies can discover these metadata values digit by digit.
Published on blog.plerion.com
Did your parents ever tell you the one about the security researcher and the AWS policy condition engine? No?
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
AWS IAM policies can carry condition keys that restrict an action based on properties of the resource being addressed. One of these is s3:ResourceAccount, which lets a caller make an S3 API call conditional on the AWS account ID that owns the bucket. In 2021 Ben Bridts published an approach for extracting AWS account IDs from public S3 buckets using this key, and this post builds directly on that work.
The technique works because a condition can be evaluated against a partial string. If a policy allows an action only when the resource account matches a given prefix, the API call succeeds when the guess is right and fails when it is wrong. That turns a 12 digit account ID into a digit by digit search rather than a brute force over the whole space.
The post extends the idea from S3 to the global aws:ResourceAccount key and to other destination side condition keys, and releases a tool called Conditional Love that automates the enumeration.
Setup
The examples use the AWS CLI with a user that has a policy attached, and a separate role that the tool assumes for testing. The tool is a Python script, conditional-love.py, run with a CLI profile, a role ARN to assume, an action, a condition, a target and an alphabet.
A precondition for the technique is that the target resource is reachable cross-account or publicly, and that it is addressed by a global namespace identifier rather than an ARN that already contains an account ID. AWS recommends customers ensure only authorised accounts are listed in their policies, since only principals with access to a resource can enumerate metadata.
Finding it
The starting point is the S3 condition key. A policy can say that access to a bucket is allowed only if the owning account is a particular ID:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowResourceAccount",
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*",
"Condition": {
"StringEquals": {"s3:ResourceAccount": "133713371337"}
}
}
]
}
Attaching that policy to a user is done with:
aws iam put-user-policy --user-name cheeky-user \
--policy-name yikes \
--policy-document file://./policy.json
With the wrong account ID in the policy, reading from the public commoncrawl bucket fails:
% aws s3api head-bucket --bucket commoncrawl
An error occurred (403) when calling the HeadBucket operation: Forbidden
With the correct ID, 949746302274, the same call succeeds and returns no output:
% aws s3api head-bucket --bucket commoncrawl
%
Guessing the full ID this way would take on average 10^12/2 attempts, testing 000000000000 through to 999999999999. The key insight that makes this practical is that s3:ResourceAccount works with any string operator, including StringLike, so a policy can test a prefix instead of the whole value:
"Condition": {
"StringLike": {"s3:ResourceAccount": "9*"}
}
or a two character prefix:
"Condition": {
"StringLike": {"s3:ResourceAccount": "95*"}
}
Each successful digit is kept and the next one is tried, so the worst case is 120 backspace and digit presses rather than a full brute force.
The researchers then asked whether other resources in the global namespace could be enumerated the same way, for example a public Route53 zone or a CloudFront distribution. They compiled the documented service based condition keys and found a few candidates:
kms:ResourceAliases
ram:ResourceArn
s3:ResourceAccount
s3express:ResourceAccount
Those were not exciting. The more useful discovery was that AWS had made the condition global under the aws namespace as aws:ResourceAccount, which can be applied to almost every AWS API apart from a few specific exceptions.

The search was not exhaustive, but it identified three resources that allow account ID enumeration from just their public identifier:
- Data Exchange data sets, addressed by a 32 character alphanumeric identifier such as
[redacted], accessed withdataexchange:GetDataSet. - Lambda function URLs, which include a random 32 character alphanumeric identifier such as
https://[redacted].lambda-url.us-east-1.on.aws/. Public function URLs do not process condition keys when invoked, but inAWS_IAMmode policies are fully evaluated. - API Gateway invocation, which is vulnerable in
AWS_IAMmode. Endpoints are shorter, such ashttps://vafkcspga1.execute-api.us-east-1.amazonaws.com/, and execution happens under a separate service and action,execute-api:Invoke.
The mechanism is the same for all of them: swap s3:ResourceAccount for aws:ResourceAccount and change the action to the target service and API call.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowResourceAccount",
"Effect": "Allow",
"Action": ["SERVICE_NAME:*"],
"Resource": "*",
"Condition": {
"StringLike": {"aws:ResourceAccount": ["PARTIALSTRING*"]}
}
}
]
}
Reading further in the documentation revealed other global condition keys that operate on the destination rather than the source:
aws:ResourceOrgPaths
aws:ResourceOrgID
aws:ResourceTag/{tag-key}
lambda:FunctionArn
The same technique applies to these, so an attacker can enumerate an organisation's OrgID and tag values. AWS explicitly states that confidential or sensitive data should never be put in tags.

In practice, users often are not aware of this guidance or do not implement it, and the Plerion team reports encountering credentials and other secrets in tags more often than they would like. There is a mitigating factor: the tag key has to be known or guessed before a value can be enumerated, so an esoteric tagging scheme offers some protection through obscurity. Common tag keys weaken that. CloudFormation creates some automatically:
aws:cloudformation:logical-id
aws:cloudformation:stack-id
aws:cloudformation:stack-name
AWS also publishes recommended tags:
AppName
AppId
EnvironmentType
OwnerTeamEmail
ComplianceFramework
CostCenter
Customer
DataClassification
HoursOfOperation
OwnerTeam
PatchGroup
ProjectId
SupportPriority
Exploitation
The released tool saves you from manually attaching and detaching policies. The examples below show what it can do.
Step 1: enumerate a tag value
To identify the value of the OwnerEmail tag of a role that can be assumed:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=sts:AssumeRole \
--condition=aws:ResourceTag \
--tag-key=OwnerEmail \
--target=<TARGET_ROLE_ARN> \
--alphabet=abcdefghijklmnopqrstuvwxyz.@
Starting to be wrong. Please be patient...
=>d
=>da
=>dag
=>dagr
=>dagrz
=>dagrz@
=>dagrz@p
=>dagrz@pl
=>dagrz@ple
=>dagrz@pler
=>dagrz@pleri
=>dagrz@plerio
=>dagrz@plerion
=>dagrz@plerion.
=>[redacted]
=>[redacted]
=>[redacted]
Step 2: enumerate an organisation ID
To identify the organisation ID that the commoncrawl S3 bucket belongs to:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=s3:HeadObject \
--condition=aws:ResourceOrgID \
--target=s3://commoncrawl/ \
--alphabet=abcdefghijklmnopqrstuvwxyz-
Starting to be wrong. Please be patient...
=>o
=>o-
=>o-f
=>o-fz
=>o-fz?
=>o-fz??
=>o-fz???
=>o-fz????
=>o-fz?????
=>o-fz?????o
=>o-fz?????ot
Here the condition is aws:ResourceOrgID and the target is the bucket.
Step 3: enumerate an account ID
To identify the account ID that owns the Carvana 'Car Sales for United States' DataExchange dataset:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=dataexchange:GetDataSet \
--condition=aws:ResourceAccount \
--target=[redacted] \
--region=us-west-2
Starting to be wrong. Please be patient...
=>1
=>10
=>102
=>102?
=>102??
=>102???
=>102????
=>102?????
=>102??????
=>102??????7
=>102??????70
=>102??????709
At release the tool supports these actions:
s3:HeadObject
dataexchange:GetDataSet
lambda:InvokeFunctionUrl
execute-api:Invoke
sts:AssumeRole
sqs:ReceiveMessage
and these conditions:
s3:ResourceAccount
aws:ResourceAccount
aws:ResourceOrgPaths
aws:ResourceOrgID
aws:ResourceTag
lambda:FunctionArn
Not all target resource conditions start with Resource. Adding more actions or conditions is described as trivial.
Root cause
The technique relies on condition keys being evaluated against resource metadata and on string operators such as StringLike allowing prefix matching. A caller who can reach a resource can therefore use the success or failure of an API call as an oracle for the resource's account ID, organisation ID, organisation paths or tag values. The global aws:ResourceAccount key widened the surface from S3 to almost every AWS API, and the destination side keys (aws:ResourceOrgID, aws:ResourceOrgPaths, aws:ResourceTag/{tag-key}, lambda:FunctionArn) extended it to organisation and tag metadata.
The report notes that only principals with access to a resource can enumerate metadata, which is the main limit.
Impact
An attacker who can reach a public or cross-account resource can recover its owning account ID, its organisation ID, its organisation paths and the values of its tags, one character at a time. Where tags contain credentials or other secrets, as the Plerion team reports encountering, those secrets become recoverable. Tag enumeration requires knowing or guessing the tag key, and an unusual tagging scheme reduces the risk. The report also raises the question of whether the technique is more dangerous inside a single account, where an attacker in a constrained context could map the tagging schema and the resources they can access, but leaves it as something to ponder.
Fix
The report gives guidance for AWS customers rather than a change to AWS itself:
- Do basic threat modelling: ask what would happen if all tags, account IDs and organisation IDs became public.
- Assume everything in resource tags is public. Never put confidential information in tags, and use a cloud security tool such as Plerion to detect when that happens.
- Where reasonable, publish resources such as images, Lambda layers, applications and integrations from separate purpose-built AWS accounts, because source account IDs are published as part of the process. Avoid doing so from production accounts.
- AWS recommends that customers ensure only authorised accounts are listed within their policies, since only principals with access to a resource can enumerate metadata. This prevents unauthorised accounts from performing actions on resources.
Variants to test
- Apply
aws:ResourceAccountwithStringLikeand a prefix to any API that addresses a resource by a global namespace identifier. A positive result is a successful call for the correct prefix and a failure for the wrong one. - Try
aws:ResourceOrgIDandaws:ResourceOrgPathsagainst public resources to recover organisation identifiers. A positive result is a prefix that resolves character by character. - Try
aws:ResourceTag/{tag-key}with common keys such as the CloudFormation generated tags or the AWS recommended tags listed above. A positive result is a tag value that resolves character by character. - Test Lambda function URLs and API Gateway endpoints in
AWS_IAMmode, since public function URLs do not process condition keys. A positive result is a conditional call that succeeds only for the matching account. - Test
lambda:FunctionArnas a destination condition. A positive result is the same prefix oracle behaviour.



What happened, in plain words
Imagine you have a locker at a gym. The gym has a rule: "you may open locker 133713371337 only." If you try to open a different locker, the door stays shut. If you try the right one, it opens. Now imagine the gym lets you write the rule as "you may open any locker whose number starts with 9." You could try "starts with 9", then "starts with 95", then "starts with 949", and so on, one digit at a time, until the door opens. You have just discovered the locker number without ever guessing all twelve digits at once.
That is the whole idea behind this research. Amazon Web Services (AWS) is a cloud provider: companies rent computers, storage and other services from Amazon instead of buying their own. Every customer gets a long number called an account ID, a bit like a customer number. AWS also has a system of rules called policies that decide who is allowed to do what. Some of those rules can check a property of the thing you are trying to reach, such as which account owns it. If the rule can check a prefix of that property, then the success or failure of your request tells you one character of the answer. Repeat, and you can read out the whole value.
The author of this post, Daniel Grzelak, builds on earlier work by Ben Bridts, who in 2021 showed the trick against Amazon S3 (AWS's file storage service). This post takes the same idea and shows it works against many more AWS services, and also against other pieces of information such as an organisation ID and the values of tags (labels attached to resources). The post ends by releasing a tool called Conditional Love that automates the whole process.
The building blocks, from zero
Before the details, here are the ideas you need. Each one is explained as if you have never seen it.
- API: an API (Application Programming Interface) is the set of doors a program can knock on to ask another program to do something. When you click "send" in a webmail, your browser calls the mail provider's API to send the message. AWS is almost entirely APIs: every action, from creating a storage bucket to reading a file, is an API call.
- AWS CLI: a command-line tool. Instead of clicking buttons in a website, you type commands in a terminal window. Each command is a single API call. In the examples below, lines starting with
%orawsare commands typed into that terminal. - IAM: Identity and Access Management, AWS's system for users, roles and permissions. Think of it as the building's security desk: it decides who may enter which room.
- Policy: a written rule in IAM. It says who may do what, to which resource, and under which conditions. Policies are written in JSON, a plain text format for structured data (curly braces, quotes, colons).
- Condition key: an extra check inside a policy. For example, "allow this action only if the resource belongs to account 123." The condition key is the name of the property being checked, such as
s3:ResourceAccount. - String operator: the way a condition compares text.
StringEqualsmeans "exactly equal".StringLikemeans "matches this pattern", where*stands for "anything after this". So9*means "starts with 9". - Bucket: a container for files in S3. Buckets have names that are unique across all of AWS, which is why anyone can address a public one by name.
- Account ID: a 12 digit number that identifies an AWS customer.
- Organisation ID (OrgID): a shorter identifier for an AWS Organisation, which is a group of AWS accounts managed together, like a holding company with subsidiaries.
- Tag: a label made of a key and a value, attached to an AWS resource. For example key
OwnerEmail, value[redacted]. Tags are meant for organisation and billing, not for secrets. - Role: an identity that a user or program can temporarily "become" (assume) to get permissions. Assuming a role is itself an API call,
sts:AssumeRole. - ARN: Amazon Resource Name, a text identifier for a resource, for example a role. It often contains the account ID already, which matters later.
- Enumeration: discovering information piece by piece, often by asking many small questions. Here it means recovering a hidden value one character at a time.
- Oracle: in security, any signal that tells you whether a guess was right. Here the oracle is simply whether the API call succeeds or fails.
The starting point: S3 and s3:ResourceAccount
Ben Bridts found that S3 has a condition key called s3:ResourceAccount. It lets the person making an S3 call say: "only proceed if the bucket I am addressing belongs to this account ID." In other words, the caller can make the call conditional on the owner of the bucket.
That means you can write a policy that says "allow access to a bucket if the account it belongs to is 133713371337". Here is that policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowResourceAccount",
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*",
"Condition": {
"StringEquals": {"s3:ResourceAccount": "133713371337"}
}
}
]
}
Line by line:
"Statement"is a list of rules. Here there is one.
So the whole policy reads: "allow every S3 action on every resource, but only when the resource's owning account is exactly 133713371337."
If a curious person attaches that policy to their own user, they do it with this command:
aws iam put-user-policy --user-name cheeky-user \
--policy-name yikes \
--policy-document file://./policy.json
Line by line:
Now the person tries to read from the commoncrawl bucket, a well-known public bucket. Because the policy only allows access when the owner is 133713371337, and the real owner is someone else, the call fails:
% aws s3api head-bucket --bucket commoncrawl
An error occurred (403) when calling the HeadBucket operation: Forbidden
Line by line:
But if the person is very good at guessing 12 digit numbers and puts 949746302274 in the policy instead of 133713371337, the same call succeeds. Success here produces no output at all:
% aws s3api head-bucket --bucket commoncrawl
%
Line by line:
- The command is identical to before.
- This time there is no error. The next line is just the prompt again, meaning the command finished quietly and successfully.
That difference, error versus silence, is the oracle. It tells you whether your guess was right.
Why guessing all twelve digits is hopeless, and how prefixes fix it
An observant reader will notice that the person in the example would need enormous luck. To find the right account ID by trying every possibility, they would have to test 000000000000 through to 999999999999, which on average takes 10^12/2 attempts. That is 500 billion API calls. Nobody has the time or the money for that.
Ben's second insight removes the problem. The s3:ResourceAccount condition key works with any string operator, not just StringEquals. In particular it works with StringLike, which matches a pattern. So a policy can ask a much smaller question: does the account ID begin with 9?
"Condition": {
"StringLike": {"s3:ResourceAccount": "9*"}
}
Line by line:
"StringLike"means pattern matching rather than exact equality."s3:ResourceAccount": "9*"means "the owning account starts with the character 9, followed by anything". The*is the wildcard.
Or a two character prefix:
"Condition": {
"StringLike": {"s3:ResourceAccount": "95*"}
}
Line by line:
- Same idea, but now the account must start with
95.
With this, the attacker works digit by digit. Try 0*, 1*, 2* and so on until the call succeeds; that gives the first digit. Then try 90*, 91*, 92* and so on for the second, and keep going. Each confirmed digit is kept and the next one is tried. The worst case is only about 120 backspace and digit presses, instead of a full brute force over a trillion values.
Extending the idea beyond S3
This is where Ben's story ends and this research begins. The question was: are there other resources in the global namespace whose account IDs could be enumerated the same way? For example, could a public Route53 zone (AWS's DNS service) or a CloudFront distribution (AWS's content delivery network) be enumerated?
The author's favourite way to find security issues in AWS is to read the documentation, because AWS documents everything thoroughly. AWS publishes a list of all the service based condition keys, and the team copied them into one file. A few candidates stood out:
kms:ResourceAliases
ram:ResourceArn
s3:ResourceAccount
s3express:ResourceAccount
Line by line:
s3:ResourceAccountis the one from Ben's work.
None of these seemed very exciting. But then the team noticed something better. At some point AWS had realised how useful this kind of condition is and made it global, under the aws namespace, as aws:ResourceAccount. Apart from a few specific exceptions, aws:ResourceAccount can be applied to almost every AWS API. That widens the playground from one service to nearly all of them.

Finding resources that can be enumerated
The team then looked for resources and API calls that meet two conditions:
- They allow cross-account or public access, meaning someone outside the owning account can reach them.
- They use a global namespace identifier, rather than an ARN that already contains an account ID in it. If the identifier already contains the account ID, there is nothing to discover.
The search was not exhaustive, but it found three resources that allow account ID enumeration from just their public identifier.
Data Exchange data sets
AWS Data Exchange is a service for buying and selling data sets in the cloud. Some data sets are public. Data assets are grouped into data sets, and each data set is addressed by a 32 character alphanumeric identifier, for example [redacted]. The operation used to access a data set is dataexchange:GetDataSet, and it is vulnerable to the same conditional trick.
Lambda function URLs
Lambda is AWS's service for running small pieces of code on demand. A Lambda function can be configured to be reachable through a simple HTTPS endpoint, so you can send a web request without setting up API Gateway. The URL includes a random 32 character alphanumeric identifier, for example https://[redacted].lambda-url.us-east-1.on.aws/. These endpoints are often made completely public, but they can also require authentication using a mode called AWS_IAM. Public Lambda function URLs do not process condition keys when invoked, but in AWS_IAM mode policies are fully evaluated, and therefore the conditional trick works.
API Gateway invocation
API Gateway is AWS's service for putting a managed front door in front of APIs. Like Lambda function URLs, API Gateway invocation is vulnerable when in AWS_IAM mode. API Gateway endpoints are shorter, for example https://vafkcspga1.execute-api.us-east-1.amazonaws.com/. They also differ in that execution happens under a separate service and action, execute-api:Invoke.
There is no material difference in how the trick works for these services. Instead of s3:ResourceAccount in the policy, you use aws:ResourceAccount, and you replace the action with the target service and API call:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowResourceAccount",
"Effect": "Allow",
"Action": ["SERVICE_NAME:*"],
"Resource": "*",
"Condition": {
"StringLike": {"aws:ResourceAccount": ["PARTIALSTRING*"]}
}
}
]
}
Line by line:
"Version": "2012-10-17"is the policy language version, as before."Statement"is the list of rules, here one rule."Sid": "AllowResourceAccount"is the rule's label."Effect": "Allow"grants permission."Resource": "*"covers every resource.
Other condition keys that look at the destination
If you keep reading the documentation, you learn more. There are other global condition keys that operate on the destination rather than the source:
aws:ResourceOrgPaths
aws:ResourceOrgID
aws:ResourceTag/{tag-key}
lambda:FunctionArn
Line by line:
The answer to "can the same technique be applied?" is yes. You can apply it to these conditions to enumerate an organisation's OrgID and tag values.
AWS explicitly states that confidential or otherwise sensitive data should never be put in tags.

In practice, AWS users often are not aware of this guidance, or do not implement it well. As a cloud security platform, the Plerion team encounters credentials and other secrets in tags more often than they would like. Attackers do not care about anyone's hopes and dreams.
There is one mitigating factor. You have to know or guess the tag key before you can enumerate a tag value. If an organisation uses an esoteric tagging system, it is more protected through its excellent use of obscurity. Unfortunately, some tag keys are very common. CloudFormation, AWS's infrastructure-as-code service, creates some tags automatically:
aws:cloudformation:logical-id
aws:cloudformation:stack-id
aws:cloudformation:stack-name
Line by line:
AWS also publishes recommended tags:
AppName
AppId
EnvironmentType
OwnerTeamEmail
ComplianceFramework
CostCenter
Customer
DataClassification
HoursOfOperation
OwnerTeam
PatchGroup
ProjectId
SupportPriority
Line by line:
- Each line is a tag key that AWS suggests customers use.
The tool: Conditional Love
As a reward for reading this far, the team released Conditional Love, an AWS metadata enumeration tool. It saves you from manually attaching and detaching policies over and over. You set up a role for testing with the necessary permissions, install Python (a programming language), and run the script. Here are examples of what it can do.
Example 1: reading a tag value
This example identifies the value of the OwnerEmail tag of a role you can assume:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=sts:AssumeRole \
--condition=aws:ResourceTag \
--tag-key=OwnerEmail \
--target=<TARGET_ROLE_ARN> \
--alphabet=abcdefghijklmnopqrstuvwxyz.@
Starting to be wrong. Please be patient...
=>d
=>da
=>dag
=>dagr
=>dagrz
=>dagrz@
=>dagrz@p
=>dagrz@pl
=>dagrz@ple
=>dagrz@pler
=>dagrz@pleri
=>dagrz@plerio
=>dagrz@plerion
=>dagrz@plerion.
=>[redacted]
=>[redacted]
=>[redacted]
Line by line:
--alphabet=abcdefghijklmnopqrstuvwxyz.@lists the characters the tool will try.
Example 2: reading an organisation ID
This example identifies the organisation ID that the commoncrawl S3 bucket belongs to:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=s3:HeadObject \
--condition=aws:ResourceOrgID \
--target=s3://commoncrawl/ \
--alphabet=abcdefghijklmnopqrstuvwxyz-
Starting to be wrong. Please be patient...
=>o
=>o-
=>o-f
=>o-fz
=>o-fz?
=>o-fz??
=>o-fz???
=>o-fz????
=>o-fz?????
=>o-fz?????o
=>o-fz?????ot
Line by line:
--action=s3:HeadObjectis the S3 operation that retrieves metadata about an object.--alphabet=abcdefghijklmnopqrstuvwxyz-lists the characters to try, including a hyphen.- The
=>lines show the prefix growing.
Example 3: reading an account ID
This example identifies the account ID that owns the Carvana 'Car Sales for United States' DataExchange dataset:
% ./conditional-love.py --profile=<YOUR_CLI_PROFILE> \
--role=<YOUR_ROLE_ARN_TO_ASSUME> \
--action=dataexchange:GetDataSet \
--condition=aws:ResourceAccount \
--target=[redacted] \
--region=us-west-2
Starting to be wrong. Please be patient...
=>1
=>10
=>102
=>102?
=>102??
=>102???
=>102????
=>102?????
=>102??????
=>102??????7
=>102??????70
=>102??????709
Line by line:
- The
=>lines show the account ID being recovered.
What the tool supports
At release, Conditional Love supports these actions:
s3:HeadObject
dataexchange:GetDataSet
lambda:InvokeFunctionUrl
execute-api:Invoke
sts:AssumeRole
sqs:ReceiveMessage
Line by line:
And these conditions:
s3:ResourceAccount
aws:ResourceAccount
aws:ResourceOrgPaths
aws:ResourceOrgID
aws:ResourceTag
lambda:FunctionArn
Line by line:
Notice that not all target resource conditions start with Resource. Adding more actions or conditions is described as trivial, so the code is worth a look if you are interested.
Why this works at all
The technique relies on condition keys being evaluated against resource metadata and on string operators such as StringLike allowing prefix matching. A caller who can reach a resource can therefore use the success or failure of an API call as an oracle for the resource's account ID, organisation ID, organisation paths or tag values. The global aws:ResourceAccount key widened the surface from S3 to almost every AWS API, and the destination side keys (aws:ResourceOrgID, aws:ResourceOrgPaths, aws:ResourceTag/{tag-key}, lambda:FunctionArn) extended it to organisation and tag metadata.
AWS recommends customers ensure only authorised accounts are listed in their policies, since only principals with access to a resource can enumerate metadata.
What an attacker gets
An attacker who can reach a public or cross-account resource can recover its owning account ID, its organisation ID, its organisation paths and the values of its tags, one character at a time. Where tags contain credentials or other secrets, as the Plerion team reports encountering, those secrets become recoverable. Tag enumeration requires knowing or guessing the tag key, and an unusual tagging scheme reduces the risk. The report also raises the question of whether the technique is more dangerous inside a single account, where an attacker in a constrained context could map the tagging schema and the resources they can access, but leaves it as something to ponder.
What AWS customers can do
The report gives guidance for AWS customers rather than a change to AWS itself:
- Do basic threat modelling: ask what would happen if all tags, account IDs and organisation IDs became public.
- Assume everything in resource tags is public. Never put confidential information in tags, and use a cloud security tool such as Plerion to detect when that happens.
- Where reasonable, publish resources such as images, Lambda layers, applications and integrations from separate purpose-built AWS accounts, because source account IDs are also published as part of the process. Avoid doing so from production accounts.
- AWS recommends that customers ensure only authorised accounts are listed within their policies, since only principals with access to a resource can enumerate metadata. This prevents unauthorised accounts from performing actions on resources.
Things to test
- Apply
aws:ResourceAccountwithStringLikeand a prefix to any API that addresses a resource by a global namespace identifier. A positive result is a successful call for the correct prefix and a failure for the wrong one. - Try
aws:ResourceOrgIDandaws:ResourceOrgPathsagainst public resources to recover organisation identifiers. A positive result is a prefix that resolves character by character. - Try
aws:ResourceTag/{tag-key}with common keys such as the CloudFormation generated tags or the AWS recommended tags listed above. A positive result is a tag value that resolves character by character. - Test Lambda function URLs and API Gateway endpoints in
AWS_IAMmode, since public function URLs do not process condition keys. A positive result is a conditional call that succeeds only for the matching account. - Test
lambda:FunctionArnas a destination condition. A positive result is the same prefix oracle behaviour.



Glossary
- API: the set of doors a program can knock on to ask another program to do something.
- API Gateway: AWS's service for putting a managed front door in front of APIs.
- ARN: Amazon Resource Name, a text identifier for an AWS resource.
- AWS: Amazon Web Services, a cloud provider that rents computing and storage.
- AWS CLI: a command-line tool for making AWS API calls by typing commands.
- AWS_IAM mode: an authentication mode for Lambda function URLs and API Gateway where policies are fully evaluated.
- Account ID: a 12 digit number identifying an AWS customer.
- Bucket: a container for files in S3.
- CloudFormation: AWS's infrastructure-as-code service, which creates resources from templates.
- CloudFront: AWS's content delivery network.
- Condition key: an extra check inside a policy, such as "only if the resource belongs to this account".
- Data Exchange: AWS's service for buying and selling data sets.
- Enumeration: discovering information piece by piece, here one character at a time.
- JSON: a plain text format for structured data, using braces, quotes and colons.
- KMS: AWS's key management service.
- Lambda: AWS's service for running small pieces of code on demand.
- Lambda function URL: a simple HTTPS endpoint that invokes a Lambda function directly.
- Oracle: any signal that tells you whether a guess was right, here success versus failure of an API call.
- Organisation ID (OrgID): an identifier for an AWS Organisation, a group of accounts managed together.
- Policy: a written IAM rule saying who may do what, to which resource, under which conditions.
- RAM: AWS's resource access manager.
- Region: a separate geographic area of AWS infrastructure, such as
us-west-2. - Role: an identity that a user or program can temporarily assume to get permissions.
- Route53: AWS's DNS service.
- S3: AWS's file storage service.
- S3 Express: a faster storage variant of S3.
- SQS: AWS's message queue service.
- String operator: the way a condition compares text, such as
StringEquals(exact) orStringLike(pattern). - Threat modelling: thinking through what could go wrong and who might cause it.
- Wildcard: a character such as
*that stands for "anything".