On 29 March 2024, a software engineer named Andres Freund posted a message to a public security mailing list. He'd been benchmarking a database on Debian's test version, and noticed something odd: logging in over SSH was using a lot of CPU and taking about half a second longer than it should.
Most people would have shrugged. He dug in, and found one of the most carefully planned attacks on open-source software ever discovered: a backdoor in XZ Utils, a compression tool installed on almost every Linux system in the world.
Note: How we checked
The technical details come from Andres Freund's original disclosure on the oss-security mailing list, the CISA alert published the same day, and the NVD entry for CVE-2024-3094. Where his post gave a hypothesis rather than a confirmed fact, we say so.
What is XZ Utils?
XZ Utils is a free, open-source data compression library and tool (.xz files), like ZIP but for Linux. Its library, liblzma, is used by many other programs, including parts of the system that start and manage services. It's the kind of quiet, essential component nobody thinks about, maintained for years mostly by one volunteer.
The long con
The attack wasn't a quick break-in. It was a patient social engineering campaign:
- Starting around 2021, a contributor using the name "Jia Tan" began sending helpful, high-quality fixes to the XZ project.
- Around the same time, other accounts (widely believed to be linked) appeared on the mailing list complaining that the project was slow and pressuring the tired original maintainer to bring in help.
- Over time, Jia Tan earned trust and became a co-maintainer, with the power to publish official releases.
- In early 2024, Jia Tan published versions 5.6.0 and 5.6.1, containing the hidden backdoor.
A two-year attack
- 2021: "Jia Tan" starts sending helpful fixes
- 2022 to 2023: pressure on the maintainer; becomes co-maintainer
- Feb to Mar 2024: backdoored 5.6.0 and 5.6.1 released
- 29 Mar 2024: Andres Freund reports it
No password was stolen and no server was hacked. The attacker simply became a trusted insider of a project that thousands of systems depended on.
How the backdoor was hidden
This is the clever part. The malicious code was split up and disguised so that people reading the source code would see nothing wrong:
- Most of the payload was hidden inside two "test files": binary files meant to look like deliberately corrupted compressed data, used for testing. Nobody reads binary test files by eye. Freund noted they weren't even used by any tests.
- The trigger was not in the Git source code at all. It was in a build script (
m4/build-to-host.m4) that only existed in the release tarballs, the downloadable.tararchives that Linux distributions use to build packages. Anyone checking the code on GitHub saw a clean project. - During the build, that script quietly extracted and ran the hidden code, and only when building on x86-64 Linux, with the usual compiler, as a Debian or RPM package: exactly how the big distributions build. Everywhere else, it stayed dormant.
Why it targeted SSH
SSH is how administrators log into servers remotely. Getting into SSH means getting into the machine.
OpenSSH doesn't use liblzma itself. But several distributions, including Debian and Fedora, patch OpenSSH to talk to systemd (the service manager), and the systemd library does load liblzma. So the chain was:
How the backdoor reached SSH
- SSH server (sshd): doesn't use liblzma itself
- libsystemd: added by a distribution patch
- liblzma 5.6.0 / 5.6.1: backdoored
Once loaded, the backdoor used a dynamic-linker feature to replace a function SSH uses to check cryptographic keys. Freund's analysis found it ran before authentication and concluded it likely allowed remote access or code execution. Later researchers confirmed that it let someone holding the attacker's secret key run commands on the server, before logging in, while everyone else saw nothing unusual.
In other words: had it spread, its author could have logged into a huge number of Linux servers on the internet.
How it was caught
The backdoor's code did a lot of work, and that work took time. On Freund's machine:
- An SSH login attempt that normally took about 0.3 seconds took about 0.8 seconds.
- A memory-checking tool (Valgrind) reported strange errors in liblzma.
The half second that exposed it
- Normal SSH login: ~0.3 s
- With the backdoor: ~0.8 s
He traced the slowdown into liblzma, found the obfuscated code, and reported it to the distributions and on the mailing list. Red Hat assigned it CVE-2024-3094, which received the maximum severity score of 10.0. CISA published an alert the same day telling everyone to downgrade.
How bad was it?
Because the bad versions were only weeks old, they had mostly reached testing and fast-moving distributions, not stable ones:
- Affected: Fedora Rawhide and the Fedora 40 beta, Debian unstable and testing, openSUSE Tumbleweed, Kali Linux and some others that ship new versions quickly.
- Not affected: stable releases such as Debian 12, Ubuntu LTS releases and Red Hat Enterprise Linux, which still shipped older XZ versions.
Distributions rolled back to a clean 5.4.x version within hours. Weeks later, the backdoored code would have reached stable releases, and the world's servers.
Check your system
xz --version Versions 5.6.0 and 5.6.1 were backdoored. If you see either, update with your package manager; distributions have long since replaced them.
What it taught the industry
- Open source runs on overworked volunteers. A critical library had essentially one unpaid maintainer, which made him vulnerable to pressure. Companies that depend on such projects now fund and support them more, though not enough.
- Source code and release files can differ. The trigger hid in tarballs, not in Git. Projects increasingly build release artifacts directly and reproducibly from the source repository, so anyone can check they match.
- Binary test files can hide code. Reviewers now treat them with more suspicion.
- Defence in depth matters. Linking extra libraries into a security-critical program like SSH widened the attack surface. OpenSSH has since reduced this.
- Curiosity is a security tool. The attack failed because one engineer refused to ignore half a second.
Summary
- An attacker spent about two years becoming a trusted maintainer of XZ Utils, then hid a backdoor in versions 5.6.0 and 5.6.1 (2024).
- The trigger lived only in release tarballs; the payload in fake test files.
- It targeted SSH servers through the systemd library, allowing the attacker to run commands on affected machines.
- It was caught by Andres Freund because SSH logins got about half a second slower, before it reached stable Linux releases.
More on this kind of attack: how hackers actually break in and the 2025 npm attacks.
Sources
- Andres Freund — backdoor in upstream xz/liblzma leading to ssh server compromise (oss-security, 29 March 2024)
- NVD — CVE-2024-3094
- CISA — Reported Supply Chain Compromise Affecting XZ Utils Data Compression Library
This article was written with the help of AI tools and checked against the sources above.
Originally published on Lattey, where I write plain-English guides to security, DevOps and how computers work.
