SSRF Leads to AWS EC2 Compromise and Account Takeover
An endpoint fetched any URL supplied by the user without validation, allowing requests to the AWS EC2 metadata service. The attacker retrieved IAM credentials and a session token, which could lead to cloud infrastructure compromise and account takeover.
medium.com
Published on medium.com
SSRF vulnerabilities can pose significant risks, as they often allow attackers to interact with internal systems that are not directly accessible from the outside. This can lead to the exposure of sensitive information such as configuration files, authentication tokens, or metadata, which attackers can then use to…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application fetched user-supplied URLs without validating or restricting them to allowed destinations, so internal metadata endpoints were reachable.
Impact
The attacker could obtain IAM credentials and a session token, potentially compromising the cloud environment and taking over the victim's account.
What the attacker needed
Victim clicks a crafted link; endpoint fetches user-supplied URLs
How it was found
- Identify an endpoint that takes a URL and fetches its content.
- Send a request with a URL to a domain you control and confirm the server fetches it.
- Request the AWS metadata endpoint to list available metadata.
- Request the identity credentials path to obtain IAM credentials.
- Craft a URL that causes the server to send a victim's session token to an attacker-controlled server.
- Use the stolen session token to impersonate the victim.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Server-side request forgery (SSRF) is when a website takes a web address from you and fetches it on its own server. If the site does not check that address, an attacker can make the server visit internal services that outsiders cannot reach, such as a cloud metadata service that holds temporary passwords. Those passwords can then be used to access the cloud account or hijack a user session.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.