Detection rules › Elastic
Script DNS Query to Managed Kubernetes Cluster
Identifies a scripting interpreter or download utility followed within one minute by a DNS lookup of a managed Kubernetes cluster API hostname (AWS EKS, Azure AKS, Google GKE, or Vultr Kubernetes). Adversaries and post-exploitation tooling may use shells, download utilities, or language runtimes to reach cluster control planes after harvesting kubeconfig credentials or service account tokens.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Discovery | |
| Command & Control |
Rule body
[rule]
description = """
Identifies a scripting interpreter or download utility followed within one minute by a DNS lookup of a managed
Kubernetes cluster API hostname (AWS EKS, Azure AKS, Google GKE, or Vultr Kubernetes). Adversaries and post-exploitation
tooling may use shells, download utilities, or language runtimes to reach cluster control planes after harvesting
kubeconfig credentials or service account tokens.
"""
id = "37249ca9-0e71-413f-899b-ae60b1599e34"
license = "Elastic License v2"
name = "Script DNS Query to Managed Kubernetes Cluster"
os_list = ["linux"]
version = "1.0.1"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.type == "start" and event.action == "exec" and (
process.name in (
"fish", "zsh", "bash", "dash", "sh", "tcsh", "csh", "ksh", "curl", "wget", "node", "bun", "deno", "pwsh",
"busybox", "timeout", "env", "java"
) or
process.name like ("python*", "perl*", "php*", "ruby*", "lua*")
)
and not (process.name in ("fish", "zsh", "bash", "dash", "sh", "tcsh", "csh", "ksh") and process.args like ("*kubectl*", "*/shims/k9s"))
]
[dns where dns.question.name like~ ("*eks.amazonaws.com", "*.azmk8s.io", "*.gke.goog", "*.vultr-k8s.com")]
'''
min_endpoint_version = "9.3.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1613"
name = "Container and Resource Discovery"
reference = "https://attack.mitre.org/techniques/T1613/"
[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.004"
name = "DNS"
reference = "https://attack.mitre.org/techniques/T1071/004/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "9.3.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and (
process.name in (
"fish", "zsh", "bash", "dash", "sh", "tcsh", "csh", "ksh", "curl", "wget", "node", "bun", "deno", "pwsh",
"busybox", "timeout", "env", "java"
) or
process.name like ("python*", "perl*", "php*", "ruby*", "lua*")
)
and not (process.name in ("fish", "zsh", "bash", "dash", "sh", "tcsh", "csh", "ksh") and process.args like ("*kubectl*", "*/shims/k9s"))
]
Stage 2: dns
[dns where dns.question.name like~ ("*eks.amazonaws.com", "*.azmk8s.io", "*.gke.goog", "*.vultr-k8s.com")]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | *kubectl*, */shims/k9s | excludes:process.args field:"process.args" value:"*kubectl*" field:"process.args" value:"*/shims/k9s" |
process.name | in | bash, csh, dash, fish, ksh, sh, tcsh, zsh | excludes:process.name |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard |
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_name" kind:in |
process.name | wildcard |
| field:"process_name" kind:wildcard |