CVE-2022-1884: Remote Command Execution in gogs/gogs

Published Jun 2, 2022
·
Updated

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.

Other sources

A remote command execution vulnerability exists in gogs/gogs versions <=0.12.7 when deployed on a Windows server. The vulnerability arises due to improper validation of the treepath parameter during file uploads. An attacker can set treepath=.git. to upload a file into the .git directory, allowing them to write or rewrite the .git/config file. If the core.sshCommand is set, this can lead to remote command execution.

MITRE

Affected Software

3 affected componentsFixes available
go/gogs.io/gogs<0.12.8
0.12.8
All of the following
Gogs Gogs<=0.12.7
Microsoft Windows

Event History

Jun 2, 2022
Advisory Published
via GitHub·08:50 PM
Nov 15, 2024
CVE Published
via MITRE·10:53 AM
Data Sourced
via MITRE·10:53 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2022-1884?

CVE-2022-1884 is considered a high severity vulnerability that allows malicious users to upload a crafted config file for unauthorized SSH access.

2

How do I fix CVE-2022-1884?

To fix CVE-2022-1884, update your Gogs installation to version 0.12.8 or later.

3

Which versions of Gogs are affected by CVE-2022-1884?

CVE-2022-1884 affects Gogs versions prior to 0.12.8, specifically versions 0.12.7 and earlier.

4

Is Windows the only platform affected by CVE-2022-1884?

No, while the issue has been noted on Windows installations, it is primarily related to Gogs regardless of platform.

5

What is the impact of CVE-2022-1884?

The impact of CVE-2022-1884 is that an attacker can gain unauthorized SSH access to the server through a maliciously crafted config file.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203