Cloud Instance Metadata API

Adversaries may attempt to access the Cloud Instance Metadata API to collect credentials and other sensitive data.

Most cloud service providers support a Cloud Instance Metadata API which is a service provided to running virtual instances that allows applications to access information about the running virtual instance. Available information generally includes name, security group, and additional metadata including sensitive data such as credentials and UserData scripts that may contain additional secrets. The Instance Metadata API is provided as a convenience to assist in managing applications and is accessible by anyone who can access the instance.[1]

If adversaries have a presence on the running virtual instance, they may query the Instance Metadata API directly to identify credentials that grant access to additional resources. Additionally, attackers may exploit a Server-Side Request Forgery (SSRF) vulnerability in a public facing web proxy that allows the attacker to gain access to the sensitive information via a request to the Instance Metadata API.[2]

The de facto standard across cloud service providers is to host the Instance Metadata API at http[:]//169.254.169.254.

ID: T1522
Tactic: Credential Access
Platform: AWS, GCP, Azure
Permissions Required: User
Data Sources: Azure activity logs, AWS CloudTrail logs, Authentication logs
Contributors: Praetorian
Version: 1.0

Mitigations

Mitigation Description
Filter Network Traffic

Limit access to the Instance Metadata API using a host-based firewall such as iptables. A properly configured Web Application Firewall (WAF) may help prevent external adversaries from exploiting Server-side Request Forgery (SSRF) attacks that allow access to the Cloud Instance Metadata API.[2]

Detection

  • Monitor access to the Instance Metadata API and look for anomalous queries.
  • It may be possible to detect adversary use of credentials they have obtained. See Valid Accounts for more information.

References