1 00:00:00,000 --> 00:00:06,040 Very good morning to you everyone, and I understand this is the first talk of the day, so thank you for coming. 2 00:00:06,820 --> 00:00:15,060 My name is Vivek, and today I'll be talking about an interesting tool which we've written called PCAP to XML and SQLite. 3 00:00:15,760 --> 00:00:24,080 A little bit about myself, I started as a programmer, 802.1 export security on the CAT 6K with Cisco. 4 00:00:24,800 --> 00:00:34,100 Moved on, did wireless security research, discovered the Café Latte attack, broke web cloaking, which was an encryption schema, currently owned by Motorola. 5 00:00:35,140 --> 00:00:38,440 I also run SecurityTube and Pentester Academy. 6 00:00:38,940 --> 00:00:46,280 My full-time job is researching, talking at conferences and writing courses, and a little bit of consulting as well. 7 00:00:47,400 --> 00:00:50,000 I'm an author of a couple of books on wireless security, 8 00:00:51,600 --> 00:00:53,580 and also our very first... 9 00:00:54,080 --> 00:00:56,200 self-published book. I'm going to give away a couple 10 00:00:56,780 --> 00:01:01,200 at the end for different questions, which I'm going to ask, you know, whoever answers it. 11 00:01:02,380 --> 00:01:05,460 Okay, so PCAP to XML and SQLite. 12 00:01:06,200 --> 00:01:08,500 Now, why did we create this tool? 13 00:01:09,260 --> 00:01:14,030 Now, I've been doing wireless security for the last, you know, 10 plus years, and 14 00:01:14,940 --> 00:01:21,480 every single time I want to get any meaningful data from the wireless traffic, it's actually quite difficult. 15 00:01:21,960 --> 00:01:23,780 How many of you have tried doing 16 00:01:24,080 --> 00:01:26,340 Wi-Fi forensics using Wireshark? 17 00:01:27,540 --> 00:01:29,460 How many of you actually succeeded? 18 00:01:31,040 --> 00:01:31,640 Okay. 19 00:01:32,340 --> 00:01:33,720 What did you search for? 20 00:01:36,720 --> 00:01:38,180 FTP traffic, right? 21 00:01:38,880 --> 00:01:43,960 At a pure wireless level, it's actually quite difficult to work with Wireshark. 22 00:01:44,380 --> 00:01:47,340 And, of course, that isn't Wireshark's limitation. 23 00:01:48,140 --> 00:01:52,900 Wireshark was never meant to be a framework to search, query, and mine data. 24 00:01:54,080 --> 00:01:57,880 You could, of course, write your own protocol disectors in Lua or in C, 25 00:01:58,020 --> 00:02:04,260 but the learning curve for all of that is quite a lot, and you'll spend a lot of time just looking at packet parsing code. 26 00:02:05,380 --> 00:02:14,940 So, what we did was, we decided to make a platform and a framework, which makes it extremely easy for anyone 27 00:02:15,660 --> 00:02:20,520 who's ever done SQL to go ahead and do wireless forensics. 28 00:02:21,860 --> 00:02:23,140 So, at the very... 29 00:02:23,140 --> 00:02:27,060 at a very high level, the concept of the tool is actually quite simple. 30 00:02:27,600 --> 00:02:30,640 We take PCAP files and packets in them, 31 00:02:31,480 --> 00:02:38,680 we map every single header field of a wireless packet that includes management data, control frames, 32 00:02:39,460 --> 00:02:44,540 most of the subtypes, and we actually map it to the database table. 33 00:02:45,280 --> 00:02:52,160 So, we take the packets, push them inside the database, and that actually allows you to do arbitrary queries. 34 00:02:53,200 --> 00:03:00,920 Now, as simple as the concept is, once the packets are in there, it's actually quite easy to get a lot of meaningful info. 35 00:03:02,400 --> 00:03:05,580 Now, PCAP to XML is actually quite portable. 36 00:03:06,720 --> 00:03:09,860 We have the Windows version, in case you prefer Windows. 37 00:03:10,540 --> 00:03:17,160 We also have the POSIX version. I've tested it on Ubuntu, but should work on any POSIX compatible system. 38 00:03:18,020 --> 00:03:19,940 The code will be open source as well. 39 00:03:20,000 --> 00:03:23,120 So, we're also seeing if we can port it on R, 40 00:03:23,140 --> 00:03:27,980 MIPS, and a couple of those CPUs as well, so that you can run it on embedded devices. 41 00:03:28,960 --> 00:03:33,540 The book which I've been doing is actually how to create your own Wi-Fi pineapple or something similar. 42 00:03:33,720 --> 00:03:37,020 So, you could actually run this on that, if you so desired. 43 00:03:38,720 --> 00:03:43,060 Now, getting started, let me actually show you a quick demo. 44 00:03:45,680 --> 00:03:47,560 I'm going to be using the Linux version. 45 00:03:48,740 --> 00:03:53,120 Now, there is a lot of stuff to be typed in, and I'm sure you wouldn't want me to do that. 46 00:03:53,140 --> 00:03:56,540 So, I'm just going to copy and paste a bunch of stuff. 47 00:03:57,460 --> 00:04:05,680 All of these commands are available, and you can go ahead and try them out after this talk. 48 00:04:05,900 --> 00:04:07,600 So, let's quickly copy this. 49 00:04:12,980 --> 00:04:13,420 Right? 50 00:04:13,800 --> 00:04:17,320 So, at the very bottom, you see a little error. It isn't. 51 00:04:17,380 --> 00:04:19,760 It's just trying to check if a newer version is available. 52 00:04:20,020 --> 00:04:21,340 If it fails, it just gives you a message. 53 00:04:21,740 --> 00:04:22,180 Now, 54 00:04:22,180 --> 00:04:24,620 what did pcap2xml actually do? 55 00:04:25,140 --> 00:04:34,120 It picked up the pcap file, processed every packet in it, and it goes ahead and converts that into a SQLite database, 56 00:04:34,400 --> 00:04:36,860 which is called xx.db at this point. 57 00:04:38,060 --> 00:04:43,560 We've converted pcap files, which are even around 2 gigs and above. 58 00:04:43,800 --> 00:04:45,080 So, you can actually give it a spin. 59 00:04:46,720 --> 00:04:49,960 Now, how does the SQLite file itself look like? 60 00:04:50,120 --> 00:04:52,160 So, we're going to actually open it up in SQLite. 61 00:04:53,040 --> 00:04:54,280 It's a client application. 62 00:04:58,640 --> 00:05:02,380 How many of you here have tried or love SQL injection? 63 00:05:03,900 --> 00:05:04,420 Okay. 64 00:05:05,320 --> 00:05:07,180 How many of you here know SQL? 65 00:05:07,420 --> 00:05:08,920 I've done some basic queries. 66 00:05:09,320 --> 00:05:14,280 So, with pcap2xml, you're basically as good as your SQL. 67 00:05:15,020 --> 00:05:15,540 Right? 68 00:05:15,560 --> 00:05:16,900 We have everything in the table. 69 00:05:17,360 --> 00:05:19,240 If you know how to do inner joins, 70 00:05:19,920 --> 00:05:23,760 kind of go ahead and take data from multiple tables and put them together, 71 00:05:24,000 --> 00:05:25,260 there's a lot of fun to be had. 72 00:05:25,840 --> 00:05:27,880 So, just to give you a very simple example, 73 00:05:28,280 --> 00:05:31,860 we could look at all the Mac headers for all the packet. 74 00:05:41,160 --> 00:05:41,900 There you go, right? 75 00:05:42,180 --> 00:05:43,980 Now, let me show you the schema. 76 00:05:44,160 --> 00:05:45,340 It's probably more interesting. 77 00:05:46,880 --> 00:05:50,660 So, we've mapped most management control data packets. 78 00:05:51,160 --> 00:05:53,800 We've also created summary tables. 79 00:05:54,500 --> 00:05:59,700 So, if you wanted to figure out if an access point has a specific encryption schema, 80 00:05:59,880 --> 00:06:03,020 then you may have to go find the right information element, 81 00:06:03,340 --> 00:06:05,340 figure out how to parse the IE. 82 00:06:05,440 --> 00:06:08,900 Now, we have the information elements and all of that 83 00:06:08,900 --> 00:06:10,960 in raw format as well, 84 00:06:11,020 --> 00:06:12,300 in case you prefer that. 85 00:06:12,340 --> 00:06:12,520 Right? 86 00:06:12,600 --> 00:06:14,780 We've base64 encoded it, 87 00:06:14,820 --> 00:06:15,320 so there's no need to worry about that. 88 00:06:15,340 --> 00:06:16,720 You can include it in your scripts 89 00:06:16,720 --> 00:06:19,800 if you'd like to write a fingerprint for Airbase NG, 90 00:06:20,480 --> 00:06:21,780 or Airreplay NG, 91 00:06:21,900 --> 00:06:23,020 or any of those tools as well. 92 00:06:23,580 --> 00:06:25,520 But this contains all of that 93 00:06:25,520 --> 00:06:26,340 plus the summary. 94 00:06:26,460 --> 00:06:27,600 So, to give you an example, 95 00:06:28,320 --> 00:06:31,020 the Mac header, the very first header 96 00:06:32,460 --> 00:06:33,820 in a wireless frame, 97 00:06:34,140 --> 00:06:35,320 we've actually mapped 98 00:06:35,320 --> 00:06:37,060 every single field 99 00:06:37,060 --> 00:06:38,620 including bit fields 100 00:06:39,160 --> 00:06:40,140 to the database. 101 00:06:41,100 --> 00:06:43,240 Now, this is the initial schema. 102 00:06:43,380 --> 00:06:45,260 If you think we can probably go ahead 103 00:06:45,340 --> 00:06:47,400 and optimize this further so that the queries 104 00:06:47,400 --> 00:06:48,340 can run faster, 105 00:06:48,540 --> 00:06:49,880 feel free to contribute. 106 00:06:52,160 --> 00:06:53,860 Now, PCAP to XML 107 00:06:53,860 --> 00:06:54,780 and SQLite 108 00:06:55,240 --> 00:06:57,020 can also dump in 109 00:06:57,020 --> 00:06:58,100 XML format. 110 00:06:59,480 --> 00:07:01,220 So, if you are more of an 111 00:07:01,220 --> 00:07:02,980 XPath and an XQuery person, 112 00:07:03,540 --> 00:07:05,380 you could actually run all of those 113 00:07:05,380 --> 00:07:07,380 queries on the XML itself. 114 00:07:07,720 --> 00:07:09,140 So, let me show you how that looks like. 115 00:07:16,680 --> 00:07:17,320 . 116 00:07:23,860 --> 00:07:25,100 So, the input 117 00:07:25,100 --> 00:07:26,400 which we've given right now 118 00:07:26,400 --> 00:07:29,040 is an additional hyphen X 119 00:07:29,040 --> 00:07:31,260 option where we specify 120 00:07:31,260 --> 00:07:33,140 the output XML file. 121 00:07:33,560 --> 00:07:35,360 Now, if I open that file up, 122 00:07:39,820 --> 00:07:41,460 for every single 123 00:07:41,460 --> 00:07:42,900 packet which we have, 124 00:07:43,000 --> 00:07:44,860 we actually have a nested XML 125 00:07:45,340 --> 00:07:45,660 packet structure. 126 00:07:47,440 --> 00:07:49,180 So, we start with the beacon frame. 127 00:07:49,420 --> 00:07:51,200 It's actually, the first frame is a beacon 128 00:07:51,200 --> 00:07:53,120 frame and we go through each 129 00:07:53,120 --> 00:07:54,520 of, you know, 130 00:07:54,540 --> 00:07:57,300 the fixed and packed parameters as an example. 131 00:07:57,520 --> 00:07:59,080 You have timestamp, beacon interval, 132 00:07:59,320 --> 00:08:00,460 capability, SSID, 133 00:08:01,300 --> 00:08:03,200 all the TLVs which may be 134 00:08:03,200 --> 00:08:03,600 in there. 135 00:08:04,840 --> 00:08:07,040 Now, the value of the TLVs are all 136 00:08:07,040 --> 00:08:09,200 base 64 encoded, right? I mean, you would 137 00:08:09,200 --> 00:08:11,140 have to do it or else it's kind of 138 00:08:11,140 --> 00:08:12,960 difficult to put everything in XML. You might 139 00:08:12,960 --> 00:08:15,140 break the XML depending on what could be 140 00:08:15,340 --> 00:08:16,420 there in one of the TLVs. 141 00:08:21,360 --> 00:08:23,060 And what we've done is 142 00:08:23,060 --> 00:08:25,300 in the XML, we've segregated 143 00:08:25,300 --> 00:08:26,520 the different headers. 144 00:08:27,020 --> 00:08:28,920 So, you can have the beacon header 145 00:08:28,920 --> 00:08:31,200 depending on if that is interesting to look at 146 00:08:31,200 --> 00:08:33,280 first and then we actually 147 00:08:33,280 --> 00:08:34,920 have the WLAN MAC header 148 00:08:34,920 --> 00:08:36,360 mentioned as well. 149 00:08:38,740 --> 00:08:41,100 Then you have all of the addresses, the four 150 00:08:41,100 --> 00:08:43,240 addresses and a bunch of 151 00:08:43,240 --> 00:08:44,160 other stuffs in there. 152 00:08:47,060 --> 00:08:47,520 Now, 153 00:08:48,200 --> 00:08:49,280 there are a lot of 154 00:08:49,280 --> 00:08:51,280 good features which PCAP to 155 00:08:51,280 --> 00:08:53,240 XML has. I'll just 156 00:08:53,240 --> 00:08:55,180 quickly run you through some of the features which 157 00:08:55,180 --> 00:08:57,300 you can try later. We've actually 158 00:08:57,300 --> 00:08:58,600 made it quite power packed. 159 00:09:04,320 --> 00:09:05,160 So, you can 160 00:09:05,160 --> 00:09:07,240 even give it a packet range or a 161 00:09:07,240 --> 00:09:09,220 list of packets to work on. So, if you're 162 00:09:09,220 --> 00:09:11,300 only interested in a subsection of the PCAP 163 00:09:11,300 --> 00:09:12,780 file, you could do that. 164 00:09:13,640 --> 00:09:15,320 So, this is basically the packet 165 00:09:15,340 --> 00:09:16,460 selection part. 166 00:09:17,500 --> 00:09:18,980 In case you have 167 00:09:18,980 --> 00:09:20,080 a data link layer, 168 00:09:20,820 --> 00:09:23,300 which is different from the regular 169 00:09:23,900 --> 00:09:24,760 PCAP offset, 170 00:09:25,100 --> 00:09:26,940 you could actually even mention the 171 00:09:26,940 --> 00:09:28,860 offset of where the .11 header 172 00:09:28,860 --> 00:09:31,140 starts. And this is something which 173 00:09:31,140 --> 00:09:32,240 I've faced a lot of times 174 00:09:32,900 --> 00:09:35,060 because a lot of cards may put in 175 00:09:35,060 --> 00:09:36,960 radio tap headers which may have more fields 176 00:09:36,960 --> 00:09:39,120 and things like that. So, this comes in 177 00:09:39,120 --> 00:09:39,620 handy there. 178 00:09:40,520 --> 00:09:42,400 We even have live mode. 179 00:09:42,620 --> 00:09:44,760 So, what live mode can do is 180 00:09:45,340 --> 00:09:47,460 if you're going ahead and dumping 181 00:09:47,460 --> 00:09:49,040 something inside a PCAP 182 00:09:49,040 --> 00:09:51,320 and you've shared that over an NFS 183 00:09:51,320 --> 00:09:53,380 based file system or even locally 184 00:09:53,380 --> 00:09:55,260 you're actually dumping using some 185 00:09:55,260 --> 00:09:57,460 other tool, then PCAP 186 00:09:57,460 --> 00:09:59,400 to XML can actually check for newer 187 00:09:59,400 --> 00:10:01,260 packets in the PCAP 188 00:10:01,260 --> 00:10:02,000 which it is monitoring. 189 00:10:02,380 --> 00:10:05,040 Just like if you've used AeroDump NG 190 00:10:05,040 --> 00:10:07,020 or any of those tools or Aircrack NG, 191 00:10:07,140 --> 00:10:09,080 it actually automatically pulls 192 00:10:09,080 --> 00:10:10,160 to see newer packets. 193 00:10:15,340 --> 00:10:17,520 Now, on POSIX based systems 194 00:10:17,520 --> 00:10:18,940 this is an experimental feature 195 00:10:18,940 --> 00:10:21,140 we just coded up last 196 00:10:21,140 --> 00:10:23,480 week. So, it's still experimental. 197 00:10:23,840 --> 00:10:25,400 But we will actually have 198 00:10:25,400 --> 00:10:27,040 live sniffing on 199 00:10:27,040 --> 00:10:28,460 POSIX based systems as well. 200 00:10:28,680 --> 00:10:31,260 On Windows you cannot do live sniffing 201 00:10:31,260 --> 00:10:33,000 without some kind of a device driver help. 202 00:10:33,160 --> 00:10:34,520 So, it doesn't apply there. 203 00:10:35,880 --> 00:10:37,080 Let's kind of go back. 204 00:10:37,680 --> 00:10:39,200 Now, one of the 205 00:10:39,200 --> 00:10:41,140 other interesting features is 206 00:10:41,140 --> 00:10:43,200 you could take multiple PCAP files 207 00:10:43,940 --> 00:10:45,200 and put them 208 00:10:45,340 --> 00:10:46,920 inside the same SQLite DB. 209 00:10:47,740 --> 00:10:49,480 So, this comes in handy 210 00:10:49,480 --> 00:10:51,300 if you'd like to do some kind 211 00:10:51,300 --> 00:10:52,480 of a spatial correlation. 212 00:10:53,220 --> 00:10:55,060 So, let's say you've probably 213 00:10:55,060 --> 00:10:57,260 deployed four pentesters who are 214 00:10:57,260 --> 00:10:59,260 collecting trace files approximately 215 00:10:59,260 --> 00:11:01,180 at the same time, you know, around 216 00:11:01,180 --> 00:11:03,120 the facility. You could merge 217 00:11:03,120 --> 00:11:05,260 those PCAPs or you can actually 218 00:11:05,260 --> 00:11:07,480 feed them directly to PCAP.xml 219 00:11:07,480 --> 00:11:09,120 and it's smart enough 220 00:11:09,120 --> 00:11:11,360 to be able to tag them based on the file 221 00:11:11,360 --> 00:11:13,300 name. We are also going 222 00:11:13,300 --> 00:11:15,200 to be adding additional options where you 223 00:11:15,340 --> 00:11:17,160 can even mention the location name 224 00:11:17,160 --> 00:11:19,420 so that you can query by location. 225 00:11:21,140 --> 00:11:22,680 Now, let me go back to the demos. 226 00:11:26,760 --> 00:11:28,780 Now, if you wanted to find 227 00:11:28,780 --> 00:11:30,880 all the beacon frames in 228 00:11:30,880 --> 00:11:32,700 Wireshark, how do you do that? 229 00:11:33,660 --> 00:11:35,140 Very simply put, you 230 00:11:35,140 --> 00:11:36,660 actually select a beacon frame. 231 00:11:38,020 --> 00:11:39,080 You'd go in here, 232 00:11:39,240 --> 00:11:41,060 right click and basically 233 00:11:41,060 --> 00:11:42,460 say apply as filter, right? 234 00:11:42,880 --> 00:11:45,040 And we get all the beacon frames 235 00:11:45,880 --> 00:11:46,640 which are there. 236 00:11:47,840 --> 00:11:49,360 36 of them in this case. 237 00:11:50,620 --> 00:11:51,260 Now, you can 238 00:11:51,260 --> 00:11:53,000 actually do the same query here. 239 00:12:00,140 --> 00:12:01,340 And all you have to do 240 00:12:01,340 --> 00:12:02,980 is give the packet type and subtype. 241 00:12:04,860 --> 00:12:05,360 And there 242 00:12:05,360 --> 00:12:07,320 you go, right? Of course, you guys 243 00:12:07,320 --> 00:12:09,420 aren't here to just see me do the same 244 00:12:09,420 --> 00:12:11,020 thing which Wireshark can already do. 245 00:12:11,560 --> 00:12:12,760 Right? So, 246 00:12:13,640 --> 00:12:14,540 let's look at the 247 00:12:14,540 --> 00:12:15,180 second problem. 248 00:12:16,620 --> 00:12:18,620 When I do wireless pen testing, 249 00:12:19,620 --> 00:12:20,600 I'd like to 250 00:12:20,600 --> 00:12:22,340 know all the unique devices 251 00:12:22,340 --> 00:12:24,620 in the air, right? I'd like to know 252 00:12:24,620 --> 00:12:26,720 the list of all Mac addresses, APs 253 00:12:26,720 --> 00:12:27,460 and clients together. 254 00:12:31,940 --> 00:12:33,740 How do you do that in Wireshark? 255 00:12:35,140 --> 00:12:36,460 I'd like a unique 256 00:12:36,460 --> 00:12:37,760 list of Mac addresses 257 00:12:37,760 --> 00:12:39,800 for all the devices around. 258 00:12:40,480 --> 00:12:42,000 How do you do that with Wireshark? 259 00:12:42,980 --> 00:12:43,860 Actually, you can't. 260 00:12:44,700 --> 00:12:46,540 Right? You'd have to probably 261 00:12:46,540 --> 00:12:48,180 script or write something on your own. 262 00:12:48,340 --> 00:12:50,520 Now, because we have everything 263 00:12:50,520 --> 00:12:51,620 in the SQL database, 264 00:12:52,180 --> 00:12:54,060 this is unbelievably simple. 265 00:12:55,240 --> 00:12:56,820 So, we can actually go in here 266 00:12:56,820 --> 00:12:58,200 and just say 267 00:12:58,760 --> 00:12:59,760 select distinct 268 00:12:59,760 --> 00:13:02,780 across all the four different addresses 269 00:13:03,760 --> 00:13:04,280 of 270 00:13:05,040 --> 00:13:06,400 a Wi-Fi packet. 271 00:13:06,740 --> 00:13:08,700 Now, of course, right now we don't have 272 00:13:08,700 --> 00:13:10,700 a blacklist for let's say the broadcast 273 00:13:10,700 --> 00:13:12,340 address and the multicast addresses. 274 00:13:12,760 --> 00:13:14,280 You could do that as well and 275 00:13:14,280 --> 00:13:15,320 have a bigger query. 276 00:13:16,000 --> 00:13:17,620 But once we go here 277 00:13:19,500 --> 00:13:20,620 and we 278 00:13:20,620 --> 00:13:21,160 run this, 279 00:13:22,280 --> 00:13:24,580 you'll actually find that we get 280 00:13:24,580 --> 00:13:26,040 the list of all unique 281 00:13:26,760 --> 00:13:28,640 Mac addresses of all devices 282 00:13:28,640 --> 00:13:29,480 in the air. 283 00:13:30,180 --> 00:13:32,460 It seems to be around 390 284 00:13:32,460 --> 00:13:32,960 of them. 285 00:13:34,680 --> 00:13:36,600 So, you can already see the power 286 00:13:36,600 --> 00:13:38,500 once everything is inside a 287 00:13:38,500 --> 00:13:39,100 SQL database. 288 00:13:41,380 --> 00:13:42,740 Now, let's actually 289 00:13:42,760 --> 00:13:44,700 make the queries a little bit more interesting. 290 00:13:48,440 --> 00:13:50,660 We have a lot of attack traffic in there 291 00:13:50,660 --> 00:13:52,420 as well. So, you may find some weird Mac 292 00:13:52,420 --> 00:13:52,900 addresses. 293 00:13:54,260 --> 00:13:56,280 We'll also talk about how to detect 294 00:13:56,280 --> 00:13:57,820 Mac address spoofing 295 00:13:57,820 --> 00:14:00,580 using this framework. Right? That's the last 296 00:14:00,580 --> 00:14:02,640 demo. So, don't worry if you see weird Macs in there. 297 00:14:02,940 --> 00:14:04,520 Now, if I'd like to find all 298 00:14:05,160 --> 00:14:06,040 access points, 299 00:14:06,500 --> 00:14:07,840 all I have to do is 300 00:14:07,840 --> 00:14:10,720 look at addresses which are transmitting 301 00:14:10,720 --> 00:14:11,300 beacon frames. 302 00:14:12,760 --> 00:14:14,620 Right? And I just take the distinct set. 303 00:14:15,640 --> 00:14:16,160 So, 304 00:14:16,260 --> 00:14:17,380 you can go in here. 305 00:14:18,620 --> 00:14:19,460 Paste this. 306 00:14:23,240 --> 00:14:24,860 And we have 36 rows 307 00:14:24,860 --> 00:14:26,440 in there. And these are 308 00:14:26,440 --> 00:14:28,460 unique Mac addresses of all the 309 00:14:28,460 --> 00:14:29,280 access points around. 310 00:14:35,860 --> 00:14:36,660 Now, we could 311 00:14:36,660 --> 00:14:37,680 do something similar 312 00:14:37,680 --> 00:14:40,280 to figure out which devices are actually 313 00:14:40,280 --> 00:14:41,260 sending data packets. 314 00:14:42,760 --> 00:14:44,420 Now, this is interesting if you'd like to run 315 00:14:44,420 --> 00:14:46,240 other tools on top of this analysis. 316 00:14:46,580 --> 00:14:48,540 Right? Let's say there is an open wireless 317 00:14:48,540 --> 00:14:50,620 network and you'd like to figure 318 00:14:50,620 --> 00:14:52,320 out certain Macs which are actually 319 00:14:52,320 --> 00:14:54,680 going ahead and sending data in plain 320 00:14:54,680 --> 00:14:56,640 text. So, the first thing is, hey, who's 321 00:14:56,640 --> 00:14:57,560 actually sending data? 322 00:14:58,380 --> 00:15:00,420 Figure out that. You can rip those 323 00:15:00,420 --> 00:15:02,600 packets out and then you can run other tools 324 00:15:02,600 --> 00:15:04,440 on them. So, 325 00:15:05,000 --> 00:15:06,460 this is again extremely 326 00:15:06,460 --> 00:15:07,980 easy to do with this 327 00:15:08,640 --> 00:15:10,060 tool. There you go. 328 00:15:11,120 --> 00:15:12,700 We can actually find the 329 00:15:12,760 --> 00:15:12,900 average 330 00:15:15,520 --> 00:15:16,480 packet length. 331 00:15:16,620 --> 00:15:17,780 So, many of these are like 332 00:15:17,780 --> 00:15:20,040 micro statistics as you can see here. 333 00:15:22,400 --> 00:15:24,460 So, the average length of 334 00:15:24,460 --> 00:15:26,580 all the packets, we have around 335 00:15:27,240 --> 00:15:28,540 400,000 packets 336 00:15:28,540 --> 00:15:29,980 in 01.db. 337 00:15:30,520 --> 00:15:32,500 Okay, that's the total number of packets in there. 338 00:15:33,800 --> 00:15:34,760 So, the average 339 00:15:34,760 --> 00:15:36,740 packet length is 106 bytes. 340 00:15:41,600 --> 00:15:42,680 You could do things 341 00:15:42,760 --> 00:15:44,760 like find the inter-packet 342 00:15:44,760 --> 00:15:45,000 delta. 343 00:15:50,820 --> 00:15:52,640 Right? So, this is the packet 344 00:15:52,640 --> 00:15:54,640 delta between successive packets. 345 00:15:56,140 --> 00:15:56,700 Now, 346 00:15:56,800 --> 00:15:58,700 let's actually get some more 347 00:15:58,700 --> 00:16:00,760 interesting information. We saw how to get 348 00:16:00,760 --> 00:16:01,740 all the Mac addresses. 349 00:16:02,280 --> 00:16:04,640 What if we can just get a unique 350 00:16:04,640 --> 00:16:06,800 list of SSIDs 351 00:16:06,800 --> 00:16:08,740 and Mac addresses in a 352 00:16:08,740 --> 00:16:10,380 given PCAP. Right? 353 00:16:10,420 --> 00:16:12,660 That would be interesting. So, it's almost 354 00:16:12,760 --> 00:16:14,540 like writing your own arrow dump in G. 355 00:16:15,780 --> 00:16:16,700 And with live 356 00:16:16,700 --> 00:16:18,600 mode, you can actually run these queries live 357 00:16:18,600 --> 00:16:20,200 to actually find out what's in the air. 358 00:16:23,520 --> 00:16:24,680 So, I'm going to copy this. 359 00:16:31,140 --> 00:16:32,020 And there you go. 360 00:16:33,620 --> 00:16:34,720 Some of these are 361 00:16:34,720 --> 00:16:36,340 hidden SSID networks. So, 362 00:16:36,380 --> 00:16:38,560 the broadcast or SSID is actually 363 00:16:38,560 --> 00:16:40,120 null. There isn't anything in there. 364 00:16:40,540 --> 00:16:42,300 So, we can actually find 365 00:16:42,760 --> 00:16:44,860 a unique list of SSIDs 366 00:16:44,860 --> 00:16:45,560 and Mac addresses 367 00:16:45,560 --> 00:16:47,800 with just a simple query. 368 00:16:48,380 --> 00:16:50,720 Now, at this point, of course, we are joining 369 00:16:50,720 --> 00:16:52,560 multiple tables because we've 370 00:16:52,560 --> 00:16:54,680 tried to partition the tables in such a way 371 00:16:54,680 --> 00:16:56,740 that the queries can be optimized. 372 00:16:57,020 --> 00:16:58,560 So, we've looked at how we can 373 00:16:58,560 --> 00:17:00,560 run fast queries on, let's say, 2-3 374 00:17:00,560 --> 00:17:01,300 million packets. 375 00:17:02,360 --> 00:17:04,440 And going ahead and creating an efficient 376 00:17:04,440 --> 00:17:05,800 schema is very important. 377 00:17:09,200 --> 00:17:11,840 Now, if we wanted to find 378 00:17:11,840 --> 00:17:13,620 all the hidden SSID networks 379 00:17:13,620 --> 00:17:15,720 around. Let's copy 380 00:17:15,720 --> 00:17:16,160 this out. 381 00:17:20,060 --> 00:17:21,560 And these are all 382 00:17:21,560 --> 00:17:23,580 the access points which are sending out 383 00:17:23,580 --> 00:17:24,760 hidden SSID networks. 384 00:17:25,660 --> 00:17:27,460 Right? It's a very simple 385 00:17:27,460 --> 00:17:29,800 where length SSID equals 0. That's it. 386 00:17:30,280 --> 00:17:31,700 You can actually run it on 387 00:17:31,700 --> 00:17:32,740 an entire column. 388 00:17:34,540 --> 00:17:36,800 And most of these macros are already 389 00:17:36,800 --> 00:17:38,620 available with SQLiteDB. I mean, 390 00:17:38,660 --> 00:17:40,700 I'm not using any of my 391 00:17:40,700 --> 00:17:42,620 own custom, you know, 392 00:17:42,640 --> 00:17:44,400 additional extensions or anything like that. 393 00:17:44,500 --> 00:17:46,300 This is the default SQLiteDB. 394 00:17:49,880 --> 00:17:50,780 Now, a lot of 395 00:17:50,780 --> 00:17:52,580 times when I do wireless pen tests, 396 00:17:52,820 --> 00:17:54,580 I'd like to know all 397 00:17:55,100 --> 00:17:56,900 SSIDs on a given channel. 398 00:18:00,680 --> 00:18:02,000 So, you can actually go in here. 399 00:18:05,940 --> 00:18:06,800 So, on 400 00:18:06,800 --> 00:18:08,600 channel 6, we 401 00:18:08,600 --> 00:18:10,600 basically have all of these access points 402 00:18:10,600 --> 00:18:12,420 and the SSIDs. 403 00:18:13,420 --> 00:18:14,660 The way we pick 404 00:18:14,660 --> 00:18:16,700 this up is in the beacon frame, you have something 405 00:18:16,700 --> 00:18:17,760 called a DS parameter, 406 00:18:18,460 --> 00:18:20,060 which actually specifies the 407 00:18:20,600 --> 00:18:21,840 channel on which the AP is. 408 00:18:30,840 --> 00:18:32,580 Now, attacking clients 409 00:18:33,800 --> 00:18:35,140 most of the times 410 00:18:35,140 --> 00:18:36,580 when you want to attack a client, 411 00:18:36,740 --> 00:18:38,460 you actually want to know the 412 00:18:38,460 --> 00:18:40,760 unique list of probed SSIDs, right? 413 00:18:41,000 --> 00:18:42,720 These are SSIDs for which 414 00:18:42,720 --> 00:18:44,320 the client is sending out probe requests. 415 00:18:44,820 --> 00:18:46,840 And then you can create a honeypot 416 00:18:46,840 --> 00:18:48,500 with the same SSID 417 00:18:48,500 --> 00:18:50,740 and the client connects to it. 418 00:18:50,960 --> 00:18:52,780 You know, you have tools like 419 00:18:52,780 --> 00:18:54,460 Karma or Karma 420 00:18:54,460 --> 00:18:56,720 you can use the Wi-Fi pineapple 421 00:18:56,720 --> 00:18:57,860 bunch of them out there. 422 00:18:58,400 --> 00:19:00,380 So, if we wanted to find 423 00:19:00,380 --> 00:19:02,720 all the probe SSIDs 424 00:19:02,740 --> 00:19:04,520 in the PCAP, 425 00:19:04,660 --> 00:19:06,460 all we have to do is 426 00:19:07,080 --> 00:19:08,280 run this query 427 00:19:08,280 --> 00:19:09,920 on the SQLite DB. 428 00:19:12,120 --> 00:19:12,720 Now, 429 00:19:12,800 --> 00:19:14,320 every single MAC 430 00:19:14,320 --> 00:19:16,580 also sends out null probe requests. 431 00:19:16,740 --> 00:19:17,700 Keep that in mind, right? 432 00:19:18,420 --> 00:19:20,560 So, there you go. Null probes 433 00:19:20,560 --> 00:19:22,480 along with whatever 434 00:19:22,480 --> 00:19:23,380 they are querying for. 435 00:19:24,860 --> 00:19:26,660 If you were interested in just 436 00:19:26,660 --> 00:19:28,820 one MAC address, you can optimize 437 00:19:28,820 --> 00:19:29,820 the query further 438 00:19:30,520 --> 00:19:32,640 and monitor a single MAC. 439 00:19:34,200 --> 00:19:35,740 And all of these things 440 00:19:35,740 --> 00:19:36,700 would actually take you 441 00:19:36,700 --> 00:19:38,320 tens of minutes, 442 00:19:38,560 --> 00:19:40,520 sometimes even hours to figure out 443 00:19:40,520 --> 00:19:41,180 with Wireshark. 444 00:19:46,820 --> 00:19:47,780 And there you go. 445 00:19:47,900 --> 00:19:50,720 This MAC address is actually querying for 446 00:19:50,720 --> 00:19:52,920 these set of SSIDs. 447 00:19:55,400 --> 00:19:56,800 Now, one of the reasons 448 00:19:56,800 --> 00:19:58,260 we have kept it SQLite 449 00:19:58,260 --> 00:20:00,680 is simply because as you can clearly see 450 00:20:00,680 --> 00:20:02,660 you can probably write your own scripts around 451 00:20:02,740 --> 00:20:04,360 this. So, if you like 452 00:20:04,360 --> 00:20:06,620 Python or Ruby or almost 453 00:20:06,620 --> 00:20:08,380 any language which can support 454 00:20:08,380 --> 00:20:10,520 SQLite, which almost 455 00:20:10,520 --> 00:20:12,300 all of them do, then you could 456 00:20:12,300 --> 00:20:14,660 make these queries and get meaningful information 457 00:20:14,660 --> 00:20:15,160 out. 458 00:20:18,400 --> 00:20:20,620 Now, let's actually make it even more 459 00:20:20,620 --> 00:20:21,100 interesting. 460 00:20:22,760 --> 00:20:24,540 Let's write our own arrow 461 00:20:24,540 --> 00:20:26,440 dump in G, kind of, right? 462 00:20:26,660 --> 00:20:28,700 Thomas' arrow dump of course is way more 463 00:20:28,700 --> 00:20:30,440 you know, interesting and sophisticated. 464 00:20:30,880 --> 00:20:32,400 So, what we have done is 465 00:20:32,740 --> 00:20:34,260 when we parse the packets, 466 00:20:34,560 --> 00:20:36,760 we also automatically pick up 467 00:20:36,760 --> 00:20:38,640 things like the encryption and all of that. 468 00:20:39,260 --> 00:20:40,740 Right? What are 469 00:20:40,740 --> 00:20:42,060 we using? Is this CCMP? 470 00:20:42,300 --> 00:20:44,400 Is the access point supporting both 471 00:20:44,400 --> 00:20:46,560 WPA, WPA2? And 472 00:20:46,560 --> 00:20:48,440 we push all of that into a 473 00:20:48,440 --> 00:20:49,900 macro statistics table. 474 00:20:50,480 --> 00:20:52,660 This is just so that you don't have to go 475 00:20:52,660 --> 00:20:54,560 through the pains of figuring out the 476 00:20:54,560 --> 00:20:56,540 right information element, what it looks 477 00:20:56,540 --> 00:20:58,760 like, how do you parse the TLV, 478 00:20:58,900 --> 00:21:00,600 right? To finally figure out 479 00:21:00,600 --> 00:21:02,020 the encryption and RSN information. 480 00:21:03,300 --> 00:21:04,600 Now, of course 481 00:21:04,600 --> 00:21:06,460 this requires a little bit more SQL 482 00:21:06,460 --> 00:21:08,660 magic. We are joining multiple 483 00:21:08,660 --> 00:21:09,200 tables. 484 00:21:10,500 --> 00:21:11,360 So, let me 485 00:21:14,640 --> 00:21:15,560 take this 486 00:21:23,700 --> 00:21:25,060 and there you go. 487 00:21:27,680 --> 00:21:28,520 Now, for 488 00:21:28,520 --> 00:21:30,660 some columns you may see CCMP, TK 489 00:21:30,660 --> 00:21:32,500 both. These are APs which are 490 00:21:32,740 --> 00:21:34,320 actually running in mixed mode. They advertise 491 00:21:34,320 --> 00:21:35,340 both possibilities. 492 00:21:36,340 --> 00:21:38,100 It's all picked up from the beacons. 493 00:21:40,820 --> 00:21:42,140 So, this basically 494 00:21:42,740 --> 00:21:44,600 can kind of go on. In the 495 00:21:44,600 --> 00:21:46,580 sense you can pick up any property 496 00:21:46,580 --> 00:21:48,580 of the access point. You can have the channels 497 00:21:48,580 --> 00:21:50,580 listed. You could have 498 00:21:50,580 --> 00:21:51,720 the data rates listed. 499 00:21:52,200 --> 00:21:54,800 Anything which is already there in the beacon 500 00:21:54,800 --> 00:21:56,460 can be comfortably done. 501 00:21:56,940 --> 00:21:58,460 You could extend the 502 00:21:58,460 --> 00:22:00,440 macro statistics part as well. 503 00:22:01,640 --> 00:22:02,160 Now, 504 00:22:02,740 --> 00:22:04,680 this entire tool is actually written in 505 00:22:04,680 --> 00:22:05,140 C++. 506 00:22:06,380 --> 00:22:08,580 The SQLiteDB, of course, once you want to 507 00:22:08,580 --> 00:22:10,600 go and do something in there, you can use any 508 00:22:11,580 --> 00:22:12,400 scripting framework. 509 00:22:22,080 --> 00:22:22,560 Now, 510 00:22:22,640 --> 00:22:24,520 when you want to do any form of attack 511 00:22:24,520 --> 00:22:26,060 tool fingerprinting, 512 00:22:26,600 --> 00:22:28,420 it's important to be able to look at 513 00:22:28,420 --> 00:22:30,460 all the IEs which are being sent. 514 00:22:30,460 --> 00:22:32,340 So, again, for 515 00:22:32,340 --> 00:22:33,080 a given 516 00:22:34,240 --> 00:22:34,800 network, 517 00:22:35,820 --> 00:22:37,440 this is actually quite easy. 518 00:22:43,740 --> 00:22:45,900 So, this is basically the list of 519 00:22:46,340 --> 00:22:48,120 all the different information elements. 520 00:22:48,300 --> 00:22:49,000 If you can have a go here. 521 00:22:56,000 --> 00:22:58,280 Now, most information elements are 522 00:22:58,280 --> 00:23:00,160 actually just simple data 523 00:23:00,460 --> 00:23:01,740 structures, right? 524 00:23:02,200 --> 00:23:03,900 Unfortunately, they aren't human readable. 525 00:23:04,560 --> 00:23:06,400 So, we've kind of encoded them in 526 00:23:06,400 --> 00:23:08,320 Base64 and put it inside the database. 527 00:23:08,760 --> 00:23:10,200 In the beginning, we were actually 528 00:23:10,200 --> 00:23:12,200 putting them in their raw binary form. 529 00:23:12,660 --> 00:23:14,200 But then that makes it quite 530 00:23:14,200 --> 00:23:16,220 difficult if you're writing a script 531 00:23:16,220 --> 00:23:18,620 which is doing some kind of fingerprinting 532 00:23:18,620 --> 00:23:20,420 because then you would have to do something similar. 533 00:23:21,220 --> 00:23:22,000 So, it's all 534 00:23:22,000 --> 00:23:23,500 Base64 encoded in there. 535 00:23:29,580 --> 00:23:30,340 Now, you can 536 00:23:30,460 --> 00:23:32,220 find client information 537 00:23:32,220 --> 00:23:34,180 elements as well. It's actually 538 00:23:34,180 --> 00:23:35,900 quite easy. It's very similar. 539 00:23:41,640 --> 00:23:44,240 Now, all of these IEs can be used to 540 00:23:44,240 --> 00:23:46,300 fingerprint clients and do interesting stuff 541 00:23:46,300 --> 00:23:47,880 if you so desire. 542 00:24:01,040 --> 00:24:02,400 Now, this one is 543 00:24:02,400 --> 00:24:03,300 just to look at 544 00:24:03,300 --> 00:24:05,980 what times exactly 545 00:24:05,980 --> 00:24:08,360 is a device actually sending something 546 00:24:08,360 --> 00:24:10,500 out, right? How active is a device 547 00:24:10,500 --> 00:24:11,140 over the air? 548 00:24:13,720 --> 00:24:14,320 So, 549 00:24:14,400 --> 00:24:16,120 these are different instances where 550 00:24:16,120 --> 00:24:18,220 the device was actually active 551 00:24:19,300 --> 00:24:20,460 using an absolute 552 00:24:20,460 --> 00:24:21,860 timestamp which is available 553 00:24:22,460 --> 00:24:24,260 in the packet header field 554 00:24:24,260 --> 00:24:26,160 which Wireshark creates for you. 555 00:24:26,240 --> 00:24:28,220 Or rather, whichever capturing 556 00:24:28,220 --> 00:24:30,160 program has actually put it in. 557 00:24:30,900 --> 00:24:31,440 Now, 558 00:24:32,840 --> 00:24:34,200 this is the first part 559 00:24:34,200 --> 00:24:36,060 where you can clearly see that 560 00:24:36,060 --> 00:24:37,440 once you go ahead 561 00:24:38,000 --> 00:24:40,080 and put everything inside 562 00:24:40,080 --> 00:24:41,260 a SQLite database, 563 00:24:41,420 --> 00:24:44,200 then you can actually run your own arbitrary queries. 564 00:24:44,520 --> 00:24:46,400 These are just a few I could 565 00:24:46,400 --> 00:24:48,120 think of. I mean, you're just limited 566 00:24:48,120 --> 00:24:50,440 by your creativity and how much SQL you know. 567 00:24:51,440 --> 00:24:52,340 So, I'm going to 568 00:24:52,340 --> 00:24:54,380 talk about one very interesting 569 00:24:54,380 --> 00:24:56,240 attack and how we could probably 570 00:24:56,240 --> 00:24:58,180 detect that writing a 571 00:24:58,180 --> 00:25:00,440 script to go ahead and use it. 572 00:25:00,460 --> 00:25:01,120 Let's use all of this data. 573 00:25:02,800 --> 00:25:04,400 Now, how do we detect 574 00:25:04,400 --> 00:25:06,100 AP max spoofing 575 00:25:06,100 --> 00:25:08,160 or max spoofing of any kind 576 00:25:08,160 --> 00:25:09,180 on a wireless interface? 577 00:25:09,600 --> 00:25:11,960 So, when we create a fake access point, 578 00:25:12,680 --> 00:25:13,980 fake AP 101 579 00:25:13,980 --> 00:25:16,160 is actually you just creating 580 00:25:16,160 --> 00:25:17,240 the same SSID. 581 00:25:17,540 --> 00:25:20,140 It ends up having different BSSIDs, right? 582 00:25:20,260 --> 00:25:22,180 Which is what is the default option 583 00:25:22,180 --> 00:25:22,860 for airbase. 584 00:25:23,700 --> 00:25:25,320 But what if the attacker 585 00:25:25,320 --> 00:25:27,460 creates an access point 586 00:25:27,460 --> 00:25:30,300 with the exact same BSSID 587 00:25:30,460 --> 00:25:30,920 as your MAC address? 588 00:25:32,720 --> 00:25:33,740 How do you detect 589 00:25:33,740 --> 00:25:35,180 that fake AP is around? 590 00:25:35,600 --> 00:25:37,340 What if there are 10 of them around? 591 00:25:40,060 --> 00:25:40,500 Anyone? 592 00:25:42,360 --> 00:25:43,860 Actually, I did a DEF CON 593 00:25:43,860 --> 00:25:46,200 talk yesterday and I gave the answer there. 594 00:25:46,360 --> 00:25:48,300 So, this is kind of good 595 00:25:48,300 --> 00:25:49,800 because if everyone is new then 596 00:25:49,800 --> 00:25:51,700 this part is going to be a repetition. 597 00:25:51,980 --> 00:25:53,360 Okay, whoever can try 598 00:25:54,140 --> 00:25:55,520 you can actually win a book. 599 00:25:58,040 --> 00:25:59,260 How would that work? 600 00:26:04,240 --> 00:26:04,720 Okay. 601 00:26:05,320 --> 00:26:06,140 Okay, great. 602 00:26:06,260 --> 00:26:07,360 Were you for my talk yesterday? 603 00:26:09,020 --> 00:26:10,180 Okay. Here you go. 604 00:26:12,460 --> 00:26:14,200 Yep. I'm just leaving it here and 605 00:26:14,200 --> 00:26:16,400 you can collect it at the end of the talk. 606 00:26:16,620 --> 00:26:17,100 Thanks. 607 00:26:19,560 --> 00:26:20,040 Okay. 608 00:26:21,740 --> 00:26:22,220 So, 609 00:26:22,800 --> 00:26:24,240 what other parameters 610 00:26:24,240 --> 00:26:26,400 can we use to go ahead and 611 00:26:26,400 --> 00:26:28,180 detect things like max spoofing 612 00:26:28,180 --> 00:26:29,880 let's say in an enterprise 613 00:26:29,880 --> 00:26:32,160 environment? So, let's say we have a rogue 614 00:26:32,160 --> 00:26:33,800 device and 615 00:26:33,800 --> 00:26:35,800 we've connected that rogue access point 616 00:26:35,800 --> 00:26:37,720 to your enterprise, right? 617 00:26:37,900 --> 00:26:39,340 It's a very common case. 618 00:26:41,040 --> 00:26:41,940 What else 619 00:26:41,940 --> 00:26:43,840 can we use apart from sequence numbers 620 00:26:43,840 --> 00:26:46,260 to detect things like MAC address spoofing? 621 00:26:47,540 --> 00:26:48,060 Anyone? 622 00:26:48,400 --> 00:26:49,940 That's because you already knew I have 623 00:26:49,940 --> 00:26:51,180 another book as well, so 624 00:26:51,180 --> 00:26:52,040 . 625 00:26:56,540 --> 00:26:57,860 Actually, I have three of them. 626 00:27:03,700 --> 00:27:04,820 Anything else? 627 00:27:05,360 --> 00:27:05,780 I mean, yeah. 628 00:27:06,440 --> 00:27:06,840 . 629 00:27:08,400 --> 00:27:10,420 What exactly in the beacon frames? 630 00:27:11,660 --> 00:27:12,220 Okay. 631 00:27:12,500 --> 00:27:14,700 One good answer is the beacon frames 632 00:27:14,700 --> 00:27:16,440 would differ because most attack tools 633 00:27:16,440 --> 00:27:18,540 don't create the exact same beacon frame, right? 634 00:27:19,140 --> 00:27:20,060 So, yep. 635 00:27:21,180 --> 00:27:22,240 Here goes second book. 636 00:27:22,400 --> 00:27:24,740 What else can we use? 637 00:27:27,780 --> 00:27:28,680 Anything else? 638 00:27:28,880 --> 00:27:31,120 So, now let's assume the attacker 639 00:27:31,120 --> 00:27:32,460 is creating a fake AP 640 00:27:32,460 --> 00:27:33,820 which is identical. 641 00:27:34,580 --> 00:27:36,820 He even clones the beacon frame. 642 00:27:38,700 --> 00:27:40,740 No attack tool does that right now. 643 00:27:40,800 --> 00:27:42,320 You could probably hack that up with Skp, 644 00:27:42,480 --> 00:27:44,480 but none of the attack tools do that. 645 00:27:44,540 --> 00:27:46,400 They don't have like a beacon frame 646 00:27:46,400 --> 00:27:47,400 replication mode. 647 00:27:48,120 --> 00:27:50,440 So, the MAC address is the same. 648 00:27:51,180 --> 00:27:52,820 The beacon frame looks identical 649 00:27:53,360 --> 00:27:55,260 apart from the sequence number. 650 00:27:55,460 --> 00:27:56,800 Is there anything else we could use 651 00:27:56,800 --> 00:27:57,900 in an enterprise environment? 652 00:27:58,380 --> 00:27:59,620 I've kind of limited the scope. 653 00:28:02,820 --> 00:28:04,600 The MAC address is the same. 654 00:28:08,740 --> 00:28:09,280 Yeah. 655 00:28:12,160 --> 00:28:13,120 If the MAC 656 00:28:13,120 --> 00:28:14,940 address is identical, most of your 657 00:28:14,940 --> 00:28:16,720 analytics tool will just pick up the first 658 00:28:16,720 --> 00:28:18,380 three octets and decide that. 659 00:28:18,380 --> 00:28:20,480 I mean, we can't see any of the APs 660 00:28:20,480 --> 00:28:21,760 that we can kind of, you know, 661 00:28:21,820 --> 00:28:24,320 turn them and actually look at the manufacturer name. 662 00:28:30,780 --> 00:28:31,780 Little bit more. 663 00:28:33,140 --> 00:28:33,880 Yeah, go ahead. 664 00:28:34,020 --> 00:28:35,620 I mean, you're close, but... 665 00:28:39,900 --> 00:28:42,480 The beacon interval timing can be cloned, right? 666 00:28:42,580 --> 00:28:44,000 I mean, you can just monitor an AP 667 00:28:44,000 --> 00:28:45,460 and most of them actually have it 668 00:28:45,460 --> 00:28:46,620 fixed values. 669 00:28:48,380 --> 00:28:49,720 Manufacturers set that to fixed values. 670 00:28:49,860 --> 00:28:50,820 Nobody ever changes it. 671 00:28:51,880 --> 00:28:54,180 So, this is an attacker who's 672 00:28:54,180 --> 00:28:56,260 actually monitoring the air 673 00:28:56,260 --> 00:28:58,220 and is creating his fake AP. 674 00:29:00,200 --> 00:29:02,020 And I've kind of limited the scope. 675 00:29:02,280 --> 00:29:04,000 This is an enterprise environment. 676 00:29:04,340 --> 00:29:06,240 I mean, maybe the fake AP is somewhere 677 00:29:06,240 --> 00:29:08,280 in this entire floor and this is an 678 00:29:08,280 --> 00:29:10,200 enterprise office, right? 679 00:29:11,380 --> 00:29:12,060 How do 680 00:29:12,060 --> 00:29:13,800 wireless intrusion detection systems 681 00:29:13,800 --> 00:29:14,560 do it today? 682 00:29:20,220 --> 00:29:20,700 Okay. 683 00:29:21,940 --> 00:29:22,980 Okay, very good. 684 00:29:23,460 --> 00:29:24,140 Very good. 685 00:29:24,200 --> 00:29:26,480 So, signal strength is something 686 00:29:26,480 --> 00:29:28,120 we can use as well, provided 687 00:29:28,120 --> 00:29:29,740 you have sensors around, right? 688 00:29:29,800 --> 00:29:31,640 So, here is a book as well. 689 00:29:32,620 --> 00:29:33,100 Great. 690 00:29:34,380 --> 00:29:36,440 So, a bunch of metrics 691 00:29:36,440 --> 00:29:38,040 which actually can be used. 692 00:29:38,540 --> 00:29:40,120 The sequence number itself 693 00:29:40,120 --> 00:29:41,340 is actually quite powerful. 694 00:29:42,140 --> 00:29:43,380 Now, let me show you 695 00:29:44,840 --> 00:29:46,060 how this looks like. 696 00:29:50,180 --> 00:29:50,700 . 697 00:29:53,640 --> 00:29:54,160 . 698 00:29:56,420 --> 00:29:56,940 . 699 00:29:56,940 --> 00:29:58,160 So, this is a PCAP file 700 00:29:58,160 --> 00:30:00,060 in which I have a 701 00:30:00,060 --> 00:30:02,080 TP-link based access point which is 702 00:30:02,080 --> 00:30:03,040 sending out beacon frames. 703 00:30:03,980 --> 00:30:06,320 And after some time, though you could have 704 00:30:06,320 --> 00:30:08,020 started the fake AP right now itself, 705 00:30:08,360 --> 00:30:10,160 we've also started a 706 00:30:10,160 --> 00:30:12,000 fake access point with the same 707 00:30:12,000 --> 00:30:14,000 MAC address. In this case, 708 00:30:14,020 --> 00:30:15,900 the beacons are differing, 709 00:30:15,900 --> 00:30:17,840 but let's not worry about the beacons, right? 710 00:30:18,380 --> 00:30:19,300 Let's use beacons to fingerprint 711 00:30:19,300 --> 00:30:22,000 two different devices. Let's use 712 00:30:22,000 --> 00:30:22,680 sequence numbers. 713 00:30:23,380 --> 00:30:25,500 So, if you can now scroll down, 714 00:30:26,340 --> 00:30:28,160 always keep looking at this 715 00:30:28,160 --> 00:30:29,280 value here, SN. 716 00:30:30,220 --> 00:30:32,220 Okay? SN stands for 717 00:30:32,220 --> 00:30:33,000 sequence numbers. 718 00:30:33,580 --> 00:30:36,200 In wireless, all devices 719 00:30:36,200 --> 00:30:38,020 are supposed to increment their sequence 720 00:30:38,020 --> 00:30:40,300 number by one for every frame 721 00:30:40,300 --> 00:30:42,140 they send. Once they hit the 722 00:30:42,140 --> 00:30:44,160 maximum, they just go ahead and, you know, 723 00:30:44,160 --> 00:30:45,940 start from one again. 724 00:30:47,220 --> 00:30:47,860 So, 725 00:30:48,380 --> 00:30:50,280 here is one device which is sending out 726 00:30:50,280 --> 00:30:51,020 sequence frames. 727 00:30:54,120 --> 00:30:55,200 Kind of increasing. 728 00:31:00,200 --> 00:31:02,180 Okay. Do you notice 729 00:31:02,180 --> 00:31:03,240 something interesting now? 730 00:31:09,880 --> 00:31:12,140 So, now what you actually see is, there 731 00:31:12,140 --> 00:31:13,380 seem to be two different 732 00:31:14,020 --> 00:31:16,180 sequences. Now, you 733 00:31:16,180 --> 00:31:18,060 might argue, what happens if an attacker 734 00:31:18,380 --> 00:31:19,400 copies that, right? 735 00:31:19,940 --> 00:31:22,080 It's extremely difficult to do it, but if 736 00:31:22,080 --> 00:31:23,820 he does it, there are going to be collisions 737 00:31:23,820 --> 00:31:26,000 in a very small space, right? 738 00:31:26,180 --> 00:31:28,140 So, let's say the real AP sent out a 739 00:31:28,140 --> 00:31:29,300 sequence number 100. 740 00:31:29,800 --> 00:31:32,000 The attacker sniffs that, sends the next 741 00:31:32,000 --> 00:31:33,600 frame 100. But by then, 742 00:31:33,720 --> 00:31:36,060 100 is already in the air. We have it. 743 00:31:36,180 --> 00:31:37,760 So, there's probably going to be 100 744 00:31:37,760 --> 00:31:40,120 after that. If the real AP is 745 00:31:40,120 --> 00:31:41,820 transmitting at a fast rate, 746 00:31:42,240 --> 00:31:44,080 you'd actually find 100 to 747 00:31:44,080 --> 00:31:46,160 110 being sent out, and 748 00:31:46,160 --> 00:31:47,620 then the attacker is trailing behind. 749 00:31:48,380 --> 00:31:49,800 Right? Regardless, 750 00:31:50,080 --> 00:31:52,060 till the time there are multiple 751 00:31:52,060 --> 00:31:54,380 frames in the air 752 00:31:54,380 --> 00:31:55,680 with the same sequence number, 753 00:31:55,920 --> 00:31:58,020 that's something which is extremely fishy. 754 00:31:58,920 --> 00:32:00,340 Intrusion detection systems 755 00:32:00,340 --> 00:32:02,300 combine that with the RSSI 756 00:32:02,300 --> 00:32:04,200 value to actually 757 00:32:04,200 --> 00:32:06,480 say, hey, this isn't a coincidence. 758 00:32:06,660 --> 00:32:08,500 These are actually two separate devices 759 00:32:08,500 --> 00:32:10,200 because three of my 760 00:32:10,200 --> 00:32:12,100 sensors are picking up completely 761 00:32:12,100 --> 00:32:13,420 different RSSI values. 762 00:32:13,940 --> 00:32:16,260 Now, who gives you the RSSI 763 00:32:16,260 --> 00:32:18,340 values? Well, depending on 764 00:32:18,380 --> 00:32:19,140 the sensor box, 765 00:32:20,560 --> 00:32:22,240 it's basically going to be the 766 00:32:22,240 --> 00:32:23,660 hardware driver. So, if we actually 767 00:32:24,380 --> 00:32:25,680 look at these values, 768 00:32:29,320 --> 00:32:30,300 and go down 769 00:32:30,300 --> 00:32:30,580 here, 770 00:32:34,120 --> 00:32:35,960 that is the signal strength. 771 00:32:36,180 --> 00:32:37,940 Now, keep in mind, just 772 00:32:37,940 --> 00:32:39,600 one node monitoring 773 00:32:40,180 --> 00:32:42,420 signal strength is not a good metric 774 00:32:42,420 --> 00:32:44,360 at all. Right? Wi-Fi 775 00:32:44,360 --> 00:32:45,580 has what we call 776 00:32:46,360 --> 00:32:48,300 multi-path fading. So, this 777 00:32:48,380 --> 00:32:50,040 environment is continuously changing. 778 00:32:50,840 --> 00:32:52,280 At the same location, 779 00:32:52,500 --> 00:32:54,180 you can have local maximas and 780 00:32:54,180 --> 00:32:56,280 minimas, depending on how the 781 00:32:56,280 --> 00:32:58,460 waves are interfering and go out of phase 782 00:32:58,460 --> 00:33:00,000 based on the environment. 783 00:33:00,480 --> 00:33:02,440 So, network IDSs, 784 00:33:02,600 --> 00:33:04,060 just like a GPS system, 785 00:33:04,240 --> 00:33:06,260 require at least three sensors 786 00:33:06,260 --> 00:33:08,320 to be able to triangulate 787 00:33:08,320 --> 00:33:10,160 a device on a given 788 00:33:10,160 --> 00:33:10,720 floor plan. 789 00:33:12,420 --> 00:33:14,380 And if you can think about a newer way 790 00:33:14,380 --> 00:33:16,240 of doing it, most of those are multi-million 791 00:33:16,240 --> 00:33:18,360 dollar patents because of which 792 00:33:18,380 --> 00:33:19,960 companies in this space actually get 793 00:33:19,960 --> 00:33:22,200 acquired. That's probably the only metric 794 00:33:22,200 --> 00:33:23,720 used. So, 795 00:33:24,260 --> 00:33:26,380 now, how can we 796 00:33:26,380 --> 00:33:27,780 use PCAP to XML 797 00:33:28,280 --> 00:33:29,620 with a little bit of visualization 798 00:33:30,380 --> 00:33:32,180 to actually pick this up for any 799 00:33:32,180 --> 00:33:32,880 given MAC address? 800 00:33:33,820 --> 00:33:36,220 So, here is what I did. This is 801 00:33:36,220 --> 00:33:37,500 an illustration of using 802 00:33:38,520 --> 00:33:39,400 PCAP to XML. 803 00:33:49,680 --> 00:33:50,120 So, 804 00:33:50,260 --> 00:33:52,060 let me run the tool and I'll show you 805 00:33:53,080 --> 00:33:54,120 how it looks like. 806 00:33:54,740 --> 00:33:56,360 Now, I've given it a MAC address. 807 00:33:56,600 --> 00:33:58,240 You can automate that to pick up 808 00:33:58,240 --> 00:34:00,240 all MACs in a given PCAP 809 00:34:00,240 --> 00:34:02,160 and actually run it for each of them, right? 810 00:34:02,420 --> 00:34:04,100 So, this is just an illustration. 811 00:34:04,360 --> 00:34:06,260 Let me go back and open up 812 00:34:06,260 --> 00:34:07,440 spoof.png. 813 00:34:23,320 --> 00:34:24,040 . 814 00:34:27,760 --> 00:34:28,480 . 815 00:34:32,760 --> 00:34:33,480 . 816 00:34:40,460 --> 00:34:41,180 . 817 00:34:41,180 --> 00:34:43,020 Let me actually copy this out somewhere. 818 00:34:44,520 --> 00:34:46,820 Does anyone remember any GUI program 819 00:34:49,380 --> 00:34:50,380 that I used? 820 00:34:53,360 --> 00:34:53,560 . 821 00:34:59,240 --> 00:34:59,440 . 822 00:34:59,440 --> 00:34:59,760 . 823 00:34:59,760 --> 00:34:59,780 . 824 00:34:59,780 --> 00:34:59,880 . 825 00:34:59,880 --> 00:34:59,940 . 826 00:34:59,940 --> 00:34:59,980 . 827 00:34:59,980 --> 00:35:00,100 . 828 00:35:00,100 --> 00:35:00,120 . 829 00:35:00,120 --> 00:35:00,180 . 830 00:35:00,180 --> 00:35:00,220 . 831 00:35:03,160 --> 00:35:03,360 . 832 00:35:03,360 --> 00:35:03,400 . 833 00:35:18,380 --> 00:35:19,320 . 834 00:35:19,320 --> 00:35:20,440 . 835 00:35:20,440 --> 00:35:20,840 . 836 00:35:22,520 --> 00:35:23,320 . 837 00:35:25,540 --> 00:35:26,340 . 838 00:35:26,340 --> 00:35:26,820 . 839 00:35:26,820 --> 00:35:26,880 . 840 00:35:26,880 --> 00:35:27,080 . 841 00:35:27,080 --> 00:35:27,140 . 842 00:35:27,140 --> 00:35:27,160 . 843 00:35:27,160 --> 00:35:27,220 . 844 00:35:48,380 --> 00:35:48,640 . 845 00:35:48,640 --> 00:35:48,680 . 846 00:35:48,680 --> 00:35:49,340 . 847 00:35:53,560 --> 00:35:54,080 . 848 00:35:54,080 --> 00:35:54,420 . 849 00:35:54,420 --> 00:35:54,460 . 850 00:35:58,920 --> 00:35:59,440 . 851 00:35:59,440 --> 00:35:59,460 . 852 00:35:59,460 --> 00:35:59,540 . 853 00:35:59,540 --> 00:35:59,560 . 854 00:35:59,560 --> 00:35:59,580 . 855 00:35:59,580 --> 00:36:00,100 . 856 00:36:00,100 --> 00:36:00,520 . 857 00:36:22,600 --> 00:36:23,120 . 858 00:36:25,840 --> 00:36:27,580 All of this code is available. 859 00:36:28,140 --> 00:36:29,380 It's going to be on GitHub, 860 00:36:29,500 --> 00:36:31,920 so feel free to use it. 861 00:36:33,380 --> 00:36:33,900 . 862 00:36:33,900 --> 00:36:34,680 . 863 00:36:39,640 --> 00:36:40,160 . 864 00:36:40,160 --> 00:36:40,180 . 865 00:36:40,180 --> 00:36:41,140 Anyone here use Python? 866 00:36:41,900 --> 00:36:42,940 Couple of guys? Okay. 867 00:36:44,380 --> 00:36:45,420 So, internally, 868 00:36:45,680 --> 00:36:47,480 we actually just use Python 869 00:36:48,380 --> 00:36:50,500 for a couple of things and other visualization. 870 00:36:50,580 --> 00:36:52,000 We actually even use Pandas 871 00:36:52,000 --> 00:36:53,100 in case you've used it. 872 00:36:53,480 --> 00:36:56,140 It's quite good to be 873 00:36:56,640 --> 00:36:57,340 using that. 874 00:36:57,940 --> 00:37:00,120 So, what we basically do is we 875 00:37:00,120 --> 00:37:02,300 initialize the database and we've 876 00:37:02,300 --> 00:37:04,240 written all of that wrapper code for you. 877 00:37:04,520 --> 00:37:06,240 So, you don't have to worry with like 878 00:37:06,240 --> 00:37:08,120 how do we initialize it, what is the 879 00:37:08,120 --> 00:37:10,260 SQLite driver, even though most of that stuff 880 00:37:10,260 --> 00:37:12,080 is actually quite boilerplate and simple. 881 00:37:13,440 --> 00:37:14,320 We go through 882 00:37:14,320 --> 00:37:16,260 a list of sequence numbers, pick them up, 883 00:37:16,260 --> 00:37:17,620 and after that, 884 00:37:17,740 --> 00:37:20,100 we just do a quick check about 885 00:37:20,100 --> 00:37:21,960 whether sequence numbers are 886 00:37:21,960 --> 00:37:24,140 going ahead and going back in time 887 00:37:24,140 --> 00:37:26,120 or going forward in time at any given point. 888 00:37:26,400 --> 00:37:27,740 Right? And 889 00:37:27,740 --> 00:37:29,740 after that, you can just plot all of them. 890 00:37:30,240 --> 00:37:32,020 The script goes ahead and 891 00:37:32,020 --> 00:37:34,220 figures that out and just gives you a very simple 892 00:37:35,180 --> 00:37:36,040 attack or 893 00:37:36,040 --> 00:37:36,340 deny. 894 00:37:36,880 --> 00:37:37,360 . 895 00:37:39,800 --> 00:37:41,200 Just when we ran it here. 896 00:37:42,200 --> 00:37:42,680 . 897 00:37:42,680 --> 00:37:42,940 Let's go. 898 00:37:43,840 --> 00:37:44,320 . 899 00:37:44,320 --> 00:37:44,380 . 900 00:37:48,040 --> 00:37:50,060 So, it'll just tell you MAC address 901 00:37:50,060 --> 00:37:52,420 detected, spoofing detected or not. 902 00:37:52,600 --> 00:37:54,500 The visualization makes it clear 903 00:37:54,500 --> 00:37:56,280 what was the actual logic of doing it. 904 00:37:57,780 --> 00:37:58,260 . 905 00:37:59,240 --> 00:37:59,720 . 906 00:38:01,940 --> 00:38:02,420 . 907 00:38:02,420 --> 00:38:04,360 So, all of this stuff we've already looked at. 908 00:38:04,460 --> 00:38:05,420 I'm going to go down below. 909 00:38:06,340 --> 00:38:06,820 . 910 00:38:07,360 --> 00:38:07,840 . 911 00:38:11,680 --> 00:38:12,160 . 912 00:38:12,680 --> 00:38:14,240 You could do a ton of other things with it. 913 00:38:14,360 --> 00:38:16,600 I have some sample scripts which you can take a look later. 914 00:38:18,080 --> 00:38:18,560 Detection 915 00:38:18,560 --> 00:38:19,440 based on signatures. 916 00:38:20,220 --> 00:38:22,280 So, you can actually detect Airbase NG. 917 00:38:22,780 --> 00:38:24,580 I don't know if any of you got time 918 00:38:24,580 --> 00:38:26,160 to catch my talk on Chellam, 919 00:38:26,260 --> 00:38:27,900 which I gave two days back. Right? 920 00:38:28,340 --> 00:38:30,500 So, Chellam actually goes 921 00:38:30,500 --> 00:38:32,720 ahead and fingerprints Airbase NG 922 00:38:32,720 --> 00:38:33,840 and a couple of other tools. 923 00:38:34,640 --> 00:38:36,520 The technique is very, very similar. 924 00:38:37,100 --> 00:38:37,380 . 925 00:38:38,240 --> 00:38:40,620 Replay attacks, again very easy to detect. 926 00:38:40,920 --> 00:38:42,620 . So, you could actually go ahead 927 00:38:42,680 --> 00:38:43,700 look at a frame 928 00:38:44,720 --> 00:38:46,680 and create some kind of a hash 929 00:38:46,680 --> 00:38:48,440 for it and then 930 00:38:48,440 --> 00:38:50,680 check if any frame which matches the exact 931 00:38:50,680 --> 00:38:51,280 same hash. 932 00:38:53,500 --> 00:38:54,320 Unauthorized devices 933 00:38:54,320 --> 00:38:56,660 and associations is actually quite easy as well. 934 00:38:57,160 --> 00:38:58,760 Have a list of APs 935 00:38:58,760 --> 00:39:00,100 and authorized clients 936 00:39:00,660 --> 00:39:02,440 and check if any other data packet 937 00:39:02,440 --> 00:39:04,540 or any other packet is going between 938 00:39:05,380 --> 00:39:06,560 any client AP 939 00:39:06,560 --> 00:39:07,640 pair not on the list. 940 00:39:08,320 --> 00:39:10,520 The more difficult part of course is 941 00:39:10,520 --> 00:39:12,660 MAC spoofing, which is what we can 942 00:39:12,680 --> 00:39:13,400 have showed right now. 943 00:39:15,540 --> 00:39:16,480 So, any 944 00:39:16,480 --> 00:39:17,060 questions? 945 00:39:19,300 --> 00:39:19,820 Yeah. 946 00:39:21,240 --> 00:39:21,760 . 947 00:39:23,280 --> 00:39:23,800 Okay. 948 00:39:24,140 --> 00:39:26,440 Good question. So, SQLite right now 949 00:39:26,440 --> 00:39:28,380 is the only one, but the schema 950 00:39:28,380 --> 00:39:30,520 itself is so flexible you could port it to 951 00:39:30,520 --> 00:39:32,360 MySQL and anything else as well. 952 00:39:33,280 --> 00:39:34,320 The only 953 00:39:34,320 --> 00:39:36,500 reason we chose SQLite is I actually 954 00:39:36,500 --> 00:39:38,420 want this to run on embedded platforms. 955 00:39:38,920 --> 00:39:40,240 I'm already testing 956 00:39:40,240 --> 00:39:41,900 a couple on Android 957 00:39:43,320 --> 00:39:44,640 and some home 958 00:39:44,640 --> 00:39:46,580 based routers as well to see 959 00:39:46,580 --> 00:39:48,520 if your phone can intelligently go ahead 960 00:39:48,520 --> 00:39:49,900 and detect many of these things. 961 00:39:50,220 --> 00:39:52,380 So, imagine that you have your Android 962 00:39:52,380 --> 00:39:54,580 device and it can scan the 963 00:39:54,580 --> 00:39:56,720 air with a list of authorized MAC addresses 964 00:39:57,260 --> 00:39:58,560 and check for things 965 00:39:58,560 --> 00:39:59,120 like this. 966 00:40:04,880 --> 00:40:06,500 It's an experimental feature 967 00:40:06,500 --> 00:40:07,140 right now. 968 00:40:08,960 --> 00:40:10,520 Probably in the next one month 969 00:40:10,520 --> 00:40:12,480 it's going to be stable. So, PCAP 970 00:40:12,680 --> 00:40:14,600 XML when you run 971 00:40:14,600 --> 00:40:14,800 it, 972 00:40:16,280 --> 00:40:18,340 you'll actually see we have sniffing options 973 00:40:18,340 --> 00:40:18,840 in there. 974 00:40:20,160 --> 00:40:22,420 Now, the most difficult part 975 00:40:22,420 --> 00:40:24,600 to get right to create something very 976 00:40:24,600 --> 00:40:26,440 stable when you do things like live capture 977 00:40:26,440 --> 00:40:27,820 is the packet parsing code. 978 00:40:28,760 --> 00:40:30,560 Now, the packet parsing code 979 00:40:30,560 --> 00:40:32,460 sometimes can be a little buggy 980 00:40:32,460 --> 00:40:34,640 because when we started off looking at 981 00:40:34,640 --> 00:40:36,260 some of the more uncommon 982 00:40:36,260 --> 00:40:38,520 frames, we had to go and actually 983 00:40:38,520 --> 00:40:40,560 see the 802.11 spec to 984 00:40:40,560 --> 00:40:41,900 understand how to parse it. 985 00:40:43,180 --> 00:40:44,500 So, I expect some 986 00:40:44,500 --> 00:40:46,420 parsing bugs to be there which 987 00:40:46,420 --> 00:40:47,380 you would like to iron out 988 00:40:47,380 --> 00:40:50,540 and that is something in live mode is difficult 989 00:40:50,540 --> 00:40:52,320 to figure out at times but 990 00:40:52,820 --> 00:40:54,380 the feature is already there. 991 00:40:54,520 --> 00:40:56,520 You could try it. I think 992 00:40:56,520 --> 00:40:58,100 in a month's time it might be more stable. 993 00:41:03,740 --> 00:41:04,400 It's actually 994 00:41:04,400 --> 00:41:05,720 all of our own parsers. 995 00:41:20,460 --> 00:41:22,660 We have a POSIX one as well and 996 00:41:22,660 --> 00:41:23,800 that has a different 997 00:41:25,180 --> 00:41:26,500 build available to it. 998 00:41:31,080 --> 00:41:32,680 So, this is the main directory. 999 00:41:34,380 --> 00:41:36,520 This is all the packet parsing which is 1000 00:41:36,520 --> 00:41:36,820 happening. 1001 00:41:43,480 --> 00:41:44,500 So, pretty much 1002 00:41:44,500 --> 00:41:46,240 we are like looking at every single 1003 00:41:46,240 --> 00:41:47,260 frame and 1004 00:41:48,180 --> 00:41:50,440 doing it. So, this does not use 1005 00:41:50,440 --> 00:41:51,320 any other 1006 00:41:52,460 --> 00:41:54,380 actually there isn't a very elaborate 1007 00:41:54,380 --> 00:41:56,160 library apart from the Wireshark 1008 00:41:56,160 --> 00:41:56,960 platform itself. 1009 00:41:57,860 --> 00:41:59,500 The problem with that is 1010 00:42:00,960 --> 00:42:02,540 we actually felt it's easy 1011 00:42:02,540 --> 00:42:04,140 to make this stand alone so that we can 1012 00:42:04,140 --> 00:42:06,060 port it easier on much other platforms 1013 00:42:06,680 --> 00:42:08,400 rather than just becoming a 1014 00:42:08,400 --> 00:42:09,780 Wireshark dissector. 1015 00:42:10,440 --> 00:42:12,460 You can write a dissector which can do 1016 00:42:12,680 --> 00:42:13,220 a lot of this stuff. 1017 00:42:13,780 --> 00:42:15,780 When we started doing a lot of aggregate 1018 00:42:15,780 --> 00:42:18,320 statistics, either I probably 1019 00:42:18,320 --> 00:42:20,400 got it wrong or definitely it was slowing 1020 00:42:20,400 --> 00:42:21,840 down Wireshark quite a lot. 1021 00:42:22,320 --> 00:42:24,140 So, I wanted this to be out 1022 00:42:24,140 --> 00:42:25,100 outside of it. 1023 00:42:26,240 --> 00:42:28,540 It's all actually complete C++ 1024 00:42:28,540 --> 00:42:29,820 code which is looking at 1025 00:42:30,960 --> 00:42:31,680 parsing stuff. 1026 00:42:32,900 --> 00:42:34,540 We've kind of documented the whole 1027 00:42:34,540 --> 00:42:34,860 thing. 1028 00:42:36,380 --> 00:42:38,460 We had a team of three people. It's me, 1029 00:42:38,540 --> 00:42:40,420 Julian and Ashish who was 1030 00:42:40,420 --> 00:42:41,700 responsible for testing it. 1031 00:42:42,680 --> 00:42:44,380 Both of those guys started coding it. 1032 00:42:45,140 --> 00:42:46,540 In the beginning when I 1033 00:42:46,540 --> 00:42:48,440 started, I probably thought this was quite 1034 00:42:48,440 --> 00:42:50,520 easy to get done but 1035 00:42:51,360 --> 00:42:52,480 almost took us 1036 00:42:53,300 --> 00:42:54,260 four months 1037 00:42:55,420 --> 00:42:56,540 of part time 1038 00:42:56,540 --> 00:42:58,520 along with building 1039 00:42:58,520 --> 00:43:00,500 Chellam and a couple of other things which I 1040 00:43:00,500 --> 00:43:01,220 demoed this year. 1041 00:43:05,620 --> 00:43:06,740 For sniffing 1042 00:43:06,740 --> 00:43:07,540 we actually use 1043 00:43:08,820 --> 00:43:10,820 PCAP for live sniffing. 1044 00:43:11,820 --> 00:43:12,380 Yeah. 1045 00:43:12,680 --> 00:43:14,560 We wanted to use the raw socket stuff to begin 1046 00:43:14,560 --> 00:43:16,480 with but that wasn't very portable 1047 00:43:16,480 --> 00:43:17,680 for at least some platforms. 1048 00:43:18,140 --> 00:43:20,700 So, we defaulted to using PCAP and of course 1049 00:43:20,700 --> 00:43:22,520 to parse a PCAP or to 1050 00:43:22,520 --> 00:43:24,360 basically get PCAP files out using 1051 00:43:24,360 --> 00:43:26,080 the PCAP library is the best option. 1052 00:43:26,880 --> 00:43:28,700 Right? So, it's complete C++ 1053 00:43:28,700 --> 00:43:29,140 code. 1054 00:43:32,820 --> 00:43:33,320 Yeah. 1055 00:43:44,700 --> 00:43:45,300 . 1056 00:43:55,920 --> 00:43:56,520 . 1057 00:43:57,400 --> 00:43:58,000 . 1058 00:43:58,000 --> 00:43:59,000 . 1059 00:43:59,220 --> 00:44:02,400 the only place we can 1060 00:44:02,400 --> 00:44:04,360 actually use the 1061 00:44:04,360 --> 00:44:06,160 beacon time stamps and a couple of things 1062 00:44:06,160 --> 00:44:08,400 inside is if you want to detect something 1063 00:44:08,400 --> 00:44:09,480 like clock skews. 1064 00:44:09,780 --> 00:44:11,300 The problem really is 1065 00:44:12,680 --> 00:44:14,560 that sometimes not know at what 1066 00:44:14,560 --> 00:44:16,580 time which devices may be around. I mean 1067 00:44:16,580 --> 00:44:18,000 based on what you are saying right now 1068 00:44:18,500 --> 00:44:20,420 it's actually quite difficult to get that 1069 00:44:20,420 --> 00:44:21,760 amount of prior information. 1070 00:44:22,960 --> 00:44:24,600 However, kind of building upon 1071 00:44:24,600 --> 00:44:26,420 what you said, there is one 1072 00:44:26,420 --> 00:44:28,400 technique where you can actually detect 1073 00:44:28,400 --> 00:44:30,120 clock skews. So, when there are multiple 1074 00:44:30,680 --> 00:44:32,500 devices and 1075 00:44:32,500 --> 00:44:34,540 you start looking at the 1076 00:44:34,540 --> 00:44:36,480 time stamps which are there inside the beacon 1077 00:44:36,480 --> 00:44:38,020 frame. There are a bunch of them as well. 1078 00:44:38,480 --> 00:44:40,480 You may be able to detect a clock 1079 00:44:40,480 --> 00:44:42,020 skew when 1080 00:44:42,680 --> 00:44:44,380 multiple devices have the same max. There are 1081 00:44:44,380 --> 00:44:46,120 actually a lot of papers on that as well. 1082 00:44:46,280 --> 00:44:48,500 I haven't implemented it in this 1083 00:44:48,500 --> 00:44:50,160 right now but I am planning. 1084 00:44:51,080 --> 00:44:51,920 Clock skews 1085 00:44:52,500 --> 00:44:54,300 I wasn't very happy with the initial 1086 00:44:54,300 --> 00:44:56,140 results. It wasn't good enough to demo. 1087 00:44:56,340 --> 00:44:58,140 Or maybe it was just my bad code so 1088 00:44:58,640 --> 00:45:00,600 I still have to work on it because there seem to be 1089 00:45:00,600 --> 00:45:02,680 a lot of papers on it so I am assuming 1090 00:45:02,680 --> 00:45:04,560 it probably works for sure at least 1091 00:45:04,560 --> 00:45:06,460 theoretically. The papers 1092 00:45:06,460 --> 00:45:08,500 were all academic so they had 1093 00:45:08,940 --> 00:45:10,200 they could actually run it through 1094 00:45:10,200 --> 00:45:11,460 MATLAB and do simulations. 1095 00:45:12,680 --> 00:45:14,360 But when you work with real traffic 1096 00:45:14,360 --> 00:45:16,660 you know some of those academic stuff 1097 00:45:16,660 --> 00:45:18,380 is kind of difficult to get right. 1098 00:45:18,720 --> 00:45:20,460 So yeah, clock skews is something 1099 00:45:20,460 --> 00:45:21,880 I do plan to use eventually. 1100 00:45:23,560 --> 00:45:24,080 Questions? 1101 00:45:25,420 --> 00:45:26,400 You could also 1102 00:45:26,400 --> 00:45:27,820 actually write this in Python. 1103 00:45:29,680 --> 00:45:30,700 What I found 1104 00:45:30,700 --> 00:45:32,120 is when you actually go about 1105 00:45:32,540 --> 00:45:34,380 file sizes of over 2 gigs 1106 00:45:34,940 --> 00:45:36,540 it takes a very long 1107 00:45:36,540 --> 00:45:38,480 time if you want to parse every single 1108 00:45:38,480 --> 00:45:39,040 field. 1109 00:45:41,120 --> 00:45:42,880 So given I used to actually 1110 00:45:42,880 --> 00:45:44,880 program in CC++ for a very long time 1111 00:45:44,880 --> 00:45:47,020 I thought this is something which comes 1112 00:45:47,020 --> 00:45:48,600 naturally to me so 1113 00:45:49,580 --> 00:45:50,920 that's why I chose this. 1114 00:45:51,080 --> 00:45:52,120 But yes you could have used 1115 00:45:52,820 --> 00:45:54,120 Python if you wanted to 1116 00:45:54,120 --> 00:45:55,480 or any language. 1117 00:45:59,940 --> 00:46:01,120 Around 3 gigs. 1118 00:46:01,280 --> 00:46:02,280 3 to 4 gigs actually. 1119 00:46:02,940 --> 00:46:04,940 That's simply because the SQLite database 1120 00:46:04,940 --> 00:46:06,800 will have a lot of meta information associated 1121 00:46:06,800 --> 00:46:08,820 with it. We also have multiple 1122 00:46:09,040 --> 00:46:10,220 indexes which we build. 1123 00:46:10,560 --> 00:46:12,760 Right? So you are only 1124 00:46:12,760 --> 00:46:15,040 limited by the RAM on the machine 1125 00:46:15,040 --> 00:46:16,260 where you analyze it. 1126 00:46:26,940 --> 00:46:29,020 Not right now but we actually 1127 00:46:29,020 --> 00:46:30,940 might eventually. I think there were a couple 1128 00:46:30,940 --> 00:46:32,840 of projects which I found for the wired side. 1129 00:46:33,800 --> 00:46:35,060 Though not everyone 1130 00:46:35,060 --> 00:46:36,840 was trying to map every single 1131 00:46:36,840 --> 00:46:38,880 bit field so that your queries 1132 00:46:39,040 --> 00:46:40,940 can be as flexible as you like. 1133 00:46:41,280 --> 00:46:42,980 But I think if many people use 1134 00:46:42,980 --> 00:46:44,420 it, we'll build it. 1135 00:46:45,320 --> 00:46:47,040 Yeah we first want to be sure that 1136 00:46:47,040 --> 00:46:48,780 we can build something very stable for 1137 00:46:48,780 --> 00:46:50,900 WiFi. I mean this is still early 1138 00:46:50,900 --> 00:46:53,060 alpha software at least in my view. 1139 00:46:53,580 --> 00:46:55,000 Probably we'll go through at least 1140 00:46:55,000 --> 00:46:56,160 a year of iteration 1141 00:46:56,740 --> 00:46:59,000 before it is extremely stable 1142 00:47:00,100 --> 00:47:01,140 you know 1143 00:47:01,140 --> 00:47:02,940 that you can actually be very 1144 00:47:02,940 --> 00:47:03,640 sure about it. 1145 00:47:06,320 --> 00:47:06,840 Questions? 1146 00:47:07,520 --> 00:47:09,020 Okay. Thank you 1147 00:47:09,040 --> 00:47:10,420 very much. Hope you enjoyed the talk.