Suspicious Instance Metadata Service (IMDS) API Command Line Execution

Last updated 24 days ago on 2026-05-22
Created 2 years ago on 2024-08-22

About

This rule identifies various tools/scripts performing command line execution attempting to access the cloud service provider's instance metadata service (IMDS) API endpoint, which can be used to retrieve sensitive instance-specific information such as instance ID, public IP address, and even temporary security credentials if roles are assumed by that instance.
Tags
Domain: EndpointDomain: CloudOS: LinuxOS: WindowsOS: macOSUse Case: Threat DetectionTactic: Credential AccessData Source: Elastic EndgameData Source: Elastic DefendData Source: Windows Security Event LogsData Source: Microsoft Defender XDRData Source: SysmonData Source: SentinelOneData Source: CrowdstrikeData Source: Auditd ManagerLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Credential Access (TA0006)(external, opens in a new tab or window)

Discovery (TA0007)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
endgame-*logs-crowdstrike.fdr*logs-endpoint.events.process-*logs-m365_defender.event-*logs-sentinel_one_cloud_funnel.*logs-system.security*logs-windows.forwarded*logs-windows.sysmon_operational-*winlogbeat-*auditbeat-*logs-auditd_manager.auditd-*
Related Integrations

endpoint(external, opens in a new tab or window)

windows(external, opens in a new tab or window)

system(external, opens in a new tab or window)

m365_defender(external, opens in a new tab or window)

sentinel_one_cloud_funnel(external, opens in a new tab or window)

crowdstrike(external, opens in a new tab or window)

auditd_manager(external, opens in a new tab or window)

Query
text code block:
process where host.os.type in ("linux", "macos", "windows") and event.type == "start" and event.action like ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started", "Process Create*") and ( process.name in~ ( "curl", "curl.exe", "wget", "wget.exe", "bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish", "mksh", "busybox", "powershell.exe", "cmd.exe", "pwsh.exe", "pwsh" ) or process.name like~ (".*", "python*", "perl*", "ruby*", "php*", "lua*", "java*") or ?process.executable like~ ( "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/home/*/*", "/var/run/*", "/run/*", "/boot/*", "/.*", "C:\\Users\\*", "?:\\ProgramData\\*", "/var/www/*", "./*" ) ) and process.args like~ ( "*/latest/meta-data/iam/security-credentials/?*", "*computeMetadata/v1/instance/service-accounts/*/oauth2/access_token*", "*/metadata/identity/oauth2/token*resource=*" )

Install detection rules in Elastic Security

Detect Suspicious Instance Metadata Service (IMDS) API Command Line Execution in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).