GCP Metadata SSRF → Service-Account Token Exfil
Scenario
A GCE-hosted image proxy fetches any URL you supply. The GCP metadata server at 169.254.169.254 hands out service-account tokens to anything on the box — including your SSRF.
Attack path
- Point the proxy at
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/tokenwith headerMetadata-Flavor: Google. - Use the OAuth token against
storage.googleapis.comto read the private flag bucket. - The object you exfiltrate is double-wrapped for transport.
Recover the flag
The blob is base64 first, then hex. Reverse the layers in order (base64 → hex) — CyberChef 'From Base64' then 'From Hex' — to recover your per-user flag.
Sign in to unlock escalating hints for this expert lab.
61474e375a324e774c57316c6447466b595852684c584e7a636d59745a58686d615777744d7a4178587a56684e5752694d444e6a4e6a49304d58303d
Apply each step IN REVERSE ORDER: 1. Hex-decode the blob to recover the flag (each pair of hex chars = 1 byte). 2. Decode the base64 blob to recover the flag.
// this payload is unique to your account — decode it, then submit the recovered hc{...} flag below
// go deeper
- Practice this in a legal lab: Box: Cloud Misconfig (S3 + IAM + SSRF)
- Read the writeup: From SSRF to Cloud Admin: Chaining AWS Metadata Exposure in a Serverless App
- Read the writeup: SSRF in a PDF Generator Led Me to AWS Metadata and Full Cloud Compromise
- Read the writeup: From SSRF to AWS Console: A Journey Through Metadata and Misconfigurations