It is my pleasure now, Césaire Pizzi, on problems. Hello to everyone. Thank you. Can you hear me? Everyone can hear me? Okay, great. Okay, let's start immediately. I have to fly a bit on the presentation because it's a bit, maybe a bit long, but okay, let's say I do my best to do everything. Okay, that's about me, let's skip it. So just a few information about me. I'm a security researcher. I work on a lot of open source projects. I developed in the past proof of concept for Arduino code injections, but that's not important. You can have a look to these things in my GitHub. I will leave you the reference at the end of the presentation. But let's start with the presentation of this research. So what I started to think was something about the invisible cloud, as I called it, of the sandboxes. We have a lot of tools out there, which popped out in the last, I don't know, five years. Sandboxes available for more or less everyone from our side. From other side, a lot of vendors that are trying to sell this kind of software to be installed in our environment. Or maybe another option is to install our own sandbox by using, for example, well-known tool like Cuckoo, for example, which is a great tool. And so we have a lot of these systems around. And what I thought is, okay, can we try to use them outside of what is their maybe intended usage? And so I started to try to make some thoughts about this. And so, okay, first of all, the sandboxes are usually isolated. So our environments are not able to go anywhere. But maybe we can try to do something about this. And so what if we can get access to these systems? For example, we can try to get some internal information that maybe are not mean to be disclosure. For example, serial numbers. For example, the first thing I thought was the serial number of the office installation, for example. Or maybe we can try to fingerprint the system to understand if you are in a sandbox. This we can see, we will see later that it's maybe done for some funny reasons. Or maybe use them as a bridge to go somewhere else, for example. And maybe other things as well. And so first thing, I try to do a quick list of sandboxes out there. These are, I know, this is not a complete list. We have tons of them. I just got this because they are more or less the most famous or in any case used. For example, for sure, Virustotal, everyone knows what is it. And also the others probably. But there are quite a lot. So I decided not to do this test manually, but to write a script to automate the actions. And so I would like to have, okay, I'd like to build something that allowed me to conduct this research. And that was done not reinventing anything, actually, sorry. But leveraging well-known tools like, for example, MSVenom from the Metasploit to create the payloads. Or maybe the 7-Zip self-extractor to create. What I would like to do is to create a kind of self-extracting executable that will have a callback function, a way to drop files, because I would like to bring with me some utilities on the sandbox itself. And maybe a kind of randomization, let's say a simple one, because we all know that the sandboxes are usually doing a basic check about the hashes. I would like to avoid this to trigger in any case, every time I upload the sample, a new analysis. So I created something to address this issue. And so that's not rocket science, just it's a quick and dirty Python script, nothing really special, but I will release it on GitHub, on my GitHub at the end of the DevCon. So you can try to use it, okay, you can write your own. It's the same, probably it's not so difficult to do it, but it allowed me to automate this research. So how it works, it's in some way the script itself, it's able to leverage the MSVenom capabilities to create a specific payload with a specific callback IPM port. It has the possibility to specify a folder where I can put my utilities, and also way to script my actions when I try to upload this on the sandbox. Okay, for example, here we can see an example of the drop folder. It's just a folder where I put all my utilities. For example, here you can see that I would like to upload on the sandbox the qrl.txe and the product-key.txe. Product-key.txe is an utility for Nimsoft, which is extracting the Microsoft Office product key, for example, from the system. And I would like to bring this on the sandbox itself. So at the end, when we run the script, I will have something like that. So a kind of self-extracting executable with some scrambled name, as you can see here, you see some .txt, .txt files, which are the qrl.txe we saw before. Scrambled names with scrambled content as well, because I would like, as I said, to avoid the hash detections. And so that is what will be created. Together with this, we will see also a setup.bat or setup.sh, which has an underscore at the beginning with the actions I would like to automate. Okay. The underscore means, okay, don't touch this file. Tag to my script to not touch the file, but just put it into the package without scrambling it, because in some case, I don't want to rename it. And so let's start with the case one. So I would like to try to get a reverse shell out from the sandboxes. So I run the script with this syntax here, very simple. And I uploaded it on all these sandboxes mentioned at the beginning. And this is the result. As you can see here, a lot of them gave me actually a shell. For some of them, it's not actually surprising. Any run, for example, allow you interactive access. So, okay, it's not a big issue. But for some other, maybe it's more surprising. And what I would like to stress is here, the behavior of Palo Alto and VirusTotal. Both of them gave me TCP callback, but then the connection went down. Like if there is a kind of IPS or something monitoring the outgoing connection of the system, probably they have something which was recognizing that I tried to open a reverse shell and they cut off the connection. But let's keep in mind this because we'll come back on this later on and we'll see something funny. Okay, now I have a reverse shell on the system, but why this is relevant? Why I should be worried about? Because I can actually extract information from them. Here, you can see I run the productkey.txt and I got the office installation product keys. I removed them from privacy here, obviously, but they were there. And so why this is important? That's really important from my point of view, from a point of view of a malware researcher, for example. But first of all, consider that this is a private information that probably someone don't want to disclose. Especially if you are running your own sandbox, this is something that you have to consider because, okay, if you are relying on something that is provided by an IT vendor, we don't care. We just use what our firewall vendor is providing us as a sandbox. But okay, it's their business if they are losing the office keys. If you are running our own, that's very important. But what is, in my opinion, the most important thing here is that this allows to leak information from this. And this allows the fingerprinting of the system. This is already happening. A lot of malware is doing this. I came across a sample a couple of weeks ago of the Okai keylogger, which the installer was checking for the username of the system. Username that they will get from probably VirusTotal or a sandbox like that one. And so that's really important because that means that if the sample is able to identify it, it can also be the analysis. So it can make the most undetectable sandboxes useless, let's say. Okay, this is a quick demo of what I did. So here I tried to upload a sample on the SND box. As you can see on your left side, yes, there was Metasploit running. As you can see, I got the reversal here. And then I was able to extract the product key, for example. Here, obviously, I removed. So let's go to the case 2. So I named it cross sandbox spawning. What it means, we saw that we have external access from the systems. So that means that also we can try to maybe try to run an attack against someone else. If I upload something that is doing, let's say, a SQL injection or something like that to a third-party site, I can do it. Again, this may be not very interesting for us if we are using third-party sandboxes, but if we are running our own, it's really important because someone could knock on our door and asking us why you did something wrong on that site. So this is something we need to keep in mind. Here, this is a simple setup I did on my script. So I just created this script here. As you can see, there is a qrl.exe running. In this case, not a real attack. It's just an upload of a file. But it would be interesting for the third case. So let's keep this in mind. So as you can see, the qrl.exe here is angle bracketed because it will be replaced automatically by the script with the scrambled name of the file when the file is renamed. So it will be done automatically by the script. And so this is the result of the test. As you can see, and I would like to stress, the Palo Alto and Virus Total sandboxes are allowing me to do this. And that will bring us to the third case. Okay. Why this is relevant? Because we have to consider a couple of things. One is that, okay, we can use something to proxy attacks to someone else. This is something that we can take in consideration. Second point, sometimes these sandboxes are really in our infrastructure. And sometimes we don't even have a real perception of that. Because, for example, our anti-spam vendor may have his sandboxes and maybe someone can just run an attack against someone else by sending an email to us, for example. Because it just executes the payload and so on. Other thing that is interesting is this example of zero effort exploit as described in Science on the Wire book, which is a great book if you work in security field. So have a read of it. So let's have a look to the demo as well. So here I'm uploading the demo on the site and then I'm looking for my on the hybrid analysis, which is a well-known sandbox. Then I created a fake site, just waiting for an info.php file to be uploaded. And we can see here that, okay, I got this file uploaded on the sandbox itself. And this worked for all the sandboxes we saw before. And that is bringing us to the third case. So let's try to do something creative to combine the two things we did before. So, okay, we saw that some of the sandboxes looks like preventing us to get access into leak information. But if we combine the second case, maybe we can do something. So I created another little script, which has been processed by my Python script, which is just combining the qrl.exe, so the upload of the file with the product key.exe. So I just, as you can see here, redirected the output of the product key.exe in a file and then try to upload it on my site. And actually, I was able in this way to extract information from both Palo Alto and VirusTotal. So that means that also in this case, I was able to get this, let's say, something that is not supposed to be disclosed. And so let's have a look here of the, again, a quick demo, in this case on the Palo Alto wildfire sandbox. So I uploaded the payload. And then in a while, I will see that I will have the file uploaded on my site with all the leaked information I will have to get. So here it is. And so we can get the information out. Okay. Maybe we can also use this system to do some other things because it's just three cases, very quick. But we can try to do other things like, for example, test your own sandbox. If you are running your own sandbox in your environment, that's something I encourage you to do for sure, because maybe someone is not realizing that some kind of information may be sent out without big effort. So it's something that you need to check. Maybe try two different fingerprinting techniques because there's really a wall here. You can get every kind of information out of the sandbox, beginning from the shellbacks, the shim cache content, and so on. All this information allows someone to do a very, very precise fingerprinting on the system and maybe understanding also which is the specific sandbox he is running on. So that's something that you have to take into consideration. Also, I added this build a database with the result and fingerprinting server sandbox. This is not a good idea. I don't know if maybe it can be used for nefarious ways. And then, okay, you can try some other things like, I don't know, I thought mining maybe, no, maybe not because I think the running time is limited to 15 minutes usually or something like that. So mining is not probably a real thing to do, but okay, it's something you can try. So this is the summary of what I did. So the results on the several sandboxes with the specific test I run. And a sample of collected data. Here I'm focused mainly on the office product key, which were obviously redacted here for privacy, but you can get everything out from the systems. It's just a matter of thinking what you want to get. Are offline sandbox safer? You know, and we saw that there are some vendors not allowing us any kind of external access. So are they safer? Maybe yes, a little bit, because in case of an APT, for example, let's think about the terminal attacker. In this case, maybe it can't just get access to your technology. So if I have FireEye, which is not allowing maybe external access, but they can get the appliance, I can try to run the fingerprinting on that specific sandbox and so extract this information anyway, because what these sandboxes are doing are creating very detailed report on what the sample is doing. So maybe just writing a registry key with the content I would like to extract, for example, the product key of office or any other information, I can just get the information out. So they are safer probably, but not completely safe in this point. Remediations. Okay, which are the remediation is not easy, because I understand that this is part of the sandbox functionality, so not easy to block this kind of behaviors. But it's something we have to consider and the vendors have to consider, because it's really maybe dangerous in some cases. For example, an IPS on the outside connection is a solution that probably is already in place for some of the vendors, as we saw at the beginning of the presentation. Also, our web application firewall may be masking information going out. It's another solution that could be considered. And for, let's say, for internal information, probably the best solution is randomize as much as possible. But it's not the easy one. Randomization for sure is the one that could allow to avoid this kind of issues, but it's for sure not the easy solution, so it's not a quick one. Probably the quick and dirty solution is running a kind of IPS or something in outgoing connections. Disclosure, I did it, yes, obviously. The only reply I got was from the guys at VirusTotal. They were very interested in the thing, so they work and so thumbs up for them, because they took it seriously and they started to think something about this, so very good. All the others, more or less, didn't give me a reply about the disclosure. Okay, these are the references of all the tools I used in the creation of this research. So Metasploit for sure, 7zip, the DVWA site for the creation of the site and some utilities. And so let's wrap up. Okay, at the end, the sandboxes are useless? No, I don't think so. I think that we can just understand how they work and how much trust we can put in them, because, as you can see, it may be easier than what we expect to evade the analysis. So thinking that we are safe because we have a sandbox in our environment, checking every file downloaded on the firewall or checking every mail coming in, it's okay. But you have to understand how these things are working and maybe you can also try to run your own test on that, because sometimes vendors are just selling these things to us saying, okay, with this you are 100% safe, the sandbox itself is undetectable. Okay, I trust you, but let's try to run a couple of tests on them and maybe then ask for a discount for it. Okay, this is my GitHub. So if you want to have a look at the presentation, the script, I will publish everything there. And that's all. So thank you for me. I don't know if you have any questions. Okay, thank you very much. Thanks for being here and thanks a lot. Enjoy your DEF CON.