hackweb
notes on hacking and technology
IT EN
main menu
user menu
you are not logged in

Managed identity: abusing the instance credentials

December 27, 2024 · 1 min read · #cloud #azure #identity

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).


« back to home

latest posts
 
your IP address:
216.73.216.108
visitor #1
MOTD:
Every abstraction leaks somewhere.
Here we look at where.
topics