The XZ Backdoor Story: The Undercover Operation That Set the Internet on Fire
This talk provides a technical breakdown of the sophisticated supply chain attack targeting the XZ Utils compression library. The attacker, operating under the pseudonym 'Jia Tan', gained maintainer status through a long-term social engineering campaign to inject a malicious backdoor into liblzma. The backdoor specifically targeted OpenSSH by hooking functions to enable remote code execution and authentication bypass. The presentation details the multi-stage compilation process, the use of obfuscated scripts, and the specific mechanisms used to hide the malicious payload.
The XZ Backdoor: Anatomy of a Three-Year Supply Chain Heist
TLDR: The CVE-2024-3094 vulnerability was not a simple coding error but a calculated, multi-year social engineering operation targeting the XZ Utils compression library. By gaining maintainer trust, the attacker injected a sophisticated backdoor into
liblzmathat specifically hooked OpenSSH authentication to enable remote code execution. This incident highlights the fragility of the open-source ecosystem and the critical need for rigorous build-time integrity checks in software supply chains.
Security researchers often focus on the latest zero-day in a web framework or a clever bypass in an authentication flow. We rarely stop to consider the integrity of the build tools themselves. The XZ Utils compromise serves as a brutal reminder that the most effective way to compromise a target is not to find a bug in their code, but to become the person who writes it. This was not a drive-by exploit; it was a patient, three-year campaign to subvert the trust model of a foundational Linux utility.
The Mechanics of the Compromise
The attacker, operating under the pseudonym "Jia Tan," did not just push malicious code. They spent years contributing legitimate patches to XZ Utils to build credibility with the project's maintainer, Lasse Collin. Once they achieved maintainer status, they began the process of embedding a backdoor that would remain dormant until the final build stage.
The backdoor was hidden within the liblzma library, specifically targeting the compilation process. The attacker used a multi-stage injection technique. During the ./configure phase, a seemingly innocuous macro file, build-to-host.m4, was executed. This file contained obfuscated scripts that extracted a malicious payload from test files included in the source distribution. These test files, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma, were not actually corrupted; they were containers for the second stage of the attack.
The script used tr and sed to de-obfuscate the payload, which was then used to patch the liblzma object files during the make process. By the time the library was compiled, the malicious code was already part of the binary. This approach is particularly dangerous because the source code in the repository appeared clean to anyone performing a cursory audit.
Hooking the Authentication Flow
Once the backdoor was compiled into liblzma, it needed a way to execute. The attacker targeted OpenSSH, which links against liblzma for compression. The backdoor utilized the IFUNC (Indirect Function) feature, which allows for dynamic resolution of functions at runtime. By hooking the RSA_public_decrypt function, the backdoor could intercept authentication attempts.
When an SSH connection was initiated, the backdoor checked for a specific, hardcoded public key. If the provided signature matched the attacker's private key, the backdoor would bypass standard authentication and execute an arbitrary command provided by the attacker. This command was passed through the system() function, effectively granting the attacker remote code execution with the privileges of the SSH daemon.
To maintain stealth, the backdoor used dl_audit to hook the dynamic linker. This allowed it to intercept function calls and hide its presence from standard monitoring tools like valgrind or perf. The attacker even included a "kill switch" mechanism, where the backdoor would check for the presence of specific environment variables or strings in memory before executing, ensuring it would only trigger in the intended target environment.
Pentesting the Supply Chain
For a penetration tester, this incident changes the scope of what we consider "in-scope." If you are assessing a client's infrastructure, you are likely looking for misconfigurations or application-level vulnerabilities. However, the XZ incident proves that the build pipeline is a valid and high-value target.
During an engagement, look for discrepancies between the source code and the deployed binaries. If a client uses custom-compiled versions of open-source tools, verify the build process. Are they using reproducible builds? If the binary hash does not match the expected output of a clean build from the source, you have found a potential point of compromise.
Furthermore, this attack highlights the risks associated with A08:2021 – Software and Data Integrity Failures. When auditing a client's environment, review their dependency management. Are they pulling dependencies from untrusted sources or using versions that have not been vetted? The reliance on "hobbyist-maintained" projects for critical infrastructure is a systemic risk that needs to be addressed in any comprehensive security assessment.
Defending Against the Invisible
Defending against this level of sophistication is difficult. The primary defense is to move toward reproducible builds, where the same source code always produces the exact same binary. If your build process is non-deterministic, you cannot verify the integrity of your software. Additionally, organizations should implement strict dependency pinning and perform regular audits of their third-party libraries.
The XZ backdoor was discovered by Andres Freund purely by accident while investigating performance issues in SSH logins. We cannot rely on luck to secure our infrastructure. We must demand transparency in the software supply chain and treat our build environments with the same level of security rigor as our production servers. The next "Jia Tan" is likely already working on a project you depend on.
CVEs
Vulnerability Classes
Attack Techniques
OWASP Categories
All Tags
Up Next From This Conference

Breaking Secure Web Gateways for Fun and Profit

Listen to the Whispers: Web Timing Attacks That Actually Work

Abusing Windows Hello Without a Severed Hand
Similar Talks

Inside the FBI's Secret Encrypted Phone Company 'Anom'

Kill List: Hacking an Assassination Site on the Dark Web

