[00:02.930 --> 00:08.530] Thanks everyone. Welcome to our talk titled Unsafe Lock, Unlocking Millions of Hotel Locks. [00:09.110 --> 00:14.110] I'm Lennart, I'm a hardware security researcher at the KU Leuven University in Belgium. [00:14.110 --> 00:18.870] I typically do research related to voltage glitching and other hardware attacks. [00:19.450 --> 00:24.810] I'm Ian, I'm an application security researcher. I was formerly at the red team at Robin Hood. [00:24.810 --> 00:29.290] And now I run a point search engine called Cicero. We got sued by Air Canada. [00:32.410 --> 00:39.530] So as you can probably tell from the first slide, neither of us is really working on locks or RFID stuff all of the time. [00:39.530 --> 00:43.050] So when we started working on this, it was all relatively new to us. [00:43.390 --> 00:52.370] And the reason we started looking at these locks is that a group of us got invited to hack some Las Vegas hotels back in 2022. [00:52.370 --> 00:54.330] And they were running a bug bounty program. [00:54.590 --> 00:58.750] And one of the elements of the hotel room that was in scope were the hotel locks. [00:58.750 --> 01:03.110] And that's how we got nerd sniped and started looking at these hotel locks. [01:03.490 --> 01:06.410] Now it wasn't just Ian and me, there were more people involved. [01:06.410 --> 01:10.130] And some of them are sitting here on the first row. So thanks everyone. [01:14.900 --> 01:18.100] So here's some related research of other researchers. [01:18.100 --> 01:25.500] So back in 2012, Sarah looked at the Onity locks. [01:25.720 --> 01:29.240] And she found that there is a programming part on the outside of the door. [01:29.240 --> 01:33.900] And if you plug into this, you can actually start reading memory of the lock itself. [01:34.160 --> 01:38.380] And if you analyze this memory, you can extract a side code. [01:38.480 --> 01:42.640] And this side code is enough to send an unlock command to the door and then open it up. [01:43.380 --> 01:47.440] Back then, Sarah immediately published all of the details of the attack. [01:47.440 --> 01:54.560] And this resulted in some people making their own devices, going to hotels, opening all of the doors, stealing TVs, and so on. [01:54.560 --> 02:00.900] There's a very nice Wired article about this hacking spree that some people went on. [02:01.040 --> 02:03.200] It's well worth the read, I would say. [02:04.020 --> 02:10.660] Then six years later, in 2018, there was an attack on the VIN card system by Essa Abloy. [02:10.820 --> 02:13.300] This was an attack by researchers from F-Secure. [02:13.300 --> 02:17.500] And they figured out that if you can read one card from the hotel, [02:17.500 --> 02:21.800] that they can make a master key and then open every door in the hotel, essentially. [02:21.800 --> 02:25.940] In this case, F-Secure worked with Essa Abloy on a fix. [02:25.940 --> 02:29.960] And this also meant that the talk didn't include a lot of technical details. [02:30.400 --> 02:33.420] And this is something where we want to strike a balance. [02:33.420 --> 02:39.400] So instead of publishing all of the details immediately, we went to a long, responsible disclosure process. [02:39.400 --> 02:42.860] And now we are sharing some of the details of what we found. [02:44.100 --> 02:47.520] So, this talk is about Dormakabos Saflock. [02:47.520 --> 02:51.320] It was introduced in 1988 by Computerized Security Systems. [02:51.320 --> 02:55.140] Back then, it was a mag stripe lock, and then they became RFID locks. [02:55.480 --> 03:01.000] It has kind of a weird corporate history. Computerized Security Systems was acquired by Kava in 2006. [03:01.220 --> 03:07.160] And then in 2015, two companies called Dorma and Kava merged, and now it's called Dormakaba. [03:08.560 --> 03:13.440] Saflock is used on 3 million doors in 13,000 hotels in 131 countries. [03:13.440 --> 03:15.940] So, this is one of the biggest brands of hotel locks. [03:17.180 --> 03:19.760] It's important to talk about the architecture before we start. [03:19.760 --> 03:22.440] So, these locks are usually entirely offline. [03:22.580 --> 03:26.320] So, there's the front desk server, and the front desk computers have a connection. [03:26.320 --> 03:28.620] But, they're not connected to the actual hotel locks. [03:28.620 --> 03:33.420] And so, the front desk will write the key card that contains the information of what doors it should open. [03:33.480 --> 03:37.080] And then, the locks make the decisions entirely themselves. [03:37.080 --> 03:39.360] They don't contact any server or anything. [03:39.620 --> 03:45.940] But, in the case of when the lock needs to be upgraded, or if you need to see the access history, there's this unit called the HH6. [03:46.060 --> 03:49.300] And you can plug into a USB port on the bottom of the lock to use this. [03:49.300 --> 03:52.220] So, generally, that's the only connection these locks have. [03:53.340 --> 03:58.820] In some places, especially in large Vegas hotels, they use kind of a semi-online architecture. [03:58.820 --> 04:01.900] So, in this case, the hallways have Zigbee coordinators in them. [04:01.900 --> 04:04.780] And this allows the front desk to kind of see the audit log. [04:05.120 --> 04:07.060] It still doesn't make it an online system. [04:07.060 --> 04:11.300] The key cards are still read by the lock, and the lock determines if it opens or not. [04:11.300 --> 04:15.480] But, afterwards, it tells the front desk, hey, this key opened this lock. [04:15.480 --> 04:20.040] This might be beneficial for hotels, because you can kind of detect what keys are being used. [04:23.140 --> 04:28.220] So, when we were starting out, we needed a hotel to do our research on. [04:28.220 --> 04:31.100] We don't own a hotel, so we had to build one ourselves. [04:31.460 --> 04:34.860] And that first meant acquiring the System 6000 software. [04:35.260 --> 04:39.980] As with any software, this is software you can find on some places on the internet. [04:40.420 --> 04:43.040] The other thing you need is an RFID encoder. [04:43.040 --> 04:47.860] So, this is the device that the front desk will use to encode a new key card. [04:48.080 --> 04:51.520] Back in 2022, these were very expensive on eBay. [04:51.580 --> 04:53.600] $600 to just get one. [04:54.100 --> 04:57.080] Now, thanks to our research, these have really come down in price. [04:57.080 --> 04:59.740] So, now you can find them for $45 online. [05:04.780 --> 05:08.820] So, the reason they are much cheaper these days is they all have to be replaced. [05:08.820 --> 05:12.000] So, all of the hotels are essentially selling their old encoders online. [05:12.720 --> 05:15.840] So, another thing you need are MiFair Classic 1K cards. [05:15.840 --> 05:18.980] These are very common, very cheap. You can find them everywhere. [05:19.940 --> 05:25.700] And optionally, if you want to actually open some doors, you can also buy on eBay some door locks. [05:25.980 --> 05:29.400] Or an HH6 programmer if you want to play with one of those. [05:30.320 --> 05:33.880] So, now that we have all of the elements for our hotel, we have to set it up. [05:33.880 --> 05:35.980] So, we start by installing the software. [05:35.980 --> 05:43.140] If you open the manual, the installation manual, the first step it tells you is to disable all of the Windows security features. [05:43.140 --> 05:46.060] And then you're good to start running the installer. [05:46.860 --> 05:52.580] Once you've installed the software, you copy over a GDB database file to the installation directory. [05:52.580 --> 05:54.440] And then you can start the software. [05:55.000 --> 05:57.920] This database file is very useful to us. [05:57.920 --> 06:00.140] It's a Firebird database file. [06:00.140 --> 06:03.080] It has a default username and password on there. [06:03.080 --> 06:06.440] And so you can start reading all of the elements in the database. [06:06.440 --> 06:09.880] So, this contains configuration data for your specific hotel. [06:10.180 --> 06:13.900] But also all of the cards that were created by the hotel software. [06:14.220 --> 06:20.940] So, this means that if you create a card, you can go look in the database and look at all of the different fields that are encoded on the card. [06:22.280 --> 06:26.480] Now, as I said, back in 2022, real encoders were very expensive. [06:26.480 --> 06:34.380] But we figured out that this system used to support just commercial RFID reader writers at some point. [06:34.940 --> 06:40.800] So, that means that you can go into the Firebird database and you can set the hide legacy encoders flag to zero. [06:40.800 --> 06:45.060] And now you can use a cheap off-the-shelf encoder essentially. [06:45.320 --> 06:47.760] So, this is what we used back in 2012. [06:47.760 --> 06:48.780] Yeah. [06:51.240 --> 06:53.520] So, about the handheld programmer. [06:53.520 --> 06:58.040] So, as I mentioned before, all of these locks have a mini USB port on the bottom of it. [06:58.040 --> 07:03.040] And obviously, that struck our interest pretty quickly because it's, you know, behind... it's in the hallway. [07:03.660 --> 07:06.340] So, we bought the H86 off of eBay. [07:07.140 --> 07:09.300] And we tried to use it in a lock at first. [07:09.300 --> 07:12.980] And we hit an issue where it detected it was being used at the wrong property. [07:13.140 --> 07:16.160] And so, we were like, okay, there's some kind of authentication here. [07:16.160 --> 07:22.720] But then we quickly realized that if we just changed the property ID in our database to the property we were staying at, it would start working. [07:24.080 --> 07:26.480] And so, there's a lot of interesting features in here. [07:26.480 --> 07:28.180] And we didn't use it too much in our attack. [07:28.180 --> 07:31.740] But the main interesting thing is you can actually interrogate these locks. [07:31.740 --> 07:34.660] And you can view every entry and every exit to the room. [07:34.660 --> 07:39.720] So, for example, you can even see, you know, when housekeeping entered your room, you can see when they left. [07:39.840 --> 07:41.580] You can see the previous guest. [07:41.580 --> 07:43.380] You can see when they were coming and going. [07:43.380 --> 07:47.500] And if you know the property ID, you can actually do this to any door on any hotel. [07:48.140 --> 07:49.900] It was also useful for our purposes. [07:49.900 --> 07:51.840] It will tell you why it refused to open the door. [07:51.840 --> 07:56.060] So, for a long time, we were making fake keycards and we couldn't figure out why it wasn't opening. [07:56.060 --> 07:59.440] But the HH6 will actually tell you, hey, this is why your keycard didn't work. [07:59.440 --> 08:01.500] So, it was very useful for our purposes. [08:04.690 --> 08:08.650] So, the next step was to reverse engineer the System 6000 software. [08:09.350 --> 08:14.310] The software consists out of some Delphi executables, which are very annoying to reverse engineer. [08:14.310 --> 08:18.230] But luckily, there are also some .NET binaries in there. [08:18.230 --> 08:20.430] And those are very easy to reverse engineer. [08:20.430 --> 08:23.610] We can simply decompile them and look at the code in .wik. [08:24.050 --> 08:26.850] Now, we had a few goals for reverse engineering the system. [08:26.850 --> 08:33.670] We wanted to understand how the MIFARE sector keys are derived, how the data stored on the card is encrypted. [08:34.110 --> 08:39.770] And then, once the data is decrypted, what is actually the meaning of the different fields of this data. [08:40.970 --> 08:43.690] So, first, a quick introduction to MIFARE Classic. [08:43.690 --> 08:47.570] Most of the CephLog deployments use MIFARE Classic 1K cards. [08:47.590 --> 08:52.450] These 1K cards have 16 sectors, each containing four 16-byte blocks. [08:52.490 --> 08:55.150] So, they are essentially just storing data. [08:55.690 --> 08:58.750] Block 0 is special. It's the manufacturer block. [08:58.750 --> 09:02.350] It contains the UID and the manufacturer data. [09:02.750 --> 09:06.250] And then, the last block of every sector contains the keys. [09:06.250 --> 09:10.690] So, the keys that you need to authenticate and to read the data on the card. [09:11.030 --> 09:13.570] Every sector has two keys associated to it. [09:13.570 --> 09:15.070] Key A and key B. [09:15.630 --> 09:22.890] And then, essentially, the access conditions indicate what actions you are allowed to perform with either of these keys. [09:24.350 --> 09:32.590] Now, if you look specifically at the CephLog cards, in the case of the CephLog system, all of the interesting data is stored in sector 0. [09:33.190 --> 09:36.570] And the key to read that sector is derived from the UID. [09:36.750 --> 09:42.810] So, all of the keys marked in orange on the slide are unique for every key card, so they always change. [09:42.810 --> 09:47.430] But they are derived from the UID, which is not a very secure way of implementing this. [09:48.070 --> 09:52.830] The key for sector 1 is the same on every CephLog card across all of the deployments. [09:52.830 --> 09:58.910] And that means that if you read one of these cards and you see this key, then you immediately know it's a CephLog system. [10:00.030 --> 10:02.050] So, the key derivation function. [10:02.610 --> 10:07.150] To read the data from the card, we need the keys to authenticate to this sector. [10:07.430 --> 10:09.630] There's a few ways you can get those keys. [10:09.630 --> 10:15.870] You can use a Proxmark3, run hfmfautopwn, and it will immediately spit out all of the keys for you. [10:16.370 --> 10:20.850] The other way to do it is to actually reverse-engineer the key derivation function. [10:21.130 --> 10:25.970] And it turns out that back in 2022, multiple people had already done this. [10:25.970 --> 10:29.030] They had reverse-engineered the KDF, but they hadn't published it. [10:29.190 --> 10:32.090] So, at the time, we had to reverse-engineer it ourselves. [10:32.410 --> 10:35.690] In the meantime, someone has published the KDF. [10:35.690 --> 10:40.670] And now it's also implemented in the Proxmark3 project and in the Flipper0. [10:42.650 --> 10:48.890] It's maybe interesting to know that knowing the KDF is not strictly necessary for our attack. [10:48.890 --> 10:53.050] And that's because there are cryptographic attacks on the MyFairClassic cards. [10:54.410 --> 10:56.570] So, reverse-engineering the KDF. [10:56.570 --> 11:05.030] We figured out that the CephLog card encoder DLL contains a kaba.getSecuredKeys function, which implements this KDF. [11:05.690 --> 11:10.070] Initially, we weren't 100% sure that this is the correct function we wanted to reverse-engineer. [11:10.070 --> 11:13.710] So, we made a simple Python wrapper that uses the DLL. [11:13.850 --> 11:21.330] And then we could feed in some UIDs and check if the response was the same key as what we were seeing in the Proxmark project, essentially. [11:21.770 --> 11:28.210] And then later on, when we were sure this was the correct function, we translated it to Python so that we had our own library for it. [11:29.870 --> 11:33.510] So, now we have a pretty good way of reading the data on the MyFair card. [11:33.510 --> 11:37.810] But, of course, our goal is not just to clone it. We want to modify what rooms the key can open. [11:38.150 --> 11:45.290] And so, we learned that really the only data that matters is the 16 bytes on block 1, which kind of tells the lock which doors the lock can open. [11:45.290 --> 11:48.790] And then the first byte on block 2 is a checksum of the first block. [11:49.170 --> 11:55.290] And so, we wanted to figure out... it looked like the data was encrypted on the sector because we didn't really see anything meaningful in it. [11:55.290 --> 11:59.770] And we found this encryptCard and decryptCard function in the Firebird services DLL. [11:59.770 --> 12:06.010] And so, using that, we discovered that the data on the card was actually encrypted using just a substitution table. [12:06.150 --> 12:11.170] And we unfortunately also learned that that substitution table is the same for every SAFLOC hotel. [12:11.170 --> 12:16.710] So, every SAFLOC installation has the keys to decrypt and encrypt every SAFLOC card. [12:18.610 --> 12:23.410] And so, now we know how to decrypt it. And now we want to start changing what the fields are. [12:23.410 --> 12:27.630] But, we had to decrypt the data, but we still didn't really know what the 16 bytes represented. [12:27.630 --> 12:31.670] Luckily, in the same DLL, we found a function that we didn't think was actually being used. [12:31.670 --> 12:35.590] But, it basically assembled the 16 bytes for an emergency card. [12:35.590 --> 12:40.970] And so, we kind of took a look at this function and saw, you know, what fields is it writing to on sector 1. [12:41.070 --> 12:48.030] And we were able to kind of work from there, work backwards and say, okay, these bytes are the expiration, these bytes are the room number, stuff like that. [12:48.510 --> 12:50.810] And being able to create cards was also very useful. [12:50.810 --> 12:57.610] We had our fake hotel, so we created some cards and we were able to decrypt that data and see, you know, do these fields align with what we expected. [12:57.630 --> 13:02.130] And so, slowly, byte by byte, we figured out what the data was starting to mean. [13:04.590 --> 13:08.710] So, this is the full card data format for the Cephalog systems. [13:09.310 --> 13:14.950] It is in alphabetical order, so if you want to reproduce it, you will have to figure out the correct order of the fields. [13:15.510 --> 13:18.510] There's a few logical fields in here. There's the card creation date. [13:18.510 --> 13:23.230] So, this is, like, up to the second when the card was created at the front desk. [13:23.230 --> 13:29.110] There are card levels, indicating if this is a guest key, a master key, or an emergency key. [13:29.110 --> 13:30.830] There's quite a few of these levels. [13:31.130 --> 13:35.050] There's a few different types of cards, but we'll get into those later on. [13:35.590 --> 13:39.330] There's a deadbolt override bit, which sounds very interesting, obviously. [13:39.330 --> 13:41.750] And then, there's a few more fields. [13:42.250 --> 13:44.130] So, the lock ID is an interesting one. [13:44.130 --> 13:50.190] This is just a numerical indicator in a database linking to a specific lock. [13:50.190 --> 13:55.130] So, you can't simply figure out what the lock ID is for a specific room number. [13:55.450 --> 14:02.190] But if you know the lock ID for your room number, you can sort of guess what the room next door has as a lock ID. [14:03.230 --> 14:07.770] The other thing that we need to know to make cards for every deployment is the property ID. [14:07.850 --> 14:13.030] So, this is a 12-bit number that is supposed to be different for every hotel. [14:13.590 --> 14:16.590] And to make a card for a hotel, you need to know this property ID. [14:17.090 --> 14:20.010] And finally, there's a sequence and combination field. [14:20.010 --> 14:24.030] And this was by far the most annoying field in this entire data format. [14:24.170 --> 14:28.050] And it took us quite a while to figure out how to work around this. [14:29.290 --> 14:33.850] So, as I mentioned before, multiple card levels and card types. [14:34.510 --> 14:38.990] Most of the keys you will get when you check into a hotel will have lower levels. [14:38.990 --> 14:42.330] So, guest keys, connector keys, suite keys, and so on. [14:42.370 --> 14:45.470] And they typically only open a single room in the property. [14:46.590 --> 14:51.750] There are more special cards, like housekeeping keys, that typically open a range of rooms. [14:51.750 --> 14:54.630] So, maybe a floor or a specific tower in the hotel. [14:55.150 --> 14:58.450] And then finally, we get to the interesting ones, like the emergency key. [14:58.450 --> 15:04.970] And the emergency key is interesting, because since it's used for emergencies, it also overrides the deadbolt. [15:05.150 --> 15:12.450] So, if someone inside of the room flips the deadbolt, and someone taps an emergency key on the card, it will allow them to override this deadbolt. [15:12.890 --> 15:16.570] I think it's important to realize if you're staying in a hotel, the deadbolt is just software. [15:16.590 --> 15:17.530] It's not software controlled. [15:18.550 --> 15:24.510] Two more interesting key levels are the primary programming key and secondary programming key. [15:24.970 --> 15:32.570] And we think the idea here is that you would tap one of these cards to a lock, before you can actually reprogram the lock with an H86 programmer. [15:35.240 --> 15:39.080] So, as Leonard said, we spent quite a lot of time on the sequence and combination. [15:39.080 --> 15:44.020] Because we knew what every field meant, but we couldn't figure out the valid sequence and combination for a lock. [15:44.020 --> 15:48.040] So, each lock has its own combination value between 0 and 4095. [15:48.640 --> 15:53.260] And, as Leonard said, you can kind of guess what lock IDs are, but guessing the combination is very painful. [15:53.620 --> 15:59.080] And there's also a sequence number, and so this is used just as you check in and check out, each guest gets their own sequence number. [15:59.080 --> 16:04.100] So, for example, if someone checks in after you, they'll tap their sequence number, and that will invalidate all the previous ones. [16:04.100 --> 16:09.080] So, that prevents, you know, two people from having a valid key to the same room, as that would be pretty bad. [16:09.580 --> 16:12.960] And the field is just the sequence encrypted and combined with a combination. [16:12.960 --> 16:18.540] And, as I said, this is really the only field that gave us any trouble in making a valid guest key. [16:19.800 --> 16:22.580] At first, we tried to brute force the field. [16:22.900 --> 16:29.160] Leonard tapped the Proxmark about 4,000 times, trying to guess what the valid sequence number was. [16:29.200 --> 16:31.520] This doesn't work. I don't suggest it. [16:31.540 --> 16:36.820] The lock does detect that you're trying to just guess key cards, and it kind of shuts itself down. [16:36.820 --> 16:39.440] It's also very physically strenuous and annoying. [16:41.000 --> 16:45.600] Later, kind of the crux of our discovery was that we found that, because these locks are offline, [16:45.600 --> 16:49.660] they sometimes have to be re-sequenced if they become desynchronized with the front desk. [16:50.260 --> 16:53.380] And what a re-sequencing card does is it just simply tells the lock, [16:53.380 --> 16:56.060] hey, this is your new sequence, and this is your new combination. [16:56.120 --> 16:58.860] And that's perfect for us, because those were the only two fields we didn't know. [16:58.860 --> 17:03.180] So, we were able to create a key card that simply re-sequenced this lock and tells it, [17:03.180 --> 17:07.020] hey, this is your new secret value, and that's the only one you need to create a forged key card. [17:09.440 --> 17:12.580] So, now we have all the elements to make a full attack. [17:12.900 --> 17:18.340] So, the idea is that you would start by obtaining any card from the hotel, just to get the property ID. [17:18.480 --> 17:21.680] This can be your own card. This can be an expired card. [17:21.680 --> 17:26.700] It can be a card you found on the floor, from the express checkout box, or simply one you bought from eBay. [17:27.560 --> 17:31.340] So, once you have the property ID, we can start forging keys. [17:31.340 --> 17:37.540] So, we forge a re-sequencing key card for a privileged level, so emergency or grandmaster. [17:37.540 --> 17:41.800] And the reason for picking emergency is that it works on all of the doors. [17:41.800 --> 17:44.080] So, you don't have to guess a lock ID anymore. [17:45.200 --> 17:50.520] Then, you walk up to a door, you tap your re-sequencing key card, it re-sequences the lock, [17:50.520 --> 17:55.640] and then you have your second key card that has an opening key for the same level, and it will open the door. [17:56.040 --> 17:59.900] And the nice thing is, you make this pair of cards once for every property, [17:59.900 --> 18:04.020] and you can now walk around and open every single door in the hotel. [18:11.960 --> 18:16.180] So, of course, we also implemented this as a full proof of concept attack. [18:16.300 --> 18:19.540] At this point, we had already written a PySafelock module. [18:19.580 --> 18:24.780] So, it's a Python module that supports doing the key derivation function, decrypting the card data, [18:24.780 --> 18:27.140] deserializing it into the different fields. [18:27.140 --> 18:33.520] Then, we can change fields, re-encrypt it, or re-serialize it, re-encrypt it, and then write it back to a card. [18:33.880 --> 18:39.360] And instead of implementing all of this within the Proxmark codebase, since we already had the Python script, [18:39.360 --> 18:46.080] we sort of made simple wrapper functions that call Proxmark code to read and write stuff to a card. [18:46.740 --> 18:52.120] Then, obviously, these days we have to implement the same thing on a Flipper 0. [18:52.200 --> 18:54.420] This was relatively straightforward. [18:54.740 --> 19:01.160] You can make an NFC-supported card plugin, and that essentially has to implement three functions. [19:01.240 --> 19:08.060] So, the first function is verify, and that's essentially a function that tries to verify if the card you tapped is a Safelock card. [19:08.060 --> 19:15.360] As I mentioned earlier, Sector 1 has a default key, and you can use that default key to detect if the card is a Safelock card. [19:15.740 --> 19:19.340] Now that you should have a Safelock card, you go to the read function. [19:19.520 --> 19:25.660] The read function derives the key, so implements the KDF, and then reads the relevant data blocks. [19:26.120 --> 19:30.320] Now that you have those data blocks, you can decrypt them, parse out the data, [19:30.320 --> 19:36.500] and then from there generate, re-sequence an emergency card that gets stored on the Flipper's file system. [19:37.480 --> 19:41.340] Before anyone asks, we are not releasing this plugin. [19:41.980 --> 19:45.660] But there is a KDF plugin available on GitHub that someone else made, [19:45.660 --> 19:50.440] and you can actually use that plugin to check if you're staying at a Safelock hotel. [19:53.790 --> 19:57.550] So, as I mentioned previously, we actually found this at DEF CON two years ago, [19:57.550 --> 20:00.570] and it was a very long disclosure process. [20:00.970 --> 20:05.710] So, in August, we kind of found the decryption key, and we were able to read and write to the card, [20:05.710 --> 20:09.290] but we didn't actually figure out the re-sequencing thing until a month later. [20:09.810 --> 20:15.170] Finally, we were able to figure that out, and we created a complete proof of concept. [20:15.350 --> 20:21.050] Unfortunately, Dorma Kava didn't have any disclosure process, and so I had to message their CSO on LinkedIn. [20:22.290 --> 20:25.270] Luckily, he actually took it seriously and responded quickly. [20:25.390 --> 20:28.370] And they actually have a VDP now, I think, which is great. [20:28.870 --> 20:32.210] We had our first meeting with them in October, [20:32.210 --> 20:35.990] and from there, I think we had at least 13 meetings with Dorma Kava [20:35.990 --> 20:39.070] talking about the vulnerability and how they were going to fix it. [20:39.450 --> 20:41.650] As I mentioned, it's three million hotel locks, [20:41.650 --> 20:45.870] and I don't think they were fully ready to do that upgrade for a while, [20:45.870 --> 20:48.110] and it was quite a painful change. [20:48.570 --> 20:53.510] But in November of 2023, they upgraded the first hotels to resolve the vulnerability, which was great. [20:54.110 --> 20:56.890] And then, as you may have seen, in March of 2024, [20:56.890 --> 21:01.310] we did a limited disclosure of saying, you know, these hotel locks have a vulnerability, [21:01.310 --> 21:03.570] but, you know, we're not going to say exactly what it is. [21:03.910 --> 21:07.530] At the time we published it, 36% of the locks have been upgraded. [21:08.330 --> 21:09.930] Today is our DEF CON talk. [21:10.070 --> 21:12.510] They only told us the majority of the locks have been updated. [21:12.510 --> 21:14.550] We don't have a specific percentage anymore. [21:14.870 --> 21:21.690] And they said nearly all Las Vegas properties are in the process of being mitigated or have been mitigated, more or less. [21:25.190 --> 21:30.470] Remediation, they added a new enhanced security mode, and this is to their Ambion software. [21:30.470 --> 21:32.650] So we mostly looked at System 6000. [21:32.810 --> 21:34.330] That's kind of deprecated now. [21:34.330 --> 21:38.110] There is a fix for it, but it's not as good as the enhanced security mode. [21:38.490 --> 21:41.010] The enhanced security mode has a new KDF. [21:41.030 --> 21:46.010] It encrypts the card data using AES, which is much better than a hard-coded substitution cipher. [21:46.630 --> 21:50.790] And it also uses MyFair Ultralight C, so even if you're able to decrypt the card data, [21:50.790 --> 21:54.270] it's still hard to actually write it to the card because you don't know the card keys. [21:54.670 --> 21:57.810] And as I mentioned previously, they also replaced all of the encoders. [21:57.810 --> 22:02.130] And so there's a new encoder for making the keys that also has a secure element inside of it. [22:05.270 --> 22:08.770] So a lot of people ask us, why did it take so long to fix these hotel locks? [22:08.770 --> 22:10.230] Why did it take two years? [22:10.510 --> 22:13.630] And it turns out that the main issue are the integrations. [22:13.630 --> 22:17.670] So of course, first, Tomacabra had to come up with a fix for their own hotel locks. [22:17.810 --> 22:21.330] But then if you start thinking about especially big Las Vegas properties, [22:21.330 --> 22:24.170] they have so many integrations with the hotel locks. [22:24.310 --> 22:26.590] So maybe you use the kiosk to check in. [22:26.810 --> 22:28.630] You've used the elevators. [22:28.710 --> 22:30.910] There's payment solutions in some hotels. [22:30.910 --> 22:33.130] And some hotels even have towel machines. [22:33.690 --> 22:39.210] And so when a hotel decides to upgrade their hotel locks, all of these systems have to be upgraded as well. [22:39.210 --> 22:42.690] And that typically means that they have to contact the manufacturers of these systems. [22:42.690 --> 22:45.110] And so you can imagine this takes a long time. [22:46.690 --> 22:49.090] Most of the locks have to be updated manually. [22:49.090 --> 22:53.910] That means that someone has to walk up to the door and hold the programmer in front of the lock for two minutes. [22:54.250 --> 22:58.030] Three million locks times two minutes is a lot of minutes. [22:58.030 --> 22:59.950] So it takes a long time. [23:00.710 --> 23:05.950] Then additionally, you have to convince property owners to perform this update. [23:05.950 --> 23:09.410] And that's also one of the reasons we had this limited disclosure initially. [23:09.410 --> 23:14.630] To make hotel owners aware of the vulnerability and give them some extra time to implement the fix. [23:14.630 --> 23:22.670] We were told that at the peak of deploying this fix, Tomacabo was resolving 500 properties per week. [23:24.090 --> 23:31.050] Another thing that has changed now in the new update is that the standard guest cards will be using Ultralight-C. [23:31.610 --> 23:40.350] And one of the reasons people are making the switch over to Ultralight-C now is that the cost of Ultralight-C cards has come down a lot over the last few years. [23:40.350 --> 23:45.030] So if we talk about card cost, we found a few statistics online. [23:45.550 --> 23:49.350] So on average, a hotel is occupied 65%. [23:50.570 --> 23:54.810] An average stay at a hotel takes 1.8 nights. [23:54.990 --> 23:58.670] The average number of cards that gets made per stay is two. [23:58.830 --> 24:03.270] And only 25% of all cards are returned when you check out. [24:03.590 --> 24:08.890] Now if we think about big Las Vegas properties that have between 3,000 and 7,000 rooms, [24:08.890 --> 24:10.830] then you can imagine they make a lot of cards. [24:10.830 --> 24:22.670] So if we do a bit of simple math, then we end up with a hotel with 5,000 rooms having roughly 660,000 stays per year. [24:22.810 --> 24:31.810] That means that around 1.3 million cards are made at one of these big properties, of which only 300,000 are being returned after stays. [24:31.950 --> 24:36.910] So that means that a hotel needs to buy roughly 1 million cards per year. [24:36.910 --> 24:42.230] If you assume $0.10 per card, that's $100,000 just in RFID cards. [24:42.570 --> 24:47.990] Now if you think about a MyFair Classic card, which is very cheap, and maybe those were $0.10, [24:47.990 --> 24:55.410] if an Ultralight C card a few years back was $0.20, then that would mean $200,000 in cards. [24:55.410 --> 24:58.870] And that's the reason you still find a lot of MyFair Classic cards around. [24:59.510 --> 25:06.470] But luckily, prices have been coming down, also because there's more of these systems asking for Ultralight C cards. [25:06.910 --> 25:11.750] So they've become cheap enough to the point where hotels are now using Ultralight C. [25:13.270 --> 25:16.530] So I guess most of the people in this room are staying at a hotel this week. [25:16.530 --> 25:21.850] So how can you tell if the hotel you're staying at is using CephLock and if it's fixed or not? [25:22.630 --> 25:26.590] It's relatively easy to see if a hotel is using CephLock. [25:26.590 --> 25:28.910] Typically, you can only tell when you're checking in. [25:28.910 --> 25:32.170] If you look over the counter, you can see the encoders. [25:32.470 --> 25:35.450] So we have two pictures of encoders on the slide here. [25:35.450 --> 25:38.230] The leftmost one is an old encoder. [25:38.270 --> 25:40.010] It's thicker, it's bigger. [25:40.250 --> 25:42.470] And the one on the right is a new one. [25:42.950 --> 25:46.030] Now, if you see the old one, you know it's a vulnerable system. [25:46.210 --> 25:53.910] If you see the new one, it could be a fixed system or it can be a system that is in the progress of being mitigated to the new solution. [25:54.650 --> 25:58.790] You can also quickly recognize the locks that are used in these systems. [25:58.790 --> 26:04.450] So the small black puck-type lock with the S going to it is very common here. [26:05.350 --> 26:07.430] And those are CephLock locks. [26:07.430 --> 26:10.490] So if you see those, you know it's a CephLock system. [26:11.330 --> 26:15.770] Then the next thing you can do is you get a card from when checking in. [26:15.770 --> 26:19.410] You can tell if it's a Mifac Classic or an Ultralight C card. [26:20.170 --> 26:25.450] So then you use your favorite RFID tool, which we all know is the Flipper Zero with Iceman firmware. [26:26.390 --> 26:31.950] Or you use an Android phone with the NFC Tag Info app, and that allows you to tell what type of card it is. [26:33.130 --> 26:38.230] So if it's a Mifac Classic card, then you know that the system is still vulnerable to this attack. [26:38.690 --> 26:43.450] Or it's not a CephLock deployment, so you have to really do all three of the steps. [26:45.370 --> 26:47.610] So how to protect yourself in a hotel? [26:47.610 --> 26:51.410] You see it's CephLock, you see it's Mifac Classic, well you're probably screwed. [26:52.210 --> 26:54.410] But there's some things you can buy. [26:55.210 --> 26:59.950] There's a door bolt deadbolt Velcro strap, and that kind of holds the deadbolt closed. [26:59.950 --> 27:02.030] And so that kind of prevents it from opening externally. [27:02.410 --> 27:07.110] You can also get under door wedges, which kind of drill themselves into the carpet and prevent the door from opening. [27:07.550 --> 27:10.670] Obviously these are kind of hacks, but they could be good if you travel a lot. [27:10.750 --> 27:13.910] And Deviant has some great videos about hotel security as well. [27:13.910 --> 27:19.570] And just in general, even if you're not staying in a CephLock hotel, maybe next year there will be more vulnerabilities. [27:21.870 --> 27:28.130] So that's it. Summary, reading a single card at a hotel allows us to open any door at the property if it's vulnerable. [27:28.690 --> 27:31.330] This system has been in use since 1988. [27:31.890 --> 27:37.370] You'd say, hey, they didn't have Mifac Classic back then, and it's true, but they did the same thing for MagStripe cards. [27:37.370 --> 27:42.630] So unfortunately the system has been vulnerable since before Leonard and I were even born. [27:45.810 --> 27:49.230] And many aspects of these systems still haven't been looked at. [27:49.230 --> 27:53.990] Once we found a way to make these master keys, we didn't really care about the rest of it. [27:54.010 --> 27:57.130] But there's a wide scope. The locks have USB ports. [27:57.850 --> 28:02.430] There's many, many aspects to these systems, and more vulnerabilities likely exist somewhere. [28:03.110 --> 28:05.630] Luckily, the cost of the secure cards have come down a lot. [28:05.630 --> 28:07.910] Ultralight C, Deathfire, stuff like that. [28:08.110 --> 28:11.690] Obviously it's a lot better than using Mifac Classic, which has been broken forever. [28:12.190 --> 28:17.370] And overall, even though we had to message them on LinkedIn at first that we did have a positive experience working with Dorma Kava, [28:17.370 --> 28:21.130] they didn't take it seriously, and they didn't sue me, so that's always great. [28:22.490 --> 28:23.830] It's time for a demo. [28:34.260 --> 28:38.720] Okay, we have two demos. We're going to attempt to show two demos. [28:47.100 --> 28:50.280] So for the first demo, we'll be using the Proxmark 3. [28:53.660 --> 28:56.380] I have a few RFID cards here. [28:56.660 --> 28:58.400] One of them says valid. [29:02.500 --> 29:04.620] As you can tell, it opens the lock. [29:04.800 --> 29:08.720] Now, if someone is staying inside of the room and they have the deadbolt on, [29:08.720 --> 29:11.180] then this card no longer works. [29:13.740 --> 29:17.340] So that's the normal behavior of regular guest cards. [29:19.120 --> 29:22.580] The second card I have says expired or invalid. [29:27.310 --> 29:29.230] And that card obviously doesn't work. [29:29.570 --> 29:32.670] So let's assume that this is the card the attacker finds in the hallway, [29:32.670 --> 29:35.170] or it's maybe the card to their room. [29:36.490 --> 29:40.290] And finally, I have the two attacker cards labeled 1 and 2. [29:40.430 --> 29:43.150] And just to show you that I'm not cheating for the demo, [29:43.150 --> 29:45.650] I'll tap these to the lock and show that the lock doesn't open. [29:51.730 --> 29:56.830] Okay, so now we'll start by reading the expired or the invalid card with the Proxmark. [30:02.440 --> 30:06.100] So what we do here is we take the UID that we read from the card, [30:06.100 --> 30:08.740] we derive the key for the sectors, [30:08.740 --> 30:12.880] we read the data from the card, we decrypt it, we deserialize it, [30:12.880 --> 30:16.140] and here we're printing a few of the fields that are stored on the card. [30:16.320 --> 30:19.740] So you can see this is a level 1 card, so it's a regular guest key. [30:19.820 --> 30:22.520] It was made for the lead room. [30:22.800 --> 30:25.480] And you can also see that the card was created in 1990. [30:25.780 --> 30:29.720] And that means the card is expired, and that's why it no longer works on this lock. [30:30.100 --> 30:33.320] Now, what we really need from this card is the property ID. [30:33.320 --> 30:37.240] And using this property ID, we can now start making new cards. [30:39.780 --> 30:42.640] So I'll first reprogram the first card. [30:46.010 --> 30:51.050] So what we're making now is an emergency level re-sequence card. [30:51.630 --> 30:53.830] So that's the re-sequencing key. [30:56.430 --> 30:59.830] And the next key we make is an opening key. [31:01.950 --> 31:04.910] And now we're ready to break into hotel rooms. [31:04.910 --> 31:08.610] I'm going to assume the person that's staying in this room has the deadbolt turned on, [31:08.610 --> 31:10.510] and then we'll start carrying out the attack. [31:14.440 --> 31:19.320] So the first key re-sequences the lock, and essentially enables the second card. [31:35.490 --> 31:39.170] And like I mentioned before, you can use these two cards over and over again [31:39.170 --> 31:42.250] in the same property and open all of the doors. [31:43.190 --> 31:47.130] Now the second demo is essentially the same thing, but using the flipper 0. [31:48.870 --> 31:51.230] I hope it's visible on the screen. [31:51.230 --> 31:54.610] But the idea is that whatever I'm doing here on the flipper [31:54.610 --> 31:57.310] is the same thing as you see on the screen over there. [31:57.650 --> 32:00.650] So essentially we just go into the NFC menu. [32:02.750 --> 32:05.210] I'm using the expired card again. [32:07.950 --> 32:10.690] So I'll read the expired card. [32:17.110 --> 32:21.650] It tells us it's a Zephyr card, we can again see the card level, [32:21.650 --> 32:26.610] the property ID, the lock ID, and that this card was created in the 1990s. [32:27.710 --> 32:29.750] And in the background, what this flipper app has done [32:29.750 --> 32:33.930] is it has automatically created two extra cards. [32:33.930 --> 32:37.270] So this first entry is a copy of the card we just read. [32:37.490 --> 32:40.130] And then the second one is the re-sequencing key. [32:40.130 --> 32:42.350] So we can start emulating this one. [32:46.780 --> 32:47.740] So now... [32:50.720 --> 32:52.960] Now the lock has been re-sequenced. [32:53.280 --> 32:57.860] We go back into the menu, we take our opening key, we emulate it. [33:01.870 --> 33:03.710] And it opens the lock. [33:12.380 --> 33:14.840] So thanks everyone for coming to the talk. [33:14.840 --> 33:17.700] If anyone has questions, we'll try to answer them. [33:29.850 --> 33:31.710] I'm too short for this, hello. [33:32.410 --> 33:35.590] Is that the Iceman firmware up there? [33:36.070 --> 33:38.490] Yeah, it's a special beta release. [33:38.670 --> 33:41.310] Alright. Okay, actual question. [33:42.970 --> 33:47.790] Considering what you said about the software from Dormakaba, [33:48.190 --> 33:51.690] do you think the responsibility lies on Dormakaba or the hotels [33:51.690 --> 33:54.510] for how long it's taking them to upgrade their systems? [33:54.510 --> 33:59.130] Thinking about the logging and even the encryption method used for their cards. [34:00.330 --> 34:02.270] That's a good question. [34:02.990 --> 34:06.650] We also don't know entirely how Dormakaba is handling the... [34:07.290 --> 34:09.570] resolving or doing the updates. [34:09.570 --> 34:13.490] How much hotels have to pay, how much Dormakaba pays and so on. [34:14.070 --> 34:18.090] I think the logging stuff is more an idea we came up with ourselves. [34:18.090 --> 34:23.530] Our idea was if the front desk can see logs of who is entering the rooms and so on, [34:23.530 --> 34:29.090] then in theory it shouldn't be too difficult to check if someone is using a re-sequencing card, for example. [34:29.090 --> 34:32.550] And you could have some alerts triggered when something like that happens. [34:32.670 --> 34:37.650] And then Ian, I heard you were a degenerate gambler. Are you up or down? [34:37.650 --> 34:39.810] I think I'm even now. [34:46.370 --> 34:47.750] What's going on? [34:47.950 --> 34:50.830] Thank you so much for talking about the disclosure process [34:50.830 --> 34:56.150] and explaining all the other factors that weigh on timelines and things like that. [34:56.230 --> 34:59.910] It's really important for all the researchers to understand that and I think it's wonderful. [34:59.910 --> 35:04.210] Did you find the process of working with them to be smooth the whole time? [35:04.210 --> 35:07.390] Or was it like smooth with an executive and then like lawyers? [35:07.770 --> 35:09.010] How did that go? [35:10.070 --> 35:13.610] They did ask us to sign an NDA at first, but we said no. [35:13.610 --> 35:15.850] And from there it was pretty good. [35:16.350 --> 35:21.390] I think obviously it was one of their first times going through this process. [35:21.390 --> 35:28.010] And so we just had to set our expectations of like we're eventually going to disclose this and it needs to be fixed. [35:28.010 --> 35:31.330] And I think once we all understood that it was okay. [35:31.350 --> 35:33.830] They never threatened to sue us or anything. [35:33.830 --> 35:35.690] So it was never hostile at all. [35:35.690 --> 35:38.170] Cool. We're really proud of you. Thank you guys. [35:38.170 --> 35:40.870] I'll just add that I think for them it was very new. [35:41.630 --> 35:42.430] Thanks. [35:44.110 --> 35:50.230] And like the picture you see in this slide is actually a video set that they had at their facilities. [35:50.830 --> 35:54.750] And on the website, on unsafelock.com, we have a small video showing the attack. [35:54.750 --> 35:58.310] And that video was actually shot at a facility from Dormakado. [36:00.210 --> 36:01.710] Thank you to them for that. [36:03.730 --> 36:07.550] Did you say that the substitution table was the same for every property? [36:07.550 --> 36:09.710] So you said they replaced that with AES? [36:10.550 --> 36:13.150] In the enhanced mode it uses AES. [36:13.150 --> 36:19.330] I think they made, if you're still using the old system 6000, my understanding is it's no longer a substitution table. [36:19.330 --> 36:21.090] I don't know if it uses AES. [36:21.390 --> 36:26.090] But it's something that's specific to each hotel at least, which is better than what they had before. [36:26.090 --> 36:29.430] That was my question. Are the keys now specific to each property? [36:29.710 --> 36:31.450] Or do you know one way or the other? [36:31.450 --> 36:32.630] That's our understanding. [36:33.390 --> 36:35.250] Fingers crossed. All right. Thank you. [36:37.550 --> 36:47.050] Hi. So you mentioned when you re-sequence a lock, it invalidates all of the existing cards with, I'm assuming, lower sequence numbers. [36:47.050 --> 36:51.830] Does that also happen with the emergency card that you re-sequenced the lock with? [36:54.490 --> 36:58.910] So I think you were asking about invalidating older cards and sequence numbers, right? [36:58.910 --> 36:59.210] Yeah. [37:00.370 --> 37:06.070] So the idea, or at least the way we think it works, is if you check in at the hotel, the sequence gets incremented. [37:06.090 --> 37:12.090] And once a lock sees a higher sequence number, it stops accepting older sequence numbers. [37:12.090 --> 37:14.870] And the same thing is probably true for emergency cards. [37:15.010 --> 37:22.030] But since our first card re-sequences the lock and tells it, this is now your sequence number, we can then use our lock. [37:22.030 --> 37:25.630] So the re-sequencing card can have any sequence number you want. [37:26.090 --> 37:32.910] So then the older cards that worked on the lock before that will get invalidated as a result? [37:33.010 --> 37:34.310] I couldn't get it. [37:34.510 --> 37:38.390] So I think you're asking if we do our attack, do the guest key cards get invalidated? [37:38.510 --> 37:42.670] So the sequence is specific to each level. So in our attack, we're doing the emergency key cards. [37:42.670 --> 37:47.370] So it would break the emergency key cards for the hotel, but the guest keys would be unaffected. [37:48.890 --> 37:50.330] Gotcha. Thank you. [37:51.050 --> 37:52.250] Thank you. [37:55.330 --> 38:00.810] Is it possible to brute force the property ID so then you wouldn't need another key from the same hotel? [38:02.630 --> 38:07.890] We could speculate that there's a way to do it. I don't know if I would do it via brute forcing because it is pretty painful. [38:07.890 --> 38:11.450] You have to physically move the device across the lock each time. [38:11.790 --> 38:17.470] But as I said, the USB port seemed pretty interesting to us and there may be a way to get that info from it. [38:17.470 --> 38:19.770] We just didn't look at that surface at all really. [38:20.190 --> 38:20.870] Thanks. [38:22.730 --> 38:30.570] Two questions. One, are you staying at Resort World? Two, is Resort World a Safelock hotel? [38:32.570 --> 38:34.970] I'm sorry, I couldn't hear the question. [38:34.970 --> 38:39.030] The second one was, is Resort World a Safelock hotel? [38:39.570 --> 38:47.510] Yeah, we've both stayed at Resort World and we believe it's been fixed there. I believe all the cards are ultra latency there. [38:51.130 --> 39:02.110] So for the legacy encoder that Dorma Kaba is replacing, it appears that that can also write ultralight C. So do you know why they replaced that encoder? [39:03.770 --> 39:07.470] I'm sorry, I think the mic is a little low, so I'm having trouble hearing the question. Sorry. [39:07.470 --> 39:17.450] Sorry. I was saying, so for the legacy encoder that Dorma Kaba is replacing, it appears that with the System 6000 software, it can also read and write the ultralight C cards. [39:17.510 --> 39:21.470] So do you know what additional security they got by replacing it? [39:22.330 --> 39:36.670] They told us that they added a secure element to the new encoder. We didn't look and they didn't tell us exactly how that's used. But I think that was part of the reason. I'm not sure if the old encoder supported ultralight C or not as well. I'm not sure. [39:36.670 --> 39:50.270] I think the older system supported other cards, not just MyFair Classic. I think they had even support for ultralight for a while. It's just no one really seemed to use it. Like all of the SAF log deployments we've seen were MyFair Classic. [39:50.810 --> 39:52.050] Thank you. Awesome talk. [39:54.270 --> 40:02.090] Hi, I read my photos card and it's not MyFair, but it's ST-CHIP. Do you know if it's vulnerable or not? [40:02.970 --> 40:04.210] ST-CHIP? [40:04.910 --> 40:07.530] It's quite difficult to understand the questions up here. [40:07.530 --> 40:11.810] I have a card with ST-CHIP, not MyFair. Did you look at those? [40:12.730 --> 40:18.750] I haven't looked at any hotels that had ST-CHIPs in them, but maybe Iceman knows about this specific card for a moment. [40:21.430 --> 40:22.750] I don't know, sorry. [40:22.910 --> 40:23.970] Okay, thank you. [40:34.830 --> 40:38.070] Hi, I'm Iceman. I have a question to you. [40:40.410 --> 40:48.190] No, the SD card is not vulnerable in that sense. Yes, it's true. But Benjamin Dipli did some work with it. [40:48.570 --> 40:55.310] Awesome fucking research. I'm in awe by it. It's amazing. [40:56.750 --> 41:00.090] I bow to the gods of 3D hacking. [41:04.070 --> 41:11.830] But to be honest, it was MyFair Classic and it did have .NET. So I think that's cheating. I thought you would have done more hardware. [41:12.750 --> 41:18.530] With that said, give them a well-rounded applause for us. They are fucking amazing. [41:25.280 --> 41:26.680] I guess that's it. [41:26.680 --> 41:28.580] Alright, thank you so much. Appreciate it.