VYPR
advisoryPublished May 29, 2026· 2 sources

Gogs Zero-Day Exposes Servers to Remote Code Execution

A critical zero-day vulnerability in the self-hosted Git service Gogs allows authenticated attackers to achieve remote code execution via argument injection through pull requests with malicious branch names.

A critical zero-day vulnerability in Gogs, a popular open-source self-hosted Git service, exposes servers to remote code execution (RCE), according to a disclosure from Rapid7. The flaw, assigned a CVSS score of 9.4, is an argument injection vulnerability that can be exploited by authenticated attackers via pull requests with malicious branch names.

The vulnerability lies in the 'Rebase before merging' merge operation. Rapid7 explains that the pull requests inject the `--exec` flag into git rebase, leading to command execution with the privileges of the Gogs server process user. While this merge operation is not enabled by default, any repository owner or administrator can enable it, and any registered user automatically becomes the owner of repositories they create.

During rebase, the merge function passes the pull request's base branch name to the git rebase function without preventing the interpretation of subsequent arguments as flags. Insufficient checks and sanitization against argument injection, combined with the fact that git rebase accepts the `--exec` flag, allow attackers to include malicious arguments in branch names, which will be executed after each replayed commit.

According to Rapid7, the vulnerability can be exploited without user interaction, as the attacker operates entirely within their own account and repository. Since Gogs ships with open registration enabled by default and no limit on repository creation, an unauthenticated attacker can simply create an account and repository on any default-configured instance. Any repository owner can enable rebase merging with a single toggle in settings, and the entire exploit chain can be operated without interaction from any other user.

The impact is severe: arbitrary command execution as the Gogs server process user gives the attacker the ability to compromise the server, read every repository on the instance (including other users' private repos), dump credentials (password hashes, API tokens, SSH keys, 2FA secrets), pivot to other network-accessible systems, and modify any hosted repository's code. Gogs servers across Windows, Linux, and macOS running default configurations are affected, with instances having multiple user accounts impacted the most.

Rapid7 has released a Metasploit module that automates the full exploit chain, as well as indicators of compromise (IoCs) to help defenders hunt for potential compromises. Gogs' maintainers were notified of the security defect in mid-March and acknowledged receiving the vulnerability report, but no patch has been released as of the time of publishing. This is the second Gogs zero-day disclosed publicly over the past half a year; in December, Wiz detailed CVE-2025-8110, an improper symbolic link handling issue that had been exploited as a zero-day for months.

Administrators are advised to restrict access to their Gogs instances until a fix is released. The disclosure highlights the risks associated with self-hosted development tools and the importance of timely patching.

The Register reports that Rapid7 researcher Jonah Burgess disclosed the flaw (GHSA-qf6p-p7ww-cwr9) to Gogs maintainers on March 17, but after initial acknowledgment on March 28, the team went silent and has not issued a patch. A Metasploit module is now publicly available, raising the urgency for users to apply mitigations such as disabling registration, restricting repository creation, and turning off 'Rebase before merging' until a fix arrives.

Synthesized by Vypr AI