Skip to content

Lesson 5 of 14 · 15m

xz: The Build Is the Artifact

CVE-2024-3094 shipped only in release tarballs via disguised test fixtures — the git repo everyone reviewed was clean.

The git repo was clean. The tarball was not.

On March 28, 2024, Andres Freund — a Microsoft engineer working on Postgres — noticed that sshd logins on his Debian sid box were burning roughly half a second of CPU they shouldn't, and that valgrind threw errors profiling it. He pulled the thread and reached liblzma, the compression library inside xz-utils. xz versions 5.6.0 (February 24) and 5.6.1 (March 9) contained a backdoor, now CVE-2024-3094, rated CVSS 10.0.

Here is what made it the defining supply-chain incident: the malicious code did not exist in the git repository. The backdoor lived only in the release tarballs — the artifacts mirrors actually distributed — smuggled in as two binary "test fixtures," tests/files/bad-3-corrupt_lzma2.xz and tests/files/good-large_compressed.lzma. During a .deb/.rpm build, a build-to-host.m4 macro present only in the tarball extracted a disguised object file from the fixtures through a chained decode (head, tr, xz -dc in sequence), injected it into the liblzma build, and used an IFUNC resolver (crc64_resolve) to hook RSA_public_decrypt, EVP_PKEY_set1_RSA, and RSA_get0_key inside sshd — but only on glibc systems where sshd linked libsystemd, which pulled in liblzma. A correctly-keyed connection could then run arbitrary commands as root. The git tag was clean; the tarball shipped the weapon.

The two-year version of "trust me"

The payload wasn't committed by a stranger. JiaT75 (Jia Tan) had contributed to xz since late 2021, built credibility with real patches, and — helped by sockpuppet accounts (Jigar Kumar, Dennis Ens) pressuring long-time maintainer Lasse Collin about release cadence — gained commit and release rights in 2023. Collin was burned out and said so publicly. The takeover wasn't a credential theft; it was a two-year social engineering campaign that ended with the attacker legitimately being the release manager.

The wrong mental model

"Review the source, ship the tarball" assumes the tarball is a mechanical transform of the reviewed source. It isn't. Tarball generation runs autotools macros — m4 scripts most projects never review — and can include files git never saw. Everyone audited the repo. Nobody audited the build inputs, and the build inputs are what millions of machines ran.

Luck is also not a control. The backdoor reached Debian testing/sid, Fedora Rawhide and the F40 beta, Kali rolling, and openSUSE Tumbleweed — and was stopped only by freeze windows from reaching Debian stable, Ubuntu, or RHEL. Debian's remediation was to revert to 5.4.5 and rebuild from git; Fedora yanked 5.6.x from Rawhide. If Freund had a slightly busier week, the sshd of half the internet's rolling-release servers would have been a wiretap.

What closes the gap

  • Diff the artifact against the repo. git archive v5.6.0 versus the released xz-5.6.0.tar.gz — the m4 file and fixtures would have shown up immediately. Any delta between source tag and release artifact is a finding, not a curiosity. Debian's response was to start building xz from git, removing the tarball-delta channel entirely.
  • Treat test fixtures as code. Two opaque .xz binaries in tests/files were the exploit vehicle. Binary blobs in a source tree deserve the same review as source.
  • Reproducible builds. If your artifact can't be rebuilt bit-for-bit from declared inputs, you can't prove what's in it. This is the premise SLSA provenance exists to formalize.
  • Watch the maintainer graph. A package whose release permissions quietly migrated to a two-year-old pseudonymous account is a risk signal — the same signal as an npm owner change, at a slower timescale.

xz wasn't a packaging bug. It was proof that the artifact you run is a different object than the code you review — and that the difference is where attacks live.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.