Security Alert: Critical Vulnerability in Gogs allows remote code execution by git rebase --exec without official patch or CVE available

Author: Published 4 min de lectura 179 reading

The images in this article were generated with artificial intelligence. How we publish

A critical vulnerability has been disclosed in Gogs, the open source self-hosted Git service, which allows remote code (CERs) execution by authenticated users under relatively simple conditions. According to the public analysis of the security firm that reported it, the failure receives a high score in the CVSS system and, for the moment, does not have a CVE identifier or an official patch available, leaving many facilities at immediate risk.

The problem takes advantage of a legitimate Git feature: the git rebase command supports the option --exec, which runs a shell command after applying each commit during a rebase. In Gogs, an attacker can insert that flag into the name of a malicious branch and, if the instance is configured to allow the operation of "Rebase before melting," induce the server to run arbitrary code when performing the rebase. What is particularly worrying about this vector is that it does not require administrator privileges or the interaction of other users: in facilities with default configuration, any registered account can create a repository and will be its owner, activate the rebase option on the interface and trigger the operation from its own repository.

Security Alert: Critical Vulnerability in Gogs allows remote code execution by git rebase --exec without official patch or CVE available
Image generated with IA.

The operational implications are serious. A successful attacker can get execution on the Gogs server, exfilter private repositories, flip credentials, move laterally over the network and modify the stored code. In multi-user or multi-tenant environments this results in a risk of flight between tenants, with exposure of projects and third-party secrets housed in the same machine. In addition, the ease of operation and the existence of a Metasploit module that automates the entire chain increase the likelihood of real and massive attacks against unprotected instances.

As long as there is no official patch, it is necessary to act urgently and apply defensive countermeasures that reduce the surface of attack. The most direct and practical measures include disabling public user registration to prevent attackers from creating new accounts (e.g. by configuring DISABLE _ REGISTRATION = true in app.ini), restricting or prohibiting the creation of repositories by normal users (e.g. MAX _ CREATION _ LIMIT = 0), and disabling the rebase option as a fusion method until a correction is available. It is also prudent to audit all repositories with an activated rebase and to review who has writing and fusion permissions.

Detection and research should prioritize specific signals: review the records of the web server and Gogs in search of errors 500 matching with the activity of creation / disposal of repositories, check if there are branches with names that include suspicious characters or embedded flags, and search for artifacts in exploited repositories (in some cases the creation and removal of the repository by the attacker leave few traces except HTTP and metadata inputs). It takes risk if it detects new accounts with repository creation activity or merges with unusual rebase operations. In case of suspicion of commitment, isolate the instance, make an inventory of access and keys, change sensitive administrative credentials and keys, and consider the rotation of secrets that may have been exposed.

Security Alert: Critical Vulnerability in Gogs allows remote code execution by git rebase --exec without official patch or CVE available
Image generated with IA.

It is important to plan additional mitigation in the medium term: to apply network segmentation so that the Gogs server does not have direct access to critical systems, to tighten branch name policies and to validate inputs (if its deployment allows), to limit users' ability to activate dangerous operations and to monitor the publication of an official patch by the project. Keep verified copies of the repositories out of vulnerable instance and establish response procedures to restore from backups if malicious handling is confirmed.

To deepen the overbase function and its --exec option, you can see Git's official documentation at https: / / git-scm.com / docs / git@-@ rebase. The page of the Gogs project and its source code are available at https: / / github.com / gogs / gogs, and anyone who wants to review public operating tools can consult the Metasploit repository at https: / / github.com / rapid7 / metasploit-framework but their presence reinforces the urgency of applying the recommended mitigation rather than trying to reproduce the attack in production environments.

In short, address this vulnerability as a priority: block public registration and the creation of repositories if possible, disable the rebase as a fusion method, audit permissions and recent activity, and prepare to apply the official patch as soon as available. The absence of a CVE or an arrangement does not reduce the technical gravity of the failure, and the exposure of Gogs servers on the Internet makes the operating window real and currently active.

Coverage

Related

More news on the same subject.