So, RFID myth busting. If you were here expecting to see a myth buster, that's next. Okay, feedback. A little bit about hardware. Hardware is my consulting company. We're a San Francisco-based startup. We do hardware security consulting. We design products, we assess products, we do gate-level reverse engineering. You give us a chip, we'll give you a netlist and a cryptanalysis. Hardware is some folks that you've heard of, myself, Tim Mullen, Karsten Noll broke my fare a little while ago. Some names that you haven't heard of that we just call Secret Agents 1 and 2. I don't actually know what their real names are. Okay, so first up, the plan that was. So, we did have this grand scheme planned where we were going to have all of this gear set up by those doors such that whenever anyone walked through the doors, they were going to read all of your RFID tags, every single one of them. Stick it all in a database, correlate it based on time, all kinds of stuff. As it turned out, we had a quite horrific number of equipment failures. Some were our fault, things like feeding 120 volts into a 741 doesn't tend to do it much good. Some of them weren't our fault, like RadioShack just not selling good enough components. So, hopefully everything that I've got here appears to be working. We're working at the moment, so we'll see how far we get. Okay, let me introduce you to the hardware first. First up, we have this device here. I don't know how well you can see that. This is a custom-built 125 kilohertz RFID reader. It's based around a PIC18. It's written in C, and it'll output anywhere from about half a watts with the 12-volt supply that I've got on it at the moment. It'll scale up to about 5 watts output power with a 60-volt rail. To put that into perspective, a traditional, typical off-the-shelf 125 kilohertz reader, somewhere between 10 milliwatts and 50 milliwatts. We're dumping a lot of power into this coil. It's capable of reading, copying, and playing back over a dozen different tag formats at 125 kilohertz, including tags that we have never before seen. So, I'd be interested to see if anyone does have any one of those. We're working on 25 kilohertz tags that we've not encountered before. If this was working completely, which it isn't at the moment, but we would be able to read those with zero knowledge. I'll get back to how. Next up, over here. This is an off-the-shelf 13.56 megahertz VivoPay reader. This was a couple hundred bucks online. This, as it is at the moment, is completely unmodified. We are in the process of producing an antenna chain for it. We've got a one watt amplifier that, again, it has worked, it has failed, it has been rebuilt and failed again several times. So, we can't demo the long-range stuff on that, but we do have it. The amplifier is built exclusively with parts from RadioShack. You spend 10 bucks on RadioShack parts, and you can amp this thing up to about a three-foot read range. We'll come back to the details on that. Important point, very important point about this, credit card RFID reader. I have performed no reverse engineering whatsoever. I can stand before you, put my hand on my heart, and swear to you faithfully, I know nothing about EMV. It's actually a good thing, trust me. We'll come back to it. Both of these devices, the 13.56 one watt amplifier and the 125 kilohertz, it's called a ProxPic, these will both be made available for sale. They're going to be commercial devices, we're hoping to launch them by the end of August, but depends on getting a few other things sorted first. But, yes, we will be making these commercially available. Finally, at the end, we have a 900 megahertz EPC Gen 2 reader. This is completely unmodified. This is the system that I presented about at ShmooCon. Exactly the same gear. You can go up on Google Video and watch the talk if you're interested. Okay, so, on to the myths. First up, RFID is short range. So, let's talk about the short range thing for a second. The 900 megahertz gear. EPC Generation 2 has a design read range of 20 to 30 feet. With a completely standard credit card size tag, you will get a 20 foot read range with off-the-shelf, unmodified gear. With a larger tag, you'll get 30 feet easily. It's relatively simple to scale it up to half a mile. If you wanted to go beyond that, it's also plausible that you could make friends with someone who operates your local airport. And just, if you can possibly convince them to let you borrow their radar tower, you could probably read these things from tens of miles away. Interesting note about this technology. This is for the enhanced driver's license and the passbook. Anyone have one of these things? Anyone have an EDL? You've been tagged with exactly the same technology that Walmart uses to tag razor blades. Everyone thank the federal government for making that law. 13.56 megahertz. This is an industry term, contactless smart card. I'm going to be making gratuitous use of air quotes throughout my talk here. Doesn't necessarily mean that I disagree with the term. It just means that I'm using it out of context. It is quite an important point because there's some subtleties that we'll see a little bit later on. Again, standard reader is about 50 milliwatts. Gives you maybe an inch of read range. Our one watt amplifier, again, when it works, gives you about three feet. 13.56 megahertz. If you double the frequency, you're in 27 megahertz. There's a whole lot of gear available for 27 megahertz, and it's really easy to drop the frequency by half. So, 101 megahertz. Your amplifiers are very, very easy to get hold of. The 125 kilohertz Prox gear. Off the shelf reader does about an inch. My gear here, as it stands at the moment, not entirely functional. I'll be demonstrating about an eight to nine inch read range. If it was working completely, it would have a foot, maybe more. So, I mean, already we've got, you know, good long read range out of the 900 megahertz gear to start out with. Shorter range on the other two bands, but let's look at that a little more closely. The demo for the 900 megahertz I might be able to do, despite the broken projector. Is that coming through on the screens? Come on. Okay. So, we can just about see the window there as much as we need to. Okay. So, three windows here. On the left is tags that are currently visible. So, you can see that there's one tag with a zero code that's kind of fading in and out. The panel in the middle is all of the tags that it has seen at any point. And if you click on one, then it logs what the tag details were, what type of tag, when it read it, how many times it read it, all that kind of stuff. So, if I can have a volunteer, someone in the front row, have an EPC generation two RFID card. And you can see that's reading. I can step back and it's still reading it. So, yeah, there's no way that's a short range system. It just doesn't even argue. So, 900 megahertz, okay. We've already busted the short range at 900 megahertz. That's very easy. If you think that was good, keep watching. Wow, the Vista machine came back. So, at ShmooCon and on the synopsis of my talk, I did say that we were going to be setting a 900 megahertz world record. It didn't happen because as it turns out, 900 megahertz amplifiers, when you're working in this kind of spectrum, every single circuit trace, every leg of every component, every ground line, everything wants to radiate power. So, your circuit is constantly just trying to bleed off all of the power into space. The design of this gear is very, very simple. It's very involved. And as a result, it's very expensive. We weren't able to find anyone who was prepared to lend us $20,000 of RFID amplifier for us to take it out into the desert and screw with it. Can't imagine why. So, what has been demonstrated, 213 feet is what I'm aware of the longest read range. That was using 10 watts of output power compared to the normal 1 watt off the shelf. You can easily go up to 100 watts with no real problems at all other than getting hold of the gear. Standard antenna is 6 decibels gain. The 213 feet was using 9 decibels of gain. You can easily get 15 dBi antennas. The only real problem you've got with amping this up to infinity, with this kind of UHF spectrum, if you can see the antenna, you can receive the signal. It's as simple as that. So, the biggest problem that you've got is the amount of power that you're putting out. A lot of that gets reflected back in and you need some way to filter that out. So, you need to dump all of the carrier that you don't want and just look for the modulated data that's coming back from the tag. That's not a particularly important factor until you get up to about half a mile. We did a whole bunch of number crunching on it and we reckon that half a mile is kind of the bridge point where just simply dumping more power into it will not give you more read range. That is the point at which you need to design your own preamp. Again, it's 900 megahertz design, so it's inherently sensitive to noise and things like that, but the actual amplifier itself isn't particularly complicated. We haven't looked at doing it yet. We haven't had time with all the other gear that we've got. I do promise that we will set the 900 megahertz world record for RFID. We will do that at some point. I'm also contemplating running an RFID range shootout competition at DEF CON next year. Show of hands, anyone that would be interested in an RFID range shootout? Okay, I might see about that then. Okay. So, this is the prox pick. This is the 125 kilohertz reader. I want to kind of go through this schematic in some detail and kind of explain why RFID is different from radio. If you treat RFID like a radio system and you just try and amplify it up and increase your gain, you will fail. There's a number of things that are very specific to RFID that just kind of don't map over from radio, so it's kind of a bizarre system to try and build if you're a radio geek. So, I don't know if I can get my oscilloscope working, hopefully. So, let me walk you through the circuit really quick first. I'll use this one over here. So, you come out from the pick. You generate a 125 kilohertz square wave and feed it in here. You're limited to about 30 milliamps. So, the first thing that you need to do is amplify it up. So, this first transistor here, this is just configured as a voltage buffer. The pick runs on 5 volts, and we want to be able to scale to any arbitrary voltage that we want to dump into it. Like I said, we can handle up to about 60 volts just with the components that we're rated to at the moment. So, amplify it up. Just a normal inverting amplifier followed by an emitter follower pair. So, this is... This forms the entirety of the power output stage. The first transistor acts as a voltage amplifier. The second pair of transistors acts as a current amplifier. So, on the positive half of the signal, you're effectively shorting whatever your supply voltage is, just shorting that straight into the coil. On the negative phase, this PNP transistor right at the bottom here, that will turn on during the negative phase and it will dump the power back out of the coil. So, given that we're feeding a square wave into it and it's an inductor, we get very, very rapid changes in current. We get lots of flyback voltage. And coming out here, between the end of the inductor and this capacitor, there we've got about... Well, typically about 150 volts. We're rated to 400 volts up there. We're getting about 60. So, the next thing that we do... Let's see if this works so I can get an oscilloscope trace up. Okay. Kind of got an oscilloscope trace. So, let me give this thing power. Okay. Do we actually have a trace there? Oh, there we go. Awesome. It's working. So, this is what we get out of the coil. This is between the inductor that you saw horizontally and the capacitor that sits vertically. These two components are tuned, so they're resonant at 125 kilohertz. This is why you can put 12 volts into it and this is currently producing... So, that's currently 70 volts peak to peak from a 12-volt rail. So, that's healthy. That's not too bad. The idea is that... Can everyone see the oscilloscope traces okay? Awesome. So, the idea is that you get your RFID tag. I have a whole bunch of them here. I'm not going to use... I'm actually going to use an HID Prox card, not because there's anything particularly special about HID Prox. It just happens to be much more visible on the oscilloscope trace. So, we drop that into our antenna. This is my antenna. This is just like 50 turns or so of 26-gauge wire. This used to be a table. Oddly, it was my wife's suggestion that I destroy it. So, we drop our tag into the middle of our coil and you can see that the trace... If you look at the very top and bottom edges of that trace, you can see it just kind of wiggling up and down a little tiny bit. That's the modulation. So, that's the entirety of the signal from the card at this point. So, what we've got, in effect, is we've got somewhere north of a watt of power being dumped into that coil. It gets transformed from 12 volts at reasonable current to high voltage, lower current. That's what the coil does. It kind of mutates the one into the other. So, we've got very high voltage. We've got lots of power behind it. And we've got a very, very small signal. So, our modulation depth, given that we've got about 70 volts of carrier, we're looking at maybe... maybe 2 volts of modulation depth. So, what we've got to do is we've got to separate that signal from the carrier, reject all of the carrier, and just pass the modulation. So, the way that we do that... Can I come back to the schematic real quick? Is Vista going to cooperate with me? Yes, it is. Awesome. So, the way that we do that... First thing that we do is half-wave rectify with this diode here. So, what that effectively does is it just completely cuts off the negative half of the supply. So, everything that we're doing from this point forward is positive with respect to ground. We then have this resistor going to ground and this capacitor going to ground. This is... It's called a tank circuit. It's an AM detector. So, the idea is that on the very positive spikes, that capacitor will charge up to whatever voltage it gets to. When the voltage drops off, the capacitor will start slowly leaking through that resistor. So, if we take a look at the trace coming out of there... We can see straightaway... So, I haven't changed the scale on the oscilloscope. And straightaway, you can see that it's a much smaller signal. So, let me put my scope down to times one. Okay. So, that's the peak detector output, if everyone can see that. Let me try moving that over a little. Is that a little better? Okay. So, this is the output from our peak detector. You can see it's AC coupled, which is why the negative side of the... Sorry, the lower voltage side of the trace is moving up and down. That should be completely flat, more or less. And you can see that we've got... We've got modulation here, which is much more visible than was present on the coil. So, we've... There we go. That's a good, clean signal. So, we've already rejected 80-90% of the coil carrier voltage at this point, just with a peak detector. Now, the problem with this is, if I come back here... This is one of the first major problems with RFID systems. You've got an awful lot of power coming through this coil into this peak detector circuit. So, there's, you know, plenty of power available to charge that capacitor. What you don't want is you don't want the voltage on this tank circuit. You don't want that to leak out too quickly, because the more voltage that leaks out of that, the more carrier is going to leak through with your signal, because you only want to drop about 5 volts per carrier wave. Any more than that, and you're just catching carrier, and it's all just noise that you need to filter out. So, what you end up with is you need as large a capacitor as you can get here, so that it charges up as high as possible. And then you need as high a voltage and impedance as possible, both with this resistor that forms the tank circuit, as well as the impedance of the rest of the receive chain. So, currently this is configured. The tank circuit sees a load of about 10 megaohms, which is how we've got the noise down to such a manageable figure. So, straight away, we've got the situation where we can't draw any power out of it. We've got a huge amount of power in the tank circuit, and the more power that we draw out of it, the more noise we get that we're just going to have to filter out anyway. So, we want to make sure that we've got our impedances as high as possible. The way that we do that, the peak detector, so this oscilloscope trace that I showed you, that's the AC component of the signal. Now, don't forget, we half-wave rectified it first, so we're only on the positive phase, and this signal that we've got is a couple of volts of ripple voltage that's floating 60 volts up in the air. So, first off, we need to block that DC voltage in order to get it back down into a range at which we can work with it again. So, that's what this capacitor right here does. That's a DC blocking capacitor. It forms a high-pass filter with this resistor. So, that helps us get rid of a little bit of the noise, blocks out the DC, and then we go straight into amplifying it from there, so that we can amplify it up. The idea of choosing the op-amp, op-amps generally have extremely high input impedances. So, we're looking at just the raw voltage. We're not actually loading the circuit at all. So, our AM detector is only clipping the very, very top of the signal off, which has got all the data that we're interested in. So, if I just kind of step through this on the oscilloscope now, having explained the basic mode of operation, so, this is the output from the peak detector. If you look at the read range from the coil right here, you can more or less see modulation about there. A few inches of read range. Not very good. We need to clean the signal up a bit more. So, we come out of that and into our low high-pass filter. I beg your pardon. And our signal gets a little smaller still because we're still filtering. However, when you drop the card in, you've got pretty clear modulation. And again, we've got a little less carrier and a little more signal. So, if I just zoom in a little here. So, you can see the ratio between the amount of modulation depth that you've got versus the amount of noise that you've got from the carrier. It's getting higher as you progress through the circuit. That's the point at which the output of this goes into an op-amp circuit and gets amplified up. The problem with that is one of dynamic range. We've got extremely high voltage swings. 120 volts peak-to-peak trivially. 200 volts peak-to-peak is very manageable. I'm actually rated to 400 volts peak-to-peak. Huge voltages flying back and forth. And we've got tiny, tiny, tiny modulation depths on the top. So, if you were to try to do this digitally, just by sampling it with an ADC at the peak of every carrier, it's not going to work. Because if you've got a 16-bit ADC even, you're going to be sampling 15 bits of resolution to cover the 120, 200-volt swing of the carrier, and you're going to have one bit of resolution left for the actual modulation depth. We need to reduce the dynamic range of the signal before we can do anything digital with it. And as it turns out, going digital is quite an expensive option. There's a device called the Proxmark 3. I don't know if many people have heard of it. It's a general-purpose RFID experimentation platform. It's very, very powerful. It's based on an ARM CPU and digital signal processor. Because of that, they cost about $500. Because this is based on a PIC microcontroller and an analog receive chain, the analog path has extremely good dynamic range. Far better than you'd ever get from... Oh, crap, 10 minutes. Okay, got to move on. Okay, so anyway, you do it in analog because you get better dynamic range, and you don't need to worry about it. So, right here, you can see the card is detectable from about here. So that's maybe... Let me hold that up so you can see it at the back. ... So you've got a clear signal from four or five inches. My reader is actually wigging out and not being entirely happy at the moment, so I'm going to leave it there and move on. Okay, so anyway, that's the 125 kilohertz circuit. The major problems that you've got are input impedance and dynamic range. So let's go back to the slides because I want to get on to the boomstick. You'll like the boomstick. Okay, so as I mentioned, the ProxPic, it's going to be commercially available. We're aiming for a $50 price point. Probably available in kit form. There'll be some slight variations on this, but we'll deal with that when we come to it. So, off the shelf, you're looking at a few inches of read range with a moderately complicated circuit like this. You can bump that up to a foot. If you really worked at it, you could probably get two feet out of a system like this. The problem with that is that that's not what you need to count as your read range. Your read range is actually largely irrelevant because I won't show you the oscilloscope trace because we're kind of running out of time already. But suffice it to say that wherever the tag is placed within that coil, as long as it's within the coil somewhere, you get a clean signal from it. So what you can do is you can wind your coil around a door such that every tag that walks through goes through the coil and you get a clean read on every tag. I don't give a damn how far away that'll read. If I can read every tag that comes through a door, surely that's a valid attack. You can actually do that with anything that's inductively coupled. You can't do it with this 900 MHz gear but you don't really need to because it's already long range. 1356 and Prox, you can do it really easily. I'm actually going to be hanging out at the hardware hacking village for the rest of the day. I've brought some magnet wire with me if someone wants to help out and we'll try and make a Prox reader Prox antenna for a doorway and see just how efficient it is. I've got everything that we need. So, let's go back to the myth. 900 MHz. Range of 20 to 30 feet, half a mile is achievable. Is it short range? Totally busted. 13.56 MHz. I'm standing here claiming that we've got amplifiers that'll give us a few feet of read range or cover a door. I haven't got the gear to actually prove that so I kind of got to call that plausible. 125 KHz. Well, you've seen read range here of, that's about 6 inches. The next amplifier stage, the op-amp stage is actually broken on this particular circuit so I can't show you that. But it's definitely busted. There is no way that you can claim that 125 KHz is short range when you can wind a coil around a door and capture everything. The only practical limit to that attack is how stealthily you can hide your coil. So, one out of three is plausible, two out of three busted. I think we've got to call short range busted. Okay. RFID is secure. You'll like this one. So, first thing that we've got to do. First thing we've got to do is fork the myth. So, I mentioned this industry term, contactless smart card. It's interesting because the industry that pushes this term to try and separate themselves from RFID, don't actually use the term contactless smart card. If you look at your credit card, it won't say I'm a contactless smart card credit card. It'll say I'm an RFID credit card. So, the industry doesn't use their own terminology that they're trying to enforce to separate it, but whatever. We'll give them the benefit of the doubt. We'll say, okay, maybe there's something different between a contactless smart card and an RFID tag, so we'll consider them separately. Two things that we need to know about them. Firstly, are the tags themselves secure? If the tags can be trivially copied, then the myth is busted. If the tags can't be trivially copied, then it comes down to whether the infrastructure surrounding the tags is secure. If you can break the system, then you don't necessarily need to break the tag. So, let's consider both. Just to be clear, 125 kilohertz prox and 13 point, sorry, 900 megahertz, those are RFID systems. 13.56 is pay pass, that's contactless smart card. So, are RFID tags secure? 125 kilohertz, the answer is just plain flat, no. This device here, the receive chain is kind of broken at the moment, but when it does work, we're able to copy several different formats of HID prox. We can read Indala, we can read VeriChip, EM4100, all of these tags. Every single one of them, we can read them, we can copy them, we can replay them. We can't clone TI type tags, just purely because they use a slightly different method to energize the tag. We can support them with a firmware upgrade as soon as someone actually gives us a sample that we can code against. We deliberately left out playback functionality from this, it will be present in the final device. That was for privacy concerns over the demo that didn't happen. We do also have working code for HITag2. The fact that I'm working with Cast and Null at hardware should give that definite credibility. The HITag is an encrypted tag. The idea of it is that there is some kind of cryptographic exchange. I'm not too familiar with the details myself, but the upshot of it is that the final production version of this device, you can scan someone's Prius car key, plug the device into your PC, do a few hours of number crunching to break the crypto, upload the result back to the device, back to the prox pick, and then not only can you open the doors on the Prius, you can actually start the car and drive it away. So... HITag2 is actually used by quite a few vehicle manufacturers. The list that I was given was Prius, BMW, Lexus, Mercedes, all the top end vehicles. It's kind of amusing to me that $50 of pick microcontroller can steal $50,000 of Lexus. We couldn't integrate it in time for DEF CON, and it wouldn't make a good presentation anyway because there's a few hours of crypto, but we do have it. It will be in the production devices. Total security fail on prox technology. All prox technology. No one vendor is any better or worse than anyone else. HITag2 makes an effort, not a very good one. It's just all bad. So, I mentioned that we can clone other tags that we haven't seen before. We have a whole pile of different test tags here. All different kinds of cars, and syringes with horrible injectable microchips in. Quite possibly the nastiest, scariest needle I've ever seen in my life. Despite all of the different tag formats, all of the different data structures that they contain, there are essentially two modulation formats. One of those does two different bit rates. So if you can support dynamic bit rates with two different modulation formats, you can clone anything. It's as simple as that. It all comes down to Manchester encoding. HITags use a slightly different encoding scheme. They layer a thing called FC810 on top of it. But it's still Manchester underneath. Manchester is designed to be very easy to decode. Our routine on this doesn't use any memory at all. And it receives, decodes, and error checks Manchester encoded RFID tags in about 20 lines of C. Very, very easy. So we've got two decode routines. That'll copy every RFID tag that lives at 125 kilohertz. The exception being HITag2 just because there's some back end crypto. It's very easy. So quick note about Manchester for those who don't know. The idea is you take a data one, becomes a one zero. You get a transition in the middle of every bit. You can sync on that transition in the middle of every bit. And you can check if the first bit and the last bit in your Manchester encoded stream. If those are the same, then you've got invalid Manchester coding and you can throw an error. It's very simple. I'll skip the decode routine. You can look at the source. Some other features that this prox pick has, it can sniff tags passively. We don't need to be the one powering the tag. We can let someone else's reader power the tag and we can just sniff and synchronize on their carrier and then read their tag from their carrier. And we can actually power ourselves passively while we're doing it. So you put a one meg EPROM in this. You can slap it on the wall behind a legitimate RFID reader. It'll power itself passively for pretty much indefinitely and just sit and harvest tags until you get bored and take it down. It's also got a semi-active shielding mode. So the idea of this is that it detects an incident carrier from a reader and it sends out invalid modulation. So the idea being that the prox cards don't have any collision avoidance. So what this thing does is it just kind of blurs the data. It just messes the data up. Makes it completely impossible to pick up anything. It's much better than an RFID shielding wallet because you can actually actively interfere with it instead of just trusting that it's passively being killed. Other bands. 900 megahertz. Trivial to clone. Watch the ShmooCon talk if you want to know more. 13.56 megahertz. Danger will Robertson. I smell crypto. There is some deep voodoo going on at 13.56. We'll come back to that in a sec. Other bands. I've no idea. Give me tag samples. So back to the myth. We forked it originally and we're considering RFID differently from RFID. So RFID 900 megahertz. 125 kilohertz. Totally busted. Totally insecure. Wide open. Trivial to clone. Totally busted. Not secure in the slightest. 13.56 megahertz. Contactless smart cards. These things support deep, deep voodoo. They support all of the basic cryptographic primitives that you need to build any kind of system that you want. Strong, strong crypto. Strong algorithms. They can sign. They can encrypt. They can key exchange. They can key generate. All on chip. They have some insanely powerful capabilities. It's all written in Java. You can have multiple applications with multiple data stores. In theory, that should be secure secure. In practice, it's kind of fail. $200 online buys you one of these VivoPay readers. I'll skip the demo, but I'll show anyone later if they want. Suffice it to say that you take your RFID reader. You take your contactless credit card. This actually belongs to a guy who's known to all of his friends as Spam. Seems kind of amusing that I'm screwing with Spam's credit card. Swipe it over the reader. And it spits out all the card details over RS232. So the reason why I mentioned that I know nothing about EMV is because I don't have to. This does all of the crypto for me. Yeah. It's pretty pitiful. You get full card information. You get card number, expiry date, name. Same as card face. The newer technologies you get a thing called dynamic CVV. The card details that you read will be good for one transaction and one transaction only. So you read it a thousand times. Big deal. The other thing to bear in mind. The name may not be supplied. If you think about this for a second. Oh no.