CVE-2021-32546
JSON

8.8high

OS Command Injection in gogs

Severity
8.8high CVSS:3.1 by NVD
Exploit likelihood
2.20% (higher than 83% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-56j7-2pm8-rgmxGO-2022-0471

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).

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
gogs.io/gogs (Go)before 0.12.8GitHub Advisory Database, Go Vulnerability Database
gogs gogsbefore 0.12.8NVD

All scores

GitHubcritical rating
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD6.5medium CVSS:2.0AV:N/AC:L/Au:S/C:P/I:P/A:P

Classification

What each source says

CVE List

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).

GitHub Advisory Database
Impact

The malicious user is able to update a crafted config file into repository's .git directory with to gain SSH access to the server. All installations with repository upload enabled (default) are affected.

Patches

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

Workarounds

N/A

References

N/A

For more information

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

Go Vulnerability Database

OS Command Injection in gogs in gogs.io/gogs

NVD (es)

Una falta de comprobación de entrada en el archivo internal/db/repo_editor.go en Gogs versiones anteriores a 0.12.8, permite a un atacante ejecutar código de forma remota. Un atacante no privilegiado (usuario registrado) puede sobrescribir la configuración de Git en su repositorio. Esto conlleva a una Ejecución de Comandos Remota, porque esa configuración puede contener una opción como sshCommand, que es ejecutado cuando una rama maestra es una rama remota (usando una URI ssh://). La rama remota también puede configurarse al editar el archivo de configuración de Git. Puede crearse un nuevo archivo en un nuevo repositorio, usando la interfaz gráfica de usuario, con "\ ~" como su nombre, y luego cambiar el nombre de este archivo a .git / configuración con el contenido de la configuración personalizada (y luego guardarlo)

References

Sources

SourceRecordLicence
CVE ListCVE-2021-32546 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-56j7-2pm8-rgmx changed 2026-07-08CC-BY-4.0
Go Vulnerability DatabaseGO-2022-0471 changed 2026-03-03CC-BY-4.0
NVDCVE-2021-32546 changed 2026-06-17Public domain