Skip to content
File upload Disclosed report Intermediate CVE-2022-0415

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).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

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.

More from gogs/gogs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.