CVE-2021-32546 OS Command Injection in gogs
An unprivileged user can achieve remote code execution by manipulating Git configuration files to inject malicious commands via the sshCommand option.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-32546?
CVE-2021-32546 is a high-severity command injection vulnerability in n/a, published on 31 May 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with "\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).
Which versions are affected by CVE-2021-32546?
3 open source packages ship an affected version, including gogs.io/gogs. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
gogs.io/gogs Go | All versions | 0.12.8 |
gogs.io/gogs Go | All versions | 0.12.8 |
gogs.io/gogs Go | All versions | 0.12.8 |
Products include Gogs Gogs.
How do I fix CVE-2021-32546?
Upgrade gogs.io/gogs to 0.12.8 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2021-32546 being exploited?
There is no known exploitation of CVE-2021-32546 in the wild and no public exploit code.
Other vulnerabilities in n/a
Sources
Also known as GHSA-56j7-2pm8-rgmx, GO-2022-0471.