1. Resources
  2. Identity Threats
  3. AWS

AWS Confused Deputy (Missing External ID)

Also known as: Confused deputy problem, Missing sts:ExternalId, Cross-service confused deputy, Third-party role without external ID

An attacker with no access to the victim account gets a trusted SaaS vendor or AWS service to use its own trusted identity against the victim's role or resource, because the trust doesn't say on whose behalf.

Platform
AWS
Impact
High
Last updated
Attack difficulty
Medium
Detection difficulty
High
Privileges required: No account
No identity in the victim account. A customer account at the same vendor (or an own AWS account for the service variant) and the victim's role ARN or resource name.
What the attacker gains
Whatever the vendor role or the service integration can do in the victim account, delivered through the deputy's product: data read, findings, configuration, written objects.

How it works

A deputy is a party that holds its own authority and uses it on behalf of others. In AWS two kinds of deputy are common: a third-party vendor that assumes a role in each customer's account, and an AWS service that reaches into a customer's resources with its service principal. The confused deputy problem is what happens when the trust only checks who the deputy is and not on whose behalf it is acting.

Third-party vendor without an external ID. A monitoring or security vendor asks each customer to create a role that trusts the vendor's AWS account and to paste the role ARN into the vendor's console. The vendor then calls AssumeRole on that ARN. If the trust policy has no condition beyond the vendor's principal, the vendor can assume it for anyone. An attacker opens an account with the same vendor and registers the victim's role ARN as their own. The vendor's backend assumes the victim's role and shows the victim's data in the attacker's tenant. AWS notes that a role ARN is not a secret and can be learned or guessed.

The sts:ExternalId condition closes this. The vendor generates a unique value per customer, the customer puts it in the trust policy, and the vendor always sends the value that belongs to the customer it is working for. When the attacker registers the victim's ARN, the vendor sends the attacker's external ID, the condition fails, and the call is denied. Two weak variants remain exploitable: a vendor that lets the customer choose the external ID, and a vendor that uses the same value for all customers.

Service principal without a source condition. A bucket policy, topic policy, key policy or role trust policy that allows a principal such as cloudtrail.amazonaws.com allows that service whenever it calls, for whichever AWS customer configured it. An attacker in their own account creates a resource in that service and points it at the victim's resource. AWS's own example is a CloudTrail trail in one account that delivers to an S3 bucket in another. For supported integrations the service passes the resource and account it is acting for, and the policy can test them with aws:SourceArn, aws:SourceAccount, aws:SourceOrgID or aws:SourceOrgPaths. A policy without one of those keys accepts every customer of the service.

In both cases the attacker never authenticates to the victim account. The deputy does, with credentials the victim explicitly trusted. This page covers the trust that is missing the binding; an over-broad trust of a whole account is covered in cross-account role trust abuse.

Prerequisites

For the vendor variant:

  • The victim uses a vendor that assumes a role in customer accounts, and the role's trust policy has no sts:ExternalId condition, or one whose value the attacker can make the vendor send.
  • The attacker can register as a customer of the same vendor, for example with a free trial.
  • The victim's role ARN: the account ID plus the role name. Vendors usually document a default role name, and role names can be confirmed from outside.

For the service variant:

  • A resource policy or role trust policy in the victim account that allows a service principal without aws:SourceArn, aws:SourceAccount or an organization condition.
  • An AWS account of the attacker's own in which to configure that service.
  • The name or ARN of the victim's resource, and a service feature that lets the customer name a target in another account.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Find the role ARN

Account IDs appear in ARNs, error messages, public resource policies and vendor documentation. With the account ID, Pacu confirms role names from the attacker's own account without sending anything the victim can log. A word list with the vendor's documented role names makes the search short:

Pacu > run iam__enum_roles --account-id 111122223333 --word-list vendor-role-names.txt

2. Register the victim's role with the vendor

Sign up with the vendor and, in the step that asks for "your" role ARN, enter the victim's:

arn:aws:iam::111122223333:role/VendorIntegrationRole

If the vendor's onboarding shows an external ID that the attacker can edit, and the victim's value is known, enter that value as well. When the trust has no usable binding, the vendor's next scheduled run does this on the attacker's behalf:

# What the vendor's backend runs, with the vendor's own credentials
aws sts assume-role \
    --role-arn arn:aws:iam::111122223333:role/VendorIntegrationRole \
    --role-session-name vendor-sync

The attacker then reads the result in their vendor tenant: asset inventory, logs, findings, cost data, or whatever the product collects. If the product can also act (remediate, deploy, snapshot), those actions run in the victim account.

3. Abuse a service principal trust

For the service variant, configure the service in the attacker's account and name the victim's resource. With a bucket policy that allows cloudtrail.amazonaws.com to write without a source condition, a trail in the attacker's account delivers into the victim's bucket:

# Run in the attacker's own account, 444455556666
aws cloudtrail create-trail \
    --name audit \
    --s3-bucket-name example-central-logs

The same idea applies to topic and queue policies that allow a service to publish, and to roles whose trust policy names a service principal for a feature that lets a customer supply the role ARN.

4. Check your own exposure

Defenders can test both conditions with read-only calls:

# Trust policy of the vendor role: look for Condition.StringEquals."sts:ExternalId"
aws iam get-role --role-name VendorIntegrationRole \
    --query 'Role.AssumeRolePolicyDocument'

# All trust policies, to review every external and service principal
aws iam list-roles \
    --query 'Roles[].{Role:RoleName,Trust:AssumeRolePolicyDocument.Statement}' \
    --output json

# Bucket policy: look for a Service principal without aws:SourceArn or aws:SourceAccount
aws s3api get-bucket-policy --bucket example-central-logs --query Policy --output text

A vendor can test its own product by registering one test customer's role ARN in a second test tenant. The assumption must fail.

Impact

The attacker gains the access the victim granted to the deputy, without ever holding a credential of the victim account. Vendor roles are often broad: read access to every service for a posture tool, write access for a deployment or backup product. That makes this a cross-account data breach by proxy, and in the write case a route to changes in the victim account.

The service variant is usually narrower. It lets the attacker write objects into a log bucket, publish to a topic, or use a key through the service, which can corrupt audit data, trigger downstream automation or run up cost.

OPSEC and artifacts

  • Everything looks like the vendor. The victim's CloudTrail records AssumeRole from the vendor's account ID with userIdentity.type of AWSAccount, exactly like a legitimate sync, and later events show the vendor role as sessionContext.sessionIssuer. Nothing in the victim's logs names the attacker.
  • Timing and scope are the only tells. A second assumption pattern outside the vendor's normal schedule, a new session name, a new source address range of the vendor, or API calls for a product module the victim never enabled.
  • Role name discovery leaves no trace in the victim account, and denied cross-account AssumeRole attempts are not logged there either. A failed attempt against a role that has an external ID is visible only to the vendor.
  • The vendor holds the real evidence. Its tenant database records which customer registered which role ARN, and its own CloudTrail shows the AssumeRole call with the full caller identity. An investigation needs the vendor's cooperation.
  • Service variant. Calls made by a service principal appear with userIdentity.type of AWSService and invokedBy set to the service. S3 object writes are data events and are recorded only when the trail selects them. Objects delivered from a foreign trail carry the attacker's account ID in their key path.

Detection

Runtime detection is weak because the deputy is trusted and expected. The reliable controls are preventive, with configuration detection as the backstop:

  • Roles created or changed without the binding. Alert when CreateRole or UpdateAssumeRolePolicy sets a trust policy that names an external account with no sts:ExternalId condition, or a service principal with no source condition. The role trust policy rules read CreateRole and UpdateAssumeRolePolicy, which carry the new document.
  • Resource policies that trust a service openly. Review PutBucketPolicy and the topic and queue policy changes covered by the SNS and SQS rules for Service principals without aws:SourceArn or aws:SourceAccount.
  • Vendor role baseline. Profile each vendor role: usual hours, call volume, source networks and API set. Flag deviations.
-- Athena, CloudTrail table: hourly use of a vendor role, to baseline its schedule
SELECT
    date_trunc('hour', from_iso8601_timestamp(eventtime)) AS hour,
    useridentity.accountid AS caller_account,
    sourceipaddress,
    count(*) AS assumptions
FROM cloudtrail_logs
WHERE eventsource = 'sts.amazonaws.com'
  AND eventname = 'AssumeRole'
  AND errorcode IS NULL
  AND json_extract_scalar(requestparameters, '$.roleArn')
      = 'arn:aws:iam::111122223333:role/VendorIntegrationRole'
  AND eventtime >= '2026-11-01T00:00:00Z'
GROUP BY 1, 2, 3
ORDER BY hour

An extra burst of assumptions is a lead, not proof. Confirm with the vendor which tenant triggered it.

Mitigation

  • Require an external ID on every third-party role. Use the value the vendor issues for your account in a StringEquals condition on sts:ExternalId. Don't accept a vendor that lets you invent the value or that uses one value for all customers.
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "AWS": "arn:aws:iam::444455556666:role/vendor-collector" },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": { "sts:ExternalId": "0a1b2c3d4e" }
      }
    }
  ]
}
  • Trust the vendor's role, not its account root, when the vendor publishes a stable role ARN.
  • Add source conditions to every service principal grant. Use aws:SourceArn with the full ARN of your own resource where the service supports it, and aws:SourceAccount otherwise. A positive StringEquals on a key the service doesn't send denies the request, so check the integration's documentation first.
{
  "Effect": "Allow",
  "Principal": { "Service": "cloudtrail.amazonaws.com" },
  "Action": "s3:PutObject",
  "Resource": "arn:aws:s3:::example-central-logs/AWSLogs/111122223333/*",
  "Condition": {
    "StringEquals": { "aws:SourceAccount": "111122223333" }
  }
}
  • Set an organization-wide floor. A resource control policy can deny service principal access when aws:SourceOrgID is not your organization, which protects resources whose own policies were written without the condition.
  • Keep vendor roles small. Grant the least privilege the product needs, and remove the role when the contract ends.
  • If you are the vendor: generate the external ID yourself, make it unique per customer, never let customers edit it, and refuse to onboard a role whose trust policy doesn't require it.

Detection rules for this attack

Log events to collect

FAQ

Is the external ID a secret?

No. AWS describes it as an identifier that binds a role to one customer relationship, not as a credential. It works because the vendor chooses it, keeps it unique per customer and always sends the value that belongs to the customer it is acting for. Knowing another customer's external ID gives nothing unless the vendor can be made to send it.

Why is an external ID that the customer chooses not enough?

If customers can type their own external ID into the vendor's setup form, an attacker who learns the victim's value can enter it together with the victim's role ARN, and the vendor will send it. AWS states that the value must be controlled by the vendor, not by its customers.

Does the confused deputy problem apply to AWS services too?

Yes. A policy that trusts a service principal such as cloudtrail.amazonaws.com trusts that service for every AWS customer. Without aws:SourceArn or aws:SourceAccount, another customer can configure their own resource in that service to act on your bucket, topic, key or role.

How can I find vulnerable roles in my account?

List every role whose trust policy names an account you don't own and check for a StringEquals condition on sts:ExternalId. Then list resource and trust policies that name a service principal and check for aws:SourceArn, aws:SourceAccount or aws:SourceOrgID. IAM Access Analyzer lists the external trusts as findings.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.