Gogs Remote Command Execution Vulnerability via .git Directory Manipulation

Vulnerability

A remote command execution vulnerability exists in Gogs versions prior to 0.13.3. This issue arises from an inadequate patch for a previous vulnerability, allowing unprivileged users to delete files in the .git directory. Exploitation of this flaw enables the execution of arbitrary commands on the Gogs instance, using the privileges of the account specified by RUN_USER in the configuration. As a result, attackers could access and modify any user's code hosted on the same instance.

Impact

Exploitation allows unprivileged users to execute arbitrary commands on the Gogs instance, with the same privileges as the RUN_USER account, potentially leading to unauthorized access and modification of user code.

Reproduction

To reproduce this vulnerability, first create a symbolic link in a repository that points to the .git directory. Then, use an unprivileged account to delete files through the symbolic link. This action will remove the targeted files from the .git directory, bypassing the application's safeguards and enabling remote command execution.

Remediation

Users can upgrade to Gogs version 0.13.3 or later, where this vulnerability has been patched.

Added: Jun 24, 2025, 4:25 AM
Updated: Jun 24, 2025, 4:25 AM

Vulnerability Rating

Custom Algorithm
spread
3.1
impact
7.5
exploitability
9.1
remediation
7.7
relevance
0.2
threat
4.8
urgency
2.9
incentive
10.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.