All vulnerabilities

Servers and applications

GHSA-8r2x-49gj-h6rm

Protected Branch Bypass via Pull Request Merge Due to Missing Hook Environment Variables

Severity
High 8.3
Published
18 Nov 2026
Last changed
18 Nov 2026
Added to UpHeron
18 Nov 2026
Fixed in
0.15.0
Weakness
Incorrect authorization (CWE-863)
Attack
Over the network · Needs a user account · No user action needed
Attacker can
Change data
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:H/SA:N
Sources
Project advisories (GitHub)

Description

The pull request merge operation in Gogs completely bypasses protected branch enforcement. When a pull request is merged through the web interface, the internal git push that writes the merge commit to the base repository runs without the SSH_ORIGINAL_COMMAND environment variable. The pre-receive hook checks for this variable at startup and immediately exits when it is absent, skipping all branch protection logic including whitelist enforcement, required pull request checks, and merge restrictions. Any collaborator with Write access can merge a pull request into any protected branch, regardless of whether they are in the push whitelist.

The vulnerability spans three components that fail to connect properly:

1. MergePullRequest handler has no application-level protection check

The handler at internal/route/repo/pull.go:401-431 only requires reqRepoWriter middleware. It never calls GetProtectBranchOfRepoByName to check whether the target branch is protected, nor does it verify…

From gogs/gogs's security advisory. Shortened; the full text is there.

Affected software

SoftwareAffected versions
GogsServers and applications · github:gogs/gogs
  • Every version before 0.15.0

About Gogs

free forge based on Git written in Go

From Wikidata, CC0 1.0.
Docker Hub pulls
94,040,857Docker Hub, 15 Nov 2026
GitHub stars
47,939GitHub, 15 Nov 2026
Forks
5,082GitHub, 15 Nov 2026
Latest release
v0.14.4GitHub, 15 Nov 2026
Released
12 Nov 2026GitHub
Developer
FLOSS contributorWikidata
License
Expat licenseWikidata
Written in
Go, Cascading Style Sheets, JavaScriptWikidata
First released
11 Feb 2014Wikidata
First published on GitHub
12 Feb 2014GitHub

References