Amazon EKS: Improper TokenRequest API usage detection
Attackers can abuse the Kubernetes TokenRequest API to mint service account tokens without filesystem access, facilitating privilege escalation and movement to cloud resources via IAM Roles for Service Accounts (IRSA).
Triage facts
Revision 5- Applicability
- Elastic Kubernetes Service (EKS)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 10 public sources
- Freshness
- Revision 5Oct 21, 09:08 UTC
- Detection
- 2 rules
- Source quality
- A1Likely
Revision history 4 entries · Revision 5
- Revision 5
added detection rule: Detect Authorized Anonymous Requests to EKS API
Changed: lastmod, references, rules, tags, ttps, updates
Sources: 1
- Revision 4
added coverage for Elastic Kubernetes Service (EKS)
Changed: lastmod, references, severity, tags, ttps, updates
Sources: 1
- Revision 3
added coverage for Elastic Kubernetes Service (EKS)
Changed: lastmod, references, updates
Sources: 1
- Revision 2
added coverage for Elastic Kubernetes Service (EKS)
Changed: lastmod, references, tags, ttps, updates
Sources: 1
The Kubernetes TokenRequest API allows identities with appropriate RBAC permissions to programmatically generate short-lived tokens for service accounts. Because this process occurs via the API server, the resulting tokens do not leave traditional filesystem footprints, evading file-based monitoring. In Amazon EKS environments, attackers who have gained initial cluster access can leverage this API to mint tokens for highly privileged service accounts, effectively bypassing security controls meant to protect mounted secrets.
Impact
Successful abuse of the TokenRequest API enables attackers to impersonate privileged service accounts, perform unauthorized cluster operations, or gain access to AWS cloud resources through IRSA (IAM Roles for Service Accounts).
Recommendation
- Enable and ingest EKS control-plane audit logs into your SIEM as defined in the AWS integration documentation for
aws.eks_audit. - Deploy the detection rules provided below to monitor for
createevents against theserviceaccounts/tokensubresource by non-system identities. - Review RBAC policies across the cluster to identify and restrict
createpermissions on theserviceaccounts/tokensubresource to only strictly necessary service accounts or users. - Audit existing tokens minted via TokenRequest by correlating
aws.eks.audit.annotations.authentication_kubernetes_io/issued-credential-idwith subsequent API activity.
Immediate actions
Enable EKS control-plane audit logging and integrate with SIEM
Deploy the TokenRequest API detection rule to production
Threat Hunt
Analyze EKS audit logs for 'create' verb on 'serviceaccounts/token' by unexpected users
Data: aws.eks.audit logs
Detection coverage 2
Detect Suspicious TokenRequest API Creation
mediumDetects the creation of a Kubernetes service account token via the TokenRequest API by a non-system identity, which may indicate credential theft or privilege escalation.
Detect Authorized Anonymous Requests to EKS API
mediumDetects authorized requests from system:anonymous or system:unauthenticated users with unusual user agents, excluding standard health check endpoints.
Detection queries are available on the platform. Get full rules →