Elastic high stable kql

AWS AssumeRoleWithWebIdentity from Kubernetes SA and External ASN

Detects successful `AssumeRoleWithWebIdentity` where the caller identity is a Kubernetes service account and the source autonomous system organization is present but not `Amazon.com, Inc.` EKS workloads that obtain IAM credentials via IAM Roles for Service Accounts (IRSA) normally reach STS from AWS-managed or AWS-associated networks; the same identity from a clearly external ASN can indicate a stolen or misused projected service-account token being exchanged for IAM credentials off-cluster.

View Source

Detection Logic

data_stream.dataset:aws.cloudtrail and 
 event.provider:sts.amazonaws.com and 
 event.action:AssumeRoleWithWebIdentity and 
 event.outcome:success and user.name:(system\:serviceaccount\:* and not system\:serviceaccount\:kube-system\:aws-load-balancer-controller) and 
 source.as.organization.name:(* and not (Amazon* or AMAZON*)) and 
 not (
  user.id:(
    *oic.prod-aks.azure.com* or
    *container.googleapis.com*
  ) and
  source.as.organization.name:("Microsoft Corporation" or "Google LLC")
) and 
not user.id:((*oidc.s3* and *ocp*) or (*s3* and *amazonaws.com* and *oidc*))

False Positives

  • ⚠ Traffic may leave the cluster via corporate proxies, VPNs, or non-AWS NAT providers that populate a non-Amazon ASN organization name while still being legitimate. AWS IP ranges are also labeled with other organization strings (for example `AMAZON-02`); this rule only excludes `Amazon.com, Inc.` per the match condition—tune with additional approved ASNs, CIDRs, or known automation identities if needed.

Field Validations

Loading…

Comments (0)

Loading comments...