CVE-2022-1986: OS Command Injection in Gogs file editor
Summary
CVE-2022-1986: OS Command Injection in file editor in Gogs. Affects gogs.io/gogs versions < 0.12.9. Fixed in 0.12.9. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Gogs is an open-source self-hosted Git service written in Go. It provides a lightweight and easy-to-use platform for managing repositories, users, and organizations. Gogs allows users to upload and manage their repositories, making it a popular choice for individuals and small teams. However, a vulnerability has been discovered in the file editor of Gogs, which can lead to OS command injection.
Vulnerability Detail
The OS command injection vulnerability in Gogs allows a malicious user to update a crafted config file into the repository's .git directory. By combining this with a crafted file deletion, the attacker can gain SSH access to the server. This vulnerability affects all installations with repository upload enabled. The impact of this vulnerability is critical, as it can lead to unauthorized access to the server and potential compromise of sensitive data.
How To Fix
Latest published version: v0.13.3 as of 22 Oct 2026
go get gogs.io/gogs@v0.13.3
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.12.9
This is the first release that contains the fix.
go get gogs.io/gogs@v0.12.9
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability.
Conclusion
The OS command injection vulnerability in Gogs can lead to unauthorized access to the server and potential compromise of sensitive data. It is crucial for Gogs users to upgrade to the latest version and apply the necessary patches to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for gogs.io/gogs →
FAQ
Gogs is a self-hosted Git service written in Go. It provides a lightweight and easy-to-use platform for managing repositories, users, and organizations.
The impact of this vulnerability is critical. It allows an attacker to gain SSH access to the server and potentially compromise sensitive data.
You can use Vulert's playground (https://vulert.com/scanner) to check if your Gogs installation is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.
There are no known exploits for this vulnerability at the moment. However, it is recommended to upgrade to the latest version of Gogs to mitigate the risk.
You can find more information about this vulnerability in the advisory posted on Huntr (https://huntr.dev/bounties/776e8f29-ff5e-4501-bb9f-0bd335007930/).
References
Related vulnerabilities
Recent vulnerabilities recorded for gogs.io/gogs.