AWS EKS Service Account Token Created via TokenRequest API
Detects the creation of a Kubernetes service account token through the TokenRequest API by a non-system identity. The TokenRequest API allows users and workloads to programmatically generate short-lived tokens for any service account they have create permissions on, without accessing the filesystem or the mounted projected token. Attackers who have gained initial access to a cluster can abuse this API to mint tokens for more privileged service accounts, pivot to cloud provider resources via IRSA/workload identity, or generate long-lived tokens that persist beyond pod termination. Unlike mounted service account tokens which are detectable through file access monitoring, tokens created via the TokenRequest API leave no filesystem footprint, they are only visible in Kubernetes audit logs as a create verb on the serviceaccounts/token subresource. This rule excludes legitimate system components such as the kubelet, kube-controller-manager, EKS managed identities, and the Calico/Tigera operator that routinely create tokens for pod lifecycle management.
Detection Query
data_stream.dataset:"aws.eks_audit" and
aws.eks.audit.verb:"create" and
aws.eks.audit.objectRef.resource:"serviceaccounts" and
aws.eks.audit.objectRef.subresource:"token" and
aws.eks.audit.stage:"ResponseComplete" and
event.outcome:success and
aws.eks.audit.responseStatus.code:201 and
user.name:(* and not
(system\:kube-controller-manager or
system\:kube-scheduler or
system\:node\:* or
system\:serviceaccount\:kube-system\:* or
eks\:* or
system\:serviceaccount\:tigera-operator\:* or
system\:serviceaccount\:calico-system\:*))
Author
Elastic
Created
2026/08/03
Data Sources
Tags
Raw Content
[metadata]
creation_date = "2026/08/03"
integration = ["aws"]
maturity = "production"
min_stack_comments = "The AWS integration adds the aws.eks_audit data stream in package 8.9.0, which requires Kibana 9.6.0 or later."
min_stack_version = "9.6.0"
updated_date = "2026/10/20"
[rule]
author = ["Elastic"]
description = """
Detects the creation of a Kubernetes service account token through the TokenRequest API by a non-system identity. The
TokenRequest API allows users and workloads to programmatically generate short-lived tokens for any service account they
have create permissions on, without accessing the filesystem or the mounted projected token. Attackers who have gained
initial access to a cluster can abuse this API to mint tokens for more privileged service accounts, pivot to cloud
provider resources via IRSA/workload identity, or generate long-lived tokens that persist beyond pod termination. Unlike
mounted service account tokens which are detectable through file access monitoring, tokens created via the TokenRequest
API leave no filesystem footprint, they are only visible in Kubernetes audit logs as a create verb on the
serviceaccounts/token subresource. This rule excludes legitimate system components such as the kubelet,
kube-controller-manager, EKS managed identities, and the Calico/Tigera operator that routinely create tokens for pod
lifecycle management.
"""
false_positives = [
"""
New automation, admission webhooks, or platform agents that legitimately call the TokenRequest API under a
non-standard user string may require narrow exclusions by user.name or source IP.
""",
]
from = "now-6m"
index = ["logs-aws.eks_audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EKS Service Account Token Created via TokenRequest API"
note = """## Triage and analysis
### Investigating AWS EKS Service Account Token Created via TokenRequest API
This alert indicates a successful `create` against the `serviceaccounts/token` subresource (TokenRequest API), which
issues a new service account token without a filesystem read. In EKS and other managed clusters, this can be abused to
mint tokens for more privileged service accounts (including IRSA-linked ones) and pivot to cloud APIs.
### Possible investigation steps
- Identify the actor and origin: `user.name` or `aws.eks.audit.user.username`, `source.ip` or `aws.eks.audit.sourceIPs`,
and `user_agent.original` or `aws.eks.audit.userAgent`. For cloud identities, review `aws.eks.audit.user.extra.*`
(for example `arn` and `principalId`).
- Identify the targeted service account from `aws.eks.audit.objectRef.namespace`, `aws.eks.audit.objectRef.name`, and
`aws.eks.audit.requestURI` (expected to resemble `/api/v1/namespaces/<ns>/serviceaccounts/<sa>/token`).
- Record the issued credential id from `aws.eks.audit.annotations.authentication_kubernetes_io/issued-credential-id`
to correlate later use of the minted token.
- Identify which Role or ClusterRoleBindings grant the actor `create` on `serviceaccounts/token` in the affected
namespace.
- Pivot on the same `user.name` and `source.ip` for follow-on secret reads, pod exec, RBAC changes, or cloud API calls.
### False positive analysis
- Platform automation, admission webhooks, or CI systems that legitimately mint short-lived tokens through the
TokenRequest API may match; confirm the owner and scope, then exclude the specific user or service account.
### Response and remediation
- If unauthorized, remove/revert the RBAC permission that allows TokenRequest (`serviceaccounts/token`) and rotate the
affected service account credentials where applicable.
- For IRSA/workload identity cases, rotate/revoke the cloud role session pathways and review cloud audit logs for API
activity from the time window of the token mint."""
references = ["https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-v1/"]
risk_score = 47
rule_id = "646f7955-d4ab-5ed6-8e1e-f15820c0b615"
setup = """This rule reads EKS control-plane audit logs collected by the AWS integration
into `logs-aws.eks_audit-*`, where the AWS EKS audit ingest
pipelines normalize each audit record under `aws.eks.audit.*`.
Enable the `audit` control-plane log type on the EKS cluster, send its
CloudWatch log group through the AWS integration, and confirm events carry
`data_stream.dataset: aws.eks_audit` and
`cloud.provider: aws` before enabling this rule.
"""
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Containers",
"Platform: AWS",
"Platform: Kubernetes",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: Kubernetes API Server Audit Logs",
"Service: AWS EKS",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Rule Type: Custom Query (KQL)",
"Resources: Investigation Guide",
"Profile: Beta",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:"aws.eks_audit" and
aws.eks.audit.verb:"create" and
aws.eks.audit.objectRef.resource:"serviceaccounts" and
aws.eks.audit.objectRef.subresource:"token" and
aws.eks.audit.stage:"ResponseComplete" and
event.outcome:success and
aws.eks.audit.responseStatus.code:201 and
user.name:(* and not
(system\:kube-controller-manager or
system\:kube-scheduler or
system\:node\:* or
system\:serviceaccount\:kube-system\:* or
eks\:* or
system\:serviceaccount\:tigera-operator\:* or
system\:serviceaccount\:calico-system\:*))
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"