XZ Backdoor — Breaching Trust in Open-Source Collaborative Development

What The Open-Source Community Can Learn From This Incident

Abdul Issa
InfoSec Write-ups

--

XZ Backdoor — CVE-2024–3094 (Source: Snyk.io)
XZ Backdoor — CVE-2024–3094 (Source: Snyk.io)

If you have been reading security feeds, news sites, Reddit or Discord discussions, you would have undoubtedly read about the recent vulnerability in open-source software XZ Utils that has shocked the cybersecurity community. We will explore what it is and why this was significant enough to cause a buzz in the industry.

In March 2024, a backdoor was discovered in XZ Utils, a popular open-source compression utility used in major Linux distributions like Red Hat, Debian and Ubuntu.

The backdoor’s detection was accidental, triggered when Microsoft developer Andres Freund, troubleshooting performance issues on a Debian system, observed and investigated abnormal CPU consumption resulting from a recent XZ Utils update.

The vulnerability was assigned, CVE-2024–3094 and a CVSS Score of 10 (Critical). The affected versions are the most recent versions 5.6.0 or 5.6.1 of XZ or liblzma which is a library included with xz-utils. The vulnerability seems to have originated from malicious and obfuscated code that was pushed into the library by one of its maintainers.

What is the buzz?

The XZ Utils backdoor incident has garnered significant attention in the security news for several reasons:

  • The sophistication of the attack
    The level of planning, patience, and technical expertise involved in the attack has captured the interest of security experts and the wider tech community.
  • The impact on trust in open-source
    The incident has raised concerns about the security and integrity of open-source software, which is relied upon by millions of users and organizations worldwide.
  • State-sponsored threats
    Speculation that the attack may have been perpetrated by a state-sponsored actor adds geopolitical significance to the incident.
  • Ongoing investigation and attribution
    The mystery surrounding the identity and motives of the attacker, as well as the ongoing investigation into the incident, has fueled speculation and interest in the story.

The discovery of a backdoor in XZ Utils, a widely used compression software for Unix-like systems, raises significant alarm. A backdoor introduces a covert entry point into the software, granting unauthorized access to systems. This compromises the security and integrity of affected systems, potentially resulting in unauthorized data access, manipulation, or system compromise.

This incident shook trust in open source by revealing vulnerabilities in collaborative development. It sparked concerns about software supply chain reliability and contributor trustworthiness, raising the possibility of unnoticed backdoors in critical Internet and digital infrastructure components.

It’s a wake-up call for the community to strengthen security measures and vigilance in open source development to maintain trust and fend off future threats.

What is XZ?

XZ Utils is a free and open-source collection of compression software utilities commonly used in Linux and Unix-like systems and employed for various tasks such as software distribution and system administration. It’s deeply ingrained in major Linux distributions such as Red Hat, CentOS, Debian, and Ubuntu ( including their derivatives) and is a key component for managing packages efficiently. Its reliability and efficiency have solidified its status as a standard tool in Unix-like operating systems, highlighting its broad adoption across industries and applications.

The malicious code made its way to the compression library release and subsequently reached the OpenSSH server (sshd), which depends on the affected library. This vulnerability enabled attackers with network access to the OpenSSH server’s listening port to execute arbitrary processes on the server and communicate with these processes.

Why did this happen?

In open-source projects, unlike their commercial or closed-source counterparts, revenue isn’t the driving force. Instead, the vast majority of contributors are volunteers who generously dedicate their time and expertise to projects they’re passionate about.

Unfortunately, this volunteer-driven model often means there are limited resources available for conducting comprehensive security audits, thorough code reviews, or robust supply-chain security assessments. As a result, vulnerabilities can persist undetected, posing significant risks to the integrity and security of the project.

The occurrence of a backdoor in XZ Utils highlights potential weaknesses in open-source collaborative projects.

While the popular belief suggests that “the more eyes on the code, the more secure it is,” this incident highlights the complexity of managing large-scale open-source projects.

Despite the collaborative nature of open-source development, vulnerabilities can still slip through the cracks due to various factors:

  • Lack of Oversight
    Open-source projects often rely on volunteer contributors who may not have the resources or expertise to thoroughly review code changes for security flaws.
  • Dependency Chains
    Projects like XZ Utils often rely on other open-source libraries or components, creating a chain of dependencies. A vulnerability in one component can cascade into the entire system.
  • Maintainer Burnout
    Maintaining open-source projects can be demanding, and individual maintainers may become overwhelmed, leading to delays in reviewing and addressing code changes.
  • Social Engineering
    Malicious actors may exploit trust within open-source communities, as seen in the case of JiaT75 pressuring the original maintainer to add new maintainers, eventually gaining control over the project.
  • Complexity
    Large projects like XZ Utils can be complex, making it challenging to detect subtle vulnerabilities, especially if they involve interactions between different components.
XKCD: Dependency (Source: https://xkcd.com/2347)
XKCD: Dependency (Source: https://xkcd.com/2347)

What does the timeline tell us about the attacker?

According to Akamai, the threat actor began contributing to the project nearly two years ago, gradually gaining trust until they were granted maintainer privileges, enabling them to introduce the backdoor. Wired traces their activity on GitHub back to 2021, marking their initial commit on the platform.

To expedite the acquisition of these privileges, the threat actor bombarded the already inundated maintainers with feature requests and bug reports, fabricating a false need for an extra maintainer role.

This cyber attack that has been brewing for a number of years demonstrated the patience, technical and social engineering prowess of the attacker(s).

This case demonstrated the long-term strategy, meticulous planning, and extraordinary patience of the threat actor, prompting well-founded suspicions that it could be the work of a nation-state seeking prolonged access and control over a significant number of Linux systems running OpenSSH server.

Supporting this theory is the careful inclusion of a private key, which ensures that access is granted only to the attacker aware of the backdoor, rather than anyone else who might stumble upon it inadvertently.

Cyber attribution and the mysterious threat actor

In the world of cyber attack attribution, it’s crucial to tread cautiously and avoid the rush to assign blame. Media narratives often lean towards labelling attacks as the handiwork of state nations like Russia, China, or Iran. However, the reality is far from black and white. Cyber adversaries, especially nation-states and Advanced Persistent Threat (APT) actors, possess a solid understanding of incident analysis and cyber attack attribution techniques, making definitive attribution challenging.

It is too easy to carry out a “Cyber False Flag” operation by a well-resourced adversary, nation-state or intelligence agency.

Cyber false flags refer to tactics applied by cunning perpetrators in covert cyber attacks to deceive or misguide attribution attempts including the attacker’s origin, identity, movement, and exploitation.(Source: Springer Open)

The Complexity of Cyber Attack Attribution (Source: Springer Open)
The Complexity of Cyber Attack Attribution (Source: Springer Open)

Theories circulating about the identity of the threat actor behind incidents like the XZ backdoor paint a complex picture. Some suggest habitual attributions to familiar adversaries like China and Russia, prompting reflection on biases and perceptions.

Dealing with sensitive, large-scale investigations and cyber attribution, calls for an unbiased and tempered approach, avoiding hasty conclusions without concrete evidence.

Let’s take Jia Tan’s attribution to China for example. A meticulously crafted persona like Jia Tan’s raises doubts about the simplicity of attributing the entity to China. Despite efforts to convey a convincing Chinese “hacker persona” through a carefully chosen name and activity patterns seemingly aligned with non-Chinese time zones and online presence, a closer examination reveals inconsistencies.

Contrary to the facade, activity during Chinese holidays, commits at odd hours, and alignment with European holidays and time zones suggest a more nuanced narrative.

On the other hand, this could have been a deliberate double-bluff to shift the suspicion away from a Chinese actor. Given the level of sophistication of the attacker and their incredible patience, anything is possible.

Jia Tan’s persona may serve as a cover, concealing the true origins and motivations behind the attack.

Patience, meticulous investigation and a deep understanding of cyber attribution and false flags are required by cyber breach investigators. These qualities are often lacking in media reporters and sensational media coverage of cyber attacks.

This cautious approach allows for a more comprehensive analysis of incidents, steering clear of oversimplification and bias.

How could it have been prevented?

Preventing similar incidents and maintaining security in open-source projects requires a combination of proactive measures and community vigilance. Here are several steps that could have been taken to prevent the XZ Utils backdoor incident and how open-source projects can enhance their security:

  • Thorough Code Reviews
    Implement rigorous code review processes where all changes are thoroughly inspected by multiple developers. This includes scrutinizing code contributions for any suspicious or potentially malicious code.
  • Access Control
    Restrict access to critical repositories and codebases. Only trusted contributors should be granted write access, and their contributions should be carefully monitored.
  • Identity Verification
    Implement mechanisms for verifying the identity of contributors. This could include requiring multi-factor authentication for repository access or validating contributors’ identities through external means.
  • Security Audits
    Conduct regular security audits of codebases to identify and address potential vulnerabilities. This includes both automated scans and manual reviews by security experts.
  • Dependency Management
    Keep track of project dependencies and ensure that they are regularly updated to the latest secure versions. Vulnerabilities in third-party libraries or components can pose significant risks to the overall project security.
  • Security Training
    Where possible (depending on the project funding), provide training and resources to developers on security best practices, Social Engineering awareness secure coding techniques, and general security awareness. Empowering developers with the knowledge and skills to identify and address security issues is crucial for maintaining project security.

In the case of XZ, several measures could have aided early detection of potential infiltration. Firstly, maintaining a thorough vetting process for new contributors, including background checks and verification of identity, could have raised red flags earlier. Of course, this may not always be possible for free and volunteer-based projects.

Additionally, implementing stricter access controls and limiting privileges for new contributors, especially those proposing significant changes to critical components like XZ Utils, might have thwarted malicious intent.

The most crucial point from this case study was the ability to recognize and address undue pressure on project maintainers to accept code commits without proper scrutiny.

Promoting a security culture of continuous vigilance and suspicion within an open-source project, where any unusual activity or code changes are promptly investigated, could have detected the presence of the backdoor sooner.

However, to prevent a reoccurrence, project maintainers should have adequate resourcing, vetted collaborators and a good degree of security awareness.

Conclusion

The unfolding tale of the XZ Utils backdoor incident leaves much yet to be uncovered. Fortunately, the impact appears limited, primarily affecting the latest Linux distributions that have adopted versions 5.6.0 and 5.6.1 of XZ Utils. For most users, the repercussions remain minimal. However, the incident serves as a stark reminder of the challenges inherent in open-source collaborative development and cyber attack attribution — a task often likened to an art form, shrouded in complexity and uncertainty.

At the heart of this saga lies the mysterious and intriguing figure of Jia Tan, whose identity and motives continue to elude investigators. Whether a lone individual, a fabricated persona, or the handiwork of a sophisticated threat group or nation-state actor, the true nature of Jia Tan remains a mystery.

Despite the uncertainty, the XZ Utils backdoor incident resonates as a wake-up call for the cybersecurity community. It highlights the vulnerabilities inherent in the open-source ecosystem and emphasizes the importance of robust security measures and heightened scrutiny within the community. While open-source development offers transparency and collaboration, it also necessitates diligence and vigilance to safeguard against malicious actors.

Commercial software houses have the resources and funding to train developers in security and ensure they adhere to strict company policies, however, open source projects are volunteer-driven with no budget for security awareness, and security training and often lack a strict set of policies for passionate contributors to adhere to.

Large enterprises bear a heavy responsibility for the critical open-source projects that underpin their software infrastructure. By offering financial support and resources, such as code reviews, security assessments, and maintenance assistance, they can bolster the resilience of these foundational projects, ensuring the stability and security of the broader Linux ecosystem.

In conclusion, the XZ Utils incident highlights the critical need for effective security measures, such as rigorous code reviews, access control, vulnerability assessments, and strict vetting of contributors. By embracing these basic principles, the open-source community can strengthen its resilience against emerging threats and uphold the integrity of its projects.

My final thoughts:

Will that thwart a determined nation-state attacker? Probably not. Was that the sole project “Jia Tan” meddled with? Perhaps not. It won’t thwart every threat, but it will aid the community in spotting or intercepting the next attempt at tampering or compromise sooner.

Thank you for your support and for visiting my blog. Your input and support are always appreciated!

Consider following my blog and subscribing to receive notifications 🔔, and let me know what type of content you’d like to see more of in the comments section.

CyberSecMaverick

--

--

Penetration Tester, Linux Evangelist, Security Geek, Blogs about Ethical Hacking, CTF, Cybersecurity Career & Certifications. www.linkedin.com/in/abdul-issa