Kubernetes Secret or ConfigMap Access via Azure Arc Proxy

Detects when secrets or configmaps are accessed, created, modified, or deleted in a Kubernetes cluster by the Azure Arc AAD proxy service account. When operations are routed through the Azure Arc Cluster Connect proxy, the Kubernetes audit log records the acting user as system:serviceaccount:azure-arc:azure-arc-kube-aad-proxy-sa with the actual caller identity in the impersonatedUser field. This pattern indicates that someone is accessing the cluster through the Azure ARM API rather than directly via kubectl against the API server. While legitimate for Arc-managed workflows, adversaries with stolen service principal credentials can abuse Arc Cluster Connect to read, exfiltrate, or modify secrets and configmaps while appearing as the Arc proxy service account in K8s audit logs. This rule uses a 5-day new-terms history window keyed on the impersonated identity and alerts the first time that Azure AD principal performs this activity.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/03/10"
  3integration = ["kubernetes"]
  4maturity = "production"
  5updated_date = "2026/08/18"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects when secrets or configmaps are accessed, created, modified, or deleted in a Kubernetes cluster by the Azure Arc
 11AAD proxy service account. When operations are routed through the Azure Arc Cluster Connect proxy, the Kubernetes audit
 12log records the acting user as system:serviceaccount:azure-arc:azure-arc-kube-aad-proxy-sa with the actual caller
 13identity in the impersonatedUser field. This pattern indicates that someone is accessing the cluster through the Azure
 14ARM API rather than directly via kubectl against the API server. While legitimate for Arc-managed workflows, adversaries
 15with stolen service principal credentials can abuse Arc Cluster Connect to read, exfiltrate, or modify secrets and
 16configmaps while appearing as the Arc proxy service account in K8s audit logs. This rule uses a 5-day new-terms history
 17window keyed on the impersonated identity and alerts the first time that Azure AD principal performs this activity.
 18"""
 19false_positives = [
 20    """
 21    Azure Arc system components may create or update secrets and configmaps in the azure-arc and azure-arc-release
 22    namespaces during normal cluster management. Filter by namespace to exclude these.
 23    """,
 24    """
 25    Helm operations managed through Arc may create release secrets (prefixed with sh.helm.release.v1). These are normal
 26    Arc lifecycle operations.
 27    """,
 28]
 29from = "now-5d"
 30interval = "9m"
 31language = "esql"
 32license = "Elastic License v2"
 33name = "Kubernetes Secret or ConfigMap Access via Azure Arc Proxy"
 34note = """## Triage and analysis
 35
 36### Investigating Kubernetes Secret or ConfigMap Access via Azure Arc Proxy
 37
 38When Kubernetes operations are performed through Azure Arc Cluster Connect, the K8s audit log shows the Arc AAD proxy
 39service account as the authenticated user, with the actual Azure AD identity in the `impersonatedUser` field. This
 40rule detects non-system secret and configmap access — including reads, writes, and deletions — routed through this
 41proxy path. Read operations (`get`, `list`) are particularly important to detect as they represent the most common
 42adversary action: exfiltrating secrets without leaving obvious modification traces.
 43
 44This rule uses a new terms approach keyed on `kubernetes.audit.impersonatedUser.username`, so it fires the first time a
 45given impersonated identity performs this activity within the 5-day history window.
 46
 47### Possible investigation steps
 48
 49- Check the `kubernetes.audit.impersonatedUser.username` field — this contains the Azure AD object ID of the actual
 50  caller. Cross-reference with Azure AD to identify the service principal or user.
 51- Review the `kubernetes.audit.impersonatedUser.extra.oid` field for the Azure AD object ID.
 52- Examine the namespace — operations in `default` or application namespaces are more suspicious than `azure-arc` or
 53  `kube-system`.
 54- Check the `kubernetes.audit.objectRef.name` — look for suspicious secret/configmap names that don't match known
 55  application resources.
 56- Correlate with Azure Activity Logs for the same time window to find the `LISTCLUSTERUSERCREDENTIAL` operation that
 57  initiated the Arc proxy session.
 58- Review Azure Sign-In Logs for the impersonated identity's authentication source IP and geolocation.
 59
 60### Response and remediation
 61
 62- If the impersonated identity is not recognized, revoke its Azure AD credentials immediately.
 63- Remove the ClusterRoleBinding or RoleBinding that grants the identity access to secrets/configmaps.
 64- Rotate any Kubernetes secrets that may have been read or exfiltrated.
 65- Review the Arc connection and consider disconnecting it if compromised.
 66"""
 67references = [
 68    "https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/cluster-connect",
 69    "https://microsoft.github.io/Threat-Matrix-for-Kubernetes/",
 70    "https://www.ibm.com/think/x-force/identifying-abusing-azure-arc-for-hybrid-escalation-persistence",
 71    "https://cloud.google.com/blog/topics/threat-intelligence/escalating-privileges-azure-kubernetes-services",
 72    "https://www.wiz.io/blog/lateral-movement-risks-in-the-cloud-and-how-to-prevent-them-part-3-from-compromis",
 73]
 74risk_score = 47
 75rule_id = "220d92c6-479d-4a49-9cc0-3a29756dad0c"
 76severity = "medium"
 77tags = [
 78    "Data Source: Kubernetes",
 79    "Data Source: Kubernetes API Server Audit Logs",
 80    "Domain: Kubernetes",
 81    "Platform: Kubernetes",
 82    "Domain: Cloud",
 83    "Use Case: Threat Detection",
 84    "Tactic: Credential Access",
 85    "Tactic: Collection",
 86    "Resources: Investigation Guide",
 87]
 88timestamp_override = "event.ingested"
 89type = "esql"
 90
 91query = '''
 92FROM logs-kubernetes.audit_logs-* metadata _id, _version, _index
 93| WHERE STARTS_WITH(kubernetes.audit.user.username, "system:serviceaccount:azure-arc:")
 94    AND kubernetes.audit.objectRef.resource IN ("secrets", "configmaps")
 95    AND kubernetes.audit.verb IN ("get", "list", "create", "update", "patch", "delete")
 96    AND kubernetes.audit.objectRef.namespace NOT IN ("azure-arc", "azure-arc-release", "kube-system")
 97    AND NOT STARTS_WITH(kubernetes.audit.objectRef.name, "sh.helm.release.v1")
 98
 99| STATS
100    Esql.verb_values = VALUES(kubernetes.audit.verb),
101    Esql.resource_type_values = VALUES(kubernetes.audit.objectRef.resource),
102    Esql.resource_name_values = VALUES(kubernetes.audit.objectRef.name),
103    Esql.namespace_values = VALUES(kubernetes.audit.objectRef.namespace),
104    Esql.data_stream_namespace_values = VALUES(data_stream.namespace),
105    Esql.acting_user_values = VALUES(kubernetes.audit.user.username),
106    Esql.user_agent_values = VALUES(kubernetes.audit.userAgent),
107    Esql.source_ips_values = VALUES(kubernetes.audit.sourceIPs),
108    Esql.response_code_values = VALUES(kubernetes.audit.responseStatus.code),
109    Esql.timestamp_first_seen = MIN(@timestamp),
110    Esql.timestamp_last_seen = MAX(@timestamp),
111    Esql.event_count = COUNT(*)
112    BY kubernetes.audit.impersonatedUser.username
113
114| WHERE Esql.timestamp_first_seen >= NOW() - 9 minutes
115| KEEP kubernetes.audit.impersonatedUser.username, Esql.*
116'''
117
118
119[[rule.threat]]
120framework = "MITRE ATT&CK"
121
122[[rule.threat.technique]]
123id = "T1552"
124name = "Unsecured Credentials"
125reference = "https://attack.mitre.org/techniques/T1552/"
126
127[[rule.threat.technique.subtechnique]]
128id = "T1552.007"
129name = "Container API"
130reference = "https://attack.mitre.org/techniques/T1552/007/"
131
132[rule.threat.tactic]
133id = "TA0006"
134name = "Credential Access"
135reference = "https://attack.mitre.org/tactics/TA0006/"
136
137[[rule.threat]]
138framework = "MITRE ATT&CK"
139
140[[rule.threat.technique]]
141id = "T1213"
142name = "Data from Information Repositories"
143reference = "https://attack.mitre.org/techniques/T1213/"
144
145[[rule.threat.technique]]
146id = "T1530"
147name = "Data from Cloud Storage"
148reference = "https://attack.mitre.org/techniques/T1530/"
149
150[rule.threat.tactic]
151id = "TA0009"
152name = "Collection"
153reference = "https://attack.mitre.org/tactics/TA0009/"
154
155[[rule.threat]]
156framework = "MITRE ATT&CK"
157
158[[rule.threat.technique]]
159id = "T1565"
160name = "Data Manipulation"
161reference = "https://attack.mitre.org/techniques/T1565/"
162
163[[rule.threat.technique.subtechnique]]
164id = "T1565.001"
165name = "Stored Data Manipulation"
166reference = "https://attack.mitre.org/techniques/T1565/001/"
167
168[rule.threat.tactic]
169id = "TA0040"
170name = "Impact"
171reference = "https://attack.mitre.org/tactics/TA0040/"

Triage and analysis

Investigating Kubernetes Secret or ConfigMap Access via Azure Arc Proxy

When Kubernetes operations are performed through Azure Arc Cluster Connect, the K8s audit log shows the Arc AAD proxy service account as the authenticated user, with the actual Azure AD identity in the impersonatedUser field. This rule detects non-system secret and configmap access — including reads, writes, and deletions — routed through this proxy path. Read operations (get, list) are particularly important to detect as they represent the most common adversary action: exfiltrating secrets without leaving obvious modification traces.

This rule uses a new terms approach keyed on kubernetes.audit.impersonatedUser.username, so it fires the first time a given impersonated identity performs this activity within the 5-day history window.

Possible investigation steps

  • Check the kubernetes.audit.impersonatedUser.username field — this contains the Azure AD object ID of the actual caller. Cross-reference with Azure AD to identify the service principal or user.
  • Review the kubernetes.audit.impersonatedUser.extra.oid field for the Azure AD object ID.
  • Examine the namespace — operations in default or application namespaces are more suspicious than azure-arc or kube-system.
  • Check the kubernetes.audit.objectRef.name — look for suspicious secret/configmap names that don't match known application resources.
  • Correlate with Azure Activity Logs for the same time window to find the LISTCLUSTERUSERCREDENTIAL operation that initiated the Arc proxy session.
  • Review Azure Sign-In Logs for the impersonated identity's authentication source IP and geolocation.

Response and remediation

  • If the impersonated identity is not recognized, revoke its Azure AD credentials immediately.
  • Remove the ClusterRoleBinding or RoleBinding that grants the identity access to secrets/configmaps.
  • Rotate any Kubernetes secrets that may have been read or exfiltrated.
  • Review the Arc connection and consider disconnecting it if compromised.

References

Related rules

to-top