Well, thank you for waiting. It was, uh, quite intense from the, the stage. All right. So, thank you very much for attending this talk. Uh, I hope you will find it, uh, enjoyable. It's, uh, it's a, it's a cool story to tell and there is a lot to cover, so buckle up. So over the past, uh, few years, the security industry, uh, you know, investigated a lot of different security incidents. But only a few of them were truly sophisticated, meaning something that was really different than what we used to be. We can talk about, for example, the SolarWinds case, the Lopetia attack, or even the 3CX, uh, supply chain attack last year. But today I want to talk about, um, another attack which surpasses even the most sophisticated we've seen before. This is, uh, an undercover operation that lasted almost three years, which is very impressive in terms of technical details, but also the social engineering aspect is very impressive as well. So I'm going to talk about the XE backdoor story, the undercover operation that set the internet on fire. And I'm pretty sure that by the end of this presentation, your definition of what is a sophisticated, uh, a sophisticated attacker is will be changed. So I'm Thomas Rocha, I'm a senior threat researcher at Microsoft. I've been working on the XE campaign when it came out by, uh, uh, Andres Freund, which is, uh, a colleague of mine, and we, we, we discovered the, the backdoor itself. I'm French, as you probably may have heard, and I'm living in Australia, so I'm, I'm good with the jet lag now because it's been a week in, uh, in Vegas already. Uh, if you want to learn more about my work, you can visit my website, securitybreak.io, or you can, you can also follow me on Twitter. What I will cover in this presentation, first, how the backdoor was found. Then I will talk about the long term operation and the timeline itself. I will then deep dive into the technical details, and we will discuss about some assumptions. And finally, I want to conclude this presentation of what it means for us, for the security industry. Okay, this story began on Friday, 29th of March, at exactly 851 minutes, and it was uh, a message sent by Andres Froon to the OSS security DL list. With the, the subject, backdoor in upstream exit, Libel ZMA leading to SSH server compromise. So that's pretty much around that time, when I saw the, the email and read the investigation, that I started to investigate more about the backdoor itself and how it was working. But before, I want to talk a little bit about Andres and how he found the, the backdoor. Because on the internet, there was a kind of a legend where everyone was saying that the backdoor was discovered because of a 500 millisecond and uh, for, from Andres that triggered the investigation. The reality is a bit different. Actually, what triggered the investigation from Andres was that he found that the SSH login in some of the tested, the testing he was doing was actually failing. So he decided to investigate a little bit more to try to understand why the SSH was, the SSH logins were actually failing. And he discovered that there was a substantial CPU usage during the SSH and he found out the 500 millisecond delay which he identified, identified later in the new package uh, XE. And he said that, he said itself, it was a bunch of coincidences. So if we, if we have a look to how he discovered the backdoor, first, he saw that there was some issue with the SSH uh, login. Then he decided to investigate and then he found uh, a little bit of uh, amount of CPU uh, using by the SSH process. So he decided to investigate a little more and he found out that this amount of CPU usage was used by the Libel ZMA. But then, that's now which is becoming a little bit crazy because he actually used some specific setup which led him to find the backdoor. First, he decided to choose a Debian unstable which at the time of the release of the, the backdoor uh, only this kind of Linux version was affected by the backdoor. Then he chose to use a specific flag. And without the flag, this flag, he wouldn't have found uh, the, the backdoor because he was actually tracing the process using Valgrind and Valgrind complaining, complained about uh, the, the processes because of the flag he was setting up before. So that's super crazy because thanks to that, he was able to investigate and to find out the high CPU usage was in the SSHD processes below get CPU ID. Keep that information in mind because it will be interesting and important for the next part of the presentation. But you may wondering, what the fuck is uh, exe, exe-utils package? So, the exe, the exe-utils package is a free software, an open source software which is dedicated for lossless data compression through SDMA algorithm and exe. It, it, it is maintained by Lasikolin which is the main maintainer of the backdoor of the, sorry, of the, of the package since more than a, than a decade. The backdoor has been found in Libel ZMA in the version of exe-560 and 561. And it was introduced by a mysterious user called Jiatan in February 2024. The, the package, uh, and the backdoor affected mostly uh, development version so it was not widely deployed when Andres found the backdoor itself. And Red Hat assigned the vulnerability CVE 2024-30-94. There is something interesting here because you may wondering as well, why the exe-utils package has in, uh, has in any relation with uh, SSH? Well, I'm glad you ask. Because actually, the exe-util uh, uh, backdoor uh, package is widely used in many Linux uh, distribution and it's a trusted open source component for pro- for compression uh, and any kind of uh, optimization. The exe-util is, has been used in the open source industry for years and which is interesting is that open SSH is using the exe-compression to reduce the size of transfer data when you are doing a connection. So, quite interesting target for an attacker. Okay, I want now to talk about the timeline. And it's a bit uh, heavy. So, what I did, I actually split the timeline into five different phases. The first phase, the first phase which I called initial involvement of GATAN from October 29, 2021 to June 2021. June 29, 2022. So, during this phase, the user GATAN started to get, started to gain trust into the exe uh, project and started to do some commit and to work a little bit more. Which is interesting is um, during that phase as well, there was, there were additional persona that was part of a kind of a pressure campaign against Lassie Collin, the main maintainer of the exe package. To move the member, the um, the maintainership to another user. So, some additional personnel, persona such as Jigar Kumar and Dennis Hance have been part of this pressure campaign to put the pressure on Lassie Collin. And in June 29 of 2022, Lassie Collin started to mention GATAN as a co-maintainer already. Then in phase two, which I call transition of mentorship from September 27 of 2022 to March 18 uh, 2023. During this time, GATAN continued to contribute to the project to gain trust with uh, with the, the main maintainer and to the project itself. On October 2022, GATAN was added to the Tukeni organization on GitHub, which is the organization uh, that released the exe package. So, and then additional event as well during this time. Then during phase three, which I call preparation for the attack from March 2023 to January 19, 2024. During this time, a bunch of information happened as well. First, GATAN uh, updates the Google OSS first to send bugs to his own email. Then, another persona, Hans Jensen, sends patches for GNU indirect uh, function features, which is quite important as well. And uh, and GATAN also disables uh, iPhone support during the OSS first build, which is quite important because it's a kind of uh, evading some, some security protections. And then during phase four, which I call backdoor insertion and distribution from February 23 uh, to March 28 of 2024. This is where GATAN started to release the backdoor. So, in February 24, GATAN merged hidden backdoor binary code in kind of test files, which are actually fake text, test files. And then he released the version 5.6.0 with an additional file that was not present in the GitHub repository itself. And in March 9, uh, GATAN committed uh, an update of the backdoor because there was a bug and then he released the version 5.6.1, which was backdoored as well. And then on the last phase, phase uh, phase number 5, which I call discovery and response from March 28 to March 30, this is where Andres found the backdoor, started to alert and to send the email with his own investigation and this is where internet was on fire as well. But there is something which is interesting. I talk about the pressure campaign. So let me give you a little bit more detail about that. Cause this is quite interesting from the social engineering aspect. So first, I mentioned that some additional personas were part of this pressure campaign to move the mentorship of the, of the backdoor to someone else. So in March, uh, in April 2022, Jigar Kumar sent a message. Patches spend years. In May 2022, Dennis Hance, the, the other persona, sent another message as well and said, I asked a question here a week ago and I have not heard back. It has not updated in over a year. Is there a plan for this thing in the future? Lassie Colleen, which at the time was getting all these messages from these personas and so on. Jiatan has helped me at least with exe-utils. And he might have a bigger role in the future. It's clear that my resources are too limited. In May 2022, Jigar Kumar and so on. Over a month and no closer to being merged. Not a surprise. Jigar Kumar sent another message. Progress will not happen until there is a new maintainer. The current maintainer lost interest or doesn't care to maintain anymore. Quite aggressive. Then on June 2022, Lassie Colleen and so on. My ability to care has been fairly limited, mostly due to long term mental health, but also due to some other things. Jiatan may have a bigger role in the future. And he mentioned also, and I think this is quite important in this case, he mentioned it's also good to keep in mind that this is a non-paid OB project. In June 2022, Jigar Kumar sent another message. Right now you shock your repo. Why wait until 5 4 0 to change maintainer? Why delay what your repo needs? Dennis Ant sends a message. Why not pass on mentorship for exe for C so you can give exe for Java more attention? And then Jigar Kumar sent another message. Jia, this is the first time he actually talked to Jia. Jia, I see you have recent commits. Why can't you commit this yourself? And then Lassie Colleen replied on June 2022, on the day 29. Jiatan may have a bigger role. He is practically a co-maintainer already. Some change in mentorship is already in progress. Mission accomplished. Jiatan is no part of the project and he has a lot of more right to contribute. Alright, so now I want to talk about the technical details and how the backdoor was deploying and how the backdoor works as well. So remember, I mentioned that the user Jiatan deployed two different test files. The first one was bad3corrupt underscore lzma2 dot exe and the second one was goodlarge underscore compressed dot lzma. And additionally, when he released the latest version, version 5.6.0 of the exe package, he shipped the version with an additional file called build2host dot m4. If you are not familiar with m4 files, it's a kind of macro file used for configuration during the compilation process. And this file was present in the release but not in the repository. So let me talk a little bit more about the build2host dot m4 file. And I will focus here on the version 5.6.0. So what you see on the screen is just the malicious part of this file, just to focus on what it is exactly doing, but imagine that this file is super big with a lot of different configuration and a lot of legitimate actions. So the ones that you saw, you see on the screens, are only the malicious part. So first, you can see there is a variable called glam config make, with a grep, which actually looks for one of the malicious test files that have been released, and specifically the bad3corrup underscore lzma2 dot exe. Then we have, in number two, two additional variables. The first one, which is the trtool, trtool translate which is basically doing a kind of a substitution algorithm for part of the backdoor, of the file itself, the bad3. And the second one is actually showing the file, the test file, and making a sed to retrieve the extension of this file, exe, which will later be used as a common line. And as you can see, the translation of this piece of screen is the cat at the end of the presentation. So basically, transforming the file itself and decompressing using exe, the file which has been deobfuscated kind of using tr. So here you have a look of what was the original bad3corrup lzma2 file before the decryption, the, the, the, the, the substitution and the, the decompression using exe. And you have the malicious script on your right. So if you have a look to this malicious script, there is some interesting information here. So first, I, I like to comment, which is actually an exact decimal string. So today, we still don't know what is exactly this string, but I believe, because in version 5.6.1, this exact decimal string was not the same. So I believe this string was potentially related to a kind of a versioning number. Then we have a bunch of, uh, head command which are used to manipulate input data stream. And at the end, we have the stash3 and backdoor extraction because in the bad3corrupt, uh, uh, in the, in the bad3corrupt lzma and the second file, the goodlargecompressed lzma, there is the next part of the, of the, the release of the backdoor and also the decompression of an object. I will come to it later. I just give me, let, let me give you a look, a deeper look of what the file, what the script is doing to release the next part. So first, is decompress the second malicious file. Remember, the second test file, goodlarge underscore compressed dot lzma. That cons, contains the stash3 and the binary backdoor. It remove a, a, a bunch of junk data and unus byte, cause the file is a bit obfuscated. There is again a custom substitution cipher using TR. And then, all the, the deciphered data are decompressed again using Xs. Which lead to the stash3, which is another script, which is doing a bunch of checking during the compilation process. So let me walk through some of the checking this stash3 is doing. First, it's checked for the iPhone support. Remember, previous commit, we discussed about it. Keep that in mind for the, for the next part. Then it verify CRC source file, CRC64 underscore fast C, and CRC32 underscore fast C. For require iPhone code, because the backdoor require this feature. There is a bunch of multiple checks. It verify the version of the Linux system, uh, validate the GCC comp, compiler, check for the previous two test file, because if the two test file are not present, there is no need to continue to deploy the backdoor. So it's a kind of protection. It ensures position independent code. And also, it extract the backdoor from the, the test file, good large compressed dot LZMA. And this backdoor, ex, uh, extracted from this file will be embedded into the, the object file, libLZMA LA dash CRC64 dash fast dot O. Then, there is a modification of a function, isArchExtensionSupported in CRCXX86CLMUL dot H, and it replaces getCPUID with two underscore, with getCPUID with one underscore. Remember getCPUID was where address trust the execution of the backdoor and the amount of CPU usage. So I want to talk a little bit about the backdoor extraction itself, because it's quite interesting how the attacker did it as well. So in the code, there is a, a piece which is using the AWK func, um, tools from Linux, and this is actually doing like a kind of a RC4 like algorithm to decrypt the payload itself that will be later stored into the libLZMA LA CRC64. So quite interesting to see that as well. So, to recapitulate a little bit the compilation process, because I know it could be quite uh, quite complex. So first we have the execution of the macro file, the build to host dot info, which is executed and subsequent scripts are also executed. It run all the checks, and it create the make file if previous conditions are met. Because there was a bunch of information, if all the conditions are not met, then the backdoor is not released. Then during the make process, there is a backup of the original file, which has been backdoor, and libLZMA LA CRC64 fast dot O. There is a backup because if something, something goes wrong, the backdoor itself, I mean the, the code itself can push back the original file and so there is no track into the final release of the exe util package. There is also some specific compilation flags. I think, I think resolvers run at startup. Modification of the file CRC64 fast dot C and CRC32 fast dot C. And then finally, compilation, linking stage, manipulation and cleanup because the attacker did well, they also have a bunch of clean, cleaning up to avoid any forensic investigation or further, further investigation. And then at this point, we are here, malicious libLZMA is incorporated into the compiled libLZMA. So now I want to talk a little bit more about the backdoor itself and some of the functionalities. So first it's using the iFunc feature, which allows for dynamic resolution of function implementation during the run time, meaning it can load some specific feature at the run time. And actually the backdoor hijacks the iFunc resolver to allow the modification of the global offset table, which, which is a kind of a table with address to some specific functions. And here on the screen, what you can see is actually the malicious get CPU ID that will trigger the backdoor and continue the execution to the global offset table hijack. Another interesting feature about the backdoor is the usage of DL audit to set up the hook and to bypass Railroad and to intercept also redirect function, function call. If you are not familiar with Railroad, it's a kind of a memory protection space to avoid, uh, to avoid to have some, some space that could be vulnerable for some vulnerability exploitation. So what it is doing here, so first it's checking that the loaded target process is SSHD, because remember, it is our target here. And verify that the share library, and specifically Libel ZMA, because this is the, the, the, this is where the backdoor is loaded, is already present. Then it set up the DL audit structure to start the audit mechanism. And during the dynamic linking, so think about all these steps, uh, doing, doing the, the loading. It resolve and bind symbols. And then, the DL audit symbol function is called by the linker whenever a symbol needs binding. And if all the conditions are met, then it set the backdoor to the install hook function to install the, the hooking function that the payload will need later. There is also the global offset table, uh, redirect, which I mentioned is a kind of a table with a function address. And in that case, at the run time, the backdoor will manipulate this pointer into the global offset table to redirect codes to the main malware function. And if you have a look to the investigation, if you have a look to the, to the running at this time, everything will look like it's been called through the CPU ID functions. On top of that, there is additional evasion mechanisms and kind of obfuscation. First, there is a string obfuscation. In that case, what the backdoor is doing is looking for a tree structure. A tree structure is basically, uh, a corresponding reference between a string and a number. And what the backdoor is doing is looking for a specific number to retrieve the strings it needs for the execution of the payload. So if you, it's kind of a, if you are familiar, it's kind of API, API hashing, where you are retrieving the function code, uh, based on a specific hash. And in that case, the sample, the payload is, is looking for some specific string and for example, 0x1d0 is for RSA public decrypt, which is one of the function. Or for example, for 0x300 for the ELF header, which is used for the deployment mechanism as well. And you have some of the strings that was extracted by the backdoor and needed for the rest of the execution. So as I said, there is function hook that have been added by the, by the, by the payload itself. So first, what it is, what it, what it is doing, it's actually retrieving obfuscated string from the tree structure and one of the string which is important here are the RSA public decrypt function, which is a hook and the RSA get zero key function, which is also a hook. These two function are used in the latest SSH server version and are called when an RSA certificate is configured, is using for the authentication. Remember that because this is important. And the last function which have been hooked is the EVP PK set one RSA, which it's a little bit weird because it's not used in the latest SSH version, but probably that it has been set up for compatibility or probably for a specific environment. There is a bunch of other checks and evasion used by the sample, uh, by the payload. Here, there is an overview. So first, as we saw, it's, it's checks that the current process is well SSHG because there is no need to deploy the backdoor if we, if we are not running, uh, if SSHG is not running. It check for a potential kill switch. So this one is not very clear. This is a string that was present into the malware itself, the payload, but it's not very clear what's the goal, what was the goal of this string. Some researcher are thinking that it could be like a kind of a kill switch. If the backdoor see the, this, uh, strings into the, the environment, the memory, then it will not run. Potentially a kill switch. It also abuses the legit LZMA alloc function for memory allocation, which is required by the payload at some point. And there is also, it is, the backdoor is also hooking the logging function, meaning for every authentication through the backdoor, nothing will be logged into the, into the log of the machine. So that means it's also more difficult for forensic investigation and incident response. And there is a bunch of other advanced functionality such as encryption, anti-replay, it also embeds its own tiny embedded disassembler which is required at some point as well. But how the, how does the backdoor works really? So remember I said there is, uh, three main function that have been hooked. And which is interesting as well, is that the backdoor embeds three main function to be triggered. To trigger this function, there is kind of magic number, actually three magic number, and there is an operation which is used by the backdoor itself, which is magic one multiplied by magic two, plus magic two, which, which will give us the common number that will be triggered by the payload itself and the backdoor. So the first one, command zero and command one, is actually an SSH authentication bypass using root login. Second one is a remote code execution via systemd, cmd2. And the third one is, uh, cleaning a closed pre-authentication that have been previously opened. And if you pay attention to the, to the diagram below, to trigger this specific, uh, command, the attacker have to embed the payload into an RSA certificate that will be read by the, by the backdoor server during the authentication. And then there is a bunch of decryption. Of course, to exploit this specific backdoor, there is an upcoded certificate used, so that means only the attacker itself can login to the compromise server because he already have the private key. So to give you a little more details of how works the certificate payload, so you have here a kind of an overview of what is inside the certificate itself. So first, this certificate is used to the connection to the SSH, uh, to the SSH, uh, process to the backdoor server. Then there is an exchange of the public key, and this public key, there is also a SHA256 which is calculated as well. So let me give you an overview of the certificate itself. First, if you have a look, it's a normal RSA certificate, but there is some interesting information. In the IV, I call that the IV because it's used later, the, this IV is actually the magic numbers. Remember, the magic numbers are used to calculate the common number that will be interpreted by the, the server and, and the, the backdoor itself. And then, in the modulus N, uh, payload, in the, in the modulus N part of the RSA certificate, there is the payload which is encrypted in SHA20, 20, uh, SHA20, sorry. And this payload is decrypted using the outcoded ED448 public key that has been exchanged during the initiation of the connection, but only with the first 32 byte. And it's also using the IV, which are the magic numbers used, outcoded into the, the malicious RSA key, to decrypt the payload. Then, in the decryption of the payload, we have two main parts. The first, which is the signatures, which have been verified by the payload to be sure this is well, this is well the attacker that has been trying to connect. And we have the payload itself, which have been executed. And the signature is generated with the CMD value, which have been calculated. A five byte flag, which we don't know at this time what is it exactly. The payload itself, and the SHA256 that have been calculated from the ED448 signature. So a bunch of mechanisms to avoid also, uh, the replay of the certificate and to investigate a little bit more. And at this point, JITAN is in. So there is a small, um, let me show you. I did a small, uh, demonstration using, I did a small demonstration using, uh, a payload, using, uh, someone reused, um, uh, recoded, actually, the, the backdoor. So I reused this code. So on, on the right, you have the target, which is the attacker. So what I did here, uh, recompiled the backdoor itself with my own certificate, so I can reuse the code and authenticate like if I, like if I was the attacker. So you have the target on your right. On the, on the bottom you have the logs, because some researcher found that if you activate the verbose mechanism in the, in the logs and the configuration of SSH, there is a logging feature, uh, that appear and then there is some track, some trace into the, into the logs. So what I'm using here, I'm actually running the backdoor against my server, which I've been compromised. And here you can see, there is, what I did here is extracting some of the components that have been used to generate the RSA certificate used to authenticate to the compromised server. And as you can see here, you can see the OSCE, the SHA-256, the different magic number, the magic command, in that case it's number two, so I'm using the RCE, remote code execution. And then we have the certificate that have been sent to the compromised server. And if you look to the target here, I've been written a file called it's me, and that have been executed by, uh, the certificate itself. And this payload was actually part of the RSA, uh, key that are sent to the mal- to the compromised server. The second one is a, um, is a remote code execution as well, just to, uh, have, uh, a reverse shell and to be able to, uh, authenticate and to do some action onto the mali- onto the compromised server. So, okay. Okay, sorry about that. Okay, so you may wondering who is behind, uh, this attack. So, as I, as I discussed at the beginning, there was multiple personas involved into the, into the deployment of the backdoor for the pressure campaign against LaCie calling. So, remember, I talk about Jigar Kumar, Dennis Ants, and Ants Jensen, and Jiathan as well. So, what I did here, I wanted to know if, because we already had this, their, their email address, also their user name, and I wanted to understand if there is some connection or if the specific email addresses were known before or not. So, what I actually did, I look for some, uh, connection using this email address, especially for the Jiathan user, and I found out that there was only a few server, only a few website that was using this email address. What I found out as well is that for Jigar Kumar, with the ProtonMail address, I was able to recover the date of creation of this email address, which was on 2022 April, April 27, and which is interesting because this email address has been created just a day before Jigar Kumar sent the first email to the, to the Exe, uh, Utils, uh, uh, DL list and, and project. So, Jigar Kumar, Hans Jensen, and Dennis Hans was part of the first pressure campaign, and the second one, Mizo Heter and Krigorin was part of the second pressure campaign which occurred between the release of the version 5.6.0 and the release of the version 5, 5.6.1. And which is interesting is that if you have a look to the structure of this email addresses, they all have the same structures. They have a username, they have a number, and they all use, used a free email service. And also, what I wanted to discover is, does this email address are using, have been, for example, known in public data leak database. And I checked for all of them, and all of them were not present in any of the public leak, leak database. And Brian Krebs, at the time of the investigation, when everyone was crazy about it, uh, said, it's super rare to have one email address which is not present in data leak databases, but it's even more rare to have multiple email address which are not present in any of the data leaks, which could give us some information about, you know, a really well-crafted, uh, operation. So, what can we do about it? Well, it's not an easy question, and I don't think I have the, the answer today, but here is some elements maybe to, you know, just to think about it. Maybe something that could be done specially on project like this one that have been widely used everywhere, would be to have like a strict contributor verification. Also to ensure that the builds are reproducible, meaning to have like the equivalent of the GitHub repository and the release of the tarball. Then hooded hooks and railroad protection, but as we saw in that case, the backdoor we are actually using, uh, bypassing for, of the railroad. And also improving dependency management could be a good way to improve issue like this one. There is also something which is important to keep in mind, which is, what does it mean for the security community and beyond? So first, I think it's important to keep in mind that the entire industry relies on open source tools, and as we saw for the XE utility package, some people are relying of a biased project such as the XE, uh, utility package. I think also the discovery of the backdoor itself was a mix of luck, coincidence and expertise because without the investigation of Andres, then we won't be able to, we probably wouldn't have been able to find the backdoor itself. So I think it's kind of important to think about it. I believe also, if you are, if you have a look to the sophistication, the mechanisms and the deep understanding of Linux operating systems, I believe it's also redefine what we call sophisticated attacker. And of course, as I said, there is no easy solution. Probably the knowledge of what I'm trying to do today, meaning explaining you how the backdoor is working and what the attacker did, is also maybe part of the solution because knowledge potentially is the key, so you are, you are well prepared for the next one. Of course, in 45 minutes, it's super difficult to give you the whole details. There is a bunch of technical, uh, details, uh, into the backdoor itself. There is a, a lot of information to cover. So I want to acknowledge, uh, all the researchers that have been working on it because they did a fantastic job and I really recommend you to have a look to the different blogs at the end if you want to learn more about it. And because, because of, uh, I mean, thanks to all their writer, we know a little bit more today how the backdoor works, but there is potentially more to discover and potentially stuff that we will never discover. And before to conclude on the presentation, I just want you to, to ask you a question to think about for potentially the, the rest of the day, the rest of the week or potentially the, the rest of your career. How many other JATAN do you think are paid, are, are paid to insert backdoors in open source project? And thank you very much for listening me today.