Discovering The Bug
A path traversal vulnerability in Snyk's file-reading endpoint allowed an attacker to read arbitrary files from private GitHub repositories by manipulating the path parameter. An attacker with access to a Snyk project could leak files from other private repositories if they knew the repository name and file path.
This post is going to be a write-up about a broken access control vulnerability I reported to Snyk a few months ago. Snyk is a developer security platform, best known for its dependency management service.
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 endpoint failed to validate or sanitise the user-supplied path before using it in a GitHub API request, allowing directory traversal.
What the attacker needed
A Snyk account; access to a Snyk project; knowledge of target repo name and file path
The fix
The issue was fixed by Snyk within less than 72 hours of the report.
How it was found
- Log in to Snyk and open a project with Snyk Code alerts.
- Inspect the network request that fetches file content for a SAST issue.
- Modify the path parameter to include directory traversal sequences.
- Send the request and observe that files outside the intended repository are returned.
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.
This report describes a path traversal bug. In simple terms, a web application let users ask for a file by giving a path, but it did not check that the path stayed inside the allowed folder. By using '../' sequences, an attacker could climb out of the intended folder and read other files, including files from private repositories that were not supposed to be accessible.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.