Rapid7 Details Unpatched Gogs RCE via Git Rebase Argument Injection

Summary
Rapid7 reports a critical argument-injection flaw in Gogs that can let an authenticated user execute commands through the rebase-before-merging workflow. Gogs 0.14.2 and 0.15.0+dev were confirmed affected; no patch was available at publication.
Key points
- The CWE-88 flaw is rated CVSSv4 9.4 and allows an authenticated user to achieve remote code execution as the Gogs server process.
- A malicious branch name injects Git’s --exec option when Gogs runs git rebase during “Rebase before merging.”
- Gogs 0.14.2 and 0.15.0+dev (commit b53d3162) were confirmed affected; earlier versions supporting rebase merging are considered likely vulnerable.
- Default open registration and unrestricted repository creation can make the exploit path accessible to a newly registered user; users with write access to a qualifying repository may also exploit it.
- Potential impact includes access to private repositories and stored credentials, server compromise, lateral movement, and modification of hosted code.
- Rapid7 reported no patch at publication. Suggested mitigations include restricting registration and repository creation; administrators can also monitor logs and repositories for suspicious branch names and artifacts.
Article Details
- Vulnerability Types
- Argument injection
- Severity
- Critical (CVSS v4 9.4)
- Affected Versions
- Gogs 0.14.2
- Gogs 0.15.0+dev (commit b53d3162)
- Exploitation Status
- reported
- Exploit Availability
- public_exploit
- Patch Status
- unavailable
- Workarounds
- Set DISABLE_REGISTRATION = true in app.ini to prevent untrusted users from creating accounts.
- Set MAX_CREATION_LIMIT = 0 in app.ini or restrict repository creation per user; this does not block exploitation by users with write access to existing repositories.
- Disable “Rebase before merging” on shared repositories where an attacker has write access but not admin privileges; repository owners or admins can re-enable it.
MITRE ATT&CK
T1059.003 · Windows Command ShellOn Windows, the file-based payload invokes cmd.exe to execute a batch file.T1059.004 · Unix ShellOn Linux and macOS, the injected Git rebase --exec command is run through sh -c.T1202 · Indirect Command ExecutionThe attacker injects Git's --exec argument into rebase to run a shell command after replaying a commit.T1552.001 · Credentials In FilesAfter gaining command execution, an attacker can read the Gogs database containing password hashes, API tokens, SSH keys, and 2FA secrets.
People
Products
GitA malicious branch name can inject the --exec flag into git rebase during the “Rebase before merging” workflow, leading to remote code execution.GogsRapid7 Labs found a critical argument injection flaw in Gogs that lets any authenticated user achieve remote code execution through a malicious branch name during “Rebase before merging.” The issue affects Gogs 0.14.2
