What happened?
Through analysis of the oss-security mailing list, a review of the (now disabled) GitHub profile for user JiaT75, and several exceptionally helpful blogs from Evan Boehs, lcamtuf, Xe Iaso, and others we can piece together several events that span a multi-year effort to compromise this utility.
Several new accounts emerge in the xz-devel mailing list in the summer of 2022, and it’s generally assumed that many of them may have been ‘sock puppet’ accounts (fake online identities). Many of these accounts engaged with the xz project’s original maintainer, Lasse Collin, to complain or pressure them to add additional maintainers or hand over the maintenance to someone with more time. Some of these accounts emerged around June 2022, and were never seen posting again afterwards.
Excerpts below:
They exploited an all-too-common experience among tech professionals today – mental health and burnout. The maintainer had reported they had been working off mailing list with Jia Tan, who the maintainers claimed may be taking over some maintenance duties in the coming months.
This ‘Jia Tan’, which is also unlikely to be a real identity, appeared suddenly in the community in 2021 and 2022, gradually making contributions and eventually emerging as the second most-active contributor to the xz project. By early 2024, Jia had all the access and permissions needed to commit backdoored code into the build. There are other projects this account may have contributed to, and researchers are continuing to look for signs of malicious content in those projects.
Fortunately, one very diligent engineer at Microsoft, Andres Freund, identified that on a recent upgrade, ssh logins were taking a lot longer than normal (well, a lot in the land of CPU clock cycles and performance metrics, at least – 500 ms or so). This prompted a deeper investigation which Freund shared with the oss-security mailing list. In that post, he identified the root cause of his performance issues: a backdoor in the xz repository.
Let’s pause for a moment and understand the relationship between xz and ssh logins that led to this discovery:
-
Xz (which was previously known as lzma) is used for lossless data compression. It includes the xz command line utilities, as well as the library liblzma.
-
The OpenSSH utility is a widely popular suite of utilities based on SSH for secure client-server communication.
-
OpenSSH does not itself use liblzma or xz utils for its core functionality, however, several Linux distributions patch OpenSSH to facilitate support of systemd, which does have the dependency of lzma.
Author’s note: This is not the kind of thing you stumble into accidentally. The OpenSSH project has had several vulnerabilities over the years, and all gained immediate attention and urgent response because of the critical nature of secure communications. By targeting the xz project, Jia Tan was able to sneak into the ecosystem and position themselves for an exploit without attracting nearly the level of scrutiny that such an outsider might be faced with when attempting to gain maintenance rights on a project like OpenSSH.
The initial malicious commit from February introduced performance bugs, which is how Freund identified the issue. It appears that Jia Tan had also identified these performance bugs and had issued yet another upgrade with the “fix”. To clarify – the initial backdoored version (5.6.0) was both backdoored and buggy. The second backdoored version (5.6.1) was still backdoored, but less likely to cause performance impact and garner attention.
Jia Tan had also been in contact with other maintainers across the open-source community, pushing to get their ‘fixed’ version in quickly – possibly attempting to get ahead of the discoveries. It was noted that Jia Tan had added several binary test files over the years, so there may be concerns that other versions are also backdoored and yet to be confirmed.