Greetings and salutations and finally now good afternoon, the RF village. Our next speaker is going to bring to you a wonderful presentation on some iClass information. This might actually be slightly helpful for some stuff in the village, competitors. So, without further ado, I will turn it over to our speaker and he will take things from there. Hello, DEF CON. So, I've got to talk to you guys today. Is this set up so I can talk hands-free? So, I'm going to be talking about iClass today. And as the title might give away, throwing away the keys. Because we all know that for authenticated systems, you only need keys to talk to them. And sometimes you can get those keys easily, like iClass Legacy. And sometimes you can't. And this talk will be about what you do when you can't. And some of the interesting options that you have available to you. Because you think that normally you don't have keys, you can't do much. But that might not always be the case. All right, can you guys still hear me? Excellent. Mic a bit closer. That's a bit... What about now? Good? More? More! All right. So, what I'm going to talk to you about today, I'm going to give an introduction to who I am. Current state in iClass. My adventure is writing an iClass emulator, twice. The interesting authentication bypass I found. A bit of version analysis of what is and isn't affected. And then the adventure doing responsible disclosure. And where to from here. So, who am I? I'm Tianan. Or nvx on a lot of social things. GitHub. Discord. I'm just some guy that likes breaking things. I don't do this for a living. But I find it fun. So, I get home from being a software engineer. And break things. And sit in front of a computer more. Go from the bad screen to the good screen. I wrote the iClass, which is Picopass emulation code for the Chameleon Mini and Tiny platforms. And then later also for the Flipper Zero. Everyone's favorite. I also occasionally contribute to the Proxmark 3, Iceman 4 code base. And sometimes what I contribute even works. Sometimes not on the first attempt. But we get there in the end. And what I'm going to talk to you today is about iClass. Why you should stop using it in any forms. And dropping a new vulnerability. And the fun of responsibly disclosing vulnerabilities to vendors in this security space. So, I'm going to go through a brief current state of iClass. I'm going to assume a little bit of prior knowledge about RFID and packs in general. So, apologies if some of it, if you're brand new to RFID. I just don't think I've got the time to go super in-depth. Hopefully a lot of you came from the awesome talk that Babak, Nick and Aaron just did in the main stage. That would have covered quite a lot of it. That was a great talk. If you haven't, check the recording. It was great. So, what the fuck is iClass? So, it's RFID technology from HID Global. And it's mostly using corporate environments. It's fairly rare that you're going to see that at a hotel. It's for business, corporate, sort of where it's aimed at. And the chance that you've seen these in the wild. If it's not at your work, you've probably walked through an airport and seen them. Or walked through the Las Vegas Convention Center West Hall and seen these little black squares on the wall with a little red line at the top. I've got one here. They're super common. And to the right are those newer, sleeker looking ones. They're a newer version of those readers called Signo. But same sort of thing. And they talk to lots of different cards. What we're focusing on today is iClass. That can be a little white card like this that may or may not be printed with your employee badge on it. It could be a little key fob that you've got on your key chain. Sometimes they're used in apartment buildings for like the front door. You might have a key to your apartment, but the front door might be a little tappy tap thing. There's also like a sticker thing. That's that little black one at the top in the middle there. Haven't really seen those in the wild as much, but they exist. So chances are you've seen these. If not, actually use them. iClass is made by a company called Hid Global. They're a subsidiary of Assa Abloy. And one of the sort of original guys in the PAX world. They've got a pretty big market share, especially in US, Australia, and Singapore. But they're probably elsewhere too. And they've been around for ages. They started off with Hid Procs type stuff, just completely unsecured. And then went from there, I think that was in the 90s. So they're not one of these companies that have just sprung up. So a brief history of iClass. So in 2002, Hid iClass Legacy was released. And that was as a secure alternative to the 125 kHz Procs. That was just basically, you put the card in the field and it just starts shitting out some data. And that data is what let you into the building. So as you can imagine, not a super secure model where any reader could just put a 125 kHz field. And it'll start modulating it back. So they used a chip from Inside Contactless. I think they're Inside Secure now, or maybe it was the other way around. And they had a line of cards called Picopass. And they were based on 15693, ISO 15693 that is. And they had some proprietary command set, including anti-collision. So you can't just read it with your phone, even though your phone can read 15693 tags. Just because it's that proprietary command set. But it has some features that the 125 kHz Procs doesn't have. It's a bi-directional, so the reader actually talks first to the card. And back and forth, and part of that back and forth is a mutual authentication. To make sure that both the reader and the card are using the same keys. And if either doesn't match, it'll bomb out and, hey, you can't read the card. So, you know, your credential is a bit more secure. To make it even more secure again, and this is generally best practice, rather than just having like one key on every card. Like if I broke this one card, hey, I've got everyone's key, right? They'll have like a master key and then take like the serial number of the card and use that key to actually talk to the individual cards. And that's what's called key diversification. And following best practice, people add key diversification function. In fact, they implemented two for some reason. One for their what's called standard key. Standard keys is basically everyone's using the same key. Sounds like a bad idea, doesn't it? And their elite program was where you could have your own customer-specific key, fully managed by HID, so you sign up for their elite program and then you could get cards from them or later encode your own cards with your key and that meant that no one else's cards would work on your system at all because the keys were different. Fast forward to 2010, there was a really, really interesting bit of research published called The Heart of Darkness, Exploring the Uncharted Backwaters of HID iClass. They basically found that if you got one of the original readers, ripped it apart, you could dump the firmware off it through some very clever tricks that they did. And suddenly, anyone using standard keys, rip. Your keys are now known, anyone can read your cards, anyone can write new cards, game over. So the recommendation was move to elite. Just after that, the iClass SE platform was released. It may have actually been 2010, not 2011, but I was googling about that era. And they had moved on the newer reader platforms to what's called a secure element or a SAM. And that SAM has... it's basically a really small microcontroller that can do cryptographic operations and store keys to do those cryptographic operations that really harden them. So they're fairly resource limited, so you don't want to use it just for everything, because you can't. But they're designed with one job, and one job that it does really well is protecting those keys so you can't get those keys out. And with that, they launched a few new technologies. But iClass SE is basically... confusing, because they called the readers that and a whole bunch of stuff. But what we're focusing on is the iClass SE cards. And they're the same silicon as the original iClass legacy cards, but they changed the data on it. So rather than just being a optionally desk-based encrypted payload that was not diversified at all, it's now got a payload that's diversified on the card serial number as well. So rather than just the card keys to talk to the card being diversified, the actual encrypted data is now diversified based on the card as well, which is a good move. Because you can't just copy the data from one card to another even if you knew the card keys. A lot more secure. They also changed the keys from DES to AS. And with that, used NIST standard KDF function to make those diversified keys. So one of the next problems with iClass, especially Elite, the standard KDF wasn't as bad, but the Elite KDF in 2012, Flavio Garcia, who's done quite a lot of research in the RFID space, released the dismantling iClass and iClass Elite paper. And the big ticket takeaway from that one was that if you talk to a reader with certain card serial numbers, you could get the responses back from the reader, like you're doing sort of the first half of the authentication, and then just dropping out and swapping to the next one, and exploiting some cryptographic weaknesses in the KDF function that Elite keys used, you could actually recover the original Elite master key. So that meant that all legacy Elite systems game over just the same as legacy iClass. But the good news is, iClass SE, they use AS. You're not breaking AS. And you're definitely not breaking KDF that has been endorsed by NIST. It's pretty good. They did the right things with SE. So even though the cards have some issues, which we'll go into later, it was a pretty good secure alternative. And although they released support for SIOs on their SE platform with DSFIRE cards and also SEOS, the real advantages with the PicoPass cards are they were dirt cheap. You can get them cheaper than a DSFIRE. You can get them cheaper than a SEOS by far. Like, we're talking an order of magnitude difference in cost compared to SEOS. And, you know, maybe half the price of a DSFIRE. So, like, pretty attractive. The other nice thing is it's a very simple card that didn't draw much power from the reader, which meant that you could read it from the reader at a fair distance. Whereas, like, a SEOS and a DSFIRE, it's going to be pretty close. PROX and iClass could both be read from a further distance. So some people, you know, if they've got a card in their wallet and they don't want to take it out every day, they just, boop, against the reader. You know, we're not talking metres. We're talking a difference of centimetres. So there are definitely some PROs with the PicoPass technology. Roll forward to a bit further in 2021. Obviously, this is in the bridge history. There was definitely some more cool shit happening in between. But 2021, the Rev-E readers, which are these very square-looking ones, they're announced end of life and end of sale. That thing got extended the next year to the next month, end of life. I'm guessing the supply chain shortages hurt everyone. Because, yeah, I'm sure they would have loved to just sell you the new Signo readers. But , yeah. And in 2023, there was a really sweet app for everyone's favourite dolphin. It got released by Eric Betz. Betsy, with the propeller hat. Go hit him up. Called Cedar, which let you basically get one of those hid SAMs and act like a full reader like this, except, hey, it's your dolphin. And because the flipper was actually doing all of that, you could sniff the data going back and forth, which becomes important too. Like, you could still do it with a reader, but you'd have to have a reader and then a Proxmark attached to it and then put a card on front. It's a lot more hassle. So this streamlined that whole operation of doing downgrade attacks and sniffing that I'll go into a bit later. So, the new readers. iClass SE. I sort of went over this a bit before. The important bit is the SIOs are encrypted, signed, and cryptographically bound to the card serial number. So, with legacy, you could easily just grab the data. Like, even if you didn't have the encryption key to decrypt and mint your own Pax data. So, like, think the Wigan data that comes out, right? Your facility code card number. Even if you couldn't mint your own of those, you could just copy it from one card to another. Like, who cares? It wasn't like a session encryption where, like, the data going from the card back and forth was encrypted with the keys that you used to authenticate the card. These cards aren't that complex. So, it's just like a USB stick. You know, you can copy the data from one USB stick to another. Encrypted, unencrypted, who cares? Which is very different to, like, a secure channel with, you know, a SIOs or even DES fire if you're doing it right. So, that was a big step up from legacy. HID really do prioritize backwards compatibility, though. So, they also released what's called iClass SR, which is basically an iClass legacy card. Then they also tack on an SIO at the end. What that does mean, though, is that the actual card keys are the same as legacy. But you do get the advantage of the SIO and being pound to that CSN. So, even though you could copy the data to another card, the SIO isn't going to work anymore. But there's some problems with that. And they still offer the standard key set, also the elite, which is the HID managed custom keys per customer. And there is also a custom keying option. But that's not super common. And that's where basically the customer manages their own custom keys. But we're throwing away the keys, so who cares? So, this is the Cedar. That's what it looks like. It's pretty cool. And see that little blue board on the top? That's actually the SAM. And just a lot more convenient. So, iClass SE, like, we can do downgrades with Cedar. So, we can read the PACS data, and we can encode that to a legacy card. Or, if it's an SR card, you don't even really need Cedar, because you can just read the data directly off the card and just read the legacy PACS data, which is almost always the same as the SIO data, and then just downgrade it to a legacy card. It's like, meh. Unfortunately, lots of installations have legacy technology still enabled. At the beginning of this year, he'd made a push to disable legacy technologies, which was great, but I can guarantee that no one's really hitting their readers. It's going to be up to the integrators. No one likes to call out the integrators, just the funsies. It's working. It's fine. But let's ignore all that. Let's just assume that we've disabled legacy iClass, including SR, and now we've got this. Now, ideally, you're using elite keys, so they're just yours, but even if you're standard, standard keys aren't public. They're in the SAM. It should be secure, right? You can't just copy one of these cards and, you know, dip it on your reader. Right? Right? Ish, kind of. So, Pickup has got a few features. So, it's old. It's similar to areas like MyFairClassic. You know, it's definitely not as new as Desfire or Seoss. It's a lot better than 125 kilohertz procs, so, you know, for the day, that's great. But there's some limitations of that silicon. So, most things, when it's doing a mutual authentication, you want to have, like, a random number that you encrypt with a key. You send that, the other side decrypts it, changes it a little bit, encrypts it again, sends it back, you decrypt that, you check that it's legit. But that relies on random numbers, because you can't just replay the same authentication every time, right? And these cards don't have a random number generator on them. It's not like MyFairClassic, where the original ones had one, but it just wasn't great, and you could predict it. These just don't have one. So, instead, they've got what's called an e-purse value, which is designed for, like, a stored value type thing, where you're like, I'm going to load $10 on my card, and then, bip, and now it's $9. Hit obviously don't use it for that. What the e-purse gets used for, as well, is also is the nonce, or card challenge part, during that mutual authentication. And it relies on the fact that you can't change the value to what it was before. But it does rely on the reader updating that e-purse value every time it's read. Because if it doesn't get changed, you're back to the problem before. You can just do a replay. One of the other limitations is that there's no encryption between the card and the reader. Now, that, like, USB stick analogy before, like, the data that's on it may be encrypted, right? But there's no intrinsic encryption between when you're reading or writing data from this card. It's all plain text. There is a MAC used during mutual authentication, so you can ensure that both sides have got the same key. Also, when you're doing a write operation, there's a MAC. But other than that, there's no cryptography. So you can just sniff that data in the clear text as I get it to a reader with a Proxmark. I can just sniff it. So it's not great. But, you know, at least SIOs are encrypted, authenticated. It's hard to tamper with those. So Proxmark go better. We can sniff. One of the bigger problems is that, like, sniffing's... it's a bit of an art, right? Sniff and, hey, look, I saw half the conversation. I saw what the reader said. I didn't see what the card said, or vice versa. Like, it can be a bit finicky. But what you can do is... and I believe the first attack was when you're sniffing with a Proxmark, when it sends the ePurse write command, you can just jam it by, like, just putting out noise. And that will stop the card from hearing that, hey, update ePurse. And now you have a card that the Macs were used for to authenticate to the card, and the ePurse value hasn't changed. You can just replay that. The other way that you can do it, and this was sort of weaponized a bit on the Flipper Zero, but you could do it on Proxmark before that, but you had to know what you were doing a bit more, is what's called an NR Mac replay. So NR is the nonce, and Mac is the Mac of that nonce. So you can basically talk to the card, get its ePurse and card serial number value, go back to your reader, authenticate to that reader, or start the authentication process, and you presented the card challenge and card serial number from that card, collect the Macs from that reader, and then you take those Macs, and you go back to your card. And the ePurse value, nothing's changed on the card. So you can then just replay those Macs to the card, and now you're authenticated to the card. Now, you can't do writes to the card, because those still have a cryptographic Mac to authenticate the writes. But for any read operations, there's no more cryptography after you've authenticated. So you can just read the contents of the card. And that often ends up being a bit more reliable, because you're not trying to sniff another reader's field, which is kind of magic. You're just now talking to a card normally. And you can do it multiple times, and read different blocks. If you get an error, hey, you can try again. You don't have to redo your whole sniff. What that means is, even if you get that SIO, you can't then read it easily, because it's encrypted. But if that SIO is standard keyed, and even in a lot of leak keyed systems, it sometimes is. I don't know why it's not always elite keyed. It should be. But sometimes you'll find an elite keyed SE card with standard keyed SIO data on it. So you can take that, and you can present it to a HID SAM, and get it to decrypt it. Now you think, hang on a minute. How do you do that? But remember that SR mode, where it was legacy keys, but with an SIO. So you can take, we already know the legacy key. We can take that, make a fake legacy card that has an SIO and the legacy data on it, punch in that SIO into the SR card, present it to a reader, like this, where you just read it as the PAX data, or you can present it to Cedar, and then decrypt that SIO data. And you've got the plain text PAX data again. And again though, you've disabled SR and legacy on your readers, right? So hopefully that's not a problem. Yeah, you know the card number, the facility number, the format, but yes, you still haven't copied the card. It'll let you do a downgrade, which ain't great, but it's not too bad. And you can't get the, if SR wasn't enabled, or legacy, with Elite, thanks to the research, with the demystifying iClass and iClass Elite, you could recover the Elite key, but you can't recover the SE Elite key, because that's AS-based, good security. So you're fine, right? Just really make sure you've got SR and SE disabled. Yeah, you can read the data, but you can't present it back to the reader. Right? We're fine? So let's change tack a little bit. So I find that if I want to truly understand something, I need to write an implementation of it. I can read the data sheet, but there's lots of little edge cases that, until you write code, you might not necessarily think to ask that question. So I was like, hey, this chameleon tiny, I saw one on AliExpress, I'm like, that's cool, that's so small, that's sweet. I want one. Because iClass cards, they're cheap if you buy them in bulk, because I'm just doing this for a hobby. 10, 15 bucks for a card. I'm in Australia, things are expensive. There's Australia tax. So like an emulator, I don't have to worry about trying to get these cards and burning them because I did dumb things. I'll just emulate it. Proxmark, you get attached to a computer, it's painful. This thing, hey, it's cool. Now, don't confuse this with the newer chameleon ultra. So the chameleon ultra looks exactly like this, but says ultra. It unfortunately doesn't support 15693, so you can't do iClass things on it. This is the older one that is hard to get these days, but yeah. So the hardware on it. The chameleon originally was designed ages ago, much older than the tiny. The tiny was just sort of like the very latest version of it. And it was based around this ATX mega 12884U chip, which is old. It's an 8-bit AVR. They clocked it at 27.12 megahertz, which isn't the fastest that you can clock this chip at, but it is a nice multiple of the 1356 megahertz carrier frequency that RF, that high-frequency RF runs at. So two times. Very convenient for doing this sort of stuff, because it was basically just bit banging the modulation. Like there was no NFC front end. There wasn't even like any proper DAC or FPGA. Like the Proxmark's got an FPGA. It's got an ADC. It's got a bunch of resistor ladder type stuff and drivers to drive the field on a much faster MCU as well. This thing's just an 8-bit AVR using interrupts to modulate the field high and low as needed. Like I'm impressed that they got this working. Like it was good. But it did provide some challenges, because doing cryptography in software is slow at the best of times. And I'm now doing it on this really slow chip. And it's not like it was a standard-based thing where the Macs were just like, oh, I can just throw it into like the DES accelerator and hey, I've got my Macs back. It's fully proprietary from Encrypt32, I think is the name of the cipher from inside Contactless, hence the in in front of it. And it was basically like a 32-bit Mac. Fully proprietary. Yeah, it was a bad time. So what I discovered is readers for iClass have got a really short timeout. Something like 300 microseconds. And that's between you sending, like the reader sending the authenticate command and the card starting to transmit its reply with the Macs. And 300 microseconds really isn't much. On such a slow microcontroller. I spent ages optimizing it. I think I got up to like 350 microseconds or something. And it was just kind of on the edge, but not really. And it's still too slow. And then I realized, I was like, hang on. What if I just start transmitting before I know the Mac yet? Because there's like a preamble, and then there's some other data, and then there's the Mac. So it's like, what if I just start transmitting what I can and hopefully by the time... Because that transmission is happening in interrupts. So while my code's calculating the crypto, the interrupts are firing, interrupting my code, doing the modulation of the first half of this packet that I haven't even fully assembled yet while my slow-ass crypto is running to finish the rest of the packet. And it worked. It was great. I honestly didn't think it would work. I was thinking, surely not. This is like the dirtiest hack known to mankind. But it worked. I was happy. And then I was like, I'm just not going to look at this terrible sin that I ever did again. And so I'm like, yeah, this is great. Tapping on one reader works. Tapping on another reader, it works. Oh, why didn't it work? And so I'm thinking, all right, maybe it wasn't fast enough. Does this reader have an even quicker timeout? Because depending on the cards, some cards are slightly faster than others. And I noticed that there was a trend that any old readers didn't work. So REV-A, REV-B, REV-C. REV-E readers worked. And I'm like, oh, that's weird. And so I went digging. I'm trying to do a sniff. I'm like sniffing sometimes hard. And I was sniffing. And there just wasn't any data on the sniff. I'm like, this is weird. And the reader wasn't responding at all. It wasn't like it said bad, you know, did the sad fourth. It was just like nothing. I'm like, that's weird. And so I'm going through a fine-toothed comb and end up getting a real card against a reader that worked and did a full sniff. And then my authenticated, my emulated card did a sniff. And like with the same e-purse data, same card serial number. Now the reader does have a random number generator in it. So it's not going to be exactly the same each time. But I thought, hang on. What if instead of using a real reader, I use a Proxmark? So you use a Proxmark. And the Proxmark, it just uses zeros, I think. It's not designed to be a secure reader. It's designed to break things. So I'm like, this is great. I'm going to use this card. And I'll go through line by line and check. Make sure that I'm doing everything fine and compare the timings. I think I ended up finding a bug in the Proxmark code with the timings. With 15.693 stuff where it was doing some weird things. That was one of the things I think I broke before fixing properly. And in the end, it turned out it wasn't timing. I had a bug in my code. I literally just forgot to call a function during the crypto initialization. So it wasn't initializing the cipher state properly. And then I fixed that bug. And, all right, it now matches. And I de-bipped it on the old reader again. And it still didn't work. I'm like, what the... Anyway, so after digging through a bunch of papers and all that sort of stuff, I discovered that 15.693 as a standard actually supports two different ways of modulating the data from the reader to the tag. One is on-off key modulation where, like, it'll... here's the carrier and then it stops the carrier entirely. And then here's the carrier again. And that's how you get the ones and zeros. But it also supports what's called ASK or amplitude shift keying which is where instead of, like, turning the field off entirely, it'll just, like, turn it off a bit. And that's actually handy for some use cases where you want the card to work at a longer distance because you're still providing some power to the card when you're doing that ASK modulation. And 14443B uses that modulation by default and whereas 14443A uses on-off keying. And that's why the sort of smart card type things would normally be before they were A because you get that higher power transfer. And for some reason, 15.693, it's like, yeah, you can support both. But, like, it's weird because they mandate that cards actually have to support both. There's no choice. Whereas readers are free to choose whichever they please. So it's like, you can't really make use of the extra power, but, like, maybe you get slightly better read range? I don't know. Anyway, after a bunch of stuffing around, it turns out those older readers were using ASK modulation. And the newer readers were using on-off key modulation. And due to some weirdness with the chameleon tiny's analog front end, it just couldn't hear that ASK modulation. It was originally designed just for 14443A, which is on-off key modulation. 15.693 got added afterwards, and the hardware just wasn't designed to detect that. So it just couldn't hear the reader. And it's like, oh, okay. Flip a zero can, which is nice. That's a story for a bit later. It's like, hang on a minute. The real reason it wasn't working was because, like, you know, I had a stuffed-up crypto and wrong modulation. But, like, if I had the crypto wrong, why did it work at all on Rev-E readers? They were all playing and tried Signo readers. They worked, too. And I'm like, hang on. Surely I'm imagining this. So just quickly go into the Proxmark code, comment out the bits where it calculates the MACs. Go to the reader. Tap. It worked. Sending just zeros as the card MAC. And I'm like, why does sending zeros work? The whole point is that the reader sends a MAC, the card decrypts that MAC, generates its own MAC based on the decrypted data that was in the reader's MAC and then sends it and then the reader checks the card MAC and then it all works well. And after the reader verifies it. And if any of that doesn't match, the MACs don't match and it's not going to work. And I thought, well, hang on. But if I tap an elite-keyed card to a reader, it doesn't read, you know, if the reader is standard-keyed or vice versa. And I'm like, hang on, but the card checks the MAC. So when the reader sends its MAC, when the card generates the MAC and sends it to the reader, the reader needs to check that too. So any real card, like you're not going to notice this problem with, when you're emulating and you're lazy or maybe it's not that you're lazy and maybe it's just that, hey, it works. It's good enough. Or maybe it's that you only just managed to be fast enough to make the crypto work in the first place and you just really didn't even have time to calculate what the correct MAC that the reader should be sending was. Yeah, so it turns out Rev-E readers and Signo were not checking the MAC. So now you've got an iClass card, iClass SE, and I did a bunch of testing and even with ASK modulation, legacy readers weren't affected. So Rev-A, Rev-B, Rev-C, they were checking the MAC properly. And in fact, even when you're using an OEM reader, those were also fine. But it's like that's the same secure element. But it turns out when... So you'll see here, most OEM readers are unaffected. It turns out that R7 and newer SAMs are fine. R8 and above, and pretty much every Rev-E reader is R8, and above, so that includes Signo, is affected. And what happened between R7 and R8 is they changed their SAM firmware from being a native code running on the chip, so probably written in C, hopefully not assembly, and they changed it so that what runs on the firmware is actually a .NET interpreter, just like a Java card, right? You've got some JVM effectively running on the silicon, then you load Java applets in that you wrote in Java. Makes it a lot easier. You're dealing in a memory-safe language. Great idea to write secure code in, right? Rather than C where you can quite easily have lots of problems. Here we're a .NET shop, not a Java shop. So they bought out a company that were developing .NET card technology to compete with Java cards, and they used it internally. And R8 is when they switched from native firmware to .NET assemblies to do all the real work. So at some point, someone rewrote the iClass code to do those MACs in .NET to run on the SAM, and it works. But they forgot to check the reader MAC. It just reminds me of that go-to-fail Apple bug that came out five, ten years ago where checking TLS certificates, they just forgot to check. So you could present an invalid certificate and it would accept it as if it worked. But for any real server, it works fine. And this is why when you're testing most code, you test it, you make sure it works, you're happy, cool, unit test passed, send it. But when you're working, especially with security, that's not good enough. You need to test the things that shouldn't work. Like when a door, you test it and the door opens when it's expected, that's great. But part of the job of that reader and door is to make sure it doesn't open for people it shouldn't open for. So you need to test it like, hey, if the card sends a bad MAC, if the key is wrong on the real card, it doesn't work. But that's the card enforcing the security at that point, not the reader. There was a little bit controversial, maybe, if people are English. But there was an attempt at the IRA to bomb the hotel where Margaret Thatcher was. And they didn't succeed. She wasn't in there. They missed her by two minutes. And there was a comment of, oh , they didn't get lucky this time. For that kind of adversarial thing, you only need to get lucky once. Your adversary. Whereas your defender needs to be lucky every single time. It only takes one mistake. And you've compromised the security. And that's something that, obviously, that's a fairly grim, where that quote's come from. But it's something to think about in the digital security world as well. It's the same sort of principle. I only need to get lucky once to find the vulnerability. Lots of things. Now, if this was any other card technology, it wouldn't be as bad. If you were using a SEOS card, for example, and they forgot to check a MAC, it actually wouldn't matter too much because that same mutual authentication is then used to drive keys that are then used to encrypt and MAC all of the comms back and forward. And you really want to be checking the MACs of your data. But even if you were checking no MACs, and you decrypt the data with the wrong key, the data's just gibberish at that point. There's some attacks that you can do if you're not checking MACs, but it's not as bad as just, hey, I can send everything. And that's one of the problems with these cards, is that they're really old, and they don't support best practice of actually encrypting that data. The data on it's encrypted, but there's no session security. If you go to a HTTPS website or something like this, the data on it is encrypted, but it's not encrypted once and then the same data sent every time. Because you can just go, oh, that's google.com. I know because that's the same encrypted data as when I go to google.com. Every time you go to google.com, it encrypts that with new data, new keys. So the data's different every time until you decrypt it, and then you go, oh, it's the same plain text, but the ciphertext is different. And that's the difference between that sort of session security versus data security. And you do both, right? That's the best practice. And that's what, you know, SEOS cards do, for example. So while in theory, iClass SE was secure, it meant that one mistake meant that you got problems. Now, you can't easily just clone this iClass SE card to another card because those SIOs are cryptographically bound and we don't have magic PicoPass cards today. We might in the future. We might maybe have one in the future that also don't check card backs. That'd be neat. But today, we don't. So it's not a full plastic-to-plastic clone, but you can definitely emulate it with a flipper. You can emulate it with a Proxmark. You can emulate it with a Chameleon Tiny. So in addition to writing the Chameleon Tiny, Mini PicoPass code, by the time I got a flipper a couple of years later, I was also like, hey, let's write it for that too. Someone gave me the idea. It was funny because it was like the official flipper zero documentation were like, yeah, we can read iClass, but you can't emulate iClass. The NFC chip we use doesn't support that. It's just physically not possible. And I took that personally. So I did the impossible because it could. And because I was playing with the same chip before I got a flipper anyway and was like, yeah, I'm pretty sure there's some sweet transparent modes that you can do some cool shit with. So when I wrote it, I knew about this vulnerability and I was much faster and more modern chip in the flipper zero. So I did some optimization, but I checked the max by default on that one from the reader because I knew that the flipper zero is pretty popular. So I didn't want to just like hand like an armed weapon to every person. But there's this really suspicious debug flag if you have a look in the flipper zero PicoPASS code. And that flag's going to disappear soon. But PicoPASS debug ignore bad RMAC. I wonder what an RMAC is. Is that maybe a reader MAC to ignore the reader MAC if it's bad? Oh, yeah. That's actually exactly what it's doing. It'll even do a log if I got a bad MAC from the reader. And... bail out. But if you do... if you compile the flipper zero code with that flag defined or you just delete those lines out, all of a sudden you can do some naughty things. And now let's on the topic of naughty things, let's see if I can do a demo. Now, we don't have a down camera, unfortunately. So I'm going to just do something super, super dodgy and just open up my webcam and hopefully I can do a live demo for you that won't be too bad. If I can... Yeah, that'll probably do. Just ignore the microphone. So, we got a flipper zero. You probably can't read any of that, can you? Yeah. All right. This is going to be kind of moot. Basically, you can do an NRMAC replay to read the card data from this without keys. You can then compile a picker pass app with that flag and then tap it to a reader. If you want, I'll be at that first table there. I can give you a little showcase, but just trust me. It works. And in fact, you'll be able to try it for yourself because we'll probably do a pull request and just now that that's public, just release it. So, on the next bit, a vulnerability disclosure. So, this timeline, implementing this simulation, discovering the bug, fixing the bug, pull requesting it. And I was a little bit torn when I discovered this because I go to an airport to go on a plane as you do. And I walk around, I see these I-class readers on the walls and I'm just like, shit, I know some problems with those. And I'm like, I like going on planes. I like my planes being secure. And I know that there's some problems with the readers securing these facilities. I don't like this. I want to arrive at my destination safely. But then I also reflect and go, I remember when the MyFairClassic vulnerabilities were first released and I tried to disclose to the vendor that was met with lawsuits. I know there's Boston Public Transport met with lawyers. I know Assa Abloy in only the last couple of years, which is the parent company of HID, has gone after people with lawyers. I'm like, I'm just doing this for fun. I can't afford lawyers. So I was torn. I'm like, do I drop this as a zero-day anonymously so it can't be tied back to me? That's harmful. I'm also like, any idiot can stumble across this. It's not a complicated exploit . And then it's like , well, I was talking to some members of the RFID community and they put me in contact with some people at HID. And I managed to have a disclose to them in February 2023 . And in July , August 2023 , I can't remember the exact date, we got a fix for signal readers. So 10.0 .5.7 and above is not affected by this vulnerability . I finally got a CVE number reserved like three days ago. Maybe two days ago . So I've got a number . Great . Unfortunately , we don't have a REVI patch yet. And as a result, we don't have an official PSA from HID . If you look up that CV, you'll find it's reserved. There's no detail on it yet . This is the first public announcement for it. But it's been a year and a half . Yeah. And it has been rediscovered since then. Yeah. And, like, I can understand why. Like, REVI, more than a decade old at this point. It's basically end of life. It had already been announced end of life and they extended it . If it wasn't extended, it would have been end of life as well. It was already hard to upgrade. At least it could be upgraded. It was easy to brick. And it involves going to each reader. If it supports reader manager, there's some older versions. That's even more brittle. And obviously they didn't know what sure people have moved on in the time period that those readers have been around. Dealing with old stuff is hard. I'm a software engineer by day job. I can fully empathise with that . If I've got hit readers , what's the mitigation? If you've got signal, upgrade the latest version. Always update the latest version. There are bugs that get fixed with security implications. Keep up to date. The other thing you should do is disable I class. I'm talking legacy SE, SR. Even if you've got the fix, there are other problems. You really want to be moving to a more secure technology. While it can have that session security by default, it doesn't. It's configurable. I don't know why they didn't configure it. What it can mean is you can still put that onto a magic classic card . Those can have SIOs on them as well. It doesn't bind to the card technology . You can change the serial number on a different technology. It would be great if it was fixed. It would be great if it could signal the technology type back to the controller. That's probably a bigger change. Also, disable technologies you're not using as well. Even if you're using iClass, unless you're thinking of moving to my fair classic. You can't disable signal. Leave signal on. Disable everything else. There might be downgrade attacks. You can't defeat the whole system. Stop using standard keys. This wouldn't fix you. If the keys aren't being checked, it's bypassed. But it's still an issue. If I can go to eBay and rip the Sam out of it or buy a Sam on a PCB and start doing dirty things to it , Sam is great at securing things . The ecosystem is complex. It only takes one vulnerability to get keys and if everyone has the same keys, step one, I need to get a Sam that's yours . I need to go to your facility , rip a reader off the wall and now I have one chance of getting this right . If I brick a Sam while mucking with it , that's okay. If I nick a reader once, I'm done. You'll notice, right, the reader is just gone. You want to be using your own keys, not the same. There's other problems too. I've been in this game long enough to know nothing is certain. Back in the day they were $15 a pop . that's expensive. These days I believe they're cheaper. I believe HID is doing that not because they're cost less to them but because they realise so many people pick the cheapest option. I've seen news articles in the last few years rolling out HID readers and finding out they're using legacy standard key credentials on a new install . I'm sure it was the cheapest option at the time. I think HID would have done the right thing by changing the pricing model because people will buy the cheapest and that needs to be the secure option. It makes everyone have a bad time, including HID. You've seen the IPVM articles. Use elite keys not just snippet. You want to be using your own keys to read the card, encrypt the data on the card. Other vendors have problems too. Principles apply across the whole ecosystem. HID are not the only ones to use standard keys. I believe getting elite keys from HID now is free. If you want a custom key , that's extra. That's shit. Per customer keys should be the standard . I understand why . It's convenient. It's easy. We want security . I want to acknowledge the research, especially that of Milos and Flavio. It's amazing. If you do nothing else, just Google those names. It's like an old web server. There's some really great stuff in there. Good bedtime reading. I want to thank Jonathan who made the original Proxmark 3 and the Iceman who took over many years now. While implementing emulators, it was a beautiful tool . You don't know why it didn't work. Proxmark, you can sniff it, increase time-outs so your code doesn't have to run fast enough. It's definitely just a timing issue, not something else . Best tool for RFID research. I want to give a shout out to the RFID community. You're all great. But some special mention to Nick who is doing the RFID stuff. He had an awesome talk. If you missed it, check the recording. It was great. Shout out to Eric Betsy. He wrote the framework for me. I didn't have to do everything from scratch. And also generally great guy, Pat. He couldn't be here today but he's awesome. Equipped as well. Awesome bloke. He made the add-on that CD uses. Whereas Eric did the software side. And finally give a massive shout out to Kate . Also does a lot in the RFID research. Nick and Aaron's talk . Like sometimes just being able to... If you don't know the term rubber ducking, Google it. It's great. Sometimes you don't know who to talk to. Having someone you can get advice from and help you. Massive shout out. All awesome people. The final thing is to hit. I think they've changed over the last few years. I think they're starting to do the right thing with improving their product. I didn't get a single legal threat . I'm pleased with that . It's a long hard road, especially when you've got legacy technical debt. They're trying. That's all you can ask for. As long as it's in the right direction. Definitely huge props to HID. If you do find something in HID, it's worth approaching them. They're not going to lawyer up and try and silence you. Any questions? I don't know how much time I've got left. I think negative maybe. If you do have any, I'll be on the table over there. You can hit me up afterwards. Thanks , everyone. Thanks for Yeah ! This is all