我想通过遵循xzbot漏洞演示并设置环境来了解 XZ Utils 后门。我知道xz-utils 5.6.1版本应该有后门,但我无法安装这个被感染的软件包。
从干净的 Kali Linux 2024.4 环境开始,它具有 liblzma 5.6.3,并且sshd
似乎不依赖于 libsystemd 和 liblzma。显然,无论是原装还是便携式 OpenSSH 都没有提供 systemd 支持。我对所有指南都期望sshd
已经链接到 liblzma 感到困惑,但它不适合我。
└─$ dpkg -l | grep liblzma5
ii liblzma5:amd64 5.6.3-1+b1 amd64 XZ-format compression library
└─$ ldconfig -p | grep liblzma
liblzma.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/liblzma.so.5
└─$ sshd -V
OpenSSH_9.9p1 Debian-3, OpenSSL 3.3.2 3 Sep 2024
└─$ ldd $(which sshd)
linux-vdso.so.1 (0x00007fc3de0b8000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fc3ddfde000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007fc3dda00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc3dd80a000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007fc3dd768000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc3de0ba000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc3ddfbe000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fc3dd6a7000)
当降级到 liblzma 5.6.1 包并ldd
再次检查时,似乎没有任何变化。
└─$ wget https://snapshot.debian.org/archive/debian/20240328T025657Z/pool/main/x/xz-utils/liblzma5_5.6.1-1_amd64.deb
2024-12-24 00:45:29 (4.72 MB/s) - ‘liblzma5_5.6.1-1_amd64.deb’ saved [252188/252188]
└─$ sudo dpkg -i ./liblzma5_5.6.1-1_amd64.deb
dpkg: warning: downgrading liblzma5:amd64 from 5.6.3-1+b1 to 5.6.1-1
(Reading database ... 425071 files and directories currently installed.)
Preparing to unpack ./liblzma5_5.6.1-1_amd64.deb ...
Unpacking liblzma5:amd64 (5.6.1-1) over (5.6.3-1+b1) ...
Setting up liblzma5:amd64 (5.6.1-1) ...
Processing triggers for libc-bin (2.40-3) ...
└─$ dpkg -l | grep liblzma5
ii liblzma5:amd64 5.6.1-1 amd64 XZ-format compression library
└─$ sudo systemctl restart ssh
└─$ ldd $(which sshd)
linux-vdso.so.1 (0x00007f705e59b000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f705e4c1000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f705de00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f705dc0a000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f705e41f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f705e59d000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f705e3ff000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f705db49000)
然后我尝试构建 OpenSSH 9.7p1,因为那是在后门公开之前,如果这也许有帮助的话。这需要重新启动才能sshd -V
显示 9.7p1
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.7p1.tar.gz
tar -xvf openssh-9.7p1.tar.gz
cd openssh-9.7p1
sudo apt install libssl-dev
./configure
make
sudo make install
但是 libsystemd 和 liblzma 仍然没有链接到 sshd。
到目前为止,我甚至不知道如何安装或构建易受攻击的 xz-utils 包。当我在 Ubuntu 24.04 上尝试同样的步骤时,也遇到了类似的问题