XZ Utils 5.6.0 and 5.6.1 contain a backdoor, CVE-2024-3094, that unpacks a hidden program from a test file while software compiles.
Andres Freund disclosed the backdoor on 29 March 2024 on the Openwall oss-security list. Version 5.4.6 is the safe version.
What happened
Andres Freund found the backdoor after he saw that SSH logins were slower than normal.
- A contributor named Jia Tan gained commit access over about two years, according to the FAQ by Sam James.
- A script in
m4/build-to-host.m4exists only in the release tarballs. It runs at the configure stage. - Two test files hold the hidden program:
tests/files/bad-3-corrupt_lzma2.xzandtests/files/good-large_compressed.lzma. The build script decodes and runs it. - The hidden code hooks the ifunc resolvers in liblzma and redirects
RSA_public_decrypt(). - Many distributions patch OpenSSH to use libsystemd, which depends on liblzma, so a patched sshd loads the bad library.
The code activates only on x86-64 Linux with glibc, in a Debian or RPM package build. At runtime, the process must be /usr/sbin/sshd with no debugger. Snyk reports that 5.6.0 came out on 24 February 2024 and 5.6.1 on 9 March 2024.
Affected versions
- Bad: 5.6.0 and 5.6.1.
- Good: 5.4.6 and earlier.
- Snyk lists these distributions as having shipped the bad versions: Debian testing and unstable, Fedora Rawhide and Fedora 40, Kali Linux and openSUSE Tumbleweed.
Indicators of compromise
m4/build-to-host.m4in a tarball with the serial number changed from 3 to 30 (Snyk).- The files
tests/files/bad-3-corrupt_lzma2.xzandtests/files/good-large_compressed.lzma, added in commitscf44e4b7and74b138d2and reverted ine93e13c8. - Slower SSH logins on a system that runs a bad liblzma.
- A liblzma version string of 5.6.0 or 5.6.1.
How to check
On Debian or Ubuntu, read the installed package records for xz-utils and liblzma.
dpkg -l | grep -E "xz-utils|liblzma"
Use your distribution’s package records on other systems. To check a source tree, look for the changed build file.
grep -rl "build-to-host" . --include='*.m4'
What to do now
- Downgrade to xz 5.4.6 or apply the patched package from your distribution.
- Restart sshd after you update liblzma.
- Treat a system that ran a bad version with a reachable SSH port as possibly compromised, and review it.
- Rebuild any container image or package that you built with the bad tarball.
Frequently asked questions
Is my stable distribution affected?
Most stable releases used older XZ versions and were not affected.
Why compare release tarballs with the tagged source?
This attack lived in files that the repository did not have.
Sources
Send this page to the person who looks after AI at your company.