Skip to content
SSRF Write-up Intermediate

How I Exploited a Secondary Context Bug to Trigger SSRF & Path Traversal in Backend API Calls

A frontend parameter was reused in a backend API call without revalidation, allowing an attacker to inject path traversal sequences and access internal endpoints. This enabled SSRF and path traversal, potentially exposing sensitive internal paths.

medium.com

Published on medium.com

In modern architectures, frontend parameters and paths are often relayed (passed) through multiple backend layers, such as BFFs (Backend for Frontend), API gateways, and microservices. As requests are translated and forwarded, the same input may be reused in different contexts (for example it might be used to call an…

Bryan Matthew, on medium.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

Likely, the application failed to validate or sanitise user input when reusing it in a backend URL path, allowing path traversal and SSRF.

Impact

An attacker could access internal API endpoints and potentially sensitive paths, leading to SSRF and path traversal.

What the attacker needed

Access to the frontend endpoint

The fix

The application should validate and sanitise user input for the context in which it is used, especially when constructing backend URLs.

How it was found

  1. Send a request to the frontend endpoint with a control character in the id parameter to test if it is used in a backend call.
  2. Observe that control characters did not reveal useful information.
  3. Inject a random string with slashes in the id parameter to trigger an error message.
  4. Receive an error response exposing the internal API endpoint and HTTP method.
  5. Inject path traversal sequences to access the root directory of the internal API.
  6. Observe the response containing content from the root directory.

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.

When you type something into a website, it might be passed to other systems behind the scenes. If the website doesn't check that input again for each system, you might be able to sneak in special characters that change where the request goes. Here, the attacker used slashes and dots to make the server visit internal addresses it shouldn't.

What is SSRF?

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

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.