XZ Utils Backdoor

CVE-2024-3094 (CVSS 10.0): a multi-year maintainer-takeover operation that shipped an obfuscated, key-gated sshd pre-auth RCE inside the xz/liblzma 5.6.0 and 5.6.1 release tarballs.

How it works

Social engineering (2021–2023). GitHub persona Jia Tan (JiaT75) was created in 2021 (546 commits across projects that year, including a libarchive PR that swapped safe_fprintf() for fprintf()). First legitimate xz commit 2022-02-06; sock-puppet personas (Jigar Kumar, Dennis Ens) pressured sole maintainer Lasse Collin to hand over control. Nov 2022 the bug-report alias was shared with Jia Tan; Jia Tan cut their first release (5.4.2) in March 2023. June 2023 brought ifunc support into crc64_fast.c (credited to another persona, “Hans Jansen”), later used by the backdoor.

Build-time injection (tarball only). The payload is never visible in git:

  • Release tarballs (5.6.0 on 2024-02-24, then 5.6.1) carried a modified build-to-host.m4 absent from the repo.
  • It runs gl_[$1]config='sed "r\n" $gl_am_configmake | eval $gl_path_map | $gl[$1]_prefix -d 2>/dev/null', decoding an obfuscated script appended to configure.
  • Stage 2 is unpacked from “corrupt” binary test fixtures: tests/files/bad-3-corrupt_lzma2.xz and tests/files/good-large_compressed.lzma, yielding a precompiled object linked into liblzma.
  • Gating: x86-64 Linux, glibc, gcc + GNU ld, and a distro package build: if test -f "$srcdir/debian/rules" || test "x$RPM_ARCH" = "xx86_64"; then — so a manual ./configure && make does not reproduce it.

Runtime hook. OpenSSH doesn’t link liblzma; distros patching sshd for systemd notification load libsystemd, which loads liblzma. An IFUNC resolver installs an audit hook that replaces RSA_public_decrypt (fallbacks EVP_PKEY_set1_RSA, RSA_get0_key) only when argv[0] is /usr/sbin/sshd.

Payload protocol. Commands ride in the RSA public modulus N presented during pubkey auth:

  1. Last 240 bytes of N decrypted with ChaCha20 (hardcoded symmetric key — captures are decryptable).
  2. 114-byte signature verified with an embedded Ed448 public key, bound to the host key (no cross-host replay).
  3. Command byte: 0x01 SSH auth bypass, 0x02 exec shell command, 0x03 exec with chosen UID/GID. Executed pre-auth as root in sshd.
    Commands disguised as key material also evade verbose sshd logs. Research client: amlweems/xzbot (needs the private key, so only useful with a patched key).

Detection / response

xz --version            # 5.6.0 / 5.6.1 (note: Alpine fixed pkg 5.6.1-r2 still prints 5.6.1)
# openwall detect.sh: check sshd's liblzma for the hook function signature
path="$(ldd $(which sshd) | grep liblzma | grep -o '/[^ ]*')"
hexdump -ve '1/1 "%.2x"' "$path" | grep -q f30f1efa554889f54c89ce5389fb81e7000000804883ec28488954241848894c2410 && echo probably vulnerable
  • Downgrade to 5.4.6 (CISA: anything < 5.6.0) and hunt on hosts that ran affected versions.
  • Kill switch if you can’t downgrade: yolAbejyiejuvnup=Evjtgvsh5okmkAvj in /etc/environment, then restart sshd/systemd.
  • JFrog cve-2024-3094-detector also looks for decrypted strings in .rodata; SBOM/package inventory queries (cve:CVE-2024-3094) answer “where is it” fleet-wide — see SBOM and Provenance.

Notable cases

  • Exposure: Fedora 40 beta / Rawhide, Debian testing/unstable/experimental (5.5.1alpha-0.1 → 5.6.1-1), Kali, openSUSE Tumbleweed, Arch images (2024-02-24 → 2024-03-28). Ubuntu removed it before noble; stable distros, Amazon Linux and FreeBSD unaffected — slow experimental→stable promotion contained the blast radius.
  • Discovery: Andres Freund noticed sshd logins burning abnormal CPU during login and Valgrind errors; reported to oss-security 2024-03-29. GitHub suspended the repo.
  • Sabotage precedent: a single . in a CMake check silently disabled Landlock sandbox detection; the libarchive fprintf swap shows the same persona seeding weaknesses elsewhere.
  • Widely assessed as state-level (multi-year persona investment, Ed448 future-proofing, multiple fallback hooks). Datadog’s history ties it to Thompson’s “Trusting Trust” and the 2003 Linux kernel current->uid = 0 patch attempt.

Defenses

  • Build from git, not maintainer tarballs, or diff tarball vs tag (build-to-host.m4 was tarball-only) — the core argument for reproducible builds and source provenance (SBOM and Provenance).
  • Treat binary test fixtures and build scripts (m4, configure, ifunc resolvers) as code under review.
  • Maintainer-handover is a risk signal: single-maintainer critical packages + new co-maintainer + pressure campaigns.
  • The arXiv “Closing the Chain” study maps SolarWinds/Log4j/XZ techniques to 73 tasks across 10 frameworks; top-priority mitigations include RBAC, system monitoring and boundary protection.

Sources