Path Traversal in Git HTTP endpoints in Gogs
The Git HTTP endpoints in Gogs did not properly clean paths, allowing a malicious user to craft HTTP requests that access unauthorised Git directories. This could let an attacker reach Git repositories they should not be able to access.
gogs/gogs
Originally disclosed on huntr
Impact
The malicious user is able to craft HTTP requests to access unauthorized Git directories. All installations with are affected.
Patches
Path cleaning has accommodated for Git HTTP endpoints. Users should upgrade to 0.12.9 or the latest 0.13.0+dev.
Workarounds
N/A
References
https://huntr.dev/bounties/22f9c074-cf60-4c67-b5c4-72fdf312609d/
For more information
If you have any questions or comments about this advisory, please post on #7002.
From the GitHub Advisory Database (GHSA-6vcc-v9vw-g2x5, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Git HTTP endpoint handlers did not normalise or clean the requested path before using it to locate a repository on disk.
Impact
A malicious user could access Git directories they are not authorised to reach, though the advisory does not state whether this was demonstrated against a live instance.
What the attacker needed
Access to a Gogs instance; ability to send crafted HTTP requests
The fix
Path cleaning was added for the Git HTTP endpoints, and users should upgrade to version 0.12.9 or the latest 0.13.0+dev.
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 report has not been written yet. The Original tab links to the source.
A path traversal bug lets someone use special characters in a web address to slip past the intended folder and reach other folders on the server. Here, the parts of Gogs that serve Git repositories over HTTP did not tidy up these addresses properly, so a user could ask for a repository they were not allowed to see. The fix makes those addresses get cleaned before they are used.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.