CVE-2022-1986: OS Command Injection in Gogs

gogs.io/gogs Updated 02 Oct 2025

Summary

21/08/2024
Yes i
Critical
9.8

CVE-2022-1986: OS Command Injection in file editor in Gogs in gogs.io/gogs. Affects gogs.io/gogs versions < 0.12.9. Fixed in 0.12.9. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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 collaborate on code, track changes, and manage their projects effectively. However, a vulnerability has been discovered in Gogs that allows for OS command injection.

Vulnerability Detail

The OS command injection vulnerability in Gogs allows an attacker to execute arbitrary commands on the underlying operating system. This can be exploited by an authenticated user with write access to a repository's file editor. By crafting a malicious file name or content, an attacker can inject arbitrary commands that will be executed when the file is accessed or modified. This can lead to unauthorized access, data leakage, and potential compromise of the host system.

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

As a temporary workaround, users can restrict write access to the file editor for untrusted users. By limiting the ability to modify files through the Gogs interface, the risk of exploitation can be reduced. Additionally, it is advisable to monitor and review file changes for any suspicious activity.

Conclusion

The OS command injection vulnerability in Gogs poses a significant risk to the security and integrity of repositories and host systems. It is crucial for Gogs users to update their installations to the latest patched version (0.12.9 or later) to mitigate this vulnerability. By following the recommended steps and monitoring for any suspicious activity, users can enhance the security of their Gogs deployments.

See every vulnerability recorded for gogs.io/gogs →

Share this vulnerability

FAQ

The vulnerability allows an attacker to execute arbitrary commands on the underlying operating system, potentially leading to unauthorized access, data leakage, and compromise of the host system.

Users of Gogs versions prior to 0.12.9 are affected by this vulnerability. Organizations and individuals using Gogs for code collaboration and version control should update their installations to the latest patched version.

You can use the Vulert Playground at Vulert Scanner to check if your Gogs installation is affected by this vulnerability. Simply provide your Gopkg.lock file, and Vulert will analyze it for any open-source vulnerabilities, including this OS command injection issue.

At the time of this report, there are no known public exploits specifically targeting this OS command injection vulnerability in Gogs. However, it is crucial to update to the latest patched version to mitigate the risk.

If you observe any suspicious activity or believe your Gogs installation has been compromised, it is recommended to disconnect the affected system from the network and seek assistance from a qualified security professional. They can help investigate the incident, assess the impact, and guide you through the remediation process.

Related vulnerabilities

Recent vulnerabilities recorded for gogs.io/gogs.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback