Azure AKS Attempted User Exec into Pod
Detects an AKS (Azure Kubernetes Service) identity establishing an exec session into a pod. Interactive command execution inside a workload via kubectl exec is a common post-compromise technique used to access secrets, run tooling, and expand access from a foothold container. Node, control-plane, and kube-system service account identities are excluded, so workload service accounts and users, the identities an adversary is most likely to abuse, remain in scope.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/07/09"
3integration = ["azure"]
4maturity = "production"
5updated_date = "2026/07/09"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects an AKS (Azure Kubernetes Service) identity establishing an exec session into a pod. Interactive command
11execution inside a workload via kubectl exec is a common post-compromise technique used to access secrets, run tooling,
12and expand access from a foothold container. Node, control-plane, and kube-system service account identities are
13excluded, so workload service accounts and users, the identities an adversary is most likely to abuse, remain in scope.
14"""
15false_positives = [
16 """
17 Administrators routinely exec into pods for troubleshooting. Baseline expected users and target pods, then exclude
18 known break-glass or operator identities after review.
19 """,
20]
21from = "now-9m"
22index = ["logs-azure.platformlogs-*"]
23language = "kuery"
24license = "Elastic License v2"
25name = "Azure AKS Attempted User Exec into Pod"
26note = """## Triage and analysis
27
28### Investigating Azure AKS Attempted User Exec into Pod
29
30AKS kube-audit events are carried under the flattened `azure.platformlogs.properties.log.*` subtree and share the ARM
31operation `event.action: Microsoft.ContainerService/managedClusters/diagnosticLogs/Read`. This rule alerts on a
32`pods/exec` request by an identity that is not node, control-plane, or kube-system infrastructure. Exec into a pod grants
33an interactive shell inside the workload, which adversaries use to read mounted secrets, pivot, and stage tooling.
34
35### Possible investigation steps
36
37- Review the acting identity in `azure.platformlogs.properties.log.user.username` and its groups in
38 `azure.platformlogs.properties.log.user.groups`, and the target pod in
39 `azure.platformlogs.properties.log.objectRef.name` / `azure.platformlogs.properties.log.objectRef.namespace`.
40- Determine whether the target pod holds sensitive data, cluster credentials, or a mounted service account token.
41- Inspect the exec request path and command context in `azure.platformlogs.properties.log.requestURI` and the client in
42 `azure.platformlogs.properties.log.userAgent` (interactive `kubectl` vs a scripted client).
43- Evaluate the source in `azure.platformlogs.properties.log.sourceIPs`. Pivot on it for related API activity, secret
44 reads, or RBAC changes from the same identity.
45
46### False positive analysis
47
48- Approved admin debugging; exclude stable operator or break-glass identities after review.
49- CI/CD or platform tooling that execs into workloads may match; exclude verified service accounts and namespaces.
50
51### Response and remediation
52
53- If unauthorized, revoke the identity's tokens and kubeconfig and terminate the exec session.
54- Inspect the target pod for tampering, dropped tooling, or accessed secrets, and rotate any credentials it exposed.
55- Collect kube-audit and identity artifacts per incident response procedures.
56"""
57references = [
58 "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/",
59 "https://microsoft.github.io/Threat-Matrix-for-Kubernetes/",
60 "https://unit42.paloaltonetworks.com/hildegard-malware-teamtnt/",
61]
62risk_score = 47
63rule_id = "8f131efa-0284-465f-a360-da23e5562dd1"
64setup = "The Azure Fleet integration collecting AKS diagnostic logs with the `kube-audit` category forwarded through Event Hub into the `azure.platformlogs` data stream is required for this rule."
65severity = "medium"
66tags = [
67 "Domain: Cloud",
68 "Domain: Kubernetes",
69 "Data Source: Azure",
70 "Data Source: Azure Platform Logs",
71 "Data Source: Kubernetes",
72 "Use Case: Threat Detection",
73 "Tactic: Execution",
74 "Resources: Investigation Guide",
75]
76timestamp_override = "event.ingested"
77type = "query"
78
79query = '''
80data_stream.dataset:azure.platformlogs and
81 event.action:"Microsoft.ContainerService/managedClusters/diagnosticLogs/Read" and
82 azure.platformlogs.category:"kube-audit" and
83 azure.platformlogs.properties.log.objectRef.resource:"pods" and azure.platformlogs.properties.log.objectRef.subresource:"exec" and
84 azure.platformlogs.properties.log.verb:("create" or "get") and
85 not azure.platformlogs.properties.log.user.username:(
86 system\:node\:* or "aksService" or "hcpService" or "readinessChecker" or
87 system\:serviceaccount\:kube-system\:*
88 )
89'''
90
91
92[[rule.threat]]
93framework = "MITRE ATT&CK"
94[[rule.threat.technique]]
95id = "T1609"
96name = "Container Administration Command"
97reference = "https://attack.mitre.org/techniques/T1609/"
98
99
100[rule.threat.tactic]
101id = "TA0002"
102name = "Execution"
103reference = "https://attack.mitre.org/tactics/TA0002/"
104
105[rule.investigation_fields]
106field_names = [
107 "@timestamp",
108 "event.action",
109 "azure.platformlogs.category",
110 "azure.platformlogs.properties.log.verb",
111 "azure.platformlogs.properties.log.user.username",
112 "azure.platformlogs.properties.log.sourceIPs",
113 "azure.platformlogs.properties.log.objectRef.resource",
114 "azure.platformlogs.properties.log.objectRef.subresource",
115 "azure.platformlogs.properties.log.objectRef.namespace",
116 "azure.platformlogs.properties.log.objectRef.name"
117]
Triage and analysis
Investigating Azure AKS Attempted User Exec into Pod
AKS kube-audit events are carried under the flattened azure.platformlogs.properties.log.* subtree and share the ARM
operation event.action: Microsoft.ContainerService/managedClusters/diagnosticLogs/Read. This rule alerts on a
pods/exec request by an identity that is not node, control-plane, or kube-system infrastructure. Exec into a pod grants
an interactive shell inside the workload, which adversaries use to read mounted secrets, pivot, and stage tooling.
Possible investigation steps
- Review the acting identity in
azure.platformlogs.properties.log.user.usernameand its groups inazure.platformlogs.properties.log.user.groups, and the target pod inazure.platformlogs.properties.log.objectRef.name/azure.platformlogs.properties.log.objectRef.namespace. - Determine whether the target pod holds sensitive data, cluster credentials, or a mounted service account token.
- Inspect the exec request path and command context in
azure.platformlogs.properties.log.requestURIand the client inazure.platformlogs.properties.log.userAgent(interactivekubectlvs a scripted client). - Evaluate the source in
azure.platformlogs.properties.log.sourceIPs. Pivot on it for related API activity, secret reads, or RBAC changes from the same identity.
False positive analysis
- Approved admin debugging; exclude stable operator or break-glass identities after review.
- CI/CD or platform tooling that execs into workloads may match; exclude verified service accounts and namespaces.
Response and remediation
- If unauthorized, revoke the identity's tokens and kubeconfig and terminate the exec session.
- Inspect the target pod for tampering, dropped tooling, or accessed secrets, and rotate any credentials it exposed.
- Collect kube-audit and identity artifacts per incident response procedures.
References
Related rules
- Azure AKS API Server Proxying Request to Kubelet
- Azure AKS Kubelet Proxy to Command Execution Endpoint
- Kubernetes Pod Exec Cloud Instance Metadata Access
- GKE Pod Exec Cloud Instance Metadata Access
- GKE Pod Exec Potential Reverse Shell