T1552.005

Cloud Instance Metadata API

Adversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data. Most cloud providers host a metadata API at http://169.254.169.254 (AWS, Azure, GCP, DigitalOcean) or http://fd00:ec2::254 (AWS IPv6). This internal endpoint provides running instances with credentials including temporary IAM role credentials (AWS), managed identity tokens (Azure), and service account tokens (GCP). Adversaries with code execution on a VM can query this endpoint directly, or exploit Server-Side Request Forgery (SSRF) vulnerabilities in public-facing applications to retrieve cloud credentials from external networks. TeamTNT, Peirates, and Hildegard have all exploited this API. The Capital One breach involved SSRF to the metadata API.

Microsoft Sentinel / Defender
kusto
// Detect Cloud Instance Metadata API access
let MetadataEndpoints = dynamic(["169.254.169.254", "fd00:ec2::254", "metadata.google.internal"]);
// Pattern 1: Network connections to metadata API IP
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteIP in (MetadataEndpoints) or RemoteUrl has "169.254.169.254"
| where InitiatingProcessFileName !in~ ("AzureGuestAgent.exe", "WindowsAzureGuestAgent.exe",
                                         "WaAppAgent.exe", "aws-cfn-bootstrap", "cloud-init",
                                         "amazon-ssm-agent", "google_guest_agent")
| project Timestamp, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine,
         RemoteIP, RemotePort, RemoteUrl
| union (
    // Pattern 2: Process command lines querying metadata API
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where ProcessCommandLine has_any (
        "169.254.169.254",
        "metadata/instance", "metadata/v1", "meta-data",
        "latest/meta-data", "latest/dynamic",
        "instance-identity", "iam/security-credentials",
        "computeMetadata", "metadata.google.internal",
        "imds.azure.com"
      )
    | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName
)
| sort by Timestamp desc
high severity high confidence

Data Sources

Network Traffic: Network Connection Creation Process: Process Creation Command: Command Execution

Required Tables

DeviceNetworkEvents DeviceProcessEvents

False Positives

  • Cloud agent software legitimately querying instance metadata (AWS SSM Agent, Azure Guest Agent, Google Guest Agent)
  • Application frameworks that read instance metadata to determine their cloud environment (AWS SDK, Azure SDK, GCP client libraries)
  • Container orchestration tools (Kubernetes node agents, Docker) querying instance metadata for configuration
  • Cloud monitoring agents (CloudWatch, Azure Monitor, Stackdriver) that collect instance metadata as part of telemetry
  • Instance initialization scripts (cloud-init, UserData scripts) that query metadata during VM startup

Unlock Pro Content

Get the full detection package for T1552.005 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections