Skip to content
RCE Disclosed report Intermediate CVE-2022-1884

OS Command Injection in gogs

A malicious user could upload a crafted config file into a repository's .git directory, which on Windows installations with repository upload enabled could lead to SSH access to the server. The issue was fixed by prohibiting uploads to the .git directory.

gogs/gogs

Originally disclosed on huntr

Critical View original

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 Windows installations with repository upload enabled (default) are affected.

Patches

Repository file uploads are prohibited to its .git directory. Users should upgrade to 0.12.8 or the latest 0.13.0+dev.

Workarounds

Disable repository files upload.

References

https://www.huntr.dev/bounties/9cd4e7b7-0979-4e5e-9a1c-388b58dea76b/

For more information

If you have any questions or comments about this advisory, please post on #6968.

From the GitHub Advisory Database (GHSA-958j-443g-7mm7, 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 allowed repository file uploads into the .git directory without restricting that path, so a crafted Git config file could be used to execute commands on Windows.

What the attacker needed

Windows installation of Gogs; repository upload enabled (default); ability to upload files to a repository

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.

This is about a code hosting server called Gogs. Normally users can upload files into their repositories, but the software did not stop someone from putting a file inside the hidden .git folder that Git uses internally. On Windows, that file could be abused to run commands and get into the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from gogs/gogs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.