My name is Itzik, and this is my colleague, Tomer, and we're going to present to you here tonight about software rapid exploitation. This lecture will cover the what, the who, the why of this attack, and we will also give you some hands-on and demo about this sweet attack. Okay, so updates. I guess everybody heard about software updates. It ain't nothing new. Your application, my application, everybody does updates these days. Over the time, different updates techniques, you can see here below some of the favorites update methods. Nowadays, most of the people, most of the companies, vendors, simply put their updates on the website, and the application downloads the update and simply updates themselves. The reason we picked an update is because the scenario which an update takes place is very ideal and comfortable for exploitation. In addition, when exploiting, an update technique, the result is, in many of the times, is that multiple application becomes vulnerable at once. Okay. The first requirement to exploit a software update technique is to be able to pull a man-in-the-middle attack on the victim. Now, you can see there's a variety of ways to pull this technique. The only real obstacles that we will see, and later on, we will see, is that there are a number of ways to pull this technique. The only way to see how we're going to dismiss this obstacle is the usage of static or predefined URLs, which makes the application very strict. But, as I said, it's no match. The second requirement to exploit a software update technique is to know the dialect between the update technique, sorry, the update agent and the update server. Now, this is a very specific case. It's a very specific information, and it's been conducted and gathered per application. What you see over here is a very generic dialect that we've picked up from a server. The first one, as you can see, is composed from two interactions. The application goes online, checking with the site, whatever it's currently being up-to-date. If it's not being up-to-date, it expects the server to supply a roadmap of versions and URLs to download them from. Now, as you can see, there are two failing points in this dialect. First, we can always reply with a negative answer. That means even if the client is really updated, you will think it's not. Second of all, when the update will proceed to download the update, we can then manipulate the URL and set it to be our own. The second dialect is much more simpler. The application is node-designed. The vendor site is pre-programmed. It simply goes straightforward and download-executable. Well, in this case, what we will show later on is it is possible to redirect or reroute the request from reaching the vendor site and actually make it go to our own website. Okay, so let's start the attack. What you can see here is the layer 4 and the layer 3. On the layer 3 basis, we're not doing anything interesting, simply inverting the IP addresses. On the layer 4, we do have something very interesting. As you can see, as usual, we complete the sequence, the checksums, the basics. But we're also going to pull what we call a one-shot, one-kill trick. The one-shot, one-kill trick is implemented in TCP. And the idea is, that most of the update's dialects takes place within a single packet frame, which means for us, it only takes to transmit one packet to the victim, and we will push aside the real server. Now, as you can see, we are going to activate the push, hack, and fin bits. The push and hack is used to transfer the information to the application, but the fin is to state that the application has finished talking, no more information to the server. So, the real server is going to be sent. What it will happen is, when the real server will wake up and give the reply, I recall that it's in the middle, and we're actually going to perform it in the WiFi environment, we cannot actually mute the server for real. It will come back with an answer. But since we've signaled the fin bit, the retransmission or the server actual reply will be disqualified as TCP out of state. So, this is our idea for a one-shot, one-kill. On a much higher scale, what we saw is most of the application are actually using HTTP to conduct their business. This makes an update just a regular HTTP transaction. Here you can see a list of a very popular and common interactive in HTTP. For instance, the client accessing a document, perhaps an XML or an INI. The result is this, a client expects some kind of a roadmap with versions, with URLs to download from. We can counter this or poison this by supplying our own document, which will, of course, be malicious with a malicious URL included. We can see that when the client proceed into downloading the file directly, regardless for anything, we can do a nice trick, and it's to basically counter it with an HTTP 302 response. Now, HTTP protocol supports redirection on the fly. It supports load balancing and transparent operations. So, when the application actually accessing a file, trying to download it, will actually redirect the request, saying that the file exists, merely just on another different server. A demo of this attack will be presented later, and you will see for yourself. Either way, the server will be muted, as explained in the layer four technique. We have nothing that we can add on this layer to basically overrun the server reply, of course. Okay, so, our idea of attack is basically to spoof the update server reply. We're going to do it by pulling a man-in-the-middle attack on the victim, and in the right moment, we're going to inject a single packet, if possible, that will contain, A, a document that says, a newer version available, this is the URL for it, or B, we will try to redirect or relocate download from taking place on the vendor side to take place on our malicious repository. So, let's start seeing some real-life case studies, and we will begin with Notepad++, a very straightforward application and a very straightforward update technique. The application begins by performing a very simple get query. You can see that the application actual version is being passed as a URI parameter for that 9.2. The application expects an XML from the server stating whatever there's a higher version to update, and if there is, which URL it should be take to download it. So, when we know that we have a higher version, we know about this, and we know how the XML look alike, it's very easy for us to generate on the fly such an XML with the response, with the proper format and syntax, basically stating, A, there's a higher version, and we can easily compete a higher version from the current performed URI pass parameter. Second of all, knowing that we can cause an update to take place, we can also set the URL to be anywhere in the world. In that case, we will, of course, take it home to our malicious server. So, what's the result? The result is a very naive application doing a very naive approach, just trying to see whether there is a new version available. It end up downloading a malware on the updated computer, and it did so quite fast. The second application that we're going to review is Skypey. Skypey, on the other hand, does not use such a naive approach. It's actually accessing the same URL to download the file, skypeysetup.exe. Now, the skypeysetup.exe file is basically determined in runtime, whether an update is required or not. So, we cannot stop Skypey from making the download, and we cannot actually make Skypey make the download from a different location. We have to actively work against download. So, in this very specific case, and in the case where the application goes straight forward, head in the wall, don't care, don't ask, to a website, what we're going to do is we're going to counter this action with HTTP 302 response code. The HTTP 302 response code allows us to basically define a new location where the resource is being located. So, when Skypey approach download.skypey.com, asking whatever Skypey set up, Skypey set up, Skypey set up, that X is available, we're going to response with, hell yeah, it's available, only it's just moved a little bit to the evil repository side. And Skypey will just go there happily ever after, download the file, and execute it. Question that people ask me many times is whatever fixed parameters or all sort of pre-shared knowledge about the server can be effective. So, as you guys saw, any fixed parameters, any fixed host names, or whatever you like to call it, is really not match. In the example of Skypey, we have proven that even the application knows the location and knows what it's after, thanks to the HTTP protocol flexibility, it's made it easy for us to basically redirect it again and downloading a malware instead. Okay. The last example we're going to review is a much complex one. The Malwarebytes application is an open source anti-malware application. And its update procedure is a little bit complex, but not that much. First, it begins by querying the server whenever there's a higher version available. Notice here that the application never reports about its current version. No worry about it. We can always fake a much higher version or the highest possible version. If the server do contain a much higher version, it will simply go and download, again, a fixed file name from a fixed site. So, that's how we're going to do it. In this specific update procedure, we can choose to do either one of the two. We can either try and always spin the download itself, which means we will make it reliable with the user. It will always try to download a real version, except it will receive a malware instead. And we can also choose another technique, which will be to fight on both fronts. In this example, we choose to fight on both fronts. For the first GET, we're going to answer with a fake higher version. As you can see, the highest possible number the application accept. So, the application will proceed further to download the actual update. Okay, again, a fixed name, fixed location. No worry about it. We're going to spin it off with HTTP response 302. The result is, even though an application performs a much complexer dialect and has more than one query, it is still possible to hijack it successfully and exploit it to run malwares. We have collected a little bit over 100 different applications. We went to download.com, other major websites, taking everything from image viewers, CD players, shitty applications, really. We just went to everything that we can. And then we collected a pretty much pretty big database. You can see some examples below here for different type of application which are vulnerable. I think it's a very good time to proceed to some real-life action. Tomer? Hey, everybody. So, before the demo, we just want to take a minute and explain to you what components build our attack. So what we have here are two computers. One is the attacker computer. Our attack tool is running on it. And the second one is the victim computer. This is the computer that will try to do the update. In addition, we also have here an access point. It's an open public Wi-Fi called MedWiFi. Also the attacker and the victim computer are connected through it. Because we had to do some changes in the setup, we will demonstrate the demo on the VMware because we do have two screens, but it's one feed. So we will not be able to see also the attacker and the victim. So let's begin. First we need to run EAPON. Okay. So what we see here is EAPON. EAPON has two modes, a CLI mode and a 3D mode. We are watching the 3D mode. Okay. We are watching, sorry, we are watching the 3D mode. The 3D mode is like a Wi-Fi radar. What we can see here that we are the yellow vertex, the main vertex. And surrounding us, all other blue vertices, right now it's only MedWiFi, are all available access points that EAPON was able to detect. The GUI also supports zooming in, zooming out, and rotating. Okay. So let's start. Let's start a demo. We have chosen AutoEat for the demo. AutoEat is a scripting language for Windows automation task. It has a check for an update feature. So let's try updating it and see what happens. First checking for an update. There is an available update. Downloading. Boom. Game over. Okay. Let's take a look at EAPON and see what happened. As we can see, the MedWiFi vertex after an attack. Thanks. After an attack, the MedWiFi vertex has changed from blue to red, indicating us a successful attack took place in MedWiFi access point. And also a green vertex was added with the attack computer IP and the trigger domain name. Okay. Let's close EAPON. Okay. After attacking AutoEat, let's build a new attack from scratch on a new task. Target. Target is a Dreamsoft PDF to word converter application. The version is 2101, which is the latest version. Before that, I just have to show you the database. In order to build some new attacks, we must use EAPON database. EAPON has a database. Sorry. So, EAPON has a database. It's actually an XML document that contains triggers and responses. Here we can see the 200 okay attack and the 302 redirection attack as we talked before. Here we can see the target name. We need to fill the target name. We need to fill the domain name, the path, the attack type, which is 200 okay. And the method is get. Because we are using 200 okay attack, we will also have to add the response. In 302 redirection attack. We do need to fill the domain name, the path, the attack type, which is 302, and the method is get. In 302 redirection attack, we do not need to supply a malicious binary location. EAPON gets it as a CLI parameter. Here we can see the script for running EAPON. Running EAPON. We have the minus W for the wireless, the minus I for the interface. The target XML is the database. The minus U is for the malicious location binary, which in this case, this is the Apache server running on my computer. So let's run Wireshark. This is the new target. Let's analyze how it's doing the update. First we need to run the application. Okay. Checking for an update. We can see that the application shows that there is no available update. We are using the latest version. Not surprising. Let's take a look at Wireshark to get a better understanding. Let's filter it with HTTP request filter. Here we can see the entire session between the application and the update server. We can see that the application went to HTTP. We can see that it sent it version 2101, which is, as I said, the latest version as a URI parameter. The server responded with 200 okay and contains an XML document. We can see here some tags, code tag, XURL tag, and some more information. So let's build a new server response and try update it once again and see what happens. Okay. We will have to use again the templates. So we will take the 200 okay template. Let's put first, let's put the name. We will have to take the host. We will have to take the path to the binary, which is go PHP. Okay. That tag type is 200 okay. And because it's 200 okay, again, we will have to use the response. Just copy the server original response and put it here. Because the server responded with a document which is an XML format, we will have to use the C letter. Let's change the code tag from one, code tag value, sorry, from one to two. And let's put in here. Let's say, epon says hi.com. Okay. Let's copy. Let's copy it to epon database. Okay. So what we have here. We have a target name, which is defcon. The domain name is cbs.agrimsoft.com. Go PHP. The attack type is 200 okay. The method is get. And this is the server respond. Okay. The code tag is two and malicious location. Let's save it. Let's run epon again. Okay. Let's close the application. Checking for an update. We can see that now the application thinks that it needs to do the update. There is an available update and you need to download from epon says hi.com. Do you want to do the update? I don't. So let's close the application. We can see a new vertex was added. Let's close epon once again. And instead of epon says hi.com, let's change it to another location, which is the Apache server running on my computer. So we will have to take this. Okay. In this case, this is the same target. Let's copy it to epon database. Okay. So the target name is agent soft PDF word converter. The domain name, as I said, 200, okay. The method is get. Again, we change the code from one to two for newer version. And here there is a function, get malicious URL, that tells epon to take the malicious binary from my Apache server. Let's save it. Let's run epon once again. Let's run the application. Okay. Checking for an update. There is an available update form here. Downloading. Boom. Game over. Okay. If we will go to the CLI mode, again, as we can see, the merge wife vertex has changed and a new vertex, the green one, was added with the attack computer IP. If we will go to the CLI mode, here we can see the two packets that were sent as we talked about, the one shot, one kill concept. We can see here the 200, okay. Here you can see the L3 layer. You can see here the L4 layer with the fin, the push, and the hack. This is the 200, okay, response that we have supplied PDF to word converter application. And that's it. Let's go back to Isaac. Okay. So what we saw here was a demo and we also saw a little bit of hands-on. As you can see, it's... It's quite simple to take this application, this everyday application, and examine how they're working. As you can see, a target can have multiple responses, depends on how complex the dialect can be, multiple 200, okay, multiple 302 if required. One of the things that the one shot, one kill concept does by supplying the fin flag to the L4 is the ability to break it. Break down pipelines. Actually, most of the clients, after receiving a packet with a fin, will disconnect from the server and take the new request on the new socket and the new connection. This actually breaks down the entire session into server response type of thing, which makes it quite easier for us to handle. So again, if there's a complex dialect, it's nothing to worry about. Just a number... Just a couple of words about Epon itself. It's basically a Python script. It's a Python script using Skippy, Skippy, I'm sorry, as a fundamental library for injecting. As Tomer said before, there's the minus W for the Wi-Fi, but it's also applicable to be performed on a LAN environment, thanks to the R poisoning. So again, it's quite a flexible application. The database itself in, hold up one second, I'll just open up real quick. Oh, yeah, sure. The database itself is a little template engine, template engine, sorry. As Tomer says, you can actually code and insert a new type of things in it. As you can see, the Python actually respects the macro between the percentage, and it's actually invoking a real Python language. It's not a very complex template language, but it's enough for you to pass parameters, and you can generate... You can write response on the fly from it. Wait, let's just... Tomer, can you show us the Notepad++ one, example? Yeah, no problem. Yeah. So the CDATA is, of course, to escape the XML within the XML, but as you can see here, we actually compete. We're actually accessing the XML. We're actually using the hash table, which the application performs as, let's say, the fundamental principle. The HTTP request just simply breaks down every parameters in the request. So you can see that the increased version is basically taking the actual value of the version. Just to remind you that... Hold up a minute, where's the presentation went? Oh, yeah. The Notepad++ actually has been kind enough to actually send its own version. So if we... If we want to be actually precise, and not just to throw some random figures, it is possible, as you can see, the 4.902. So except we're basically increasing it by one, making sure it always will trigger an update. And as you can see, the location in the XML is also a function in the EEPON code. It's quite flexible. We tried to tweak it as generic as possible. So you can extend it. To support new functions, new generation of content, and even new protocols, if you will encounter. Okay. So let's continue with the presentation and talk about the most obvious obstacle that most people think when they hear about HTTP is, what about SSL? Well, yeah, SSL can update you better, but there is a couple of drawbacks when using SSL. First of all, it's quite expensive for a resource. You cannot use SSL to transfer gigs of gigs of downloads. And again, since most of the vendors presume, if you can try to remember, most of the application don't actually give you the entire look. You don't see the golden lock. So the vendors allow themselves to fool around with SSL and to provide you only a sense of security instead of for real security. Here. You can see some... A very interesting example that we came across of vendors using SSL to update, but only to say so. You can see some cheap solutions like update with self-signed certificate. Yeah. That's going to help. We even saw one application which was quite interesting. It accepted third-party certificate and didn't actually give a damn about the host name. Just wanted to have some certificate. Again, very interesting. Very interesting solution. The result is basically even though it's conducted through SSL and everything is supposed to be kosher, it's not. We don't support it in EEPON as it is, but it won't be so hard to implement to counter this cheap SSL solution. Another attack that me and Tomer came up with is a little bit on theoretical side here, is that we actually saw that there is no minimum for the cipher suit strength in SSL. I mean, browsers do support some sort of a minimum set for SSL, but this application actually will agree for anything, and they will also agree for a null cipher. Now it is possible to raise condition the SSL handshake, basically give the server the idea that the client has only a null cipher to offer, and make the server believe the server offers to the client a null cipher, the result will be a legitimate SSL connection negotiated on SSL. So it's actually doesn't do anything productive. So is it the end of the world? Apparently not. There are some quite instance and applicable solution that software vendors can implement and some of them did implement. Actually some of the major players such as Microsoft and Google did implement digital signatures in their updates. A very, very simple. They basically give away the public key in their application, and when the application downloads a new binary, a new update, it simply verified itself to make sure it's signed properly. So even if we can tamper with the downloads, we cannot still push away a binary that's not signed by the vendor. So it's a very easy and very fast solution. Of course, there are other solutions that can be made SSL the right way. For example, if you have a server that's not signed by the vendor, it's a very easy and very fast solution. There's a valid certificate that's actually designed to be for that host name. And now the SSL itself does not need to provide the entire binary transformation because SSL can be only used to transfer the MD5 or the SHA-1 of the actual download. The download can be take place on a clear HTTP. This way, even if we will hijack the session and we'll push away a different binary, the MD5 has already passed in a secure separate channel, so the application can confirm the MD5 does not exist. So it's a resource-consumptive way, but it's also applicable. Okay. So what's the future for EAPN? What's the future for Update Attack? Well, we actually think the future is quite pink for these guys. First, some ideas for the next version. Playing with proprietary update data, although we can always push an executable or a binary rootkit and make things interesting from there, we don't actually have to do it on this level. We can simply tamper with application-specific information. Now, imagine an application such as a friendly firewall downloading a blacklist of IPs. If the black IPs file is not secured, I can tamper with it. I can actually give away IPs of an actual real site, such as Google, and make home firewalls block Google. But the most interesting thing that we saw, except, again, firewalls, snorting, et cetera, is antivirus rules. People tend to trust antivirus pop-up box, and they tend to believe that what they say is the truth. So we can actually make an antivirus attack legitimate application. We will just insert a bad signature, and the antivirus will just tell you that this application is no longer legitimate. We can make the antivirus actually come after itself. It will be quite interesting to see it fighting over its own protection and end up having broken DLLs. And we can also make the most funniest things in the world, basically make the antivirus protect the virus from others to be deleted. The hit and run mode is also very interesting. We've noticed that some of the applications store some sort of a history of successful updates. You can see there's a list of IPs and URLs. So I don't even know. You can actually have to walk or stalk you all the way. It's good enough that we meet in the airport, and I attack you. You just happen to check in for an update, your application, and bang, it's recorded my malicious website as a potential download site. You must be familiar with the option of download now, install later. This is exactly the case. You performed a download in an insecure network, and you installed it later on in your house, installing a malware. So it's the hit and run mode. But I think the most interesting thing that we came up with HIPPON is that whatever HIPPON does to you, to your application, to your laptop, you can do it to your friends, etc. Because we're not actually relying on any exploit, we're not relying on anything specific. You only have to do is have a Wi-Fi connection and a computer. So imagine that we're sitting in a gate in an airport. Each one goes to its own direction. I'm going to attack some of you, some of you will get infected. When you're coming back to your friends, to your office, to your state, the malware will do the same thing to your environment. It can actually manifest as an airborne virus. It doesn't need any network, it doesn't require any storage. It simply propagates through searching updates in your area. And whatever it's recognized, or whatever the update is something HIPPON knows how to attack. It will attack and spread forward. So how about that? Thank you. The HIPPON project has been released on DEF CON. It's the official announcement. We are going to maintain a code repository at Google Code Projects. You're welcome to download it. I don't think we're going to actually. Supply targets, but we will supply some bug fixes and some of the ideas. Maybe improve the 3D graphics a little bit. I'm going to get the questions in a minute. So whatever the version you have right now in DEF CON, it's the first version. Just check it out for the newer version. Yes, questions? . . . . . didn't pursue further to embedded PKI. Oh, fuck you. Yeah, any more relevant questions? Have we? No, don't think so. Oh, that's wonderful. That's, thank you very much. That's a free tip for you guys. Yes? It should, yeah, I think. But as I said again, you guys have the real hard copy on your CDs, so no tampering with that. But, yeah, it will work. For both versions. Any more questions? Thank you very much.