Managed identity: abusing the instance credentials
Managed identities (Azure) / instance profiles (AWS) / service accounts (GCP) give a cloud resource credentials without hardcoded secrets: a local endpoint issues tokens on demand.
The abuse
If you compromise the resource (RCE) or coerce it into making a request (SSRF), you obtain its tokens and act with its roles:
# Azure IMDS
curl -H 'Metadata:true' 'http://169.254.169.254/metadata/identity/oauth2/token?resource=https://management.azure.com/&api-version=2018-02-01'If the identity has broad roles (Contributor on the subscription), the attacker controls a large part of the tenant.
Defence
Least privilege on managed identities (the roles are the attacker's privileges after compromise). On AWS enforce IMDSv2 against SSRF. Segmentation, and monitoring anomalous token use (location, unusual actions via CloudTrail/Activity Log).