AWS Lateral Movement from Kubernetes Service Account via AssumeRoleWithWebIdentity
This rule detects lateral movement in AWS environments originating from Kubernetes service accounts by identifying instances where credentials obtained for a service account are used for multiple distinct AWS control-plane actions, potentially indicating unauthorized access.
This detection rule identifies lateral movement in AWS environments stemming from Kubernetes service accounts utilizing AssumeRoleWithWebIdentity. It focuses on detecting instances where credentials obtained via this method are subsequently used to perform several distinct AWS control-plane actions within a single session. This behavior deviates from typical pod traffic and could signify unauthorized access or privilege escalation. The rule prioritizes the detection of sensitive API usage, including reconnaissance activities, access to secrets, IAM modifications, and compute creation events, while strategically excluding high-volume S3 data-plane operations to minimize false positives. The targeted environments are those leveraging EKS IAM Roles for Service Accounts.
Attack Chain
- A Kubernetes service account projects a token.
- The service account uses
AssumeRoleWithWebIdentityto exchange the token for short-lived IAM credentials. - The attacker leverages the assumed role to perform reconnaissance activities such as
ListUsers,ListRoles, andDescribeInstances. - The attacker attempts to access secrets using actions like
GetSecretValueandListSecrets. - The attacker escalates privileges by modifying IAM policies with actions like
AttachRolePolicyandPutRolePolicy. - The attacker attempts to create new users or roles within the AWS environment using actions like
CreateUserandCreateRole. - The attacker performs lateral movement using actions like
SendCommandandStartSession. - The attacker attempts to evade detection by stopping logging with the
StopLoggingaction.
Impact
Successful exploitation can lead to unauthorized access to sensitive data, privilege escalation, and the potential compromise of the entire AWS environment. Lateral movement within the AWS infrastructure allows attackers to gain access to critical systems and data, potentially leading to data breaches, service disruptions, or other malicious activities.
Recommendation
- Deploy the provided Sigma rule to your SIEM to detect potentially malicious activity related to
AssumeRoleWithWebIdentityand tune for your environment. - Review and harden IAM role trust policies associated with Kubernetes service accounts, specifically focusing on OIDC trust conditions, as referenced in the IAM OIDC identity provider documentation.
- Implement strict least privilege principles for Kubernetes service accounts, limiting their access to only the necessary AWS resources, as covered in EKS IAM roles for service accounts.
- Monitor CloudTrail logs for
AssumeRoleWithWebIdentityevents followed by suspicious API calls, focusing on the actions listed in the Sigma rule detection patterns.
Detection coverage 2
AWS AssumeRoleWithWebIdentity Followed by Multiple Control Plane Actions
highDetects when credentials assumed via AssumeRoleWithWebIdentity are used for multiple distinct AWS control plane actions.
AWS Lateral Movement via AssumeRoleWithWebIdentity - Multiple Actions
highDetects lateral movement in AWS environments originating from Kubernetes service accounts by identifying multiple distinct AWS control-plane actions after AssumeRoleWithWebIdentity.
Detection queries are kept inside the platform. Get full rules →