Friday, October 16, 2026

New Gogs 0-Day Flaw Enables Remote Code Execution on Servers

A new 0-day vulnerability in Gogs, a popular self-hosted Git service, allows authenticated users to run arbitrary commands on the server and potentially take full control of the system.

The flaw was discovered by Rapid7 Labs and is rated Critical with a CVSS v4 score of 9.4. At the time of publication, there is no official patch from the Gogs maintainers, which means thousands of internet-facing and internal Gogs instances may currently be exposed to this risk.

New Gogs 0-Day Flaw

The issue lies in how Gogs handles the “Rebase before merging” option for pull requests. When this feature is enabled, Gogs runs a Git rebase command under the hood to replay commits from one branch onto another.

However, the application passes the base branch name directly into the Git command without using a safe argument separator. Because Git supports an “–exec” flag that instructs it to run a shell command after each commit, an attacker can create a malicious branch whose name contains this flag and their chosen payload.

During the merge operation, Git interprets the injected “–exec” argument as a valid option, allowing remote code execution as the Gogs server process user.

What makes this vulnerability particularly dangerous is that it does not require admin rights or any interaction from other users. By default, Gogs allows open registration and does not limit repository creation.

This means an attacker can sign up, create a repository, enable the “Rebase before merging” setting, craft a malicious branch name, and open a pull request.

The exploit chain runs entirely within the attacker’s own account and repository. Even on hardened deployments where registration or repository creation is restricted, any user with write access to a repository that has rebase merging enabled can still exploit the flaw.

Once exploited, the consequences are serious. The attacker gains the ability to run arbitrary commands as the Gogs process user, which is typically a “git” or dedicated service account.

From there, they can read all repositories hosted on the server, including private code, configuration files, and internal tools. They can dump the database to steal password hashes, API tokens, SSH private keys, and two-factor authentication secrets.

With this level of access, they can also pivot to other systems on the same network and carry out supply-chain attacks by silently modifying source code.

Because Gogs stores repositories together on disk under a single root directory, and direct filesystem changes can bypass application logging, malicious changes may be difficult to detect without strong code integrity controls such as commit signing and rigorous review.

Rapid7 confirmed the vulnerability on Gogs 0.14.2 and 0.15.0+dev and believes all versions that support the “Rebase before merging” style are likely impacted.

Metasploit module obtaining a command shell session on a Gogs 0.14.2 instance running on Ubuntu.(Source: Rapid7)
Metasploit module obtaining a command shell session on a Gogs 0.14.2 instance running on Ubuntu.(Source: Rapid7)

The bug exists because the merge logic uses a low-level process-execution wrapper instead of the hardened git-module API, which was previously updated to add “–end-of-options” or “–” separators across many Git operations. As a result, the rebase call remained unprotected, leaving a new argument injection path despite earlier security fixes in other areas of the codebase.

Attackers already have an easy path to automation. Rapid7 has released a Metasploit module that performs the full exploit flow against both Linux and Windows Gogs servers.

In many cases, the only obvious sign of exploitation is an HTTP 500 error during the merge process and a corresponding error entry in the server logs complaining about an unknown “–exec” option.

If the target is an existing shared repository, defenders may also see a suspicious branch named “–exec”, a failed pull request, and a repository stuck in a corrupted Git state.

Since no patch is available yet, administrators should treat this as an actively exploitable 0-day and apply strong mitigations. Recommended steps include disabling public user registration, restricting who can create repositories, auditing repositories and logs for suspicious branch names and errors, and limiting write and merge permissions to only highly trusted users.

Where possible, place Gogs instances behind VPNs or access gateways, and closely monitor for any abnormal behavior until the Gogs maintainers release an official fix.

Indicators of compromise (IoCs)

[E] ...merge: git checkout '--exec=<...>': exit status 128 - error: unknown option `exec=<...>'

Note: IP addresses and domains are intentionally defanged (e.g., [.]) to prevent accidental resolution or hyperlinking. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

Follow us on Google News, LinkedIn, and X to Get Instant Updates and Set GBH as a Preferred Source in Google.

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Hot this week

How To Access Dark Web Anonymously and know its Secretive and Mysterious Activities

What is Deep Web The deep web, invisible web, or...

How to Build and Run a Security Operations Center (SOC Guide) – 2023

Today’s Cyber security operations center (CSOC) should have everything...

Russian Hackers Bypass EDR to Deliver a Weaponized TeamViewer Component

TeamViewer's popularity and remote access capabilities make it an...

Web Server Penetration Testing Checklist – 2026

Web server pentesting is performed under three significant categories: identity,...

ATM Penetration Testing – Advanced Testing Methods to Find The Vulnerabilities

ATM Penetration testing, Hackers have found different approaches to...

Researchers Uncover 20,000 Malicious Cloudflare Pages Domains Used in Tech Support Scams

More than 20,000 malicious Cloudflare Pages subdomains used by...

Hackers Exploit BeyondTrust Zero-Day and Erase Security Logs to Hide Their Tracks

A suspected China-nexus espionage group exploited a critical zero-day...

Critical Collabora Online Flaw Lets Attackers Execute Commands on Nextcloud Servers

A critical unauthenticated OS command injection flaw in Collabora...

Hackers Use Hundreds of AI Agents to Exploit PaperCut Servers and Steal Windows Credentials

A likely Russian-speaking threat actor used hundreds of AI...

Microsoft Disrupts CoGUI Phishing Kit Linked to Over 100 Million Malicious Emails a Month

Microsoft and international partners have disrupted infrastructure supporting CoGUI....

12 Best Mobile Application Security Testing Tools Compared (2026): Features & Pricing

NowSecure and Data Theorem mobile security lead automated mobile...

12 Best SBOM Tools Compared (2026): Features & Pricing

Anchore’s Syft SBOM generator is the free generation standard,...

Related Articles

Recent News