Kubernetes Multi-Resource Discovery Reconnaissance
Adversaries may perform reconnaissance in a Kubernetes environment by rapidly querying multiple resource types to map the environment and identify potential privilege escalation paths.
After gaining initial access to a Kubernetes cluster, adversaries often conduct reconnaissance to understand the environment before further actions like exfiltration or privilege escalation. This involves mapping the cluster’s structure, identifying workloads, and understanding role-based access control (RBAC) configurations. This reconnaissance is achieved by rapidly querying various API resources, including namespaces, pods, roles, ClusterRoles, ConfigMaps, and ServiceAccounts. The activity is characterized by a burst of get and list requests across multiple resource types within a short timeframe, which is atypical for normal cluster operations and may indicate malicious probing or permission reconnaissance. This detection focuses on identifying such cross-resource bursts from a single client to distinguish reconnaissance activities from routine automation.
Attack Chain
- The attacker gains initial access to the Kubernetes cluster using compromised credentials or by exploiting a vulnerability. (T1190, T1566)
- The attacker authenticates to the Kubernetes API server using the compromised credentials or a valid service account token.
- The attacker begins enumerating namespaces to understand the logical divisions within the cluster using
kubectl get namespacesor equivalent API calls. (T1068) - The attacker queries pods within the discovered namespaces to identify running workloads and potential targets. (T1068)
- The attacker lists roles and cluster roles to understand the existing RBAC configurations and identify potential privilege escalation opportunities. (T1069)
- The attacker retrieves service accounts to identify applications and their associated permissions, potentially discovering more attack vectors.
- The attacker analyzes the collected information to identify vulnerable services, misconfigured permissions, or sensitive data.
- Based on the reconnaissance, the attacker proceeds with lateral movement, privilege escalation, data exfiltration, or other malicious objectives.
Impact
Successful reconnaissance allows attackers to gain a comprehensive understanding of the Kubernetes environment, facilitating further malicious activities such as lateral movement, privilege escalation, and data exfiltration. This can lead to the compromise of sensitive data, disruption of services, and unauthorized access to critical resources. The impact is magnified in clusters with weak RBAC policies or exposed sensitive information.
Recommendation
- Deploy the Sigma rule “Kubernetes Multi-Resource Discovery” to your SIEM and tune for your environment to detect reconnaissance activities.
- Investigate alerts generated by the Sigma rule by pivoting on
user.name,source.ip, anduser_agent.originalto determine the sequence of API calls. - Correlate the identified activity with RBAC configurations to identify potential violations of the principle of least privilege as described in the rule’s Triage and Analysis section.
- Baseline automation by allowlisting known service accounts or source networks that legitimately span multiple resource types in a short window, as described in the rule’s False Positive Analysis section.
- Review and tighten RBAC configurations to minimize the impact of compromised credentials as described in the Response and Remediation section.
Detection coverage 2
Kubernetes Multi-Resource Discovery
mediumDetects rapid enumeration of multiple Kubernetes resource types, indicating potential reconnaissance activity.
Kubernetes Discovery via Kubectl API Requests
mediumDetects suspicious discovery activity in Kubernetes by monitoring kubectl API requests for common discovery commands.
Detection queries are kept inside the platform. Get full rules →