
PEACH
Un cadre d’isolation des locataires
CVE-2026-52806 is a critical Remote Code Execution (RCE) vulnerability in Gogs, the self-hosted Git service, caused by argument injection via a crafted branch name during pull request rebase merges. An authenticated attacker can inject the --exec flag into the git rebase command by naming a branch --exec=<payload>, causing arbitrary OS commands to execute as the Gogs process user. The vulnerability affects Gogs versions prior to 0.14.3, including the latest stable release 0.14.2 and development commit b53d3162. It was discovered by Jonah Burgess (CryptoCat) of Rapid7, published on June 19, 2026, and patched on June 23, 2026. It carries a CVSS v3.1 base score of 9.9 (Critical) (GitHub Advisory, Gogs Advisory).
The root cause is CWE-77 (Command Injection): in internal/database/pull.go, the Merge() function passes pr.BaseBranch directly to git rebase via process.ExecDir without a -- end-of-options separator, allowing branch names beginning with -- to be interpreted as git flags. The pr.BaseBranch value originates from a URL parameter and is validated only via git rev-parse --verify (which confirms the ref exists as a git object, not that it is argument-safe); since the attacker pushes the malicious branch themselves, this check passes. Git's --exec flag causes git rebase to execute a shell command via sh -c after each replayed commit, and ${IFS} is used to embed spaces in the payload while bypassing git's prohibition on spaces in branch names. For payloads requiring characters forbidden in git refs (e.g., :, |), the attacker base64-encodes the command: --exec=echo${IFS}<base64>|base64${IFS}-d|sh. The Merge() function bypasses the hardened git-module library (v1.8.7) because it uses raw process.ExecDir instead of the safe API, and the git rebase call was never migrated to use --end-of-options (GitHub Advisory, Fix Commit).
Successful exploitation grants the attacker arbitrary OS command execution as the Gogs process user (typically git), constituting a full privilege escalation from authenticated user to server-level access. On multi-tenant instances, this enables cross-tenant data breaches (reading all repositories including private ones), credential theft (database access to password hashes, API tokens, SSH keys, and 2FA secrets for all users), supply chain attacks (silent modification of any hosted repository's code), and lateral movement to other systems reachable from the server's network. Because Gogs ships with open registration enabled by default (DISABLE_REGISTRATION = false) and any user who creates a repository is automatically its admin, the effective attack surface extends to unauthenticated network attackers on default-configured instances (GitHub Advisory, Gogs Advisory).
curl -s -u attacker:Password123 -X POST http://target:3000/api/v1/user/repos -H 'Content-Type: application/json' -d '{"name":"demo"}'--exec flag: git update-ref 'refs/heads/--exec=touch${IFS}/tmp/rce_proof' HEAD. For complex payloads (e.g., reverse shells), base64-encode the command: --exec=echo${IFS}<base64_payload>|base64${IFS}-d|shgit push origin master feature 'refs/heads/--exec=touch${IFS}/tmp/rce_proof:refs/heads/--exec=touch${IFS}/tmp/rce_proof'TestPullRequests goroutine to mark the PR as mergeable (exploiting the race condition in testPatch()).git rebase --quiet '--exec=<payload>' 'head_repo/feature', firing the RCE. The server returns HTTP 500 (expected), but the payload has already executed.[E] ...merge: git checkout '--exec=<...>': exit status 128 - error: unknown option 'exec=<...>' — this is the signature left by the failed git checkout step after RCE has already fired.POST /<user>/<repo>/pulls/<id>/merge) with Rebase before merging selected, especially from newly created repositories./tmp/ or other world-writable directories by the git process user (e.g., /tmp/rce_proof, /tmp/BROWSER_RCE_PROOF).git, UID 1000 in Docker).wget/curl to external hosts) originating from the Gogs server process.sh, bash, curl, wget, nc) with command-line arguments containing base64-encoded strings or ${IFS} patterns.--exec= or other git flag patterns (GitHub Advisory, Gogs Advisory).Upgrade Gogs to version 0.14.3, which adds --end-of-options to the git rebase, git checkout, git merge, and git push invocations in Merge(), and rejects branch names starting with - at the Merge() entry point (Gogs Release, Fix Commit). If immediate upgrade is not possible, disable self-registration (DISABLE_REGISTRATION = true in app.ini) to prevent unauthenticated account creation, and disable the "Rebase before merging" option on all repositories. Additionally, restrict network access to the Gogs instance to trusted users only, and run the Gogs process with the minimum necessary OS privileges to limit the blast radius of exploitation.
The vulnerability was discovered and reported by Jonah Burgess (CryptoCat), Senior Security Researcher at Rapid7, who published a detailed technical blog post and a standalone Python PoC exploit (Rapid7 Blog). The advisory notes this is part of a recurring pattern of argument injection vulnerabilities in Gogs, representing an incomplete fix bypass of protections added in prior CVEs (CVE-2024-39933, CVE-2024-39932, CVE-2024-39930). The fix was merged promptly by Gogs maintainer unknwon on June 6, 2026, and released in v0.14.3 on June 7, 2026 (Fix PR). CTI aggregators such as CTI Pilot covered the vulnerability in their weekly briefs.
Source: Ce rapport a été généré à l’aide de l’IA
Évaluation gratuite des vulnérabilités
Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité pour évaluer votre niveau de risque et identifier les failles dans vos défenses.
Obtenez une démo personnalisée
"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."