Yesterday afternoon it became public that a backdoor had been built into versions 5.6.0 and 5.6.1 of the xz compression package. The flaw is tracked as CVE-2024-3094, and Red Hat gave it the highest possible CVSS score, 10.0. The xz backdoor is especially unpleasant because xz includes the liblzma library, which almost every Linux system uses, and the malicious code takes effect through the SSH server.
The good news: according to current knowledge, the stable distributions used on servers (RHEL and its clones, Debian stable, released Ubuntu versions) are not affected. Below we sum up what is known as of Saturday morning and show you how to check your machines.
What happened?
A developer, Andres Freund, noticed that on a Debian unstable system SSH logins were using an unusual amount of CPU and were half a second slower than usual. At the end of his investigation it turned out that the slowdown was caused by code hidden in the new version of xz. On 29 March he described what he had found in detail on the oss-security mailing list.
The key points:
- The malicious code is in the release packages (tarballs) of xz 5.6.0 (end of February 2024) and 5.6.1 (early March). Among the source files there are files disguised as test data that actually contain a precompiled piece of program code, and the build script of the release package smuggles this into the
liblzmalibrary at compile time. - The injection only happens under certain conditions: on the x86-64 architecture, on glibc-based Linux, with GCC and the GNU linker, when building a Debian or RPM package.
- The OpenSSH server (
sshd) does not useliblzmaon its own. However, several distributions patch OpenSSH so that it loadslibsystemdfor systemd notifications, and that in turn loadsliblzma. This is how the malicious code gets into thesshdprocess. - According to the analysis so far, the code hooks into public key authentication (it hijacks OpenSSL’s
RSA_public_decryptfunction), so it probably allows unauthorised remote access. The exact mechanism is still being examined.
The changes were released by one of the project’s co-maintainers, as the result of weeks of work. Whether that person is behind it, or their account was compromised, is not yet known.
Which distributions are affected?
The vendors released their first advisories yesterday afternoon and evening. The situation as of Saturday morning:
| Distribution | Affected? | Action |
|---|---|---|
| RHEL, AlmaLinux, Rocky Linux, CentOS 7 and Stream | No | Nothing to do |
| Fedora 41 and Rawhide | Yes | According to Red Hat, don’t use them for work; Rawhide has reverted to the 5.4 branch |
| Fedora 40 (beta, updates-testing) | Possibly, if xz-5.6.0-2.fc40 was installed |
sudo dnf upgrade or sudo dnf distro-sync to the 5.4.6 package |
| Debian 12 and 11 (stable, oldstable) | No | Nothing to do |
| Debian testing, unstable, experimental | Yes (from 5.5.1alpha-0.1 to 5.6.1-1) | Update to the 5.6.1+really5.4.5-1 package (DSA-5649-1) |
| Ubuntu | Released versions are not | The affected package has been removed from the noble-proposed repository of 24.04, which is under development |
| openSUSE Tumbleweed and MicroOS | Yes (between 7 and 28 March) | Update to the 20240328 snapshot or newer; with SSH open to the internet, a fresh installation is recommended |
| SUSE Linux Enterprise, openSUSE Leap | No | Nothing to do |
| Kali Linux | Yes, if updated between 26 and 29 March | Update liblzma5 |
| Arch Linux | The package is affected (5.6.0-1, 5.6.1-1), but Arch’s sshd doesn’t link liblzma |
pacman -Syu (5.6.1-2) |
Proxmox VE is based on the stable release of Debian 12, so based on Debian’s advisory it is not affected. The US cybersecurity agency, CISA, also recommends that anyone using xz 5.6 should revert to an uncompromised version, such as 5.4.6.
How to check your servers
First, check which xz version is installed. On any distribution:
xz --version
Debian, Ubuntu, Kali:
dpkg -l xz-utils liblzma5
apt-cache policy liblzma5
RHEL family, Fedora, openSUSE:
rpm -q xz xz-libs # RHEL, AlmaLinux, Rocky Linux, Fedora
rpm -q liblzma5 # openSUSE
Arch Linux:
pacman -Q xz
If the output shows 5.6.0 or 5.6.1 (and not Debian’s fixed package marked “really5.4.5” or openSUSE’s marked “revertto5.4”), the machine may be affected. You can also check whether sshd loads liblzma:
ldd /usr/sbin/sshd | grep -E 'liblzma|libsystemd'
On Fedora it’s also worth checking whether the affected package was ever installed, not just what is installed now:
dnf history info xz
Don’t forget the “hidden” machines
Most of your servers probably run a stable release, but the xz backdoor can hide where you wouldn’t look for it:
- Container images: images based on
debian:testing,debian:sid,archlinuxoropensuse/tumbleweedmay have contained the affected version in recent weeks. Rebuild them, and check the running containers too. - CI/CD runners and build machines: if the pipeline runs in a rolling or testing image, the affected library may also have got into the build artefacts.
- Developer machines and test servers: Fedora betas, Tumbleweed, Arch and Debian unstable are popular developer systems.
- xz compiled from source: if someone installed version 5.6 “by hand” under
/usr/local, the package manager doesn’t know about it.
What to do if you find an affected machine
- Update or revert the package to your distribution’s fixed version, and restart
sshd(or the whole machine). - If SSH was reachable from the internet, treat the machine as compromised, as Fedora and openSUSE also recommend: updating the package doesn’t remove whatever a possible attacker left on the machine. The safe solution is to reinstall and restore the data from a verified backup.
- Change the credentials that were on the machine: SSH keys, API tokens, passwords, database credentials.
- Review the logs for unusual logins and outgoing connections, although a well-written backdoor doesn’t necessarily leave traces.
What can we learn from it?
It’s worth restricting SSH even where there is no known flaw at the moment. A server whose SSH port can only be reached from the VPN or from a few office IP addresses is a much smaller risk, even against a backdoor like this. You can read more about setting up a firewall and securing an SSH server in the knowledge base of our hosting brand, aWh.
The other lesson: production servers should run a stable release. Testing and rolling distributions bring new features quickly, but also bugs – and now a deliberately planted backdoor. The fact that the RHEL clones and Debian stable were left out of this is not luck, but the result of a slower, conservative release process; we also wrote about this in our article on Red Hat’s source code change and the clones.
The case is still fresh, and the details will certainly become clearer in the coming days, so follow your distribution’s security advisories. If you need help checking your servers or reinstalling a machine securely, get in touch; you can read about our operations services on the Infrastructure and operations page.