Anatomy of the XZ Utils Backdoor (CVE-2024-3094): Build-System Stealth & IFUNC Hijacking
How a multi-year supply-chain operation weaponized autotools m4 macros, release tarballs, and GNU Indirect Functions to intercept OpenSSH authentication.
1. EXECUTIVE SUMMARY
On March 29, 2024, PostgreSQL developer Andres Freund disclosed a multi-year supply-chain backdoor in upstream XZ Utils versions 5.6.0 and 5.6.1 (CVE-2024-3094, CVSS 10.0). Rather than committing malicious C code directly to the public Git repository where static review would catch it, the operation hid obfuscated stages inside binary test fixtures (`tests/files/bad-3-corrupt_lzma2.xz` and `tests/files/good-large_compressed.lzma`) and triggered extraction using a modified `m4/build-to-host.m4` macro present only inside official release tarballs. When compiled on targeted x86_64 glibc Linux distributions where `/usr/sbin/sshd` linked transitively against `libsystemd` and `liblzma`, the backdoor used a GNU Indirect Function (`STT_GNU_IFUNC`) resolver to hook `RSA_public_decrypt` inside OpenSSH prior to authentication.
2. TECHNICAL EXPLANATION & EXECUTION CHAIN
Upstream OpenSSH does not link against `liblzma`. However, several major Linux distributions (including Debian and Fedora) applied a downstream patch linking `sshd` against `libsystemd` for `sd_notify()` service readiness signaling, and `libsystemd` links against `liblzma.so.5` for journal compression. During dynamic linking at process startup, `liblzma` resolves `crc64_resolve()` via the ELF `STT_GNU_IFUNC` mechanism—infrastructure that had been merged in June 2023 via a patch from sockpuppet account `Hans Jansen`, shortly before `JiaT75` disabled `ifunc` checks in Google's `oss-fuzz` harness so AddressSanitizer would not flag future resolver hooks. Because `IFUNC` resolvers execute during symbol relocation before Full RELRO (`LD_BIND_NOW`) marks the Global Offset Table (GOT) read-only, the injected object (`liblzma_la-crc64-fast.o`) verified `argv[0]` was `/usr/sbin/sshd`, walked internal glibc dynamic linker structures (`_r_debug` / `link_map`), and redirected `RSA_public_decrypt`. When a client connected, the hook inspected the raw RSA public key modulus `N` (`RSA_get0_key`) for a magic header (`a * b + c <= 3`), decrypted the embedded payload with ChaCha20 derived from the attacker's hardcoded Ed448 public key, verified an Ed448 signature binding the server host key and payload, and passed the verified command to `system()`.
Stage 1 (`build-to-host.m4` in release tarball) -> Stage 2 (obfuscated shell script carved from `bad-3-corrupt_lzma2.xz` & `good-large_compressed.lzma`) -> Stage 3 (pre-compiled `.o` object injected into `crc64_fast.c` compilation) -> Stage 4 (ELF `IFUNC` resolver executes inside `/usr/sbin/sshd` via `libsystemd.so` -> `liblzma.so.5` dependency chain and hooks `RSA_public_decrypt`).
3. VERIFIED EVIDENCE MATRIX (FACT VS. INTERPRETATION VS. UNCERTAINTY)
The backdoor build trigger (`m4/build-to-host.m4`) existed only in the distributed release tarballs (`xz-5.6.0.tar.gz`, `xz-5.6.1.tar.gz`) and was absent from the corresponding Git commit tree.
The Stage-2 build script explicitly gated injection on `x86_64-*-linux-gnu*` built inside Debian (`DEB_BUILD_ARCH`) or RPM (`RPM_ARCH`) package build environments before modifying `liblzma_la-crc64-fast.o`.
Triggering RCE or auth bypass on a backdoored sshd required the attacker's private Ed448 signing key to sign the payload inside the RSA modulus N; third parties cannot replay or forge triggers from the binary alone.
Git commit timestamps for 'JiaT75' clustered within standard 09:00–17:00 working hours in UTC+2/UTC+3 and paused across Eastern/Central European public holidays, despite early commits declaring a UTC+0800 offset.
No government agency, CERT, or forensic responder has published verified attribution tying the 'Jia Tan', 'Jigar Kumar', 'Dennis Ens', or 'Hans Jansen' personas to a specific state intelligence service or named APT group; public state-attribution theories remain unverified inference.
4. CHRONOLOGICAL TIMELINE
Account 'JiaT75' (Jia Tan) submits first patch to the xz-devel mailing list following initial activity on libarchive.
Single-purpose sockpuppet accounts ('Jigar Kumar', 'Dennis Ens') pressure original maintainer Lasse Collin on xz-devel to add a co-maintainer; Jia Tan gains commit/maintainer role by late 2022.
Patch from 'Hans Jansen' introduces GNU IFUNC resolver (`crc64_resolve`) into liblzma; 'JiaT75' submits PR to Google OSS-Fuzz disabling ifunc instrumentation under sanitizer builds.
XZ Utils 5.6.0 release tarball published containing modified m4/build-to-host.m4 and staged binary test fixtures absent from the Git tag.
XZ Utils 5.6.1 released with updated binary test fixtures while sockpuppet accounts lobby Debian and Fedora packagers for rapid inclusion.
Andres Freund investigates ~500ms CPU latency in failed SSH logins on Debian sid using `perf` and discloses CVE-2024-3094 on oss-security.
5. PRACTICAL ENGINEERING LESSONS
- [1]Git repository tags and release tarballs generated by `make dist` (autotools) are NOT identical artifacts. Relying solely on Git commit review misses `m4` and `configure` modifications injected during tarball packaging.
- [2]Transitive dynamic library dependencies expand the attack surface of critical security daemons (`sshd`). Every shared library mapped into a privileged daemon's address space (`ldd /usr/sbin/sshd`) shares its privileges.
- [3]Performance profiling (`perf`, `btop`, flamegraphs) is a legitimate security detection capability: a 500ms latency anomaly caught what static scanners missed.
6. DEFENSIVE RECOMMENDATIONS
- [1]Enforce reproducible builds that build directly from verified Git commit hashes rather than opaque upstream `make dist` tarballs.
- [2]Minimize transitive shared-library linkage in network authentication daemons (e.g., OpenSSH 9.8+ separated `sshd` into smaller privilege-separated binaries `sshd-session` and `sshd-auth` and replaced `libsystemd` linkage with a standalone socket notification implementation).
- [3]Treat binary test fixtures (`.xz`, `.gz`, `.bin`, `.pkl`) committed to source repositories as executable code during code review.