Skip to content
SSRF Write-up Advanced

Exploitation of an SSRF vulnerability against EC2 IMDSv2

An SSRF vulnerability in Atlassian Confluence (CVE-2019-8451) allowed attackers to make arbitrary HTTP requests, including PUT requests with custom headers, to the EC2 instance metadata service. This enabled retrieval of an IMDSv2 session token and subsequent access to sensitive instance metadata, including hardcoded credentials and EC2 security credentials.

Yassine Aboukir Follow

Published on yassineaboukir.com

bug bounties appsec

Yassine Aboukir, on yassineaboukir.com

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

The Atlassian gadgets makeRequest endpoint allowed control over HTTP method and headers, enabling the attacker to perform the PUT request needed to obtain an IMDSv2 token and then use it.

Impact

Attackers could access sensitive instance metadata, including hardcoded credentials for PostgreSQL, Tenable Nessus, and Hibernate, as well as EC2 security credentials, potentially leading to further compromise of AWS resources.

What the attacker needed

Access to a vulnerable Confluence instance; Ability to send requests to the makeRequest endpoint; Target running on AWS with IMDSv2

The fix

The vulnerability was fixed by Atlassian in CVE-2019-8451; additionally, AWS recommends using IMDSv2 and avoiding hardcoded credentials in user-data.

How it was found

  1. Identify Confluence instances vulnerable to CVE-2019-8451 using Burp Collaborator.
  2. Enumerate internal ports via SSRF to find services (e.g., Nginx on port 80, Confluence on port 5000).
  3. Attempt to access the AWS metadata endpoint and observe a 401 response, indicating IMDSv2.
  4. Use the makeRequest endpoint with httpmethod=PUT and the required header to retrieve an IMDSv2 session token.
  5. Use the token in a subsequent request to access metadata, double URL-encoding the token to avoid stripping of '=='.
  6. Retrieve user-data and EC2 security credentials from the metadata service.

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.

A server-side request forgery (SSRF) bug lets an attacker trick a server into making requests to internal systems. Here, the Confluence server could be told to contact the cloud metadata service, which normally only the server itself can reach. By controlling the request method and headers, the attackers bypassed the newer protection (IMDSv2) and stole credentials.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by Yassine Aboukir

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.