Vulnerabilities

Gogs Zero-Day Vulnerability Exposes Servers

May 30, 2026 00:06 · 10 min read
Gogs Zero-Day Vulnerability Exposes Servers

Gogs Zero-Day Vulnerability

The popular open source self-hosted Git service Gogs is affected by a critical-severity zero-day vulnerability that exposes servers to remote code execution (RCE), according to a report by Rapid7.

The vulnerability, assigned a CVSS score of 9.4, is an argument injection flaw that can be exploited by authenticated attackers via pull requests with malicious branch names. This allows attackers to inject the –exec flag into git rebase during the ‘Rebase before merging’ merge operation, leading to command execution with the privileges of the Gogs server process user.

Technical Details

A standard merge creates a merge commit joining two branch histories. A rebase before merge replays the head branch’s commits on top of the base branch to produce a linear history. While the ‘Rebase before merging’ 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 and the fact that git rebase accepts the –exec flag, which tells Gogs to run a shell command after replaying each commit, allows attackers to include malicious arguments in branch names, which will be executed after each replayed commit.

Exploitation and Impact

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. Attackers with write access to repositories that have rebase enabled can exploit the flaw directly, resulting in arbitrary command execution as the Gogs server process user. This 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.

Affected Systems and Mitigation

Gogs servers across Windows, Linux, and macOS that are running default configurations are affected. Instances with multiple user accounts, a default for many organizations, are 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, 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, following the disclosure of CVE-2025-8110, an improper symbolic link handling issue, in December.


Source: SecurityWeek

Source: SecurityWeek

Powered by ZeroBot

Protect your website from bots, scrapers, and automated threats.

Try ZeroBot Free