Finding and fixing an arbitrary file-read vulnerability in GitIngest (**CVE-2024–56074)**
GitIngest followed symbolic links in submitted GitHub repositories without checking whether they pointed outside the cloned directory, so an attacker could read arbitrary files from the server. By submitting a repository containing a symlink to a sensitive file or directory, the attacker received its contents as text.
In the rush to get it online, GitIngest was deployed without proper isolation and ran as root. After the project made it to the front page of Hacker News, it was immediately hit by a wave of attackers and DDoS attempts.
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 application did not validate symbolic links, allowing them to point outside the cloned repository and expose arbitrary files.
Impact
An attacker could read arbitrary files on the server, including sensitive configuration and certificate files, potentially leading to full compromise of the hosting environment.
What the attacker needed
A GitHub account; ability to create and push a repository; access to GitIngest web interface
The fix
The vulnerability was fixed by adding a check that skips symbolic links pointing outside the cloned directory, using realpath() to resolve and compare paths.
How it was found
- Create a symbolic link on the local machine pointing to a sensitive file or directory.
- Add the symlink to a GitHub repository, commit, and push the changes.
- Submit the malicious repository's URL to GitIngest through its web interface.
- Receive the target file's content as text in the response.
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 symbolic link (symlink) is like a shortcut that points to another file or folder. GitIngest copied files from GitHub repositories but did not check where these shortcuts led, so a shortcut pointing to a private file on the server let the attacker read that file. The fix makes the tool skip any shortcut that leads outside the repository.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.