Unrestricted Upload of File with Dangerous Type in Gogs
Gogs allowed uploading a crafted config file into a repository's .git directory, which could give an attacker SSH access to the server. All installations with repository upload enabled (the default) were affected.
gogs/gogs
Originally disclosed on huntr
Impact
The malicious user is able to upload a crafted config file into repository's .git directory with to gain SSH access to the server. All installations with repository upload enabled (default) are affected.
Patches
Repository file uploads are prohibited to its .git directory. Users should upgrade to 0.12.6 or the latest 0.13.0+dev.
Workarounds
Disable repository files upload.
References
https://huntr.dev/bounties/b4928cfe-4110-462f-a180-6d5673797902/
For more information
If you have any questions or comments about this advisory, please post on #6833.
From the GitHub Advisory Database (GHSA-5gjh-5j4f-cpwv, 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 application did not block uploads to the .git directory, allowing a file that changes server behaviour to be placed there.
What the attacker needed
Repository upload enabled (default); attacker has a user account
The fix
The issue was fixed by prohibiting repository file uploads to the .git directory; users should upgrade to 0.12.6 or later.
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 code hosting tool let users upload files into a hidden folder that controls how the server runs. By placing a special file there, an attacker could trick the server into letting them log in remotely. This is dangerous because it gives full control of the machine.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.