AWS EKS Anonymous User Create/Update/Patch Pods Request
Description
This rule detects attempts to create, update, or patch pods by an anonymous user. An anonymous user is a user that is not authenticated or authorized to access the Kubernetes API server. Creating, updating, or patching pods is a common activity for attackers to gain access to the cluster and execute commands.
Query · eql
any where data_stream.dataset == "aws.eks_audit" and (
aws.eks.audit.user.username in ("system:anonymous", "system:unauthenticated") or
aws.eks.audit.impersonatedUser.username in ("system:anonymous", "system:unauthenticated") or
aws.eks.audit.user.username == null or
aws.eks.audit.user.username == ""
) and aws.eks.audit.level in ("RequestResponse", "ResponseComplete", "Request") and aws.eks.audit.verb in ("create", "update", "patch") and
aws.eks.audit.objectRef.resource == "pods"
Implementation guide
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.
Analyst notes
Investigating AWS EKS Anonymous User Create/Update/Patch Pods Request
This rule fires when the EKS API server records a create, update, or patch request against the pods resource
from the anonymous identity (system:anonymous or the system:unauthenticated group), directly or through
impersonation. Anonymous access to the Kubernetes API is disabled by default on EKS, and the anonymous identity should
never be able to write workloads. A matching event indicates either a misconfigured RoleBinding or ClusterRoleBinding
that grants pod write access to anonymous callers, or an attacker exploiting such a binding to run a container in the
cluster.
Possible investigation steps
- Review
aws.eks.audit.annotations.authorization_k8s_io/decisionandaws.eks.audit.responseStatus.codeto determine whether the request was allowed or forbidden. An allowed request is a confirmed exposure. - Inspect
aws.eks.audit.requestObject.specfor the pod definition: image, command, privileged settings, host namespaces, hostPath volumes, and the service account the pod would run as. - Identify the client from
source.ip,aws.eks.audit.sourceIPs, anduser_agent.original, and check whether the address is inside the VPC or external. - Search the audit log for other anonymous activity from the same source around the alert, such as discovery requests, secret reads, or exec into the created pod.
- Review RoleBindings and ClusterRoleBindings that reference
system:anonymousorsystem:unauthenticatedto find the binding that permitted the request, and check the cluster endpoint access configuration.
False positive analysis
- Security scanners or penetration tests that probe anonymous access may generate forbidden requests. Confirm the source and schedule, and scope the rule or an exception to the testing window and source addresses.
Response and remediation
- If the request was allowed, treat the cluster as compromised: delete or quarantine the created or modified pod, capture its image and spec for analysis, and review what it accessed.
- Remove any binding that grants write permissions to
system:anonymousorsystem:unauthenticated, and restrict the cluster endpoint to private access or an allowlist of CIDR ranges. - Rotate secrets and service account tokens reachable from the affected namespace, and review node and IAM activity for follow-on access.