xz-utils Backdoor
A years-long campaign put a hidden SSH backdoor into a core Linux compression library. An engineer spotted it because logins got slower.
- Severity
- History books
- Difficulty
- advanced
- Companies
- Tukaani Project (XZ Utils), Debian, Red Hat, Microsoft
- Tech
- XZ Utils / liblzma, OpenSSH, systemd, Autotools build scripts, Linux distributions
- Root cause
- poisoned dependency, social engineering
The story
Quick (1 min)
On 29 March 2024, Microsoft engineer Andres Freund posted a warning: the xz compression tools, part of almost every Linux system, had been backdoored.
He'd noticed that SSH logins on his test machine were using too much CPU, about 0.5 seconds instead of 0.01. Digging in, he found hidden code in xz's library (liblzma) that could hijack the SSH server, potentially letting the attacker run commands on affected machines.
The backdoor was planted by someone using the name "Jia Tan", who had spent over two years becoming a trusted xz maintainer, helped by other accounts that pressured the original, overworked maintainer. The malicious code was cleverly hidden in test files and in release downloads that didn't match the public source code.
It was caught before reaching most stable Linux releases. It had reached some testing and development versions.
The lesson: open-source projects depend on a few unpaid maintainers, and patient social engineering can turn that trust into an attack.
Keep reading to the end to earn XP.Read. XP earned.
Engineer (2 min)
Where it hid. Freund: "The upstream xz repository and the xz tarballs have been backdoored."
- Repository: the bulk of the payload was obfuscated inside "test" files,
tests/files/bad-3-corrupt_lzma2.xzandgood-large_compressed.lzma. - Release tarballs only: a modified
build-to-host.m4existed only in the release tarballs for 5.6.0 and 5.6.1, not in the git source. It injected an obfuscated script that ran at the end ofconfigure.
Selective activation. The build-time script only patched liblzma's Makefile when conditions matched, such as an x86-64 Linux target and a Debian or RPM package build (debian/rules present or RPM_ARCH = x86_64). It only works on glibc systems. At runtime it checked for things like argv[0] being /usr/sbin/sshd and TERM being unset, plus countermeasures to make analysis harder.
Why SSH? OpenSSH doesn't use liblzma directly. But several distributions patch OpenSSH to support systemd notification, which pulls in libsystemd, which depends on liblzma. Through that chain, the backdoored library was loaded into sshd, where it replaced an existing OpenSSH function with a malicious version (Wikipedia).
The slowdown that gave it away. Backdoored sshd logins took "about 0.5s on my older system" versus about 0.01s without it. Freund also saw valgrind errors. Starting sshd outside systemd didn't show the slowdown, a clue to the systemd link.
The long con. Wikipedia: starting in 2021, "Jia Tan" built trust while suspected sock puppet accounts (for example "Jigar Kumar") pressured original maintainer Lasse Collin, until Jia Tan got maintainer permissions and introduced the backdoor in February 2024.
Interview takeaway: compare release artifacts with source, build from source in hermetic and reproducible pipelines, minimise transitive dependencies in privileged processes, and investigate small performance anomalies.
Keep reading to the end to earn XP.Read. XP earned.
Deep dive (2 min)
Timeline (Wikipedia, Openwall, CISA)
- 2021: "Jia Tan" begins contributing to XZ Utils.
- 2021–2023: suspected sock puppet accounts pressure maintainer Lasse Collin to add maintainers. Jia Tan eventually gets maintainer permissions.
- February 2024: the backdoor is deliberately included; versions 5.6.0 and 5.6.1 are affected.
- Weeks before 29 March: Andres Freund notices odd symptoms on Debian sid (unstable): slow, CPU-heavy SSH logins and valgrind errors.
- 29 March 2024: Freund posts to oss-security on Openwall. CISA issues an advisory recommending rollback to an uncompromised version. CVE-2024-3094 is assigned a CVSS score of 10.0.
- Following days: Red Hat, SUSE, Debian and other distributors revert to older versions. GitHub temporarily disables the XZ repository.
- 30 March 2024: project email forwarding to Jia Tan stopped.
- 9 April 2024: Collin regains access to GitHub. 29 May 2024: version 5.6.2 released with the backdoor removed.
- August 2025: Binarly finds at least 35 Docker Hub images still containing the backdoor, including old Debian development images (Wikipedia).
The trigger conditions (Freund)
- Targets only x86-64 Linux, and only builds as part of a Debian or RPM package.
- Only works on glibc-based systems.
- Runtime checks include
TERMnot set andargv[0]being/usr/sbin/sshd.
Why it nearly worked
- Trust built over years, not a quick break-in.
- Source vs release mismatch: reviewers reading the git repository wouldn't see
build-to-host.m4changes. - Payload in binary test files, which people rarely inspect.
- Transitive dependency path into sshd through a distribution patch, which nobody would think to check.
Why it was caught
Curiosity about a half-second slowdown and some valgrind warnings, plus one engineer's willingness to dig into "probably nothing." It's frequently cited as lucky as much as systematic.
Keep reading to the end to earn XP.Read. XP earned.
Failure replay
Step by step, what broke and what it hit next. Showing the key steps. Switch to Engineer or Deep dive for every step.
- 2021–2023Jia Tancompromised
A new contributor builds trust in XZ Utils while sock puppet accounts pressure the tired original maintainer.
Affects: XZ maintainer access
- 2023XZ maintainer accesscompromised
Jia Tan is given maintainer permissions on the project.
Affects: xz 5.6.0 and 5.6.1 tarballs
- Feb 2024xz 5.6.0 and 5.6.1 tarballscompromised
Obfuscated payloads hide in binary test files, and release tarballs carry a modified build script not in git.
Affects: Distro builds
- Feb–Mar 2024Distro buildscompromised
Only on x86-64 Debian or RPM package builds, the script patches a backdoor into liblzma.
Affects: sshd
- Runtimesshdcompromised
Via the systemd patch, libsystemd loads liblzma into sshd, and the backdoor replaces an OpenSSH function.
- Mar 2024Andres Freunddegraded
SSH logins on Debian sid take about 0.5s instead of 0.01s, with valgrind errors. He investigates.
Affects: sshd
- Mar 29, 2024Distro buildsrecovering
Freund reports on oss-security. CISA advises rollback and distributions revert to older xz versions.
Impact
- Who was affected
- Systems that installed XZ Utils 5.6.0 or 5.6.1, mainly testing and development distribution versions (such as Debian sid); caught before most stable releases shipped it.
- How long
- Backdoored releases existed from February 2024 until discovery on 29 March 2024; the trust campaign ran from 2021.
- Cost
- not disclosed
Lessons
- Release artifacts can differ from source; build from source and compare.
- Maintainer burnout is a security risk; pressure campaigns can transfer control to attackers.
- Binary test files and build scripts can hide malicious code.
- Privileged processes like sshd should load as few transitive libraries as possible.
- Investigate small anomalies; a 0.5-second slowdown exposed a major backdoor.
Quiz
What first made Andres Freund suspicious?
The answer is SSH logins using a lot of CPU, about 0.5s instead of 0.01s, plus valgrind errors. He investigated the slowdown on Debian sid and found the backdoor.
Check answer
SSH logins using a lot of CPU, about 0.5s instead of 0.01s, plus valgrind errors. He investigated the slowdown on Debian sid and found the backdoor.
Where was part of the backdoor hidden so that reviewers of the git repository wouldn't see it?
The answer is In release tarballs only, via a modified build-to-host.m4 not present in git. Freund noted the injecting build script existed only in the distributed tarballs.
Check answer
In release tarballs only, via a modified build-to-host.m4 not present in git. Freund noted the injecting build script existed only in the distributed tarballs.
How did "Jia Tan" gain the ability to publish releases?
The answer is Through over two years of contributions plus a sock puppet pressure campaign, until they were made maintainer. Wikipedia describes a multi-year campaign starting in 2021.
Check answer
Through over two years of contributions plus a sock puppet pressure campaign, until they were made maintainer. Wikipedia describes a multi-year campaign starting in 2021.
Which XZ Utils versions contained the backdoor?
The answer is 5.6.0 and 5.6.1. CISA advised rolling back from 5.6.0 and 5.6.1; 5.6.2 removed the backdoor.
Check answer
5.6.0 and 5.6.1. CISA advised rolling back from 5.6.0 and 5.6.1; 5.6.2 removed the backdoor.
Interview prep
Try answering out loud before you open the model answer.
- security
How did the xz backdoor end up inside sshd when OpenSSH doesn't use xz?
Show model answer
Several Linux distributions patch OpenSSH to support systemd notifications, linking sshd against libsystemd. libsystemd depends on liblzma from XZ Utils. So the backdoored liblzma was loaded into sshd's process through a transitive dependency introduced by a distribution patch, where it replaced an OpenSSH function with a malicious version. This shows why privileged processes should minimise dependencies, and why distro patches expand the attack surface.
A strong answer hits:
- Distro patch adds systemd notify support
- libsystemd depends on liblzma
- Transitive load into sshd
- Minimise dependencies of privileged processes
How did your answer compare? - system design
How would a Linux distribution protect itself from upstream release tarballs that don't match the public source, as with xz?
Show model answer
Build from tagged source in version control rather than maintainer-supplied tarballs, or verify tarballs reproduce exactly from the tagged source. Use reproducible, hermetic builds and compare outputs across independent builders. Regenerate autotools output instead of trusting shipped configure scripts. Flag binary blobs and test fixtures that change between releases. Track maintainer changes and require extra review when trust shifts. Distribute packages with provenance attestations.
A strong answer hits:
- Build from VCS or verify tarball reproducibility
- Regenerate generated files
- Reproducible hermetic builds
- Review maintainer changes and binary blobs
How did your answer compare? - behavioural
You notice a small, unexplained performance regression after a dependency update. It's probably nothing. What do you do?
Show model answer
Investigate, at least briefly: reproduce it, profile it, and bisect to the change that caused it. Andres Freund's curiosity about about 0.5 seconds of extra SSH login time uncovered the xz backdoor. Unexplained behaviour changes in dependencies deserve a look, and if something looks suspicious, report it responsibly to maintainers, distributions or security lists rather than staying silent.
A strong answer hits:
- Reproduce, profile, bisect
- Treat unexplained changes as signals
- Report responsibly
How did your answer compare?
Go deeper
- Official postmortembackdoor in upstream xz/liblzma leading to ssh server compromiseoss-security (Andres Freund), link checked 2026-11-25
- AdvisoryReported Supply Chain Compromise Affecting XZ Utils Data Compression Library, CVE-2024-3094CISA, link checked 2026-11-25
- ArticleXZ Utils backdoorWikipedia, link checked 2026-11-25