
Proof-of-concept exploit for CVE-2025-8110 in Gogs <=0.13.x, enabling authenticated symlink bypass to arbitrary file write as the Gogs process user, leading to local privilege escalation.
Proof-of-concept for CVE-2025-8110, a symlink-following flaw in Gogs <= 0.13.x.
An authenticated user commits a symlink into a repository, then calls the
"update file contents" API (PUT /api/v1/repos/<u>/<r>/contents/<path>). Gogs
follows the symlink and writes attacker-controlled bytes to the link target with
the privileges of the Gogs process. When Gogs runs as root this is an arbitrary
root file write, for example dropping a NOPASSWD rule into /etc/sudoers.d/
for local privilege escalation.
Discovered by Wiz Research.
Gogs <= 0.13.3. Listed on the CISA Known Exploited Vulnerabilities catalog; this flaw bypasses the fix for CVE-2024-55947.
The "update file contents" API resolves the target path through a committed symlink instead of treating the repository working tree as a sandbox, so a write to a repo path is redirected to the symlink target on the host filesystem. The write happens as the Gogs process user; where that is root, any absolute path is writable.
python3 -m pip install requests pillow # gogs_register.py (captcha OCR)
# plus a `tesseract` binary on PATH (or edit the R= path in gogs_register.py)
gogs_symlink_root.sh needs git and curl, and is run on the target host
with Gogs reachable on 127.0.0.1:3001.
gogs_register.py - get an authenticated account past the signup captchapython3 gogs_register.py [username] [password] # defaults: pocuser / PocPass123!
Targets http://127.0.0.1:3001; edit B= for a remote instance. Registration
is open but captcha-gated (dchest/captcha, 6 digits); the script OCRs the
captcha with tesseract and retries signup until it takes.
gogs_symlink_root.sh - the symlink write./gogs_symlink_root.sh <gogs-user> <gogs-pass> [sudo-user]
| Input | Description |
|---|---|
argv[1] | Gogs username |
argv[2] | Gogs password |
argv[3] | User to grant NOPASSWD sudo (default: current user) |
Run on the target host (git and curl available, Gogs on 127.0.0.1:3001).
The script mints an API token, creates a repo, commits a symlink pointing at
/etc/sudoers.d/<sudo-user>, then PUTs the sudoers payload through the
"update file contents" API and attempts sudo -n id.
Expected result: sudo -n id returns uid=0(root), confirming the NOPASSWD
sudo rule was written as root.
Arbitrary file write as the Gogs process user. When Gogs runs as root this is a
root file write, trivially escalated to a root shell via /etc/sudoers.d/.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (8.8 High; CVSS v4.0 8.7), per the
NVD entry for CVE-2025-8110. Authenticated (PR:L) write primitive; the root
impact is conditional on Gogs running as root.
CWE-59 (improper link resolution / symlink following) leading to arbitrary file write.
For authorized security testing and education only. Use this only against systems you own or have explicit written permission to test. The author accepts no liability for misuse.
Dilanka Kaushal Hewage (r3vpwnx)
MIT - see LICENSE.