A very good afternoon to all of you. My name is Sohail and I work for Airtight Networks. I'm a Wi-Fi security researcher. And today I'm going to talk about a security problem in WPA2 protocol. You may have heard about hole 196. In fact, last one and a half week a lot has been said and discussed about hole 196 or GTK vulnerability. And in fact, a lot of speculations have been seen around this problem. So today we are going to present the real picture and we'll help you understand or see the implication of the problem. So let me answer the most frequently asked questions that people have asked to me. Where did we find this hole 196? And for your information, it's already there in the standard. For last six years, it was buried in the standard on page number 196 and that's the reason why we are calling it a hole 196. If you see the last line of the... page 196, the designers of dot 11 have warned about the weakness of WPA2, one key that is used in WPA2. And on the last line, there is something mentioned about that key. GTKs do not have this property. So designers are talking about some property of encryption key which is not there, which is lacking. But this problem was never discussed. And in fact, there is a problem, but it was never brought to the attention of WPA2 users. So in this presentation, we will talk about that. So this talk is not about unauthorized user taking or gaining access to your corporate or your trusted network. No, it's not about that. It's not about key cracking. Okay? It's not about cracking private key of a user. This talk is about an insider attack. That can be carried by a malicious user who is already part of your network, who is already inside the network. But I have seen people saying that, okay, when a malicious user is already inside the network, then he can do pretty much anything or everything in that network. Okay, so what's the big deal? Fine. So let me ask this question to them. If, let's assume that if you are a malicious insider, can you really sniff private data of other Wi-Fi users? If you try to capture packet in the air, you will see encrypted packet. And since you don't have key, you will not be able to decrypt it. So can you really sniff or see private traffic of other Wi-Fi users? users even if you are inside the network and the trick to do that is basically one can try launching man-in-the-middle attack and the most popular trick is basically in in basically in Wi-Fi network is setting up a map a honeypot okay using this one can actually do man-in-the-middle and try to capture all the traffic of a user but in a WPA2 networks client devices are actually configured to connect to WPA2 okay so those clients are not going to authenticate honeypot access point or they will not connect so this trick is also not going to work so what are the other options available so probably we can think of launching man-in-the-middle style man-in-the-middle attack in a very conventional style old style with the help of our spoofing attack but today's network are basically much more secure than what it used to be there are security systems which can actually detect our spoofing attack wired IDS IPS or even switches have capability to detect it okay so if you are going to launch our spoofing attack the chance of man-in-the-middle attack is very small chances of getting detected is very very high okay so now let me ask again this question that without getting detected can you really sniff private traffic or data of other Wi-Fi users even if you are inside that network is it really possible the answer is yes in this presentation I'm going to show you that it is possible and this will not involve any key cracking or brute force how let's walk through the presentation and we'll see so I'd like to briefly talk about wpa2 protocol I'm sure many of you must have a good technical understanding of that but just to recall in wpa2 protocol there are two types of keys which are used for traffic encryption packet encryption one is called PTK pairwise transient key and the other one is GTK group temporal key and the purpose of PTK is to protect unicast traffic okay while the purpose of GTK is to protect broadcast or multicast traffic so there are two types of keys if you see PTK is a unique key it is unique for each user and it is derived per session so for example if two clients are connected to a wpa2 enabled access point both of these clients will be using two different keys so client one will not know the private key of client two and client two will not know the private key of client one so their traffic is basically secure but GTK is a shared key it is shared among all associated client devices and it is actually managed by access point so whenever a client connects to access point it receives a copy of GTK from access point okay so at any point in time all associated clients are going to have same copy of GTK now I said GTK is used to protect broadcast traffic or multicast traffic so in a in a Wi-Fi network if you have noticed all broadcast traffic is basically sent by access point because access point can talk to each and every client okay and this traffic is never sent by client device because client can whenever a client has to talk to other Wi-Fi client device it it first send packets to access point okay so for a client destination is always fixed which means client always send unicast packet and that gets so does that mean client never generate broadcast packet it generates but it in dot 11 that broadcast frame gets mapped to unicast frame okay we'll not talk about that but just to you know so which means by design GTK is going to be used as a one-way key access point is going to use it for traffic encryption broadcast traffic encryption and all client devices are going to use it as a decryption key and that's how the software in access point and clients are programmed and here I'm showing you a log of Wi-Fi client device there is a software called WPS applicant which runs on client devices and it shows the that client has a copy of GTK available right so the group key is always available to client device it is always known to client device why it is available why client keeps a copy of GTK because it has to decrypt packet coming from access point okay now let me ask what is stopping that client not using that GTK for its own packet encryption so protocol says something which is a normal of normal behavior right client should not use this key for packet encryption it should always use this key for packet decryption but a malicious user can always exploit this key malicious user present in that network can always use this key to create its own packet generate its own packet which means for a malicious user one broadcast frame is available which that malicious insider can generate is created and send that packet to all other Wi-Fi client devices but Wi-Fi client devices are programmed to receive packets from access point not from other Wi-Fi client device right so in order to successfully deliver that packet this insider is going to spoof the MAC address of access point So once the attacker keeps the MAC address of access point as the sender of that packet, all clients present in that network and associated with the same access point is going to receive that packet and going to decrypt it successfully, right? Which means a malicious insider has access to a broadcast frame which it can create and generate and send. And there is no way for other Wi-Fi client devices to differentiate whether this packet is coming from other malicious user or it is coming from access point. Absolutely, there is nothing present in that packet which can help a client to, you know. So it's now it's clear that attacker can send broadcast packet. So he can do a lot of attack. It depends. It depends what kind of attack payload he's going to encapsulate inside that broadcast frame, right? So in this presentation, I'm going to show you three exploits of GTK. And the first exploit is basically using the ARP payload to encapsulate and create broadcast frame. So in this example, attacker is... Okay. Okay. It is generating its own broadcast frame and sending that frame to other Wi-Fi users present in that network. And basically, the attacker is advertising that he's a gateway of that network. All other clients are going to receive that packet and update its ARP cache, thinking that the gateway, this new machine has become the gateway of that. That's how our protocol works. If you send, if you advertise that you are a gateway. Okay. All recipients of that packet is going to update its ARP cache. So attacker becomes the gateway of the network for that client who receives that packet. And after that, all traffic generated from that victim is going to be destined to this new gateway, who is the attacker. So victim sends all its packet to access point, encrypting its packet with its own private key, which is known to this user or access point. So access point will be able to decrypt those packets. And at this point, access point finds that this packet is actually destined for other Wi-Fi user, who is also part of the same network. So access point forwards that packet to other Wi-Fi user. And that other Wi-Fi user happened to be a malicious attacker. So finally the packet reaches to that insider. So just by injecting one spoofed gratitude or ARP request frame, the attacker is able to redirect all the private traffic of a legitimate user in that network to its own machine. At this point, attacker can actually drop all the packets and do denial of service attack in the network. But he wants to steal information. Right? So for that, he has to provide a seamless service to the user, a transparent service to the user. User should not feel that there is something wrong going on in that network. For example, if I'm accessing Yahoo, and I'm not able to access that, it means there is something wrong in that network. So what happens is that attacker is going to forward all that packet to actual server or gateway. And he becomes man in the middle. Right? So just by exploiting the GTK shared key and forging its own broadcast packet, attacker is able to redirect private traffic of other victim to its machine and able to provide services. Since attacker is sending a broadcast frames, it means all other Wi-Fi client devices which are also present in that network are going to receive that packet and update its ARP cache. So attacker is not just going to send the packet to the server. He is not just victimizing one Wi-Fi user. He is victimizing almost all Wi-Fi users who are in the range of that attacker. Now one can ask, what is the difference between this and the old style, conventional style of ARP spoofing attack? One can, I mean, no matter what, I mean, no matter if you are using a WPA2 network, I can always use ARP spoofing attack. I can always launch ARP attack. Do man in the middle. So in this old style ARP spoofing attack, your packet first goes to access point. And after that access point decides and forwards those packets to wired segment of the LAN or wireless segment of the LAN, which means the security systems present on that network, wired IDS or IPS or switches are going to see that packet. Which means the footprint of the attack is available on the wire and in any wired security systems, which are capable of detecting ARP spoofing attack, are going to capture that packet and detect this attack. But then when attacker is using this stealth mode attack, packets are directly sent by one malicious user to other Wi-Fi users in that network. Packets are never going to access point and it is never reaching to wired segment of the LAN. Which means the footprint of attack is limited to the air. Right? Which means most of the wired IDS, IPS systems are going, will not detect this. Because packet is not hitting the wired segment of the LAN. So without getting detected, attacker can do man in the middle attack and steal private information of other Wi-Fi users in a WPA2 network. Okay? So this is one example of GTK exploit or hole 196 exploit. I'm going to... Present here the second exploit. And it's all about, you know, changing the payload, what kind of payload you are encapsulating in that broadcast frame. So this time, attacker is going to use unicast IP payload inside that packet to basically launch IP level targeted attack. So for example, if frame is at layer two, frame is broadcast, but I can always use IP layer. Okay? Layer three unicast frame inside that. And one example could be, you know, port scanning. If I'm going to use a payload which is used for port scanning, then my packets will actually reach to the victim and victim will respond to that packet. Which means I can do port scanning and I can find out whether that Wi-Fi user is vulnerable or not. Which can further be exploited. So just think what else is possible. I mean... If I know that this payload is going to cause some buffer overflow, then I can inject that packet. Right? I can... Probably I can also inject malware. So a frame is available in which attacker can inject... In which attacker can encapsulate payload of his choice and cause serious damage to other Wi-Fi users. This is second example of GTK exploit. The third example of GTK exploit. The third example of GTK exploit is related to the replay detection in WPA2. There is something called replay detection in WPA2. So all encrypted data frames have this field called packet number, which is a 48 byte number. And this number is going to be present in all encrypted data frames. And this number is used to detect whether a frame is replayed or not. And how that replay detection works? When client connects to access point, access point informs that client that this is the last consumed packet number. So you should use this number for replay detection. So for example, last consumed packet number was 700. Client is going to cache that number, save that number. And after that, client is expecting data frame having packet number greater than 700. So for example, if I'm replaying packet. Which I have captured at the time when packet number was 600. And if I'm replaying that packet, that packet will not be accepted because client will find that the packet number is less than the last successfully received packet, which was 700. When access point sends packet, it will send with 700 one, because that is part of its traffic stream. It has already sent 700. So next packet will be 701. 702, and so on. So when access point sends packet with 701, client is going to accept that packet. And once the packet is successfully decrypted, client is going to update its locally cached packet number. So now the packet number becomes 701. And that 701 will be used to detect replayed frames. So attacker is. He is going to exploit this replay detection logic. Here what attacker is doing, he is injecting a very large packet number, arbitrarily generated number, because it is a 48-bit number, right? So let's take this example in which client, the last successfully received packet number was 780. At this point, attacker is injecting a packet, because attacker knows the GTK, he can create its broadcast frame. He can put any number of his choice. So he is going to put a number, let's say, 9,999, nine, four nines, okay? Client is going to accept that packet, because at the time of replay detection check, it finds that packet number is greater than the last successfully received packet number, which was 780. So the client is going to update its locally saved packet number. And the last. The local packet number becomes 9,999. Access point has no idea about this. This change which has happened on the client device. So access point will send broadcast packet as per its own traffic stream. So the last packet which was sent by access point was 780. So next time it will send 781, 782, 783. And so on. But let's see what is happening at the client device. Client device finds that the numbers are too less to the locally saved packet number. Last saved packet number was 9,000 and I'm getting 781, which means somebody is replaying packet. So client device is going to drop all the broadcast packet whose packet number is less than its locally cast packet number. Now imagine the implication of this. All Wi-Fi client devices who have successfully received attacker injected high packet number will start dropping all the broadcast packet coming from access point. Which means the protocol which works on broadcast packet will not work. Right? Two clients will not be able to communicate with each other because they will not be able to resolve ARP. So attacker. By example. By exploiting this replay detection logic, he is causing denial of service attack in downlink direction. And which can break few protocols. So this was the third example of exploit of hole 196 or GTK vulnerability. Now I will talk about the POC code that was written to exploit GTK. And I have used two open source software. One is WPS applicant software. And I have used it. There was no modification done. So it was used as it is. And then I have used open source driver, mad Wi-Fi. And the main modification was done in the driver part of the mad Wi-Fi. So before we actually see what kind of modification was done. Let me quickly present the dot 11 frame here. When a client sends a packet to access point, it is called to DS frame. From client to access point. Uplink packet. And when access point sends a packet to client, it is called from DS packet. Or it is a kind of downlink packet. And there is a field present in the frame. Which indicates about the direction of frame. Whether it is going from client to access point. Or it is coming from access point to client. But if you notice, there is not much difference between to DS frame and from DS frame. If you do a cyclic shift, to DS frame will become from DS frame. You move address 3 to address 1. Address 1 to address 2. And address 2 to address 3. It will become from DS frame. And this requires three line of code to do that. And one line of code to change to DS flag to from DS flag. So in four line of code, you can actually convert two DS packet into four DS packet. From DS packet. And then you need to select a right key to encrypt that packet. Because client always use unicast data traffic. So it always use unicast key. So, six lines of code were added to choose the right key. So it's just about selection. In which data structure, what kind of key is stored. Right? So in just ten lines of code, it was possible to exploit the GTK vulnerability. So. . So now I will. . , do a demo of man-in-the-middle attack in which GTK vulnerability will be exploited. And after that, I will talk about the counter measures. So in this example, the demo that I'm going to do now, I'll be using two Wi-Fi client devices. One client device is going to be my, the same laptop which I'm using for presentation. And then I have one more laptop here. Which is running backtrack. And I'm going to use one of the tools available for launching man-in-the-middle attack. There are a lot of tools available using which one can launch MITM. So, for example, these are the tools, very popular tools, which are used to launch man-in-the-middle attack. So I'm going to use one of the tools. So the only modification, the only soft code changes that was done was in mad Wi-Fi driver. Everything is available open source. . . . . . access point here and you can see the SSID of that access point is corporate Wi-Fi and if you go you will see that this is a WPA2 configured this is a WPA2 access point okay so I'm going to access my attacker machine with the help of VNC software so that you can also see what's going on on the attacker machine so so so so so so Okay, so my machine is accessible, so we can access this. So, this is the backtrack running machine which I'm going to use to launch attack. Okay, perfect. Okay. Is this visible to people at the back? Or should I increase the font size? Okay. All my stuff is here. And I have two Wi-Fi interfaces. One interface is running on this laptop. One is running on top of unmodified version of driver. I will be using it to demonstrate something. And then I have at zero interface which is running on top of a modified version of driver. So, let's, so I'm going to use SSL strip software to launch man-in-the-middle attack. I'll give you three seconds. So, I'll show it to you. So, the first one is a obvious one. Five, six, seven, eight. Let's see how fast it is running for the demo. You can see the time lapse. Come on. Here we go. Five, six, seven, eight. Wow. All right. Now, you can see the time lapse doesn't resist. You're going to notice it's quite long. I'm going to push this button to the left. Oh, I see it. Okay. Okay. So, I'm able to successfully run SSL strips of tool. Now, the next step is to basically poison the cache of the client, right? And for that, I'll be using the modified version of driver. So... Okay. Okay. And let's quickly check what is the default gateway present on this subnet. So, default gateway is running on 172.16.8.1. And if you check the ARP cache entry... You can see the default gateway is running on 8.1, and the MAC address is basically the last two bytes is FE72, okay? And we are going to replace the MAC address, the IP and this MAC binding with the attacker's MAC. So... And the Wi-Fi users, the IP address of users to which I have sent my IP address and the am going to victimize is using IP address 172.16.8.218. So I have used his IP address. And this is the MAC address of my machine. And this is the IP address of gateway on behalf of which I am sending this spoofed request packet. Now let's go back and see what is the ARP entry. So if you remember the last ARP entry for gateway was, the MAC address was FE72. Now let's quickly check. And you can see the MAC address of the default gateway has changed. It has become 0AD3. Okay. . . So, so far everything is working fine. Let's hope SSL stream works as per the expectation. So I'm going to open some site. Let's open, let's say, gmail. Oops. Let's try running. . . , . . . . . . . . . . . . . . . . . . . . . . run this SSL strip but I was able to poison the ARP cache entry of a victim and just to demonstrate that my packets which I am injecting is not actually flowing on the wire I am going to take a packet capture here you can see right now I am sniffing on a wireless interface of my client and you can see ARP request and response frames are being exchanged between my client and the attacker. The attacker was sending request frames and my machine is responding to those requests. Now let me quickly connect a wire and we will sniff what kind of traffic is flowing on the wire and here you can see there is no broadcast ARP request packet coming on the wire. The packet which I was injecting those packets are directly going on the char. These are the response which is basically sent by my client devices. So the footprint of attack is available only in the air, it's not available on the wire. But if I, instead of using a modified interface which was running on top of a modified version of driver software, if I run an unmodified version, what will happen? So let me quickly... So, in fact, I have demonstrated that my packets are not actually running, going on the wire. Let me quickly present all basically countermeasure techniques. The real fix is basically fixing this problem in the protocol. And for that, one can think of deprecating the use of GTK and group address data frame. The other solution... Okay. ...is basically using the endpoint security software like SNOT or ARP watch which detects ARP cache, changing the ARP entry, but there is a limitation of this software. It is not available for all kind of Wi-Fi devices. Then one can actually think of using PSPF or client isolation feature, but then this can also break the legitimate communication between legitimate users. For example, if a user wants to share... ...some pictures from laptop to smartphone, that kind of thing will not be possible. And we can probably not use this feature in a voice over Wi-Fi deployment scenario because then two Wi-Fi client devices will not be able to communicate, which means this will create a problem. So can we really think of using wireless monitoring system? Since... ...the footprint of attack is available in the air, it is possible to detect that in the air. So, WIPS can also serve as an additional layer of security to... ...in detecting and protecting from such attacks. So the final conclusion is that all WPA2 networks are exposed to hole 196, and the inter-user privacy that was guaranteed is now broken in WPA2. The real fix is to fix... ...fix this problem in the protocol. In the meantime, enterprises can think of using PSPF kind of feature, but... ...for endpoint security, you can use a SNOT or IPSec. But then you say it is not foolproof. In some certain scenario, it will not work. So multi-layer of defense... ...multi-layer of security is required, and probably over the air, security can be used to detect attacks like hole 16. 196 or any zero-day vulnerability. So the final words, be aware, be secure. That's it.