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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| gogs.io/gogs (Go) | before 0.12.8 | GitHub Advisory Database, Go Vulnerability Database |
| gogs gogs | before 0.12.8 | NVD |
All scores
| GitHub | critical rating | |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 6.5medium CVSS:2.0 | AV: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
| https://github.com/gogs/gogs/releases | release-notes, third-party-advisory, web | |
| https://github.com/gogs/gogs/security/advisories/GHSA-56j7-2pm8-rgmx | advisory, issue-tracking, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-32546 | advisory | |
| https://github.com/gogs/gogs/issues/6555 | web | |
| https://github.com/gogs/gogs/pull/6986 | web | |
| https://github.com/gogs/gogs | package | |
| https://github.com/gogs/gogs/blob/f36eeedbf89328ee70cc3a2e239f6314f9021f58/conf/app.ini#L127-L129 | web | |
| https://github.com/gogs/gogs/releases/tag/v0.12.8 | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-32546 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-56j7-2pm8-rgmx changed 2026-07-08 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2022-0471 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2021-32546 changed 2026-06-17 | Public domain |