CVE-2026-52811 Gogs: UploadRepoFiles writes outside repo working tree via committed parent sym
An attacker with repo-write access can exploit symlink handling flaws to write files outside the repository, potentially achieving remote code execution or SSH access.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-52811?
CVE-2026-52811 is a critical path traversal vulnerability in gogs, published on 24 Jun 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
Gogs is an open source self-hosted Git service. Prior to 0.14.3, (*Repository).UploadRepoFiles checks for symlinks only on the leaf of the upload target (osx.IsSymlink(targetPath)). The siblings UpdateRepoFile, DeleteRepoFile, and GetDiffPreview use hasSymlinkInPath, which lstats every component — UploadRepoFiles is the lone outlier. An attacker with repo-write access plus a multipart upload whose filename contains a literal backslash (preserved by filepath.Base on Linux, then converted to / by pathx.Clean) redirects the write through a previously-committed directory symlink. iox.CopyFile opens the destination with os.Create (no O_NOFOLLOW), so the kernel follows the parent symlink and writes attacker bytes anywhere the gogs UID can write — ~git/.ssh/authorized_keys → SSH foothold, or <repo>.git/hooks/post-receive → next-push RCE. This vulnerability is fixed in 0.14.3.
Which versions are affected by CVE-2026-52811?
3 open source packages ship an affected version, including gogs.io/gogs.
| Package | Affected | Fixed in |
|---|---|---|
gogs.io/gogs Go | All versions | None |
gogs.io/gogs Go | All versions | 0.14.3 |
gogs.io/gogs Go | All versions | 0.14.3 |
How do I fix CVE-2026-52811?
Upgrade gogs.io/gogs to 0.14.3 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2026-52811 being exploited?
There is no known exploitation of CVE-2026-52811 in the wild and no public exploit code.
Sources
Also known as GHSA-89mr-xqfv-758m, GO-2026-5249.