Every major cloud runs an unauthenticated HTTP endpoint at 169.254.169.254 on each virtual machine that will hand a workload credential to any process able to send it the right request, and each provider protects that endpoint differently. Teams that run in more than one cloud often harden the AWS metadata service and assume the others are equivalent. They are not: header requirements, legacy versions, the ability to switch features off and the identity each endpoint issues all differ. This guide compares the Amazon EC2, Azure, Google Compute Engine and Oracle Cloud Infrastructure metadata services side by side, then sets out a common baseline, detection approach and rollout plan. It is for cloud security architects, platform engineers and detection teams working across providers. Provider facts were checked against official documentation and client libraries on 27 October 2026; the AWS detail lives in the EC2 Instance Metadata Service Hardening Guide.
Key takeaways
- All four services sit on the same link-local address and none requires the caller to authenticate; the protection is a request shape that a typical SSRF cannot produce.
- Headers are the main defence: AWS IMDSv2 needs a PUT-issued token, Azure needs
Metadata: true, Google needsMetadata-Flavor: Googleand OCI IMDSv2 needsAuthorization: Bearer Oracle. - AWS and OCI still ship a legacy, header-free version that you must turn off per instance or by policy; Google shut its legacy endpoints down in 2020; Azure has never offered one.
- The credential matters more than the endpoint: any process on the VM can obtain the instance role, managed identity, service account token or instance principal certificate, so scope those identities tightly.
- Containers change the threat model: pods reaching the node's metadata endpoint inherit the node identity unless you block them and use the platform's workload identity.
How identity and access work in cloud metadata services
The metadata service gives a VM information about itself (instance ID, network, tags, user data) and, more importantly, a credential for the identity attached to the VM. Cloud SDKs find that credential automatically. Because the endpoint is reachable from inside the instance without authentication, anything that can make the VM issue an HTTP request to it, such as a server-side request forgery bug, an open proxy or a compromised container, can obtain the credential. ATT&CK tracks this as T1552.005 Unsecured Credentials: Cloud Instance Metadata API. For the application-side flaw, see the SSRF Prevention Guide.
The four services compared
| Property | AWS EC2 IMDS | Azure IMDS | Google Compute Engine metadata server | OCI IMDS |
|---|---|---|---|---|
| Address | 169.254.169.254; IPv6 [fd00:ec2::254] on Nitro when enabled | 169.254.169.254, root /metadata | 169.254.169.254 or metadata.google.internal, root /computeMetadata/v1/ | 169.254.169.254, root /opc/v2/ |
| Protective requirement | IMDSv2: PUT to obtain a session token (1 to 21,600 seconds), then header X-aws-ec2-metadata-token | Header Metadata: true; api-version parameter mandatory | Header Metadata-Flavor: Google | IMDSv2: header Authorization: Bearer Oracle |
| Forwarded header handling | PUT requests with X-Forwarded-For rejected | Requests with X-Forwarded-For rejected | Confirm with the vendor | With v2 only, requests with Forwarded, X-Forwarded-For or X-Forwarded-Host rejected |
| Legacy header-free version | IMDSv1, enabled unless configured otherwise | Not applicable; the header is mandatory | v0.1 and v1beta1 endpoints shut down on 30 September 2020 | IMDSv1 (/opc/v1, /openstack) until legacy endpoints are disabled |
| Extra network control | PUT response hop limit, default 1 | Primary NIC only; proxies must be bypassed | Confirm with the vendor | Primary VNIC |
| Can it be switched off? | Yes, HttpEndpoint disabled | Restrict with local firewall rules; confirm with the vendor | Confirm with the vendor | Legacy endpoints can be disabled; v2 remains |
| Rate limits | 1,024 packets per second shared by link-local services | 5 requests per second; managed identity 20 per second and 5 concurrent | Confirm with the vendor | Throttled; no published figure |
The credential each one issues
| Provider | Identity | Where it comes from | Who on the VM can use it |
|---|---|---|---|
| AWS | IAM role via instance profile | Temporary STS credentials from the metadata service | Any process that can call IMDS |
| Azure | System or user-assigned managed identity | Entra ID access token from /metadata/identity/oauth2/token with a resource parameter (and client_id, object_id or msi_res_id when several user-assigned identities exist) | Microsoft states that any code on the VM can request tokens for any managed identity available on it |
| Google Cloud | Attached service account, limited by access scopes | OAuth access token from instance/service-accounts/<account>/token | Any process that can call the metadata server |
| OCI | Instance principal via dynamic group membership | Certificates delivered through the metadata service and rotated multiple times a day | Oracle states that certificates are readable by all users on the instance and anyone who can SSH in inherits its privileges |
The provider-specific identity guides go deeper on each: AWS STS and AssumeRole Guide, Azure Managed Identities Security Guide and Google Cloud IAM and Service Accounts Guide.
Admin roles and privileged access
A VM identity is a standing, non-human credential that every process and every user with a shell on the machine effectively holds. Treat the VM's attached identity as privileged when it can change infrastructure or read bulk data.
- Scope the attached identity to the workload: in the Capital One breach, SSRF in a firewall reached the AWS metadata service, and the firewall's role could list and sync S3 buckets. The same pattern applies to an Azure managed identity with subscription Contributor or a Google VM running as a broadly privileged service account.
- Avoid default identities: Google Compute Engine and GKE nodes use the Compute Engine default service account unless you choose another; Google recommends a dedicated least-privilege node service account. On AWS, do not reuse one instance profile across unrelated workloads.
- Limit who can attach identities: the permission to attach a role, managed identity or service account to a VM (for example
iam:PassRoleon AWS) is an escalation path, because whoever launches the VM can then read its credential from inside. - Limit shell access: on OCI, Oracle says anyone who can SSH to an instance inherits its instance principal privileges. That is true in practice on every provider.
- Know the non-revocable extras: every OCI instance principal automatically has
compartment_inspect, which lets it list compartment names, descriptions and tags.
Integrations, API tokens and service accounts
Containers and Kubernetes nodes
A pod on a node can usually reach the node's metadata endpoint and, with it, the node identity. Each provider has a workload identity mechanism that should replace node credentials for pods.
| Platform | Block pods from node metadata | Give pods their own identity |
|---|---|---|
| Amazon EKS | Require IMDSv2 with hop limit 1 on nodes; do not disable IMDS, as node components rely on it | IAM Roles for Service Accounts or EKS Pod Identity |
| Google Kubernetes Engine | Workload Identity Federation for GKE, which Google says replaces metadata concealment and recommends in all situations; node metadata includes kube-env with kubelet credentials | Workload Identity Federation for GKE |
| Azure Kubernetes Service | Restrict with network policy or host firewall rules | Microsoft Entra Workload ID for pods |
| OCI Kubernetes Engine | Disable legacy IMDS endpoints on nodes and restrict node instance principal policies | Provider workload identity where available |
See the EKS Identity Hardening Guide, the GKE Identity Hardening Guide and the Kubernetes NHI Security Guide.
Agents, SDKs and images
- AWS: IMDSv2 needs minimum SDK versions (for example AWS CLI 1.16.289 and Boto3 1.12.6). Migration detail is in the EC2 Instance Metadata Service Hardening Guide.
- OCI: IMDSv2 needs supporting images: Oracle Linux 7.x and 8.x released July 2020 or later, custom Linux images with cloud-init 20.3+ and Oracle Cloud Agent 0.0.19+, and custom Windows images with Oracle Cloud Agent 1.0.0.0+ (confirm cloudbase-init images with Oracle before switching). Confirm image support before disabling IMDSv1, or the instance can be unreachable after launch.
- Azure: clients must bypass proxies for IMDS, even where none is configured, because proxy settings can be discovered automatically later. Running IMDS through a proxy is unsupported.
- All providers: cache tokens until near expiry rather than fetching per request; each provider throttles the endpoint and recommends exponential back-off.
Logging and detection
Metadata requests are local and are not recorded in any provider's control plane logs. Detection therefore relies on configuration posture and on spotting the credential being used somewhere it should not be.
| Provider | Posture signal | Credential misuse signal |
|---|---|---|
| AWS | CloudWatch MetadataNoToken and ImdsV1Enabled; instances with HttpTokens optional | GuardDuty InstanceCredentialExfiltration.OutsideAWS and .InsideAWS; CloudTrail calls by the instance role from unexpected IPs |
| Azure | Inventory of VMs with managed identities and their role assignments | Managed identity sign-in logs in Entra ID and Azure Activity Log operations by the identity from unexpected sources |
| Google Cloud | VMs and nodes running as the default service account or with broad access scopes | Cloud Audit Logs entries where the VM's service account is the principal, from outside its expected network |
| OCI | areLegacyImdsEndpointsDisabled false in GetInstance or ListInstances | Audit service events where principalId is the instance OCID, from unexpected sources |
On the instance itself, an EDR or host log rule that flags unexpected processes connecting to 169.254.169.254 catches abuse that the cloud logs miss. Web application firewall and proxy logs showing the address, metadata.google.internal or /latest/meta-data in request parameters are a strong SSRF indicator. Map these to T1552.005, T1190 Exploit Public-Facing Application and T1078.004 Valid Accounts: Cloud Accounts.
Metrics
- Legacy metadata exposure: share of AWS instances with IMDSv1 enabled and OCI instances with legacy endpoints enabled; target zero.
- Default identities: count of Google VMs on the default service account and AWS instances sharing a generic instance profile.
- Privileged VM identities: VM identities with administrative or bulk data permissions, each with a named owner.
- Pods on node identity: Kubernetes workloads still using node credentials rather than workload identity.
- Time to contain a credential exfiltration alert.
Hardening baseline
| Control | AWS | Azure | Google Cloud | OCI |
|---|---|---|---|---|
| Require the protected version | HttpTokens required; account enforcement or declarative policy | Built in (Metadata: true) | Built in (Metadata-Flavor: Google) | areLegacyImdsEndpointsDisabled true ("Version 2 only") |
| Restrict local access | Hop limit 1 for container hosts; host firewall for specific processes | Local firewall rules allowing only specific processes, as Microsoft advises | Host firewall; Workload Identity Federation for GKE | Host firewall; restrict SSH |
| Least privilege identity | Workload-specific instance profile | User-assigned identity per workload, scoped role assignments | Dedicated service account, no default account | Narrow dynamic group matching rules and compartment-scoped policies |
| Bind credential to network | aws:Ec2InstanceSourceVpc condition with VPC endpoints | Conditional Access for workload identities where licensed | VPC Service Controls | Scoped policies; confirm other options with the vendor |
| Detect misuse | GuardDuty | Entra and Activity logs | Cloud Audit Logs | Audit service |
Rolling out a cross-cloud baseline
- Inventory: list every VM and node with an attached identity in each cloud, with that identity's permissions.
- Remove legacy access: on AWS follow the IMDSv2 migration; on OCI check image support, then set "Version 2 only" on a pilot group, watch for broken agents, then widen. Rollback on OCI is selecting "Version 1 and version 2" and restarting the instance.
- Shrink identities: replace default and shared identities with workload-specific ones, starting with internet-facing VMs.
- Move pods off node identity to IRSA or EKS Pod Identity, Workload Identity Federation for GKE or Entra Workload ID, then block pod access to node metadata.
- Add host controls where the provider offers no header-level legacy switch, for example local firewall rules on Azure VMs that limit metadata access to the agents that need it.
- Turn on detection per provider and add a common SSRF indicator rule in the WAF and proxy layer.
Choosing priorities: a single-cloud estate should finish that provider's legacy removal first. A multi-cloud estate gets most value from the identity step, because a tightly scoped VM identity limits the damage whichever endpoint leaks. Small teams can rely on provider defaults plus least privilege; large estates should enforce the AWS and OCI settings through organisation-level policy and report posture centrally. For the wider cross-cloud identity picture, see the Multi-Cloud Identity Guide.
Common misconfigurations
- Hardening one cloud only: AWS IMDSv2 is enforced while OCI instances still answer header-free requests on
/opc/v1. - Assuming a header requirement stops every SSRF: a bug that lets the attacker set arbitrary headers defeats Azure's and Google's protections, and a bug that controls the method and headers defeats AWS IMDSv2. Fix the SSRF and limit egress.
- Proxies in front of metadata: a forward proxy or sidecar that adds the required header on behalf of callers recreates the legacy exposure; Microsoft's guidance is to bypass proxies for IMDS.
- Several user-assigned identities on one Azure VM: any code on the VM can request a token for any of them, so the VM holds the union of their access.
- Default service accounts on Google VMs and GKE nodes: one compromised workload inherits project-wide permissions.
- Pods reaching node metadata: on GKE that can expose
kube-envwith kubelet credentials; on EKS it exposes the node role.
Framework mapping
| Framework | Reference | Metadata service control |
|---|---|---|
| NIST CSF 2.0 | PR.PS-01, PR.AA-01, PR.AA-05, DE.CM-09 | Secure configuration, workload identity management, least privilege, runtime monitoring |
| NIST SP 800-53 Rev. 5 | CM-6, CM-7, AC-6, IA-9, SI-4 | Metadata settings, disabling legacy endpoints, scoped VM identities, service authentication, monitoring |
| CIS Controls v8.1 | 4 Secure Configuration, 5 Account Management, 6 Access Control Management | Baseline per provider, VM identity inventory, least privilege |
| ISO/IEC 27001:2022 Annex A | 8.9, 5.16, 8.2 | Configuration management, identity management, privileged access |
| MITRE ATT&CK v20 | T1552.005, T1190, T1078.004 | Metadata credential theft, SSRF entry, use of stolen cloud credentials |
Practitioner checklist
- Inventory every VM and node identity in every cloud, with permissions and an owner.
- Require AWS IMDSv2 and enforce it at account or organisation level.
- Disable OCI legacy IMDS endpoints after confirming image and agent support.
- Replace Google default service accounts on VMs and GKE nodes with dedicated accounts.
- Limit Azure VMs to the managed identities they need and restrict metadata access with host firewall rules where practical.
- Move Kubernetes pods to workload identity and block pod access to node metadata.
- Remove any proxy or sidecar that adds metadata headers for other processes.
- Enable per-provider credential misuse detection and a WAF rule for metadata addresses in requests.
- Review who can attach identities to VMs, since that grants access to the credential.
Standards and references
- AWS: Use the Instance Metadata Service to access instance metadata
- Microsoft: Azure Instance Metadata Service
- Microsoft: How to use managed identities for Azure resources on a VM to acquire an access token
- Google Cloud: Protecting cluster metadata
- Google: Cloud client library for Go, compute metadata package
- Oracle: Getting instance metadata
- Oracle: Calling services from an instance (instance principals)
- MITRE ATT&CK: Unsecured Credentials: Cloud Instance Metadata API
Related NHI Mgmt Group resources: EC2 Instance Metadata Service Hardening Guide · SSRF Prevention Guide · Multi-Cloud Identity Guide · Cloud Workload Identity Guide · Oracle Cloud Infrastructure Security Guide