Lab Icon

SSRF Attack: Steal Cloud Metadata Credentials

Exploit a link-preview SSRF to reach AWS IMDS and steal IAM role credentials

Medium Updated 02 Aug 2026 Free Access Solution (Pro)
SSRF Cloud Penetration Testing AWS IMDS IMDSv2 IAM Credential Theft Privilege Escalation Metadata Service Abuse API Enumeration

Exploit a real SSRF attack in a link-preview SaaS to reach the cloud metadata service (IMDS), steal the instance's temporary IAM credentials, and abuse an over-permissive role to read an internal secret. Run the full SSRF-to-cloud chain hands-on in the Attack Terminal.

2
Flags
400
XP
50%
Success Rate

What is an SSRF attack?

A server-side request forgery (SSRF) attack tricks a server into making HTTP requests on the attacker's behalf. When an application fetches a user-supplied URL - to build a link preview, render a thumbnail, or call a webhook - an attacker can point it at addresses the server can reach but the attacker cannot: internal admin panels, databases, and, most dangerously in the cloud, the instance metadata service. This lab is built around that exact pattern.

How this lab works

You are looking at Previewly, a link-preview SaaS that turns any URL into a rich card by fetching it server-side. That fetch has no allow-list. Working entirely from the Attack Terminal with curl and jq, you will turn the preview feature into an SSRF primitive, reach the cloud metadata service at 169.254.169.254, read a secret leaked into the instance user-data for the user flag, then steal the instance's temporary IAM role credentials. Replaying that stolen session token against Previewly's over-permissive internal control-plane gives you the root flag. Every step is hands-on; nothing is simulated away.

Why practice SSRF and cloud metadata attacks?

SSRF against the metadata service is one of the highest-impact cloud attacks there is. In the 2019 Capital One breach, an SSRF flaw let an attacker read IAM credentials from 169.254.169.254 and exfiltrate over 100 million records from S3. The fix - IMDSv2, which requires a session token and blocks the naive SSRF - is now standard, but plenty of instances still allow IMDSv1. Practicing the full chain on HackerDNA builds the instinct to spot a vulnerable URL-fetch feature, recognize the metadata endpoint, and understand why least-privilege IAM roles matter.

What You Will Learn

  • Identify server-side request forgery in a URL preview feature
  • Exploit SSRF to reach the cloud instance metadata service (IMDS)
  • Extract a secret leaked in EC2 user-data through the metadata service
  • Steal temporary IAM role credentials from the security-credentials endpoint
  • Replay a stolen session token against an over-permissive internal API
  • Recognize the IMDSv1 misconfiguration that enables cloud credential theft

Prerequisites

HTTP basics curl command line JSON parsing with jq Basic cloud concepts URL structure

Ready to hack this lab?

Create a free account and start practicing cybersecurity hands-on.

Start Hacking - It's Free
Start Your Challenge

Launch your dedicated machine to begin hacking

~1-2 min setup
Dedicated server
Private instance
Standard power
New here? Here's what to do
1
Click "Start Lab" above You'll get your own private machine with an IP address
2
Explore the target Open the IP in your browser and look for vulnerabilities
3
Find and submit flags Flags are secret text strings hidden in the system - paste them below to score

Ready to hack this lab?

Create a free account to start your own dedicated server, submit flags, and earn XP on the leaderboard.

Start Hacking Free
18,000+ Hackers 100+ Labs & Courses Free
Start Hacking Free