1 00:00:00,000 --> 00:00:06,080 Thanks for coming to my talk. I'm going to talk to you today about NFC and why, besides my body 2 00:00:06,080 --> 00:00:14,840 odor, you shouldn't stand too close to me. Okay, so who am I? So first one to hack iPhone and G1 3 00:00:14,840 --> 00:00:22,400 phone. I won this snazzy jacket. I wrote some books. Got some letters I can put after my name 4 00:00:22,400 --> 00:00:28,940 sometimes if I feel like it. And I'm still, even after yesterday's talk by Apple, not a member of 5 00:00:28,940 --> 00:00:36,800 the iOS developer program. So today what's on the agenda? So first I'll tell you why I did this 6 00:00:36,800 --> 00:00:42,280 project. Then I'll go through some basic stuff about NFC so that we all know what I'm talking 7 00:00:42,280 --> 00:00:49,540 about and can see what NFC is all about. And then the main part of the talk is basically how to 8 00:00:49,540 --> 00:00:55,920 fuzz NFC, NFC stacks on phones. And then I'll look beyond that at sort of applications that deal 9 00:00:55,920 --> 00:00:58,920 with NFC. And finally I'll have some, like, you know, some tips and tricks on how to fuzz NFC. 10 00:00:58,940 --> 00:01:03,580 Demos and if there are anything like my projector that will fail horribly. But I have backup 11 00:01:03,580 --> 00:01:08,980 videos because I've had too many talks totally bombed. So hopefully the videos at least will 12 00:01:08,980 --> 00:01:15,620 work. Okay. So why NFC? So I started looking at this, like, nine months ago. And I was actually 13 00:01:15,620 --> 00:01:21,180 having lunch with Moxie Marlin Spike and he told me that the code in the Linux kernel looked 14 00:01:21,180 --> 00:01:27,060 really weak. And I was like, oh, okay, weak code. I like that. And NFC is, like, you know, sort of 15 00:01:27,060 --> 00:01:28,920 mobile phone related and I like phones. And I was like, oh, okay, weak code. I like that. And NFC is, 16 00:01:29,520 --> 00:01:32,900 like, you know, you don't have to, like, make the person touch anything. I like that. So there's a 17 00:01:32,900 --> 00:01:37,500 lot of things that were kind of appealing. And while there's not that many phones right now that 18 00:01:37,500 --> 00:01:43,080 have NFC, like, you know, supposedly if you believe Johnny Evans, in the future there's going 19 00:01:43,080 --> 00:01:48,820 to be more. So, you know, maybe the next iPhone would have NFC. Who knows? I hope the last one 20 00:01:48,820 --> 00:01:54,500 would have it and it didn't. So all Nokia phones supposedly from now on are going to have NFC in 21 00:01:54,500 --> 00:01:58,480 them. The new Samsung phones have it. I don't know if they're going to have NFC. I don't know. 22 00:01:59,460 --> 00:02:04,040 And then the Windows Phone 8s are supposed to have it when they come out. So anyway, so in 23 00:02:04,040 --> 00:02:07,640 theory NFC is going to be something that everyone is going to have in a couple years. So it's, like, 24 00:02:07,800 --> 00:02:13,640 you know, pertinent to look at it now, I think. And the thing I found out is it's actually really 25 00:02:13,640 --> 00:02:23,200 hard to test NFC. So all these things are sort of the reasons I did it. So I wanted to, you 26 00:02:23,600 --> 00:02:27,280 know, finding bugs is cool and really, like, that's what the end of the talk is about. It's, 27 00:02:27,340 --> 00:02:28,900 like, wow, cool. Check it out. I pop all these things in there. So I wanted to, you know, 28 00:02:28,900 --> 00:02:31,280 figure out how to make sure I was getting all of these boxes and stuff. But, really, what this is 29 00:02:31,280 --> 00:02:38,700 about was giving away that, you know, people could test NFC implementation. So I have a bunch of 30 00:02:38,700 --> 00:02:42,760 code. You can download it and, you know, test the NFC on your phone or on the next phone that 31 00:02:42,760 --> 00:02:47,740 comes out and stuff. And what I'm really concerned about is, like, getting owned through 32 00:02:47,740 --> 00:02:53,940 NFC. So I don't really care about, you know, Google Wallet and credit card information or I 33 00:02:53,940 --> 00:02:56,880 shouldn't say I don't care, but I didn't look at that. So what I was concerned about is, like, 34 00:02:56,880 --> 00:02:58,880 can someone, you know, use this new chip and you can actually use it if they don't want to use it. 35 00:02:58,880 --> 00:03:02,900 shipping my phone to get a shell on my phone and steal all my 36 00:03:02,900 --> 00:03:07,160 contacts and all my naked photos and stuff. So here's some, if 37 00:03:07,160 --> 00:03:08,980 you're interested, some other guys have done some really cool 38 00:03:08,980 --> 00:03:13,940 research on NFC related things like getting free gym 39 00:03:13,940 --> 00:03:15,960 memberships or snacks from vending machines and other 40 00:03:15,960 --> 00:03:18,940 really cool stuff. But that's not what my talk is about. So 41 00:03:18,940 --> 00:03:22,000 check out those references if you're interested. As far as 42 00:03:22,000 --> 00:03:25,820 other people who have looked at this idea of can you use NFC as 43 00:03:25,820 --> 00:03:29,680 a way to attack a phone. Colin Molnar a few years ago looked 44 00:03:29,680 --> 00:03:33,020 into fuzzing NFC a little bit but he didn't have a way to 45 00:03:33,020 --> 00:03:35,860 automate it so it was more like write a tag, put the tag by the 46 00:03:35,860 --> 00:03:39,100 phone, it didn't crash. Write a tag, put the tag by the phone, 47 00:03:39,140 --> 00:03:44,640 it didn't crash. So he gave up after a couple of hours. So a 48 00:03:44,640 --> 00:03:47,660 couple of these academic guys looked at the Nokia 6212 to see 49 00:03:47,660 --> 00:03:50,780 if they could find attacks against it and they did. And 50 00:03:50,780 --> 00:03:52,460 the attacks they found are kind of similar to what I'll talk 51 00:03:52,460 --> 00:03:55,800 about and the Nokia phone I looked at. And for the 52 00:03:55,820 --> 00:03:58,260 finally, Dan Rosenberg found some bugs in the Linux kernel 53 00:03:58,260 --> 00:04:02,120 stack. I think that this is what Moxie was looking at. But it 54 00:04:02,120 --> 00:04:05,800 turns out that this code is for hardware that doesn't really 55 00:04:05,800 --> 00:04:09,320 exist yet. So these are bugs in the NFC stack but no one's using 56 00:04:09,320 --> 00:04:12,300 it yet. But it still just shows that bugs can exist in the NFC 57 00:04:12,300 --> 00:04:15,420 stack. And at least one of those bugs is like really easy to 58 00:04:15,420 --> 00:04:17,980 exploit stack overflow with no canaries and stuff. It's really 59 00:04:17,980 --> 00:04:21,480 sweet. So he shouldn't have told anyone until the chip came 60 00:04:21,480 --> 00:04:25,800 out. All right. So what's NFC all about? Well, it's a 61 00:04:25,820 --> 00:04:31,380 basically based on RFID and it runs at 13.56 megahertz at least 62 00:04:31,380 --> 00:04:35,480 initially. And then the range for it is like four centimeters. So 63 00:04:35,480 --> 00:04:38,840 this is like, you know, the actual papers and stuff will 64 00:04:38,840 --> 00:04:41,160 say ten centimeters but I've never actually seen that. So in 65 00:04:41,160 --> 00:04:42,940 real life it's more like four centimeters, something like that. 66 00:04:43,800 --> 00:04:45,720 And, you know, there's people who talk about building like 67 00:04:45,720 --> 00:04:47,860 big old antennas and going across the room and stuff. But 68 00:04:47,860 --> 00:04:52,220 for me, it's just, you know, you just need to know that you 69 00:04:52,220 --> 00:04:54,320 have to be like really close but you don't have to touch. That's 70 00:04:54,320 --> 00:04:55,800 basically what it means. All right. All right. All right. All 71 00:04:57,060 --> 00:04:59,540 right. I have a very naughty thing to say just there but I'm 72 00:04:59,540 --> 00:05:04,120 not going to say it. Okay. So sorry. I'm really trying to be 73 00:05:04,120 --> 00:05:08,860 good. So the data rates for NFC is like quite slow. So you don't 74 00:05:08,860 --> 00:05:10,500 want to transfer like a bunch of data with it. And it's not 75 00:05:10,500 --> 00:05:13,600 really designed to do that. Okay. So how close do you really 76 00:05:13,600 --> 00:05:15,560 have to be? So here's like a couple little experiments just 77 00:05:15,560 --> 00:05:19,820 to give you an idea. So let me pause this one. So on the right 78 00:05:19,820 --> 00:05:23,740 there's a hotel key, NFC card, and a wallet and a pocket and 79 00:05:23,740 --> 00:05:25,800 you can read it. By like getting it in your pocket and 80 00:05:25,820 --> 00:05:30,080 getting close to the pocket. On this one, it's just like a NFC 81 00:05:30,080 --> 00:05:32,380 tag and a phone. And so you can see it's basically, you know, 82 00:05:32,380 --> 00:05:36,680 more than a thumb's width to read the tag. So that's how 83 00:05:36,680 --> 00:05:39,800 close you have to be. But then if you want to actually do 84 00:05:39,800 --> 00:05:43,060 something in real life, I thought I'd do a little 85 00:05:43,060 --> 00:05:46,420 experiment. So this is my coworker, Todd Manning, who I 86 00:05:46,420 --> 00:05:49,400 understand. He didn't know this was coming until Black Hat, he 87 00:05:49,400 --> 00:05:51,740 was sitting in the audience and all of a sudden he saw his ass 88 00:05:51,740 --> 00:05:55,480 on the screen. But so here's a little video of me 89 00:05:55,480 --> 00:06:01,160 trying to read his hotel card key without him knowing. So I'm 90 00:06:01,160 --> 00:06:06,400 in the green shirt. He's in the checkered shirt. You can hear our 91 00:06:06,400 --> 00:06:10,700 idle chatter. There it is. I'm so subtle. But I must admit that 92 00:06:10,700 --> 00:06:16,280 I was trained by the NSA. So a normal person might not be able 93 00:06:16,280 --> 00:06:19,280 to pull this off. So anyway, you can't see this, but I looked and 94 00:06:19,280 --> 00:06:21,180 it didn't show up. I was like, what the hell? So I was like, 95 00:06:21,240 --> 00:06:24,440 well, I'll do it while he's moving. So this is a moving 96 00:06:25,480 --> 00:06:28,580 circuit. It's a little harder. I'm looking, like, damn it's not 97 00:06:28,580 --> 00:06:31,840 working. So I'm like, I'm just going to sit on his ass at this 98 00:06:31,840 --> 00:06:41,020 point. So that's the video. Thanks. So I was like, I can't 99 00:06:41,020 --> 00:06:42,960 believe this didn't work. This totally should have worked. What 100 00:06:42,960 --> 00:06:45,960 was the deal? I followed him back to his room, and he goes to 101 00:06:45,960 --> 00:06:49,100 get into his hotel room, and he pulls the key out of his front 102 00:06:49,100 --> 00:06:54,080 pocket. So I was like, oh, okay. So anyway, that's one version of 103 00:06:54,080 --> 00:06:55,460 the, you know, what my opponent likes to do. So I'm like, tell me, 104 00:06:55,460 --> 00:06:57,840 bugs I'm going to talk about you can do is follow around 105 00:06:57,840 --> 00:07:01,920 uncomfortably next to somebody. Sort of a more realistic attack 106 00:07:01,920 --> 00:07:05,160 is equivalent to ATM card skimmers or something where 107 00:07:05,160 --> 00:07:08,060 there would be an MC pay terminal or movie poster or 108 00:07:08,060 --> 00:07:11,080 something and you would stick a tag on the side or you would 109 00:07:11,560 --> 00:07:15,100 replace the terminal with a fake one or whatever. Tags are pretty 110 00:07:15,100 --> 00:07:18,240 little. They're just stickers sometimes. Sometimes they're 111 00:07:18,240 --> 00:07:23,000 like plastic cards or whatever. So you can imagine putting it in 112 00:07:23,000 --> 00:07:26,640 a situation where, you know, someone wants to use NFC. So 113 00:07:26,640 --> 00:07:28,920 that would be a way easier attack than what I tried to do. 114 00:07:30,600 --> 00:07:34,560 Speaking of that, when is NFC on? It doesn't do any good if 115 00:07:34,560 --> 00:07:40,720 it's not on. It is on when your phone is awake. Like this phone 116 00:07:40,720 --> 00:07:44,800 went to sleep and NFC is off. And for newer versions of 117 00:07:46,280 --> 00:07:51,260 mobile operating systems, if you have a pass code it also is to 118 00:07:51,260 --> 00:07:52,980 be unlocked. The SDK has an MFüğür дис씨 Put biases or even 119 00:07:52,980 --> 00:07:56,520 the ice cream sandwich it's only on when it's unlocked and 120 00:07:56,520 --> 00:07:59,640 gingerbread it's on no matter what if the device is on. And 121 00:07:59,640 --> 00:08:02,260 for the Nokia phone I look at the low level stack is 122 00:08:02,260 --> 00:08:07,300 accessible if it's not, if it's locked. But the high level apps 123 00:08:07,300 --> 00:08:10,440 don't behave right unless it's unlocked. So basically the easy 124 00:08:10,440 --> 00:08:13,100 scenario is if the person is like talking on the phone or 125 00:08:13,100 --> 00:08:15,680 using the phone or has just finished using the phone and 126 00:08:15,680 --> 00:08:17,580 it's unlocked then you can do the things I'm going to talk 127 00:08:17,580 --> 00:08:20,420 about. And then the other thing is as long as they don't have a 128 00:08:20,920 --> 00:08:23,900 passcode on their phone you can actually wake up the phone and 129 00:08:23,900 --> 00:08:27,880 then turn NFC on and then use NFC. So here's a little movie of 130 00:08:27,880 --> 00:08:31,400 this. So here's a Nokia N9 and the tag NFC reader isn't working 131 00:08:31,400 --> 00:08:36,120 because it's asleep. The phone is asleep. But this is my 132 00:08:36,120 --> 00:08:38,500 friend. The phone is in his pocket or something. So I sent 133 00:08:38,500 --> 00:08:41,580 him a text message and that wakes up the phone and then I 134 00:08:41,580 --> 00:08:45,920 just run up and give him a swat and then the NFC is working. So 135 00:08:46,600 --> 00:08:49,700 it would have been a two-step process against my friend Todd 136 00:08:49,700 --> 00:08:50,040 Manning. 137 00:08:50,420 --> 00:08:52,440 I would have had to send him a text message while I was like in 138 00:08:52,440 --> 00:08:57,860 the elevator with him. Okay. So that's basically how NFC, when 139 00:08:57,860 --> 00:09:01,800 NFC is available, how you, you know, a couple ways you can 140 00:09:01,800 --> 00:09:07,180 imagine trying to attack someone with an NFC phone. So 141 00:09:07,180 --> 00:09:10,360 now let's talk about NFC. So it's basically two modes to 142 00:09:10,360 --> 00:09:15,300 NFC. One is passive. So this is, you know, this scenario where 143 00:09:15,300 --> 00:09:19,160 you've got, you know, a phone, an active reading device and 144 00:09:19,160 --> 00:09:20,400 you've got an attack device. And then you've got an active reading 145 00:09:20,420 --> 00:09:22,500 tag. And tags are just like, I said, little stickers or 146 00:09:22,500 --> 00:09:25,080 something. So, you know, you just put it up there and then 147 00:09:25,080 --> 00:09:29,520 something happens. Right? So that's, that's passive. In that 148 00:09:29,520 --> 00:09:32,680 case, the tags don't have a battery or power or anything. 149 00:09:32,880 --> 00:09:39,520 They just use the power provided by the initiator. So and the 150 00:09:39,520 --> 00:09:42,320 other mode is peer-to-peer. So if you have two phones and you 151 00:09:42,320 --> 00:09:44,780 want to, like, share data between them, you just kind of 152 00:09:44,780 --> 00:09:49,000 get them close and NFC will let you share files that way. And 153 00:09:49,000 --> 00:09:50,400 the way that that works is, you know, if you have two phones and 154 00:09:50,420 --> 00:09:52,720 the way that that works is, both of them are powered devices. So 155 00:09:52,720 --> 00:09:54,700 it's a little different. And they have different protocols and 156 00:09:54,700 --> 00:09:58,620 stuff. So when I sat down to fuzz this, you know, this stack, 157 00:09:58,780 --> 00:10:01,780 I was like, okay, there's like 200 bytes on this card and I 158 00:10:01,780 --> 00:10:04,220 want to fuzz this. So it's probably not that complicated. 159 00:10:04,520 --> 00:10:06,380 And then I was like, I got this diagram and I was like, oh, 160 00:10:06,400 --> 00:10:09,740 shit, it's, like, super complicated. So there's lots and 161 00:10:09,740 --> 00:10:11,660 lots of specs and, you know, you have to sit down and read them 162 00:10:11,660 --> 00:10:15,160 all. And I'll just run through them real quick. So at the very 163 00:10:15,160 --> 00:10:17,180 lowest level, you've got, like, you know, radio waves and 164 00:10:17,180 --> 00:10:22,440 stuff. So here, this is the spec you would want. And this is, if 165 00:10:22,440 --> 00:10:26,300 you can kind of see it, so this is just a FFT plot I got from 166 00:10:26,300 --> 00:10:31,720 using a software-defined radio. And then if you want to, you can 167 00:10:31,720 --> 00:10:35,460 actually see the radio waves and decode them into bits. And it's 168 00:10:35,460 --> 00:10:38,160 a real pain in the ass, but it's possible. So here's an example 169 00:10:38,160 --> 00:10:41,200 of one. Every time it crosses the line, you get a zero. 170 00:10:41,300 --> 00:10:43,860 Otherwise, you get ones. I did it bigger here so you can see. 171 00:10:44,200 --> 00:10:47,080 And then there's some sort of decoding scheme where, like, you 172 00:10:47,080 --> 00:10:47,160 get a zero. And then you get a one. And then you get a two. 173 00:10:47,180 --> 00:10:49,140 You get a one if there's two ones unless it's followed by one, 174 00:10:49,220 --> 00:10:51,540 in which case it's zero one. Anyway, so all these basic rules 175 00:10:51,540 --> 00:10:55,340 that allow you to convert this line crossing into actual bits. 176 00:10:55,580 --> 00:11:00,740 And then you can see that this waveform actually is sending 177 00:11:00,740 --> 00:11:05,360 hex 26. And hex 26, if you read the spec, is the sends rec 178 00:11:05,360 --> 00:11:08,120 command, which is basically, like, the wake up. Like, NFC, 179 00:11:08,140 --> 00:11:11,880 here I am, wake up. Okay. So that was the, like, super low 180 00:11:11,880 --> 00:11:15,840 level, where the radio transmissions look like. I 181 00:11:15,840 --> 00:11:17,160 didn't fuzz at that level because, you know, I was 182 00:11:17,160 --> 00:11:21,420 super hard. And I'm lazy. Okay. So the next thing is 183 00:11:22,380 --> 00:11:25,540 initialization, anti-collision, stuff like that. So whenever a 184 00:11:25,540 --> 00:11:31,280 device enters or, like, say a tag enters the phone's, you 185 00:11:31,280 --> 00:11:35,160 know, RF range, then they start to have to, you know, work out 186 00:11:35,160 --> 00:11:37,420 some initial stuff. And that's what this layer is. There's 187 00:11:37,420 --> 00:11:40,380 almost no data exchanged. So I didn't fuzz this, although I 188 00:11:40,380 --> 00:11:45,140 could have. And then I'll show you an example of this and 189 00:11:45,140 --> 00:11:47,140 you'll see what these bytes look like. Okay. 190 00:11:47,160 --> 00:11:50,120 And then sort of a more interesting layer is when you 191 00:11:50,120 --> 00:11:53,120 get a little higher. So then you get into, there's lots and 192 00:11:53,120 --> 00:11:56,860 lots of different kinds of tags. And each one speaks a slightly 193 00:11:56,860 --> 00:11:59,920 different protocol. And then at the bottom there's this LCP and 194 00:11:59,920 --> 00:12:04,040 that's the communications for peer to peer communication. So 195 00:12:04,040 --> 00:12:06,160 I'll just show you some details on a couple of those because 196 00:12:06,800 --> 00:12:10,040 these are the ones I actually fuzzed. So one is called type 2 197 00:12:10,040 --> 00:12:14,320 tags, also known as my fair ultralight. The actual commands 198 00:12:14,320 --> 00:12:17,140 that the device can send, you know, it can send a message 199 00:12:17,160 --> 00:12:19,480 into the tag or things like read, write, stuff like that. 200 00:12:19,820 --> 00:12:24,080 And the stuff that the tag can send back is things like this. 201 00:12:24,160 --> 00:12:26,240 So first there's some metadata. It has things like serial 202 00:12:26,240 --> 00:12:29,320 numbers. And then there's this capability container and that 203 00:12:29,320 --> 00:12:32,160 contains information like version number, how much data to 204 00:12:32,160 --> 00:12:34,660 expect, stuff like that. And then there's the actual data 205 00:12:34,660 --> 00:12:41,020 itself. And then another type of tag is a type 4 tag called 206 00:12:41,020 --> 00:12:43,760 . So this one's a little different. Here it's like a 207 00:12:43,760 --> 00:12:47,140 little virtual file system. And you can, they're kind of 208 00:12:47,160 --> 00:12:49,440 commands that the device can send are like select, read and 209 00:12:49,440 --> 00:12:51,860 update. And so the important thing is just to know that 210 00:12:51,860 --> 00:12:53,960 there's this capability container file and then there's 211 00:12:53,960 --> 00:12:57,380 a file or files that contain the actual data that you want to 212 00:12:57,380 --> 00:13:00,600 send. So the way that it typically works is the phone 213 00:13:00,600 --> 00:13:05,300 will be like, okay, I want to read you. So then it selects the 214 00:13:05,300 --> 00:13:08,020 capability container file. Then it reads the capability container 215 00:13:08,020 --> 00:13:11,380 file. And that tells it where to find the data. So then it 216 00:13:11,380 --> 00:13:14,360 selects the data file and then it reads the data. So that's the 217 00:13:14,360 --> 00:13:17,140 back and forth communication between the device and the 218 00:13:17,500 --> 00:13:22,600 phone and the tag. And then finally, if you have two peer 219 00:13:22,600 --> 00:13:24,980 devices want to talk to each other, they send each other 220 00:13:24,980 --> 00:13:27,960 these things called PDUs. There's lots of different kinds 221 00:13:27,960 --> 00:13:32,080 of PDUs and, you know, this is more or less what they look 222 00:13:32,080 --> 00:13:35,800 like. So if you want to see an example exchange of, you know, 223 00:13:35,800 --> 00:13:38,500 say I want to share like the greatest, coolest, you know, 224 00:13:38,520 --> 00:13:43,480 video of, with you, I would send this connect PDU with some 225 00:13:43,480 --> 00:13:47,040 parameters and like what service I want to connect to. Then I 226 00:13:47,140 --> 00:13:50,780 would, you would respond with a connection complete, a CC PDU. 227 00:13:51,140 --> 00:13:55,160 Then I'd send you an I PDU. I stands for information. You'd 228 00:13:55,160 --> 00:13:59,620 either send me back another information or an RR, which is 229 00:13:59,620 --> 00:14:01,420 just like an acknowledgement. And we just go back and forth 230 00:14:01,420 --> 00:14:04,120 sending data back until one of us is done and sends a 231 00:14:04,120 --> 00:14:11,540 disconnect. All right. And then unlike the tags, the LCP is 232 00:14:11,540 --> 00:14:14,200 more like a connection and then you have to say where you want 233 00:14:14,200 --> 00:14:16,500 to connect to. So there's different kinds of service end 234 00:14:17,140 --> 00:14:20,060 death that you can connect to. And all the like stuff I looked 235 00:14:20,060 --> 00:14:23,960 at, I only saw two. One was called MPP. And that was, I saw 236 00:14:23,960 --> 00:14:26,920 on the Android phones. And then another is Snap, which you see 237 00:14:26,920 --> 00:14:32,120 on like other phones, like Okias and stuff. All right. So all 238 00:14:32,620 --> 00:14:35,200 that's left is, you know, so far it's just how to communicate 239 00:14:35,200 --> 00:14:37,120 data back and forth, but I haven't talked about the actual 240 00:14:37,120 --> 00:14:41,500 data. So the actual data is called, is stored, it can be 241 00:14:41,500 --> 00:14:44,540 anything, but it's normally stored in a format called end 242 00:14:44,540 --> 00:14:49,100 death. So this is just some binary data and it describes 243 00:14:49,100 --> 00:14:52,020 different things that it can contain. It can contain lots of 244 00:14:52,020 --> 00:14:54,900 different kinds of data. And I talked about it, I gave this 245 00:14:54,900 --> 00:14:58,380 talk in Black Hat, except that talk was like a lot more 246 00:14:58,380 --> 00:15:01,460 expensive than this talk. So you guys are really getting your 247 00:15:01,460 --> 00:15:07,080 money's worth. So the Black Hat badges had MSC and you could 248 00:15:07,080 --> 00:15:09,720 read the end death data and stuff off them. But anyway, so 249 00:15:09,720 --> 00:15:12,020 end death is just the format of the data that is typically 250 00:15:12,020 --> 00:15:14,520 exchanged. So we're going to talk a little bit about the 251 00:15:14,520 --> 00:15:16,720 data. So, you know, I sit down and I read specs for, you know, 252 00:15:16,760 --> 00:15:20,700 three months and I'm about to blow my brains out. So I finally 253 00:15:20,700 --> 00:15:23,360 get an antenna and I actually look at the data and I, you 254 00:15:23,360 --> 00:15:25,000 know, because I want to use something like Wireshark, but 255 00:15:25,000 --> 00:15:29,620 they don't have it. So instead I look at this. So I get a 256 00:15:30,040 --> 00:15:32,280 Proxmark, you can sniff the traffic and see what it looks 257 00:15:32,280 --> 00:15:35,960 like. So this is what the traffic looks like between an 258 00:15:35,960 --> 00:15:41,680 MSC reader and a type 2 My Fair Ultralight card. So I don't 259 00:15:41,680 --> 00:15:43,900 know if you can read it, but I'll just explain it anyway. So 260 00:15:44,520 --> 00:15:51,040 the first reader is like, hey, wake up. And then the card says, 261 00:15:51,940 --> 00:15:55,180 okay, I have a seven byte serial number. And then the reader 262 00:15:55,180 --> 00:15:58,660 says, cool, give it to me. And the reader says, okay, here's the 263 00:15:58,660 --> 00:16:02,200 first three bytes. And then the reader is like, okay, I got those 264 00:16:02,200 --> 00:16:05,640 three bytes. Are they these? And he's like, yep. And then he 265 00:16:05,640 --> 00:16:09,640 says, okay, send me more. And he says, okay, here's the rest. 266 00:16:09,840 --> 00:16:14,500 And he says, were they these? And he says, yep. So, you know, 267 00:16:14,500 --> 00:16:17,920 anyway, and the other thing that happens is at some point the 268 00:16:18,320 --> 00:16:21,300 tag said, by the way, I'm a type 2 tag. So once they get to this 269 00:16:21,300 --> 00:16:24,720 point, they've done the initialization and they're 270 00:16:24,720 --> 00:16:27,240 ready to actually do the data and they know to use the type 2 271 00:16:27,240 --> 00:16:31,120 protocol. So he knows he can do reads. So he reads column 8 from 272 00:16:31,120 --> 00:16:34,280 that chart I showed you. The tag responds with a bunch of data. 273 00:16:34,720 --> 00:16:38,560 And then he reads the third one, which is that capability 274 00:16:38,560 --> 00:16:43,960 container stuff. So he reads the card sends, the tag sends this 275 00:16:44,500 --> 00:16:48,040 data. And then he reads the actual data. So anyway, you can 276 00:16:48,040 --> 00:16:50,820 start thinking about what you want to fuzz. So you could fuzz 277 00:16:51,180 --> 00:16:52,900 like the serial number and stuff. But I didn't because it 278 00:16:52,900 --> 00:16:55,520 seemed like a waste. You can start to fuzz, you know, like 279 00:16:55,520 --> 00:16:58,580 the serial numbers and the memory stuff. And then down here 280 00:16:58,580 --> 00:17:01,380 you can fuzz the data. So there's stuff to fuzz, but not 281 00:17:01,380 --> 00:17:05,920 a ton. And then I, if you look at that last slide, I pulled out 282 00:17:05,920 --> 00:17:08,600 the actual data. And you can break that data out, too, and 283 00:17:08,600 --> 00:17:13,120 see what it looks like. So in this example, it starts with the 284 00:17:13,120 --> 00:17:14,480 three that just says, hey, it's actually, you know, I'm going to 285 00:17:14,480 --> 00:17:18,360 end up. And then it says a link. So end up is basically type link 286 00:17:18,360 --> 00:17:22,500 value. So it's linked and then it says, like, okay, I'm a D1, 287 00:17:22,580 --> 00:17:25,600 which says I'm a message begin, message end, which means I'm just 288 00:17:25,600 --> 00:17:28,500 a complete message. Short record, which means my links are 289 00:17:28,500 --> 00:17:31,300 one byte as opposed to four. And then, like, I'm a well-known 290 00:17:31,300 --> 00:17:35,180 type. And then it's, like, type link, payload link, type, blah, 291 00:17:35,220 --> 00:17:39,220 blah, blah, blah. And then, you know, type, and then, so once 292 00:17:39,220 --> 00:17:42,040 you know that the type is T for text, then you look at that spec 293 00:17:42,040 --> 00:17:44,380 and see how text data looks like. And eventually you break it 294 00:17:44,480 --> 00:17:47,800 out to some text and then you're done. So you can extract this 295 00:17:47,800 --> 00:17:50,000 data and you can imagine, like, fuzzing these things and there's 296 00:17:50,000 --> 00:17:52,260 some link values. And so there's some potential for some coolness. 297 00:17:53,360 --> 00:17:55,620 But then you got to, you know, so at this point, you know, I 298 00:17:55,620 --> 00:17:58,080 read the specs. I understood NFC. Like, you know, everyone 299 00:17:58,080 --> 00:18:02,220 in this room now, so, you know, we're all NFC experts. And how, 300 00:18:02,460 --> 00:18:06,820 you know, where are the bugs going to be? So if you look at, 301 00:18:06,900 --> 00:18:09,120 say, the software stack on an Android phone, it looks 302 00:18:09,120 --> 00:18:13,780 something like this for NFC. So you've got the kernel. There's 303 00:18:13,780 --> 00:18:14,460 some drivers. You've got, you know, you've got, you know, 304 00:18:14,460 --> 00:18:16,640 the driver and the kernel that is, you know, talking to the 305 00:18:16,640 --> 00:18:21,240 hardware, you know, the actual NFC chip. And then there's an 306 00:18:21,240 --> 00:18:26,540 Android service that deals with all the NFC data. And then 307 00:18:26,540 --> 00:18:29,600 there's applications that consume the data afterwards. So 308 00:18:29,600 --> 00:18:34,120 in this picture, the driver's native code. Inside the service 309 00:18:34,120 --> 00:18:36,840 there's some native code libraries. But mostly the 310 00:18:36,840 --> 00:18:40,900 service is written in Java. And likewise, this tags application 311 00:18:40,900 --> 00:18:44,440 that handles the end up data is written in Java. So you can 312 00:18:44,460 --> 00:18:46,420 use that. So if you're looking for memory corruption bugs, like 313 00:18:46,420 --> 00:18:48,640 you're kind of limited, right, to just these native code dudes. 314 00:18:51,360 --> 00:18:54,220 The Mego, which is the other phone I looked at, Nokia 9 315 00:18:54,220 --> 00:18:57,220 running Mego, which was the reason I chose these two phones, 316 00:18:57,240 --> 00:18:59,460 by the way, is, like, last fall they were more or less the 317 00:18:59,460 --> 00:19:03,300 only phones I could get my hand on that had NFC. And then the 318 00:19:03,760 --> 00:19:06,640 Mego had the advantage of being kind of Linux-y, which is 319 00:19:06,640 --> 00:19:09,640 something that I like. Turns out, at least in the U.S., 320 00:19:09,640 --> 00:19:13,200 there's not many people with Nokia N9s. But there's a few 321 00:19:13,200 --> 00:19:14,440 people. Like, I saw a trend in the U.S. where they were 322 00:19:14,460 --> 00:19:17,020 like, oh, Travis Goodspeed has one the other night. So I'm 323 00:19:17,020 --> 00:19:20,680 going to totally own his ass. And then I heard H.C. Moore might 324 00:19:20,680 --> 00:19:25,580 have one, too. So I want to see those guys on the phone. I'm 325 00:19:25,580 --> 00:19:28,840 going to be, like, all over them. Okay. So the Mego stack 326 00:19:28,840 --> 00:19:33,820 basically looks like the Android stack. The biggest difference, 327 00:19:34,000 --> 00:19:36,460 so, you know, there's kernel, driver, service, and then 328 00:19:36,460 --> 00:19:39,060 applications that consume the data. The difference is here 329 00:19:39,060 --> 00:19:41,200 everything is native code. So it seems there's at least a 330 00:19:41,200 --> 00:19:44,440 potential for some more bugs. All right. All right. So 331 00:19:44,460 --> 00:19:48,360 I already kind of mentioned this, but, you know, so when you 332 00:19:48,360 --> 00:19:50,780 sit back and say, okay, where are the bugs? Well, there could be 333 00:19:50,780 --> 00:19:53,200 bugs in the actual MFC-specific code, like the thing that's 334 00:19:53,200 --> 00:19:55,800 parsing NDEFs or parsing capability containers or 335 00:19:55,800 --> 00:19:58,200 something. Or there could be bugs in the applications, like 336 00:19:58,200 --> 00:20:01,240 tags, that are actually processing the data afterwards. 337 00:20:02,480 --> 00:20:06,700 We want to look for bugs in both those spots. So the first thing 338 00:20:06,700 --> 00:20:09,420 I want to do is fuzz the low-level stuff. Because that's 339 00:20:09,420 --> 00:20:12,260 like, you know, it's the whole, you know, when you're 340 00:20:12,260 --> 00:20:14,440 hammer, everything looks like a nail. So I want to look for bugs 341 00:20:14,440 --> 00:20:16,640 and I do fuzzing and so everything I want to do starts 342 00:20:16,640 --> 00:20:21,040 with fuzzing. So fuzzing on MFC is a little hard. It took me like 343 00:20:21,460 --> 00:20:24,800 six months to get this fuzzer running. So the first thing you 344 00:20:24,800 --> 00:20:27,480 do is you create data and then you want to present it to the 345 00:20:27,480 --> 00:20:30,660 phone and then you want to monitor the phone for, you 346 00:20:30,660 --> 00:20:34,440 know, crashes and stuff. So the test case generation is really 347 00:20:34,440 --> 00:20:37,800 pretty simple. I use two approaches. The first one was, 348 00:20:37,900 --> 00:20:40,040 you know, what they call dumb fuzzing, mutation-based 349 00:20:40,040 --> 00:20:44,400 fuzzing. So I just got some valid data and did some 350 00:20:44,440 --> 00:20:46,660 bit flipping, added some bits, stuff like that. So, you know, 351 00:20:46,660 --> 00:20:49,680 valid data for, like, these are, like, PDUs, these are capability 352 00:20:49,680 --> 00:20:53,480 containers, these are NDEFs. So, you know, just got a bunch of 353 00:20:53,480 --> 00:20:57,160 data and then started flipping it. And then I also, at least 354 00:20:57,160 --> 00:21:03,940 for the NDEFs, used Soli to create some fuzzed NDEFs, you 355 00:21:03,940 --> 00:21:06,600 know, so that you could have, like, very long strings but 356 00:21:06,600 --> 00:21:09,040 everything else is right. Like, you know, the links are right 357 00:21:09,040 --> 00:21:14,400 and stuff like that. So I tried both approaches. And, you know, 358 00:21:14,400 --> 00:21:17,940 I generated, like, something like 50,000 test cases for each of 359 00:21:17,940 --> 00:21:22,020 the phones. So then the question, that part was easy. The 360 00:21:22,020 --> 00:21:25,420 hard part is, like, getting the test cases to the phone. So, like, 361 00:21:25,440 --> 00:21:28,260 NFC is basically designed to be, like, some dude has a phone, 362 00:21:28,360 --> 00:21:30,800 he puts it near some other phone and then he takes the phone 363 00:21:30,800 --> 00:21:33,580 away, right? But I want to just, like, leave it running overnight. 364 00:21:34,100 --> 00:21:37,400 And I only have, you know, there's only so many interns who 365 00:21:37,400 --> 00:21:42,520 will just do this all day. So, like I mentioned before, Colin 366 00:21:42,520 --> 00:21:46,640 Molnar originally did this by hand and then realized that that 367 00:21:46,640 --> 00:21:49,740 was kind of silly. So I had to figure out a way to automate 368 00:21:49,740 --> 00:21:54,700 this. So the first thing I thought is I'll just get some 369 00:21:55,040 --> 00:21:59,260 off-the-shelf NFC readers and have them. There's a mode called 370 00:21:59,260 --> 00:22:02,180 card emulation, which means, like, pretend to be a card, a 371 00:22:02,180 --> 00:22:05,520 tag. And then if you go to read it, you know, the phone doesn't 372 00:22:05,520 --> 00:22:07,680 make any difference. But the problem is there's, like, tons 373 00:22:07,680 --> 00:22:11,280 of different kinds of NFC hardware. They all kind of claim, 374 00:22:11,420 --> 00:22:12,500 you know, in some vague way that they're not going to be able to 375 00:22:12,520 --> 00:22:15,540 do card emulation. But then when you buy it, they don't. And, 376 00:22:15,720 --> 00:22:18,980 you know, the help support dudes are, like, oh, yeah, we didn't 377 00:22:18,980 --> 00:22:23,120 actually do that. We can sort of do that. And then there's lots of 378 00:22:23,120 --> 00:22:26,480 different software that you can try for each of the pieces of 379 00:22:26,480 --> 00:22:30,740 hardware. So for a long time I couldn't get any of them to 380 00:22:30,740 --> 00:22:34,560 actually do card emulation. So then the next approach I looked 381 00:22:34,560 --> 00:22:41,700 at was using a USRP. So here you can do everything, you know, 382 00:22:41,700 --> 00:22:42,500 from the very beginning to the very end. And then you can do 383 00:22:42,520 --> 00:22:44,280 everything from the very bottom up. You can pretend to do the 384 00:22:44,280 --> 00:22:48,040 radio signals and be a card or be a peer and do everything. And 385 00:22:48,040 --> 00:22:50,740 the advantage is you can fuzz everything, too. And then I 386 00:22:50,740 --> 00:22:53,160 started writing code. And, you know, there's getting these 387 00:22:53,160 --> 00:22:57,580 waveforms and decoding waveforms and having to send out more 388 00:22:57,580 --> 00:23:03,620 waves. And, yeah, it wasn't working very well. So I'm not a 389 00:23:03,620 --> 00:23:06,900 signal analyst apparently. And the best I could get was I could 390 00:23:06,900 --> 00:23:09,600 decode this way, but it took, like, six seconds. And it turns 391 00:23:09,600 --> 00:23:13,940 out that you have to respond in like .0001 seconds so I was too 392 00:23:13,940 --> 00:23:19,400 slow. So I gave up on that. And then Kyle Molnar at summer con 393 00:23:19,400 --> 00:23:22,740 this year released an Android injection framework that would 394 00:23:23,280 --> 00:23:27,680 theoretically allow you to inject data into the NFC demon 395 00:23:27,680 --> 00:23:31,080 so it would think that you had just presented a tag. But I 396 00:23:31,080 --> 00:23:34,300 don't think anyone has ever used that to fuzz yet and also it 397 00:23:34,300 --> 00:23:36,300 turns out the bugs I'm going to tell you about, a lot of them 398 00:23:36,300 --> 00:23:38,820 are related to timing issues and so you won't get those either. 399 00:23:38,820 --> 00:23:41,180 So there's some reasons you wouldn't want to do this. But 400 00:23:41,180 --> 00:23:47,200 it's at least a possibility. So finally I found after I did all 401 00:23:47,200 --> 00:23:50,480 that stuff and gave up, I eventually went back and actually 402 00:23:50,480 --> 00:23:54,060 found some hardware that worked. So you get this reader and use 403 00:23:54,060 --> 00:23:56,400 that software or this reader and that software, you're in 404 00:23:56,400 --> 00:23:58,880 business. So you can plug those in and they'll pretend to be 405 00:23:58,880 --> 00:24:04,260 cards and you can read them. So now with those combinations of 406 00:24:04,260 --> 00:24:07,280 hardware and software I can fuzz the parts of the spec that are 407 00:24:07,280 --> 00:24:08,720 this like ugly green. 408 00:24:09,400 --> 00:24:12,120 So it's like roughly half or something. So there's still lots 409 00:24:12,120 --> 00:24:16,580 of work that you guys can do if you want. This is what I did. So 410 00:24:16,580 --> 00:24:19,940 let's start talking about how I did it. So the top level fuzzing 411 00:24:19,940 --> 00:24:23,940 NDEFs was pretty easy. So I already had a bunch of fuzzed 412 00:24:23,940 --> 00:24:27,400 NDEFs. I just had to get them to the phone. And lib NFC comes 413 00:24:27,400 --> 00:24:29,520 with a little program that basically does exactly that. It 414 00:24:29,520 --> 00:24:33,660 takes in a binary file and presents that as an NDEF to the 415 00:24:33,660 --> 00:24:38,620 phone. So that part was easy. Then if I wanted to fuzz this 416 00:24:38,820 --> 00:24:44,260 part, the purple part, then I want to fuzz the sort of low 417 00:24:44,260 --> 00:24:47,640 level type 2 transactions. So what I did there is I just made 418 00:24:47,640 --> 00:24:50,720 some modifications to lib NFC to allow me to modify these 419 00:24:50,720 --> 00:24:53,680 bytes that weren't the metadata bytes of things like capability 420 00:24:53,680 --> 00:24:58,220 container. So it just changed up that program and then it was 421 00:24:58,220 --> 00:25:01,180 working pretty good. Pretty much the same thing for type 4 422 00:25:01,180 --> 00:25:04,440 fuzzing. So if I wanted to do the low level stuff, all I did 423 00:25:04,440 --> 00:25:08,640 was instead of fuzzing the NDEF data, which is what lib NFC wants 424 00:25:08,820 --> 00:25:12,200 me to do, I just changed lib NFC to instead allow me to supply a 425 00:25:12,200 --> 00:25:17,960 capability container file. And then finally fuzzing LLCP, so the 426 00:25:17,960 --> 00:25:22,880 peer-to-peer communication. I just again modified this time 427 00:25:22,880 --> 00:25:27,320 NFC-py to allow me to change the connecting information 428 00:25:27,320 --> 00:25:32,820 previews. So that was cool. So what I could do at that point 429 00:25:32,820 --> 00:25:35,600 was I could emulate a tag, I could put the phone down and it 430 00:25:35,600 --> 00:25:38,660 would read the tag. And those tags could have like crazy mess 431 00:25:38,820 --> 00:25:44,340 up fields. But then I need to like do that a lot, right? And 432 00:25:44,340 --> 00:25:48,260 again, my interns started quitting after a couple hours. So 433 00:25:48,260 --> 00:25:51,640 I had to figure out a way to automate that. And so basically 434 00:25:51,640 --> 00:25:55,700 what I would do is I would just turn off NFC, I would change the 435 00:25:55,700 --> 00:25:59,440 tag to be something new, and then I would turn on NFC and 436 00:25:59,440 --> 00:26:01,540 that would be sort of the equivalent of presenting the 437 00:26:01,540 --> 00:26:04,680 tag. And then I would, once that was done, then I would turn off 438 00:26:04,680 --> 00:26:08,800 NFC, change the tag, turn on NFC, so forth. And then I would 439 00:26:08,820 --> 00:26:11,200 do that again. There's a couple ways here that you can turn off or 440 00:26:11,200 --> 00:26:16,240 turn on NFC. Hey, you're leaving my talk? The demos are still 441 00:26:16,240 --> 00:26:19,460 coming. The cool part is at the end, this is the painful part 442 00:26:19,460 --> 00:26:22,540 where you learn to appreciate the hard work I did before the 443 00:26:22,540 --> 00:26:30,740 whiz bang demos. All right. Thanks. All right, so he's 444 00:26:30,740 --> 00:26:32,400 going to leave and be like, man, that talk was so boring. It was 445 00:26:32,400 --> 00:26:36,340 just all about specs and shit. So all right, anyway, so then I 446 00:26:36,340 --> 00:26:38,800 needed a way that it turns out NFC readers aren't designed to 447 00:26:39,420 --> 00:26:43,600 emulate 10,000 tags in a day. So after a little bit, they just 448 00:26:43,600 --> 00:26:47,240 freeze up. And the support people say the way you fix it is you 449 00:26:47,240 --> 00:26:49,520 just unplug it and plug it back in and everything's great, hard 450 00:26:49,520 --> 00:26:52,600 reset. I was like, well, I don't know if that's actually 451 00:26:52,600 --> 00:26:54,740 better than doing this with the phone if I'm doing this with the 452 00:26:54,740 --> 00:26:59,480 USB. So I got this, I found this USB hub that I could control 453 00:26:59,480 --> 00:27:02,520 the power on and software I could turn the power off and then back 454 00:27:02,520 --> 00:27:06,480 on. And so it was kind of like plugging it and unplugging it. 455 00:27:06,620 --> 00:27:08,720 And you also notice, like, a lot of people come up to me and 456 00:27:08,820 --> 00:27:11,080 be like, Charlie, like, how do you find time to do all this 457 00:27:11,080 --> 00:27:15,140 research? And I say, well, I totally, I don't do any household 458 00:27:15,140 --> 00:27:18,020 chores at all. And so you can see, like, total water damage in 459 00:27:18,020 --> 00:27:20,460 my wall. It's like, eh, I'll just set up my fuzzer right 460 00:27:20,460 --> 00:27:25,860 next to it. All right, so the final part of the puzzle is 461 00:27:25,860 --> 00:27:28,680 looking for crashes. And Android, it's super easy. They 462 00:27:28,680 --> 00:27:30,800 have logcat, which basically tells you any time anything 463 00:27:30,800 --> 00:27:35,100 crashes. And on Amigo, no one's really ever looked at that 464 00:27:35,100 --> 00:27:37,840 operating system. So it turns out they have GDB, though, so I 465 00:27:38,820 --> 00:27:42,900 was kind of attached to the server or the service. And then 466 00:27:42,900 --> 00:27:47,460 in case other things crashed, I just did basically a PS before 467 00:27:47,460 --> 00:27:49,460 and after sending the NDEF and looked to see if anything 468 00:27:49,460 --> 00:27:55,320 significant had changed. And then finally, like, I wanted to 469 00:27:55,320 --> 00:27:57,520 make sure NFC was still working. So between every fuzz 470 00:27:57,520 --> 00:28:00,780 test case, I would send a valid test case, a valid, you know, 471 00:28:00,780 --> 00:28:03,400 NDEF file or something. And then I would just make sure that 472 00:28:03,400 --> 00:28:05,660 that worked. And if not, I would kind of restart everything. So 473 00:28:05,660 --> 00:28:08,800 in Android, tags puts things in a SQLite database. You can 474 00:28:08,820 --> 00:28:10,920 just check to make sure the thing you just sent shows up 475 00:28:10,920 --> 00:28:15,100 there. And in Amigo, if you start the NFC daemon with this 476 00:28:15,100 --> 00:28:19,380 extra, you know, verbosity setting, it actually shows you 477 00:28:19,380 --> 00:28:21,940 the NDEFs that it's reading and syslogs. You can look to make 478 00:28:21,940 --> 00:28:25,700 sure everything's working great. All right, so here is, like, 479 00:28:25,700 --> 00:28:28,600 super boring videos, but it took me six months to make, so you're 480 00:28:28,600 --> 00:28:32,860 going to watch it. So here's the Nokia N9. So this is, like, 481 00:28:32,880 --> 00:28:35,500 the valid test case. This is the invalid test case. It can't 482 00:28:35,500 --> 00:28:38,080 read it. And this is the valid test case. I would send it, like, 483 00:28:38,080 --> 00:28:41,500 a RAM number. And this is the invalid test case. And here is a 484 00:28:41,500 --> 00:28:48,200 Nexus S. Go. Go Nexus S. There we go. So I don't even turn it 485 00:28:48,200 --> 00:28:53,300 up. Oh, there it is. Beauty. So this one is a valid test case, 486 00:28:53,400 --> 00:28:55,160 and then there's an invalid test case that doesn't even show up. 487 00:28:55,280 --> 00:28:58,880 And then there is another valid test case. So if you lived in my 488 00:28:58,880 --> 00:29:01,320 house, you would just hear, like, in the background all day, 489 00:29:01,360 --> 00:29:06,960 all night, wink, wink, wink. So it's pretty annoying, but, you 490 00:29:06,960 --> 00:29:08,060 know, that's what I do for Sunday. So I'm going to show you 491 00:29:08,080 --> 00:29:10,160 how to do it. And then the other thing that happened in my 492 00:29:10,160 --> 00:29:13,940 house is that one stupid reader, the big one, in some weird 493 00:29:13,940 --> 00:29:16,640 situations, it would just start, like, making this huge loud 494 00:29:16,640 --> 00:29:20,920 noise. Like that loud. And I was like, well, this isn't 495 00:29:20,920 --> 00:29:25,860 ideal. So at first I tried to put a pillow on it, and you can 496 00:29:25,860 --> 00:29:28,440 still hear it. So that's why I moved eventually to my basement 497 00:29:28,440 --> 00:29:32,480 that's all flooded up. So finally I did the actual 498 00:29:32,480 --> 00:29:35,720 fuzzing. So like I said, it was, like, 50,000 test cases. I 499 00:29:35,720 --> 00:29:38,060 fuzzed against the latest OS that was available at the time. 500 00:29:38,080 --> 00:29:42,840 Last fall, which was 233 for gingerbread and 1.2 for the 501 00:29:42,840 --> 00:29:47,060 Nokia's. And as you saw in the video, each test case would take 502 00:29:47,060 --> 00:29:49,920 around, you know, five or ten seconds. So it was a very, very 503 00:29:49,920 --> 00:29:53,560 slow process. So as soon as you start fuzzing, you'll basically 504 00:29:53,560 --> 00:29:57,340 start to see things crashing and stuff. So the first thing that 505 00:29:57,340 --> 00:30:01,140 you'll see crash is tags. Tags, like, crash is super easy. But 506 00:30:01,140 --> 00:30:03,360 the problem is it's written in Java, so, like, it's not very 507 00:30:03,360 --> 00:30:05,860 exciting. So it's just Java exceptions. You can't really do 508 00:30:05,860 --> 00:30:07,040 anything with that. 509 00:30:08,080 --> 00:30:11,180 Keep fuzzing and then eventually the NMC demon will 510 00:30:11,180 --> 00:30:14,220 start dying. In this case, again, it's a Java exception, so 511 00:30:14,220 --> 00:30:18,660 not super cool. But at least it's good to know your fuzzer 512 00:30:18,660 --> 00:30:21,840 is working. And then finally you get some native code 513 00:30:21,840 --> 00:30:24,840 crashes. So that's cool. Here's one. It's a no pointer 514 00:30:24,840 --> 00:30:26,760 reference, so it's still not so exciting. But at least, again, 515 00:30:26,880 --> 00:30:28,860 it's like, wow, at least it crashed in native code. I'm 516 00:30:28,860 --> 00:30:32,280 getting there. So this is an example of if you send 517 00:30:32,920 --> 00:30:36,620 connection complete PDU before you establish a connection, it 518 00:30:36,620 --> 00:30:37,980 references a no pointer. 519 00:30:39,180 --> 00:30:43,420 All right. And then finally some actual bugs. And this is in 520 00:30:43,420 --> 00:30:50,040 the two, what did I say, 223 gingerbread NMC stack. So the 521 00:30:50,040 --> 00:30:53,320 key is to look at this thing. LCP check LCP. So this showed up 522 00:30:53,320 --> 00:30:59,520 in the logs and then it crashed in abort from free. So this is 523 00:30:59,520 --> 00:31:02,040 the source code for that. So the cool thing about Android is you 524 00:31:02,040 --> 00:31:04,900 can look at the source code. So if you look here, it's doing, 525 00:31:05,100 --> 00:31:07,500 you know, it's checking LCP, blah, blah, blah, blah. It 526 00:31:07,500 --> 00:31:11,900 allocates a buffer. And then if things don't work out right, 527 00:31:12,500 --> 00:31:15,280 there's dot, dot, dot here. So something happens. And then if 528 00:31:15,280 --> 00:31:17,340 things don't work out, it prints that thing which you saw in the 529 00:31:17,340 --> 00:31:20,820 log. And then it frees the buffer. Cool. And then it goes 530 00:31:20,820 --> 00:31:24,440 to down here and it calls DNIT which frees the buffer, which is 531 00:31:24,440 --> 00:31:29,020 not cool. So this is a double free. You know, with some work 532 00:31:29,020 --> 00:31:32,040 you could maybe write an exploit for it. And so the cool thing 533 00:31:32,040 --> 00:31:35,380 about this exploit, if you wrote it, which I didn't, would be, 534 00:31:35,460 --> 00:31:37,480 you know, basically you present a tag to a person and then you 535 00:31:37,500 --> 00:31:39,960 get a phone and you get a shell. So that would be like pretty 536 00:31:39,960 --> 00:31:44,620 exciting, I think. Anyway, this would give you code access as 537 00:31:44,620 --> 00:31:47,720 the NFC daemon, which does not have Internet access but does 538 00:31:47,720 --> 00:31:50,720 have Bluetooth admin access, which as you'll see later is 539 00:31:50,720 --> 00:31:54,700 like pretty awesome. So what about this? Well, being the 540 00:31:54,700 --> 00:31:58,500 responsible researcher I am, Google actually found it without 541 00:31:58,500 --> 00:32:03,180 me because I didn't report it. So it's fixed, though, at 542 00:32:03,180 --> 00:32:06,660 Ice Cream Sandwich, which is cool. The bad thing is that even 543 00:32:06,660 --> 00:32:07,480 though it's fixed on Ice Cream Sandwich, it's fixed on the 544 00:32:07,960 --> 00:32:11,420 NFC daemon. Most people still run gingerbread devices. So 545 00:32:11,420 --> 00:32:14,900 there's still like some guys out there you can get close to in 546 00:32:14,900 --> 00:32:18,980 the elevator and maybe get a shell. So now this is the part of 547 00:32:18,980 --> 00:32:21,880 the talk where I wasted so much time it's not even funny. So 548 00:32:21,880 --> 00:32:24,260 it turns out I found a bunch of these other like really awesome 549 00:32:24,260 --> 00:32:27,500 memory corruption bugs in the gingerbread stack. But I could 550 00:32:27,500 --> 00:32:31,360 never replicate them in any reasonable fashion. So I 551 00:32:31,360 --> 00:32:34,680 suspect they have to do with timing issues because if I ran 552 00:32:34,680 --> 00:32:36,860 the same thousand test cases I would always get, you know, the 553 00:32:37,560 --> 00:32:39,920 same number of them, more or less. But they weren't ever in 554 00:32:39,920 --> 00:32:42,460 the same spot. So I couldn't really replicate it. But anyway, 555 00:32:42,600 --> 00:32:45,760 here is some, like, super cool memory corruption crashes that 556 00:32:45,760 --> 00:32:48,020 may or may not be fixed. There's just a mystery. So 557 00:32:48,020 --> 00:32:52,280 here's one that crashes in DL malak, calls abort. And that 558 00:32:52,280 --> 00:32:54,560 usually happens when there's memory corruption. Here's one 559 00:32:54,560 --> 00:32:57,660 that happens in DL free, calls abort. That happens a lot in 560 00:32:57,660 --> 00:33:01,540 memory corruption. Here's one that crashes in free when it's 561 00:33:01,540 --> 00:33:07,080 trying to unlink a chunk where the back pointer is screwed up. 562 00:33:07,120 --> 00:33:07,480 That's my favorite one. Not a bad thing. But it's a really good 563 00:33:07,480 --> 00:33:10,800 memory corruption for sure. Here's one more. A bunch of 564 00:33:10,800 --> 00:33:15,440 crashes I found. Never hunted down. Reran the test cases and 565 00:33:15,440 --> 00:33:19,480 each time it took like four days. So many times that it's 566 00:33:19,480 --> 00:33:23,600 insane. But anyway, so the moral of the story is if Google had a 567 00:33:23,600 --> 00:33:26,220 decent tool chain for me to use, there would be like maybe four 568 00:33:26,220 --> 00:33:32,020 more bugs I would have not reported to them. Okay. So I'm 569 00:33:32,020 --> 00:33:34,640 just kidding. I'm a very responsible person. If any 570 00:33:34,640 --> 00:33:39,160 reporters are here, I never do anything bad. Thank you. Okay. 571 00:33:39,240 --> 00:33:42,860 So that's the NFC stack. So found some bugs in gingerbread. 572 00:33:43,540 --> 00:33:46,540 Some are fixed. Some may not be fixed. And then there's I didn't 573 00:33:46,540 --> 00:33:50,820 find any bugs in the N9 stack. So that means either their code, 574 00:33:50,900 --> 00:33:54,320 which is all native code, is perfect or there was something 575 00:33:54,320 --> 00:33:59,900 wrong with my fuzzer. So please fix my fuzzer for me. So now 576 00:33:59,900 --> 00:34:02,780 the question is fine. I've looked at the low level NFC 577 00:34:02,780 --> 00:34:04,620 code and that was like pretty good. I've looked at the low 578 00:34:04,620 --> 00:34:06,740 level and there weren't too many bugs. But what about the higher 579 00:34:06,740 --> 00:34:11,000 level stuff, right? So it turns out that Nokia and Google can do 580 00:34:11,000 --> 00:34:14,460 a pretty good job at parsing 200 bytes on an NFC tag. That's what 581 00:34:14,460 --> 00:34:17,260 NFC basically is. But what about these other apps? Can they 582 00:34:17,260 --> 00:34:21,280 do that? So at first glance, you look at what happens when you 583 00:34:21,280 --> 00:34:24,960 present a tag to NFC and it's super boring. So gingerbread, 584 00:34:25,160 --> 00:34:29,840 it just, you know, if they can screw up printing a string to a 585 00:34:29,840 --> 00:34:33,180 screen, like that's pretty bad. But they didn't. So here's a 586 00:34:33,180 --> 00:34:34,600 string. Here's a string. Here's a string. So if they can screw up 587 00:34:34,620 --> 00:34:36,160 printing a string, it's super boring, nothing exciting going 588 00:34:36,160 --> 00:34:39,700 on. But then they added all these like extra features. 589 00:34:41,040 --> 00:34:43,080 Starting at ice cream sandwich, Android has this thing called 590 00:34:43,080 --> 00:34:46,780 beam. Nokia has this equivalent thing called content sharing 591 00:34:46,780 --> 00:34:50,020 and also this Bluetooth pairing thing. So if you start to look 592 00:34:50,020 --> 00:34:52,980 at these things, get a little more interesting. So what's 593 00:34:52,980 --> 00:34:57,380 Android beam? Basically it's a way for you and your friend who 594 00:34:57,380 --> 00:35:00,220 both have Android phones to like share files and pictures and 595 00:35:00,220 --> 00:35:04,300 stuff like that. So or I guess in this case, really web pages. 596 00:35:05,640 --> 00:35:08,160 So how does it work now that you guys understand all the 597 00:35:08,160 --> 00:35:11,600 specs? This sentence will make sense to you when it wouldn't have 598 00:35:11,600 --> 00:35:16,100 an hour ago. They use LLCP with snap and they fall back to LLCP 599 00:35:16,100 --> 00:35:19,920 and MPP. See like what you learned. And the interesting 600 00:35:19,920 --> 00:35:22,180 thing is you can see here I'm beaming this game called Crime 601 00:35:22,180 --> 00:35:27,120 City, which is a fun game. You should get it. But to beam it, I 602 00:35:27,120 --> 00:35:29,440 have to press a button. But the guy on the receiving side, it 603 00:35:29,440 --> 00:35:31,500 just gets beamed and they can't do anything. It just shows up. 604 00:35:32,380 --> 00:35:34,600 It's sort of the opposite of what, you know, what you're 605 00:35:34,620 --> 00:35:36,520 thinking you might want to design if you were thinking 606 00:35:36,520 --> 00:35:42,240 about security. So how is this implemented? Like it's designed 607 00:35:42,240 --> 00:35:44,160 for two phones to be close to each other. But the way it's 608 00:35:44,160 --> 00:35:47,800 implemented is because like most things in Android with 609 00:35:47,800 --> 00:35:50,860 intents. And so that means as long as it gets an intent, it 610 00:35:50,860 --> 00:35:54,460 doesn't matter if it came via another phone or a tag. So you 611 00:35:54,460 --> 00:35:58,480 can still get it to do things like open up a web page just by 612 00:35:58,480 --> 00:36:04,000 getting a tag close to it. So, you know, if I get close to 613 00:36:04,620 --> 00:36:07,600 Todd Manning on the elevator, I can make his phone open up a 614 00:36:07,600 --> 00:36:13,120 web page to a URL I specify, which is not probably what would 615 00:36:13,120 --> 00:36:16,520 be good. So here's an example of just to show you how web pages 616 00:36:16,520 --> 00:36:19,740 get opened up. You get to a tag and, look, it goes to a 617 00:36:19,740 --> 00:36:23,780 website. So before, you know, I trusted, as much as I distrust 618 00:36:23,780 --> 00:36:30,860 vendors, I can trust them to parse 200 bytes, right? But now 619 00:36:30,860 --> 00:36:34,600 I have to trust them to parse what browser parses, right? And 620 00:36:34,620 --> 00:36:38,160 I don't trust that. So, you know, HTML, movies, videos, 621 00:36:39,040 --> 00:36:42,020 images, sounds, fonts. So now you can get to all this stuff 622 00:36:42,020 --> 00:36:48,060 through NFC. Okay. So now time for a demo. I got to thank Josh, 623 00:36:49,600 --> 00:36:52,500 Jayduck, Drake, and I don't know how to spell his name. 624 00:36:52,840 --> 00:36:57,200 Georg. So they wrote this exploit with me, I should say, 625 00:36:57,220 --> 00:37:01,040 but they did most of the work. It's just an Android exploit, 626 00:37:01,240 --> 00:37:04,060 right? It's an Android browser exploit. But, you know, you can 627 00:37:04,060 --> 00:37:04,360 get to it. 628 00:37:04,620 --> 00:37:07,840 So let me show you this and see if it works. And I have a 629 00:37:07,840 --> 00:37:11,220 backup movie if it doesn't work. So, hey, look, I have a project 630 00:37:11,220 --> 00:37:16,840 meeting today. Okay. So here is the exploit. So here in this 631 00:37:16,840 --> 00:37:21,220 window I have a Netcat listener. Here I have a phone. 632 00:37:23,440 --> 00:37:27,120 So this is an Android phone running 401. So this 633 00:37:27,120 --> 00:37:30,860 particular web, it's a WebKit bug, is fixed in 404. But it's 634 00:37:30,860 --> 00:37:34,600 still kind of cool. So anyway, here's a phone, right? I'm 635 00:37:34,600 --> 00:37:37,580 talking on the phone in a busy subway and some pervert comes up 636 00:37:37,580 --> 00:37:40,500 to me and is like, hey, Charlie, look at this. Oh, what, what, 637 00:37:40,500 --> 00:37:42,820 what, what? Oh, look, there's something. Oh, wait. Oh, it's 638 00:37:42,820 --> 00:37:46,260 gone. What happened? Right? And then over here is a shell. 639 00:37:51,140 --> 00:38:03,520 Anyway, it's pretty awesome. So touch a tag, get a shell. Oh, 640 00:38:03,520 --> 00:38:05,620 here's the movie if you didn't believe it was going to work. 641 00:38:05,820 --> 00:38:10,000 But it, of course, worked. That movie. Why did I do that? Okay. 642 00:38:10,040 --> 00:38:13,680 So the point of that is it's not that, wow, there's another WebKit 643 00:38:13,680 --> 00:38:16,480 bug, right? The point is that while you thought the NFC 644 00:38:16,480 --> 00:38:19,420 attack service was, you know, the 200 bytes of end data, 645 00:38:19,760 --> 00:38:23,260 really the NFC attack service is the browser, right? And the 646 00:38:23,260 --> 00:38:28,420 browser, you know, I mean, the good news is that Google fixed 647 00:38:28,420 --> 00:38:32,000 that WebKit bug that was in 401. So now the browser is secure. 648 00:38:35,120 --> 00:38:40,040 Okay. So that was Android. Now let's move on to Travis Goodspeed's 649 00:38:40,040 --> 00:38:44,880 phone, the Nokia N9. So it has something just like Android Beam 650 00:38:44,880 --> 00:38:48,020 which allows you to share, you know, images and files and stuff 651 00:38:48,020 --> 00:38:52,620 like that. Again, without user interaction. And the thing 652 00:38:52,620 --> 00:38:56,180 that's interesting is they have, so in Android, NFC is either on 653 00:38:56,180 --> 00:39:00,240 or off. And on the N9 it's on or off and you get this extra 654 00:39:00,240 --> 00:39:03,380 security option called confirm sharing and connecting. So you 655 00:39:03,520 --> 00:39:06,000 think if you turn that on, then if I tried to push you a video, 656 00:39:06,140 --> 00:39:10,280 it would like make you confirm. But it doesn't. So it actually 657 00:39:10,280 --> 00:39:12,600 does something else which I'll talk about in a minute. So here 658 00:39:12,600 --> 00:39:18,220 is an example of on a Nokia N9. So you can check Bluetooth is 659 00:39:18,220 --> 00:39:21,400 off. So I'm not doing anything with Bluetooth. But if I, so I 660 00:39:21,400 --> 00:39:25,660 touch, I touch it near to another N9 and then I just sit 661 00:39:25,660 --> 00:39:28,360 back and wait. And it's like, well, probably nothing bad is 662 00:39:28,360 --> 00:39:30,480 going to happen. Oh, it turned on my Bluetooth. Oh, it's 663 00:39:30,480 --> 00:39:32,560 downloading something. Well, it's just downloading. What's the 664 00:39:32,560 --> 00:39:32,900 harm, right? 665 00:39:33,520 --> 00:39:39,480 So cool, that was it. Oh, shit, it's rendering it. So anyway, so 666 00:39:39,480 --> 00:39:43,000 the point is without user interaction, you can push like 667 00:39:43,000 --> 00:39:48,240 things like PDFs and Word documents and Excel spreadsheets 668 00:39:48,240 --> 00:39:51,820 and stuff to a phone without the person doing anything. So again, 669 00:39:51,920 --> 00:39:54,100 it's just like this much larger attack service than you would 670 00:39:54,100 --> 00:39:56,920 have imagined. So instead of the attack service being this little 671 00:39:56,920 --> 00:40:00,800 guy that prints a string, it's actually, you can't do a web 672 00:40:00,800 --> 00:40:03,500 page on Nokia, but you can do basically everything else. So 673 00:40:04,840 --> 00:40:08,080 what kind of bugs could there possibly be? Well, if you're 674 00:40:08,080 --> 00:40:11,400 like lazy and you just want to use public bugs, you could do 675 00:40:11,400 --> 00:40:15,460 that. But, you know, that's pretty lame. So there's LibPNG, 676 00:40:15,520 --> 00:40:18,380 for example, ships on the latest Nokia N9, which is running 677 00:40:18,380 --> 00:40:22,780 version 1.3. It has LibPNG 1242 and there's at least two 678 00:40:22,780 --> 00:40:26,360 critical vulnerabilities reported on that. But, like, you 679 00:40:26,360 --> 00:40:30,020 know, you guys are too good to use public bugs. So I turned on 680 00:40:30,020 --> 00:40:33,500 my fuzzer for a little bit to see what I could find. And, you 681 00:40:33,500 --> 00:40:36,820 know, I found this, like, invalid free in PowerPoints and 682 00:40:36,820 --> 00:40:40,740 this invalid write in PDFs. So here, look, dear Google, look, 683 00:40:40,800 --> 00:40:44,320 I'm using Valgrind on my phone. See how cool that is? Maybe you 684 00:40:44,320 --> 00:40:48,680 should do that for Android. Or if you don't want to use those 685 00:40:48,680 --> 00:40:50,720 bugs, here's another bug I found, which is pretty awesome. 686 00:40:50,840 --> 00:40:56,120 So this bug is in the way they parse Word documents. And it's 687 00:40:56,120 --> 00:40:59,240 also, turns out to be a zero day in K office, too. So for your 688 00:40:59,240 --> 00:41:00,900 friends who think they're secure because they use Linux, 689 00:41:01,020 --> 00:41:03,420 you can just ship them this Word document and own them, 690 00:41:03,500 --> 00:41:08,560 basically. So basically the way this bug works is it allocates a 691 00:41:08,560 --> 00:41:13,100 buffer called group grupex or something based on some number 692 00:41:13,100 --> 00:41:17,240 you gave it. And then it reads in this other value, short from 693 00:41:17,240 --> 00:41:19,480 the data stream you're providing. And then it loops 694 00:41:19,480 --> 00:41:22,900 that number of times it just read and writes into your 695 00:41:22,900 --> 00:41:26,880 allocated buffer, grupex, whatever it reads. So you can, 696 00:41:26,920 --> 00:41:29,920 you have the choice of how big the allocation is, how much data 697 00:41:29,920 --> 00:41:33,480 you want to copy, and what data you copy. So you can, you can 698 00:41:33,500 --> 00:41:38,280 do that. So it's like a classic heap overflow bug. So I didn't 699 00:41:38,280 --> 00:41:40,480 write an exploit for this one either, but I'll show you that 700 00:41:40,480 --> 00:41:44,720 it's pretty easy to exploit. So here's an example of a data 701 00:41:44,720 --> 00:41:48,760 stream. I made the link big and then I put some data. So it 702 00:41:48,760 --> 00:41:52,120 crashes. Here's the back trace. It crashes at some address that 703 00:41:52,120 --> 00:41:55,560 isn't mapped. But if you look at what happened right before, it 704 00:41:55,560 --> 00:42:01,680 crashed. It loaded a value from R3. And then it, you know, from 705 00:42:01,680 --> 00:42:03,480 where R3 is pointing. And then it brings it back. And then it 706 00:42:03,500 --> 00:42:06,020 branches that value. And it turned out I controlled R3. So 707 00:42:06,020 --> 00:42:10,780 if I would have just pointed it to, you know, some other data I 708 00:42:10,780 --> 00:42:13,180 controlled, I would have gotten control. So basically this is a 709 00:42:13,180 --> 00:42:16,120 pretty easy to exploit bug. And again, you would get it just by 710 00:42:16,120 --> 00:42:19,800 getting one N9 close to another N9. You could make it open up 711 00:42:19,800 --> 00:42:25,260 the Word document and own them. All right. So the final thing I 712 00:42:25,260 --> 00:42:28,280 want to show you is this. So it turns out that if you Google 713 00:42:29,360 --> 00:42:33,360 Nokia N9 NFC, you come across like 10,000 versions of this 714 00:42:33,360 --> 00:42:36,620 video. So the guy's listening to his music. He's jamming out. And 715 00:42:36,620 --> 00:42:39,440 then he gets his phone close to the speakers. And then all of a 716 00:42:39,440 --> 00:42:42,000 sudden, like, the whole room is jamming out to his music. And I 717 00:42:42,000 --> 00:42:46,740 was like, how did that, what just happened, right? Like, he's 718 00:42:46,740 --> 00:42:49,620 on his phone. And now all of a sudden the speaker's, like, on 719 00:42:49,620 --> 00:42:52,000 his phone. It is magic. And where there's magic, there's 720 00:42:52,000 --> 00:42:58,080 security problems. So I bought one of these speakers, right? 721 00:42:58,360 --> 00:43:02,820 And I'll show you how it works, I think, except it's kind of, 722 00:43:03,900 --> 00:43:07,320 whoa, someone totally hacked my N9 because I went to my talk 723 00:43:07,320 --> 00:43:11,600 yesterday, I think. Oh, here we go. So now, so I got one of 724 00:43:11,600 --> 00:43:15,060 these speakers. I got out my N9 and I downloaded some free 725 00:43:15,060 --> 00:43:17,400 music. And then I was like, okay, let's see what's going to 726 00:43:17,400 --> 00:43:22,060 happen. So I put it here. Is it going to work? Give me one more 727 00:43:22,060 --> 00:43:25,800 second. See, I get the shell to work in the demo, but I can't 728 00:43:25,800 --> 00:43:30,380 get, like, the actual music player to work. One check real 729 00:43:30,380 --> 00:43:33,340 quick and then I will move on. All right. All right. All right. 730 00:43:33,360 --> 00:43:38,320 So I'm going to try this one. It should work. Okay, let's try it 731 00:43:38,320 --> 00:43:49,280 again. Is the thing on? The speaker has to be on. It's a 732 00:43:49,280 --> 00:43:54,300 piece of crap. Oh, wait, it's working, I think. Yeah. Is it 733 00:43:54,300 --> 00:44:01,560 working? This is crap. Anyway, it was just like the dude with 734 00:44:01,560 --> 00:44:03,340 the, like, little music symbol. I don't know. I don't know. I'm 735 00:44:03,760 --> 00:44:05,140 going to try this one. It was going to look just like that, 736 00:44:05,220 --> 00:44:08,560 but it's not working. Anyway, the point is, I got this thing 737 00:44:08,560 --> 00:44:10,840 and I was like, how the hell are these talking to each other? And 738 00:44:10,840 --> 00:44:15,540 I didn't do anything. So I looked into it some. Oh, look. 739 00:44:17,540 --> 00:44:21,140 I had this sharing option on. That's what happened. So now I 740 00:44:21,140 --> 00:44:24,200 don't know if it will work. But who cares? Oh, it's working. Oh, 741 00:44:24,220 --> 00:44:26,820 it worked. So, like, I didn't do anything. Well, that time I did 742 00:44:26,820 --> 00:44:30,540 do something, but you'll see in a second. So there's this, so, 743 00:44:30,600 --> 00:44:33,040 like I said before, oh, and then it turned off. You press it 744 00:44:33,040 --> 00:44:33,340 again. Oh, it worked. So, like, I didn't do anything. Well, 745 00:44:33,820 --> 00:44:38,380 I'm going to unplug it in about one second. So there's this, oh, 746 00:44:38,380 --> 00:44:43,260 no, it's got a battery. I unplugged it, but it didn't 747 00:44:43,260 --> 00:44:47,640 stop. So now we're back to this thing about confirmed sharing. 748 00:44:48,640 --> 00:44:51,820 So if you have the confirmed sharing set, which isn't on by 749 00:44:51,820 --> 00:44:55,280 default, then it actually would prompt you before you do the 750 00:44:55,280 --> 00:44:58,240 magical speaker thing. But if you just, if you don't touch 751 00:44:58,240 --> 00:45:01,260 your NFC settings, then it just magically happens like in the 752 00:45:01,260 --> 00:45:03,320 video. So the way that it magically, like, it just 753 00:45:04,300 --> 00:45:07,900 behind the curtain, behind the magic is this NDEF. So if you 754 00:45:07,900 --> 00:45:12,960 send it this NDEF data, what you send it is a Bluetooth address, 755 00:45:13,380 --> 00:45:18,020 a pin that you made up that it's going to then know, and then a 756 00:45:18,020 --> 00:45:21,940 name. So it turns out, like, you know, I grew up in the old 757 00:45:21,940 --> 00:45:24,260 days, and my whole life I've been looking for a root shell. 758 00:45:24,520 --> 00:45:27,140 But it turns out what I really wanted was this thing, Bluetooth. 759 00:45:28,100 --> 00:45:32,900 So here's the video. So here's a Bluetooth tag. It's an NDEF 760 00:45:32,900 --> 00:45:33,320 tag. So you can see it's a Bluetooth tag. So you can see it 761 00:45:33,340 --> 00:45:37,800 Bluetooth is off. Cool. And then I'm going to present the tag 762 00:45:38,260 --> 00:45:41,380 to the phone. So you imagine, like, you know, I'm running up, 763 00:45:41,540 --> 00:45:45,520 hey, how's it going, swat on the butt. And then, you know, 764 00:45:45,540 --> 00:45:47,300 nothing happened on the phone. If you look, like, the phone 765 00:45:47,300 --> 00:45:51,000 made that little blue thing, but that was it. And then even then 766 00:45:51,000 --> 00:45:54,820 it's kind of screwed. So anyway, it pairs. You look over, oops, 767 00:45:54,940 --> 00:45:56,760 you can't see where I'm pointing. So this thing showed that it 768 00:45:56,760 --> 00:45:59,480 just paired with me. And I didn't need to know the pin or 769 00:45:59,480 --> 00:46:02,320 anything like that, because I told it the pin to use. And then 770 00:46:02,320 --> 00:46:03,320 I can mount the file set up. And then I can go back to the 771 00:46:03,340 --> 00:46:07,480 file system on the phone and, you know, read all of its files. 772 00:46:07,620 --> 00:46:12,740 And on the phone, there's nothing going on. So thanks. 773 00:46:15,700 --> 00:46:19,560 So I can see all their files. And then so you can see things 774 00:46:19,560 --> 00:46:23,340 like, you know, pictures they've taken with their camera, JPEGs 775 00:46:24,840 --> 00:46:28,880 that they just happened to have downloaded, music, that song I 776 00:46:28,880 --> 00:46:32,180 was just playing for you, you know, like, documents. So 777 00:46:32,180 --> 00:46:33,320 basically anything you want, you can just download. And then 778 00:46:34,080 --> 00:46:36,960 you can write to it too, although I never bothered. But, you know, 779 00:46:36,980 --> 00:46:38,980 files are one thing. I want to actually, like, use the phone, 780 00:46:39,080 --> 00:46:42,540 right? This is what makes this cooler than the root shell. So 781 00:46:42,540 --> 00:46:45,080 now I'm going to send a text message with the phone. So send 782 00:46:45,080 --> 00:46:50,060 the text message. Wait for it, wait for it, wait for it. Let's 783 00:46:50,060 --> 00:46:53,700 go over here. So there's my phone. It showed up. If I turned 784 00:46:53,700 --> 00:46:56,840 this on, you would have actually heard it show up. But too late. 785 00:46:57,080 --> 00:46:59,800 Anyway, so trust me, that text message really sent. And then you 786 00:46:59,800 --> 00:47:03,300 can do things like read their contacts. So, and then you can 787 00:47:03,300 --> 00:47:04,200 actually use the phone. And these are the contacts that are 788 00:47:04,200 --> 00:47:06,740 stored on the file system as well as the SIM card. So you can 789 00:47:06,740 --> 00:47:14,560 see, you know, in a second here. Let's fast forward. So anyway, 790 00:47:14,580 --> 00:47:19,820 here's their contacts. And then finally, like, the super end all 791 00:47:19,820 --> 00:47:23,120 money shot is then you can actually just, like, dial their 792 00:47:23,120 --> 00:47:27,040 phone for them. . And I put the camera on so you 793 00:47:27,040 --> 00:47:29,060 don't see my phone number. So you can't call me. I'm very 794 00:47:29,060 --> 00:47:33,280 clever that way. And then I wait, wait, wait. Come here, 795 00:47:33,300 --> 00:47:37,740 okay, it's dialing and then it shows up over here. Compliments 796 00:47:37,740 --> 00:47:43,060 of AT&T. Thank you. So anyway, the thing is if you don't change 797 00:47:43,060 --> 00:47:47,960 that setting, if I just present a tag to you, then I own your 798 00:47:47,960 --> 00:47:51,920 phone. So if you do have that setting set, though, you get 799 00:47:51,920 --> 00:47:55,580 this nice thing and I have to then push you a Word document 800 00:47:55,580 --> 00:48:00,240 that owns your phone. So just to wrap things up quickly, 801 00:48:00,240 --> 00:48:04,680 so NFC is like a whole new way to own people's phones, server 802 00:48:04,680 --> 00:48:07,980 side. It's hard to test them, but I'm releasing tools that 803 00:48:07,980 --> 00:48:12,480 will let you test them. Vendors should let you say okay before 804 00:48:12,980 --> 00:48:15,700 people can push Word documents and Web pages to you. Here's the 805 00:48:15,700 --> 00:48:19,480 code, tiny URL, NFC dash files, and here's all the people that 806 00:48:19,480 --> 00:48:21,840 helped me while I was doing this, including cyber fast track 807 00:48:21,840 --> 00:48:24,460 which funded part of this work. Thank you. 808 00:48:30,960 --> 00:48:32,880 Thank you.