start	end	text
0	5740	It is my pleasure now, Césaire Pizzi, on problems.
7400	12020	Hello to everyone. Thank you. Can you hear me? Everyone can hear me? Okay, great.
13100	19320	Okay, let's start immediately. I have to fly a bit on the presentation because it's a bit,
19320	26120	maybe a bit long, but okay, let's say I do my best to do everything. Okay, that's about me,
26120	32680	let's skip it. So just a few information about me. I'm a security researcher. I work on a lot of
33320	39600	open source projects. I developed in the past proof of concept for Arduino code injections,
39600	45680	but that's not important. You can have a look to these things in my GitHub. I will leave you
45680	50400	the reference at the end of the presentation. But let's start with the presentation of this
50400	59660	research. So what I started to think was something about the invisible cloud, as I called it,
60160	64900	of the sandboxes. We have a lot of tools out there, which popped out in the last,
64900	72000	I don't know, five years. Sandboxes available for more or less everyone from our side. From
72000	79240	other side, a lot of vendors that are trying to sell this kind of software to be installed in our
79240	85600	environment. Or maybe another option is to install our own sandbox by using, for example,
85600	92040	well-known tool like Cuckoo, for example, which is a great tool. And so we have a lot of these
92040	100320	systems around. And what I thought is, okay, can we try to use them outside of what is their
100320	110580	maybe intended usage? And so I started to try to make some thoughts about this.
110580	116440	And so, okay, first of all, the sandboxes are usually isolated. So our environments are not
116440	124160	able to go anywhere. But maybe we can try to do something about this. And so what if we can get
124160	130080	access to these systems? For example, we can try to get some internal information that maybe are
130080	136780	not mean to be disclosure. For example, serial numbers. For example, the first thing I thought
136780	142120	was the serial number of the office installation, for example. Or maybe we can try to fingerprint
142120	149120	the system to understand if you are in a sandbox. This we can see, we will see later that it's
149120	155020	maybe done for some funny reasons. Or maybe use them as a bridge to go somewhere else, for
155020	163380	example. And maybe other things as well. And so first thing, I try to do a quick list of sandboxes
163380	168280	out there. These are, I know, this is not a complete list. We have tons of them. I just got
168280	174900	this because they are more or less the most famous or in any case used. For example, for sure,
174900	181560	Virustotal, everyone knows what is it. And also the others probably. But there are quite a lot.
181560	188140	So I decided not to do this test manually, but to write a script to automate the actions. And so
188140	195420	I would like to have, okay, I'd like to build something that allowed me to conduct this research.
195460	203340	And that was done not reinventing anything, actually, sorry. But leveraging well-known tools like,
203340	208920	for example, MSVenom from the Metasploit to create the payloads. Or maybe the 7-Zip self-extractor
208920	214580	to create. What I would like to do is to create a kind of self-extracting executable that will
214580	219360	have a callback function, a way to drop files, because I would like to bring with me some
219360	225460	utilities on the sandbox itself. And maybe a kind of randomization, let's say a simple one,
225460	232460	because we all know that the sandboxes are usually doing a basic check about the hashes.
232560	237640	I would like to avoid this to trigger in any case, every time I upload the sample, a new analysis. So
237640	246260	I created something to address this issue. And so that's not rocket science, just it's a quick
246260	252900	and dirty Python script, nothing really special, but I will release it on GitHub, on my GitHub at
252900	258640	the end of the DevCon. So you can try to use it, okay, you can write your own. It's the same,
258640	263980	probably it's not so difficult to do it, but it allowed me to automate this research. So
263980	271880	how it works, it's in some way the script itself, it's able to leverage the MSVenom capabilities
271880	278740	to create a specific payload with a specific callback IPM port. It has the possibility to
278740	287500	specify a folder where I can put my utilities, and also way to script my actions when I try to
287500	292720	upload this on the sandbox. Okay, for example, here we can see an example of the drop folder.
292720	297180	It's just a folder where I put all my utilities. For example, here you can see that I would like
297180	303920	to upload on the sandbox the qrl.txe and the product-key.txe. Product-key.txe is an utility
303920	311080	for Nimsoft, which is extracting the Microsoft Office product key, for example, from the system.
311420	316700	And I would like to bring this on the sandbox itself. So at the end, when we run the script,
316700	322760	I will have something like that. So a kind of self-extracting executable with
323340	329620	some scrambled name, as you can see here, you see some .txt, .txt files, which are the
329620	336520	qrl.txe we saw before. Scrambled names with scrambled content as well, because I would
336520	343160	like, as I said, to avoid the hash detections. And so that is what will be created.
343160	348760	Together with this, we will see also a setup.bat or setup.sh, which has an underscore
349680	356880	at the beginning with the actions I would like to automate. Okay. The underscore means,
356880	362740	okay, don't touch this file. Tag to my script to not touch the file, but just put it into the
362740	368260	package without scrambling it, because in some case, I don't want to rename it.
369380	373080	And so let's start with the case one. So I would like to try to get a reverse shell
373080	379260	out from the sandboxes. So I run the script with this syntax here, very simple. And I
379260	384780	uploaded it on all these sandboxes mentioned at the beginning. And this is the result.
384780	390560	As you can see here, a lot of them gave me actually a shell. For some of them, it's not
390560	394500	actually surprising. Any run, for example, allow you interactive access. So, okay, it's
394500	401000	not a big issue. But for some other, maybe it's more surprising. And what I would like
401000	409040	to stress is here, the behavior of Palo Alto and VirusTotal. Both of them gave me TCP callback,
409040	415620	but then the connection went down. Like if there is a kind of IPS or something monitoring
415620	420140	the outgoing connection of the system, probably they have something which was recognizing that
420140	428440	I tried to open a reverse shell and they cut off the connection. But let's keep in mind this
428440	434740	because we'll come back on this later on and we'll see something funny. Okay, now I have a
434740	440260	reverse shell on the system, but why this is relevant? Why I should be worried about? Because
440260	447080	I can actually extract information from them. Here, you can see I run the productkey.txt
447080	453000	and I got the office installation product keys. I removed them from privacy here, obviously,
453000	459220	but they were there. And so why this is important? That's really important from my point of view,
459220	463580	from a point of view of a malware researcher, for example. But first of all, consider that
464540	469720	this is a private information that probably someone don't want to disclose. Especially if
469720	474120	you are running your own sandbox, this is something that you have to consider because,
474120	479260	okay, if you are relying on something that is provided by an IT vendor, we don't care. We just
479260	487340	use what our firewall vendor is providing us as a sandbox. But okay, it's their business if
487340	494140	they are losing the office keys. If you are running our own, that's very important. But
494140	502240	what is, in my opinion, the most important thing here is that this allows to leak information from
502240	508880	this. And this allows the fingerprinting of the system. This is already happening. A lot of
508880	517400	malware is doing this. I came across a sample a couple of weeks ago of the Okai keylogger,
517400	525420	which the installer was checking for the username of the system. Username that they will get from
525420	532420	probably VirusTotal or a sandbox like that one. And so that's really important because that means
532980	540940	that if the sample is able to identify it, it can also be the analysis. So it can
542900	550720	make the most undetectable sandboxes useless, let's say. Okay, this is a quick demo of what
551120	563240	I did. So here I tried to upload a sample on the SND box. As you can see on your left side, yes,
563240	573440	there was Metasploit running. As you can see, I got the reversal here. And then I was able to
577140	584020	extract the product key, for example. Here, obviously, I removed. So let's go to the case 2.
584020	589460	So I named it cross sandbox spawning. What it means, we saw that we have external access from
589460	594980	the systems. So that means that also we can try to maybe try to run an attack against someone else.
595640	601300	If I upload something that is doing, let's say, a SQL injection or something like that
601300	607360	to a third-party site, I can do it. Again, this may be not very interesting for us if
608280	613880	we are using third-party sandboxes, but if we are running our own, it's really important because
615200	621300	someone could knock on our door and asking us why you did something wrong on that site. So
621900	626500	this is something we need to keep in mind. Here, this is a simple setup I did on my script. So
626500	632600	I just created this script here. As you can see, there is a qrl.exe running. In this case,
632600	637620	not a real attack. It's just an upload of a file. But it would be interesting for the third case.
637620	644320	So let's keep this in mind. So as you can see, the qrl.exe here is angle bracketed because it
644320	653180	will be replaced automatically by the script with the scrambled name of the file when the file is
653180	658980	renamed. So it will be done automatically by the script. And so this is the result of the test.
659140	663980	As you can see, and I would like to stress, the Palo Alto and Virus Total sandboxes are
663980	671980	allowing me to do this. And that will bring us to the third case. Okay. Why this is relevant?
672080	678100	Because we have to consider a couple of things. One is that, okay, we can use something to proxy
678100	683240	attacks to someone else. This is something that we can take in consideration. Second point,
683860	692040	sometimes these sandboxes are really in our infrastructure. And sometimes we don't even
692040	699100	have a real perception of that. Because, for example, our anti-spam vendor may have his
699960	705060	sandboxes and maybe someone can just run an attack against someone else by sending an email to us,
705060	712900	for example. Because it just executes the payload and so on. Other thing that is interesting is
712900	721280	this example of zero effort exploit as described in Science on the Wire book, which is a great
721280	730440	book if you work in security field. So have a read of it. So let's have a look to the demo as well.
733200	743760	So here I'm uploading the demo on the site and then I'm looking for my on the hybrid analysis,
743760	753880	which is a well-known sandbox. Then I created a fake site, just waiting for an info.php
753880	761540	file to be uploaded. And we can see here that, okay, I got this file uploaded on the sandbox
761540	768460	itself. And this worked for all the sandboxes we saw before. And that is bringing us
768460	775600	to the third case. So let's try to do something creative to combine the two things we did before.
775600	783560	So, okay, we saw that some of the sandboxes looks like preventing us to get access into
783560	790060	leak information. But if we combine the second case, maybe we can do something. So I created
790060	796640	another little script, which has been processed by my Python script, which is just combining the
796640	803240	qrl.exe, so the upload of the file with the product key.exe. So I just, as you can see here,
803240	815860	redirected the output of the product key.exe in a file and then try to upload it on my site.
816540	822640	And actually, I was able in this way to extract information from both Palo Alto and VirusTotal.
822640	830340	So that means that also in this case, I was able to get this, let's say, something that
830340	838380	is not supposed to be disclosed. And so let's have a look here of the, again, a quick demo,
838380	846720	in this case on the Palo Alto wildfire sandbox. So I uploaded the payload.
851860	855560	And then in a while, I will see that I will have the file uploaded
857280	865540	on my site with all the leaked information I will have to get. So here it is. And so we can get
865540	873740	the information out. Okay. Maybe we can also use this system to do some other things because
873740	880400	it's just three cases, very quick. But we can try to do other things like, for example,
880920	884580	test your own sandbox. If you are running your own sandbox in your environment, that's something I
884580	891000	encourage you to do for sure, because maybe someone is not realizing that some kind of
891000	898880	information may be sent out without big effort. So it's something that you need to check. Maybe
898880	906260	try two different fingerprinting techniques because there's really a wall here. You can get
906260	910820	every kind of information out of the sandbox, beginning from the shellbacks, the shim cache
910820	917840	content, and so on. All this information allows someone to do a very, very precise fingerprinting
917840	924500	on the system and maybe understanding also which is the specific sandbox he is running on. So
924500	931240	that's something that you have to take into consideration. Also, I added this build a
931240	935520	database with the result and fingerprinting server sandbox. This is not a good idea. I don't know if
935520	946000	maybe it can be used for nefarious ways. And then, okay, you can try some other things like,
946000	953420	I don't know, I thought mining maybe, no, maybe not because I think the running time is limited
953420	962060	to 15 minutes usually or something like that. So mining is not probably a real thing to do, but
962060	971180	okay, it's something you can try. So this is the summary of what I did. So the results on the
971180	976280	several sandboxes with the specific test I run.
978080	985360	And a sample of collected data. Here I'm focused mainly on the office product key, which were
985360	991460	obviously redacted here for privacy, but you can get everything out from the systems. It's
991460	1002260	just a matter of thinking what you want to get. Are offline sandbox safer? You know,
1002260	1007380	and we saw that there are some vendors not allowing us any kind of external access.
1007880	1014940	So are they safer? Maybe yes, a little bit, because in case of an APT, for example, let's
1014940	1023220	think about the terminal attacker. In this case, maybe it can't just get access to your
1023220	1029740	technology. So if I have FireEye, which is not allowing maybe external access, but they can get
1029740	1039100	the appliance, I can try to run the fingerprinting on that specific sandbox and so extract this
1039100	1045360	information anyway, because what these sandboxes are doing are creating very detailed report on
1045360	1052600	what the sample is doing. So maybe just writing a registry key with the content I would like to
1052600	1060260	extract, for example, the product key of office or any other information, I can just get the
1060260	1066240	information out. So they are safer probably, but not completely safe in this point.
1066900	1070420	Remediations. Okay, which are the remediation is not easy, because I understand that this is
1070420	1076280	part of the sandbox functionality, so not easy to block this kind of behaviors.
1077300	1081180	But it's something we have to consider and the vendors have to consider, because
1081720	1089500	it's really maybe dangerous in some cases. For example, an IPS on the outside connection is a
1089500	1094000	solution that probably is already in place for some of the vendors, as we saw at the beginning
1094000	1100700	of the presentation. Also, our web application firewall may be masking information going out.
1100700	1109620	It's another solution that could be considered. And for, let's say, for internal information,
1109620	1114480	probably the best solution is randomize as much as possible. But it's not the easy one.
1115160	1122400	Randomization for sure is the one that could allow to avoid this kind of issues, but it's
1122400	1127580	for sure not the easy solution, so it's not a quick one. Probably the quick and dirty solution
1127580	1135700	is running a kind of IPS or something in outgoing connections. Disclosure, I did it, yes, obviously.
1137600	1143900	The only reply I got was from the guys at VirusTotal. They were very interested in the
1143900	1149140	thing, so they work and so thumbs up for them, because they took it seriously and they started
1149140	1158980	to think something about this, so very good. All the others, more or less, didn't give me a reply
1158980	1166360	about the disclosure. Okay, these are the references of all the tools I used in the
1168860	1177960	creation of this research. So Metasploit for sure, 7zip, the DVWA site for the creation of
1179140	1189380	the site and some utilities. And so let's wrap up. Okay, at the end, the sandboxes are useless? No,
1189380	1196400	I don't think so. I think that we can just understand how they work and how much trust
1196400	1203000	we can put in them, because, as you can see, it may be easier than what we expect to evade the
1203000	1209940	analysis. So thinking that we are safe because we have a sandbox in our environment, checking
1209940	1218480	every file downloaded on the firewall or checking every mail coming in, it's okay. But you have to
1218480	1224840	understand how these things are working and maybe you can also try to run your own test on that,
1224840	1230300	because sometimes vendors are just selling these things to us saying, okay, with this you
1230300	1238680	are 100% safe, the sandbox itself is undetectable. Okay, I trust you, but let's try to run a couple
1238680	1247460	of tests on them and maybe then ask for a discount for it. Okay, this is my GitHub.
1247980	1252040	So if you want to have a look at the presentation, the script, I will publish everything there.
1252520	1258780	And that's all. So thank you for me. I don't know if you have any questions.
1261480	1268360	Okay, thank you very much. Thanks for being here and thanks a lot. Enjoy your DEF CON.
