The xz-utils backdoor (CVE-2024-3094): how it worked and how to check
On 2024-03-29 Andres Freund reported that the release tarballs of xz-utils 5.6.0 and 5.6.1 contained a backdoor aimed at the OpenSSH server on Linux distributions. A co-maintainer account of the project had made and signed the tarballs. Freund noticed that SSH logins on his Debian unstable machine used more CPU than expected (about 0.5 s on his machine) and that valgrind reported errors. The backdoor had not reached a stable release of the major distributions.
What broke
xz-utils contains the xz tool and the liblzma compression library, which almost every Linux system has.
The backdoor had two parts. In the Git repository, two test files (tests/files/bad-3-corrupt_lzma2.xz and tests/files/good-large_compressed.lzma) contained the obfuscated payload; binary test files are normal in a compression project. In the release tarballs only, a modified m4/build-to-host.m4 added a step to the build that extracted the payload from the test files and linked a prebuilt object into liblzma. The source code on GitHub did not contain this step, so reading the repository did not reveal it.
Many projects publish tarballs with generated files (configure scripts, m4 macros) that are not in Git, and distributions build from those tarballs. Reproducible builds and builds from the Git tag narrow that gap.
The build step only ran under narrow conditions: an x86-64 Linux target with glibc, built as part of a Debian or RPM package. According to the xz project page, the maintainer account "Jia Tan" created and signed the 5.6.0 and 5.6.1 tarballs.
How the attack worked
OpenSSH does not use liblzma. Debian and several other distributions patch sshd to report its status to systemd, though, and libsystemd links liblzma. On Debian 12 you can see the chain:
ldd /usr/sbin/sshd | grep -E 'lzma|systemd'
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5
ldd shows such links for one binary; an SBOM of the host lists the packages behind them.
When sshd started, the backdoored liblzma redirected the OpenSSL function RSA_public_decrypt, which sshd calls during public key login, to its own code. Freund noted that this code runs before authentication and "seems likely to allow some form of access or other form of remote code execution". To stay hidden from people testing it, it first checked its environment: the program had to be /usr/sbin/sshd, TERM unset, and debugging variables absent.
The CNA rated it 10.0. The CVE is not on the CISA KEV list (catalog of 2026-11-25), and the CISA ADP data in the CVE record rate exploitation as "none".
Who was affected
Only systems that installed xz-utils or liblzma 5.6.0 or 5.6.1 built by a distribution from the tarball. Those were mostly development and rolling releases:
| Distribution | What it got |
|---|---|
| Debian | No stable release. Testing, unstable and experimental had compromised packages from 5.5.1alpha-0.1 (uploaded 2024-02-01) up to and including 5.6.1-1. Debian reverted to the 5.4.5 code as 5.6.1+really5.4.5-1 (DSA-5649-1). |
| Fedora | Rawhide and the Fedora 40 beta received 5.6.0 or 5.6.1. According to Red Hat, no version of RHEL was affected. |
| Others | Red Hat noted that other distributions may also be affected; their own notices are the reference. |
Servers on Debian stable and on RHEL and its rebuilds never had the backdoor: new upstream versions take months to reach stable releases.
How to check a server
Check the installed version of the library and the tool:
# Debian, Ubuntu
dpkg-query -W liblzma5 xz-utils
# RHEL, Fedora, Rocky, Alma
rpm -q xz xz-libs
# Alpine
apk list --installed xz-libs xz
# any system with the xz command
xz --version
On Debian 12 the first command prints liblzma5:amd64 5.4.1-1+deb12u2 or similar, a 5.4 version that is not affected. The backdoored upstream versions are 5.6.0 and 5.6.1. Debian packages named 5.6.1+really5.4.5 are the reverted, clean ones.
Also check container images and VM templates built in spring 2024 from development releases. Run the same command inside the image:
docker run --rm --entrypoint dpkg-query <image> -W liblzma5
If a server did run 5.6.0 or 5.6.1 with sshd reachable from the internet, treat it as possibly compromised, even though no use of the backdoor was ever shown. Rebuild it from a known good image and rotate the credentials it held. The steps are in the first hour of a security incident.
How it was fixed
Debian and Fedora reverted to 5.4.x within days. GitHub suspended the accounts of both maintainers for a time. The original maintainer reviewed the history of the project, published review notes and made clean releases on 2024-05-29, starting with XZ Utils 5.6.2.
Sources
- CVE-2024-3094 record (description, affected versions, CVSS, CWE-506, CISA ADP SSVC "Exploitation: none")
- Andres Freund: backdoor in upstream xz/liblzma leading to ssh server compromise, oss-security, 2024-03-29 (files, build conditions, sshd and libsystemd, RSA_public_decrypt, environment checks)
- XZ Utils backdoor, tukaani.org (tarballs signed by Jia Tan, clean releases on 2024-05-29)
- Debian DSA-5649-1 (affected Debian versions, revert to 5.4.5)
- Red Hat: Urgent security alert for Fedora Linux 40 and Fedora Rawhide users (Fedora versions, RHEL not affected)
- CISA KEV catalog, version 2026.11.25 (CVE-2024-3094 not listed)
lddanddpkg-queryoutput from adebian:bookworm-20261027-slimcontainer on 2026-11-26
Check your servers every day
The Vulnpocalypse collector reports the packages and settings of a server once a day, and the digest lists what to fix, most urgent first.
Vulnpocalypse