Gogs is an open source self-hosted Git service. In version 0.13.3 and prior, due to the insufficient patch for CVE-2024-56731, it's still possible to update files in the .git directory and achieve remote command execution. This issue has been patched in versions 0.13.4 and 0.14.0+dev.
The patch applied in the previous version for CVE-2024-56731 proved insufficient — an attacker can still manipulate files in the .git directory of repositories hosted by Gogs. By deliberately overwriting or creating Git configuration files, it is possible to trigger the execution of arbitrary system commands (command injection, CWE-78) on the server side. The attack requires no authentication or user interaction.
An attacker can remotely execute arbitrary commands on the server hosting Gogs, leading to full system takeover, theft of repository data, and potential lateral movement within the internal network.
Gogs should be updated to version 0.13.4 or 0.14.0+dev, in which the vulnerability has been fixed. Patches are available in the official project repository on GitHub.
Gogs version 0.13.3 and all earlier versions
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XGogs
APPGogs< 0.13.4
Related vulnerabilities
Gogs: nadpisywanie obiektów LFS między repozytoriami – atak na łańcuch dostaw
Gogs: RCE przez usuwanie plików w katalogu .git (bypass patcha CVE-2024-39931)
RCE w Gogs poprzez command injection w parametrze tree_path (Windows)
Argument injection w serwerze SSH Gogs prowadzący do RCE
Gogs – nieautoryzowane usuwanie plików wewnętrznych (CWE-552)