Skip to content
RCE Write-up Advanced

Backdoor in XZ Utils allows RCE: everything you need to know

Malicious code was inserted into XZ Utils versions 5.6.0 and 5.6.1, which, under specific conditions, could allow remote code execution via SSH authentication in certain Linux distributions. The backdoor intercepts SSH authentication and executes attacker-supplied payloads.

Merav Bar Follow

Published on wiz.io

A backdoor has been identified in versions 5.6.0 and 5.6.1 of XZ Utils (assigned CVE-2024-3094), which under some conditions may allow RCE via SSH authentication in specific versions of certain Linux distributions.

Merav Bar, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The build process of XZ Utils was manipulated to inject malicious code that hooks into SSH authentication functions, allowing execution of attacker-controlled payloads.

Impact

Under specific conditions, an attacker could execute arbitrary code on affected systems via SSH authentication, potentially leading to full system compromise.

What the attacker needed

Affected XZ Utils version (5.6.0 or 5.6.1); Linux distribution using systemd notification in SSH; x86-64 architecture; Build as Debian or RPM package

The fix

The backdoor was removed in later versions; users should downgrade to versions earlier than 5.6.0 or apply updated packages from their distribution.

How it was found

  1. The attacker submitted malicious code to the XZ Utils project, which was included in releases 5.6.0 and 5.6.1.
  2. During the build process, an obfuscated script in the build configuration extracts and injects a precompiled object file into the liblzma library.
  3. The injected code modifies the liblzma library to hook functions used in SSH authentication, such as RSA_public_decrypt.
  4. When sshd (the SSH server) uses the compromised liblzma, the backdoor intercepts authentication attempts and checks for a special payload in the public key.
  5. If the payload passes verification, it is executed via the system() function, achieving remote code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A backdoor is hidden code that lets an attacker bypass normal security. Here, someone secretly added code to a popular compression tool, XZ Utils, so that when it was used by the SSH service (which lets people log in remotely), the attacker could run their own commands on the system. This only worked on certain Linux distributions and only if the tool was built in a specific way.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Merav Bar

View all

27 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.