Endpoint Discovery Commands Followed by IMDS Requests
Detects a process that spawns multiple distinct host, user or network discovery utilities and within a short time window, accesses the cloud instance metadata service (IMDS), either directly or through a child process. Network requests to additional metadata endpoints, respective of the provider also meet this criteria.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/10/23"
3integration = ["endpoint"]
4maturity = "production"
5min_stack_comments = "MV_CONTAINS was added to ES|QL in 9.2.0 and is not available on 8.19; 9.4.0 is the lowest supported 9.x release."
6min_stack_version = "9.4.0"
7updated_date = "2026/11/18"
8
9[rule]
10author = ["Elastic"]
11description = """
12Detects a process that spawns multiple distinct host, user or network discovery utilities and within a short time
13window, accesses the cloud instance metadata service (IMDS), either directly or through a child
14process. Network requests to additional metadata endpoints, respective of the provider also meet this criteria.
15"""
16false_positives = [
17 """
18 Cloud bootstrap tooling, guest agents, configuration management and monitoring agents may run discovery commands
19 and query the instance metadata service from the same parent process. Validate the parent executable and command
20 line and exclude approved automation.
21 """,
22]
23from = "now-6m"
24interval = "5m"
25language = "esql"
26license = "Elastic License v2"
27name = "Endpoint Discovery Commands Followed by IMDS Requests"
28note = """## Triage and analysis
29
30> **Disclaimer**:
31> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
32
33
34### Investigating Endpoint Discovery Commands Followed by IMDS Requests
35
36Each result groups the activity of a single parent process on a host: the discovery commands it spawned
37(`Esql.recon_command_values`) and the connections to the instance metadata service made by the process itself or by
38one of its children. The correlation key is stored in `Esql.correlation_id`.
39
40### Possible investigation steps
41
42- Review `Esql.process_parent_executable_values` and `Esql.process_parent_command_line_values` to identify the process
43 that drove the activity and determine whether it is an interactive shell, a script interpreter, a web application, or
44 approved automation.
45- Inspect `Esql.process_command_line_values` for the exact discovery commands and any metadata request paths such as
46 `/latest/meta-data/iam/security-credentials/` (AWS), `/metadata/identity/oauth2/token` (Azure), or
47 `/computeMetadata/v1/instance/service-accounts/` (GCP).
48- Identify the user in `Esql.user_name_values` and the session context, and check whether the activity followed a
49 remote login, an exploit, or the execution of a newly dropped file.
50- Correlate the host and time window with cloud control-plane logs to determine whether instance role credentials or
51 managed identity tokens were subsequently used from this host or from an external IP address.
52- Look for follow-on behavior such as cloud CLI or SDK usage, credential staging to disk, or outbound connections to
53 unfamiliar destinations.
54
55### False positive analysis
56
57- Cloud-init, cloud guest agents, configuration management tools (Puppet, Chef, Salt, Ansible), MDM agents, and
58 monitoring agents can legitimately run discovery utilities and query the metadata service. Confirm the parent
59 executable path and exclude approved tooling by path or command line.
60- In-house bootstrap or service startup scripts may collect host details and read instance metadata. Validate the script
61 location, owner, and execution schedule.
62
63### Response and remediation
64
65- Isolate the affected instance or host and terminate the offending process tree.
66- Revoke or rotate any instance role credentials, managed identity tokens, or secrets that may have been retrieved from
67 the metadata service, and review the permissions attached to the instance role.
68- Remove any dropped scripts, binaries, or persistence mechanisms associated with the activity.
69- Enforce IMDSv2 or the strongest metadata protections offered by the cloud provider and restrict metadata access to
70 the processes that require it.
71"""
72references = [
73 "https://docs.litellm.ai/blog/security-incident-oct-21-2026",
74]
75risk_score = 47
76rule_id = "ee9f9ede-3537-47aa-a94a-206690cd5037"
77severity = "medium"
78tags = [
79 "Domain: Endpoint",
80 "OS: Linux",
81 "OS: macOS",
82 "Use Case: Threat Detection",
83 "Tactic: Discovery",
84 "Tactic: Credential Access",
85 "Threat: Supply Chain",
86 "Threat: IMDS Credential Theft",
87 "Data Source: Elastic Defend",
88 "Resources: Investigation Guide",
89 "Rule Type: ES|QL",
90 "Platform: Linux",
91 "Platform: macOS",
92]
93timestamp_override = "event.ingested"
94type = "esql"
95query = '''
96FROM logs-endpoint.events.process-*, logs-endpoint.events.network-*
97| WHERE host.os.type IN ("linux", "macos")
98| WHERE
99 (
100 MV_CONTAINS(event.action, "exec")
101 AND
102 process.name.caseless IN (
103 // Linux
104 "ip", "ss", "hostnamectl", "uptime", "uname", "whoami", "id", "hostname",
105 "netstat", "arp", "ifconfig", "route", "w", "who",
106 "last", "getent", "dmidecode",
107 // macOS
108 "sw_vers", "system_profiler", "scutil", "networksetup", "ioreg",
109 "sysctl", "dscl", "dscacheutil", "csrutil", "spctl", "users", "groups"
110 )
111 )
112 OR destination.ip IN ("169.254.169.254", "169.254.170.2", "169.254.170.23", "100.100.100.200", "168.63.129.16")
113| WHERE process.parent.executable IS NULL OR NOT (
114 process.parent.executable LIKE "/Library/Application Support/JAMF/*" OR
115 process.parent.executable LIKE "/usr/local/jamf/*" OR
116 process.parent.executable LIKE "/opt/puppetlabs/*" OR
117 process.parent.executable LIKE "/opt/chef/*" OR
118 process.parent.executable LIKE "/usr/lib/google-cloud-sdk/*" OR
119 process.parent.executable LIKE "/Applications/Docker.app/Contents/MacOS/*"
120 )
121| EVAL
122 is_recon = process.name.caseless IN (
123 "ip", "ss", "hostnamectl", "uptime", "uname", "whoami", "id", "hostname",
124 "netstat", "arp", "ifconfig", "route", "w", "who",
125 "last", "getent", "dmidecode",
126 "sw_vers", "system_profiler", "scutil", "networksetup", "ioreg",
127 "sysctl", "dscl", "dscacheutil", "csrutil", "spctl", "users", "groups"
128 ) AND MV_CONTAINS(event.category, "process"),
129 is_metadata = destination.ip IN ("169.254.169.254", "169.254.170.2", "169.254.170.23", "100.100.100.200", "168.63.129.16")
130// recon events correlate on their parent, metadata events on both themselves and their parent
131| EVAL
132 Esql.correlation_id = CASE(
133 is_recon,
134 process.parent.entity_id,
135 MV_APPEND(process.entity_id, process.parent.entity_id)
136 ),
137 recon_command = CASE(is_recon, process.name.caseless, null),
138 metadata_access = CASE(is_metadata, 1, 0)
139| MV_EXPAND Esql.correlation_id
140| WHERE Esql.correlation_id IS NOT NULL
141| STATS
142 Esql.host_name_values = VALUES(host.name),
143 Esql.host_ip_values = VALUES(host.ip),
144 Esql.process_name_values = VALUES(process.name),
145 Esql.process_command_line_values = VALUES(process.command_line),
146 Esql.process_executable_values = VALUES(process.executable),
147 Esql.process_entity_id_values = VALUES(process.entity_id),
148 Esql.process_parent_entity_id_values = VALUES(process.parent.entity_id),
149 Esql.process_parent_name_values = VALUES(process.parent.name),
150 Esql.process_parent_executable_values = VALUES(process.parent.executable),
151 Esql.process_parent_command_line_values = VALUES(process.parent.command_line),
152 Esql.user_name_values = VALUES(user.name),
153 Esql.destination_ip_values = VALUES(destination.ip),
154 Esql.destination_port_values = VALUES(destination.port),
155 Esql.network_transport_values = VALUES(network.transport),
156 Esql.recon_command_values = VALUES(recon_command),
157 Esql.recon_command_count_distinct = COUNT_DISTINCT(recon_command),
158 Esql.metadata_access_count = SUM(metadata_access),
159 Esql.first_seen = MIN(@timestamp),
160 Esql.last_seen = MAX(@timestamp)
161 BY host.id, Esql.correlation_id
162| WHERE Esql.recon_command_count_distinct >= 3
163 AND Esql.metadata_access_count > 0
164 AND DATE_DIFF("seconds", Esql.first_seen, Esql.last_seen) <= 10
165| KEEP host.id, Esql.*
166'''
167
168[[rule.threat]]
169framework = "MITRE ATT&CK"
170
171[[rule.threat.technique]]
172id = "T1016"
173name = "System Network Configuration Discovery"
174reference = "https://attack.mitre.org/techniques/T1016/"
175
176[[rule.threat.technique]]
177id = "T1033"
178name = "System Owner/User Discovery"
179reference = "https://attack.mitre.org/techniques/T1033/"
180
181[[rule.threat.technique]]
182id = "T1082"
183name = "System Information Discovery"
184reference = "https://attack.mitre.org/techniques/T1082/"
185
186[rule.threat.tactic]
187id = "TA0007"
188name = "Discovery"
189reference = "https://attack.mitre.org/tactics/TA0007/"
190
191[[rule.threat]]
192framework = "MITRE ATT&CK"
193
194[[rule.threat.technique]]
195id = "T1552"
196name = "Unsecured Credentials"
197reference = "https://attack.mitre.org/techniques/T1552/"
198
199[[rule.threat.technique.subtechnique]]
200id = "T1552.005"
201name = "Cloud Instance Metadata API"
202reference = "https://attack.mitre.org/techniques/T1552/005/"
203
204[rule.threat.tactic]
205id = "TA0006"
206name = "Credential Access"
207reference = "https://attack.mitre.org/tactics/TA0006/"
Triage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating Endpoint Discovery Commands Followed by IMDS Requests
Each result groups the activity of a single parent process on a host: the discovery commands it spawned
(Esql.recon_command_values) and the connections to the instance metadata service made by the process itself or by
one of its children. The correlation key is stored in Esql.correlation_id.
Possible investigation steps
- Review
Esql.process_parent_executable_valuesandEsql.process_parent_command_line_valuesto identify the process that drove the activity and determine whether it is an interactive shell, a script interpreter, a web application, or approved automation. - Inspect
Esql.process_command_line_valuesfor the exact discovery commands and any metadata request paths such as/latest/meta-data/iam/security-credentials/(AWS),/metadata/identity/oauth2/token(Azure), or/computeMetadata/v1/instance/service-accounts/(GCP). - Identify the user in
Esql.user_name_valuesand the session context, and check whether the activity followed a remote login, an exploit, or the execution of a newly dropped file. - Correlate the host and time window with cloud control-plane logs to determine whether instance role credentials or managed identity tokens were subsequently used from this host or from an external IP address.
- Look for follow-on behavior such as cloud CLI or SDK usage, credential staging to disk, or outbound connections to unfamiliar destinations.
False positive analysis
- Cloud-init, cloud guest agents, configuration management tools (Puppet, Chef, Salt, Ansible), MDM agents, and monitoring agents can legitimately run discovery utilities and query the metadata service. Confirm the parent executable path and exclude approved tooling by path or command line.
- In-house bootstrap or service startup scripts may collect host details and read instance metadata. Validate the script location, owner, and execution schedule.
Response and remediation
- Isolate the affected instance or host and terminate the offending process tree.
- Revoke or rotate any instance role credentials, managed identity tokens, or secrets that may have been retrieved from the metadata service, and review the permissions attached to the instance role.
- Remove any dropped scripts, binaries, or persistence mechanisms associated with the activity.
- Enforce IMDSv2 or the strongest metadata protections offered by the cloud provider and restrict metadata access to the processes that require it.
References
Related rules
- Potential Credential Discovery via Recursive Grep
- Multi-Cloud CLI Token and Credential Access Commands
- Suspicious Instance Metadata Service (IMDS) API Request
- Curl Download Activity from npm Package Install
- Kubectl Secrets Enumeration Across All Namespaces