Skip to content
Path traversal Write-up Intermediate

Breaking API Gateway Isolation with Path Traversal and URL Parsin

An API gateway failed to properly normalise request paths, allowing traversal sequences to route requests to internal services. By inserting a CRLF sequence before traversal, the attacker bypassed a 403 block and accessed internal endpoints, including Prometheus metrics and potentially unauthenticated APIs leaking personal information.

Hazem Brini Follow

Published on medium.com

During a private bug bounty engagement, I discovered a path traversal vulnerability affecting an API Gateway protecting a large microservice architecture.

Hazem Brini, 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 inconsistent URL normalisation between the component enforcing security policy and the component routing requests, allowing path traversal and CRLF injection to bypass restrictions.

Impact

The bypass allowed access to internal APIs that were never intended to be reachable from the Internet, and some of these APIs were unauthenticated and could leak personal information.

What the attacker needed

None

The fix

URLs should be normalised before validation, and every component in the request chain must interpret URLs consistently.

How it was found

  1. Append traversal sequences to a public endpoint and observe responses from different backend routes.
  2. Follow the traversed routes to an internal API index listing endpoints such as metrics.
  3. Request the metrics endpoint directly and receive a 403 Forbidden.
  4. Insert a CRLF sequence before the traversal back to the protected endpoint.
  5. Send the modified request and receive a 200 OK with the full Prometheus metrics page.

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.

An API gateway is like a receptionist that only lets you into certain rooms. The researcher found that by adding '../' (which means 'go up a folder') to the web address, they could sneak into rooms that were supposed to be off-limits. Adding a special line-break code (CRLF) tricked the security check into allowing the request, so they could see internal pages that were never meant to be public.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.