
This repository contains a Proof of Concept (PoC) script in Python to demonstrate and analyze the vulnerability registered as CVE-2025-8110 in the self-hosted Git service Gogs (versions 0.13.3 and earlier).
[!WARNING] THIS SOFTWARE IS PROVIDED SOLELY FOR EDUCATIONAL AND SECURITY RESEARCH PURPOSES. Using this material against targets without prior written consent from their owners is completely illegal. The author of this repository is not responsible for any damages, losses, or misuse arising from the use of this code. Always use it at your own risk and only in controlled environments or authorized simulations (such as CTF labs).
CVE-2025-8110 is a critical Arbitrary File Write vulnerability caused by insufficient validation when handling symbolic links (symlinks) through Gogs' PutContents API.
An authenticated attacker can:
.git/config configuration file).root, the file write can be escalated to Remote Code Execution (RCE) by injecting the desired command into the sshCommand property of Git's configuration file.exploit.py)The script automates the entire exploitation process using valid credentials and an API Token previously generated manually in the Gogs web interface:
┌──────────────────────────────────────────────┐
│ Máquina del Atacante (Kali) │
└──────────────────────┬───────────────────────┘
│
(1) Crea Repositorio │ (3) Sube Symlink (.git/config)
Malicioso vía API │ vía git push
▼
┌──────────────────────────────────────────────┐
│ Túnel SSH Local (puerto 8080) │
└──────────────────────┬───────────────────────┘
│
▼
┌──────────────────────────────────────────────┐
│ Servidor Víctima Gogs │
│ (Puerto 3001) │
└──────────────────────┬───────────────────────┘
│
│ (4) API PUT "contents"
│ Sigue Symlink y escribe
│ "sshCommand" en .git/config
▼
┌──────────────────────────────────────────────┐
│ Ejecución del Payload como ROOT │
└──────────────────────────────────────────────┘
create_malicious_repo: Makes a POST request to the Gogs API (/api/v1/user/repos) authenticating with the provided access token to create a new repository with a dynamically generated random name.upload_malicious_symlink:
/tmp/..git/config (the server's Git configuration file).git push).exploit: Defines the payload using an injection trick in Git's sshCommand property. By updating the content through the API, Gogs is forced to overwrite its own .git/config on the server. When the final part of Git's process is triggered, Gogs executes the terminal command (a reverse shell in Bash) returning the connection to your Netcat listener.Make sure to configure global Git identity settings before running the script to avoid errors when performing the automatic commit:
git config --global user.email "[email protected]"
git config --global user.name "estudiante"