[00:02.420 --> 00:07.840] Hello, DEF CON. Thank you for being here on a Saturday morning. I know everyone was partying [00:07.840 --> 00:13.560] yesterday until 5 a.m. probably, so I'm glad that you're here. So yeah, now we're talking [00:13.560 --> 00:18.880] about our talk, open CSAM, or how secure is your stuff in your lockers. And this is the [00:18.880 --> 00:23.620] main question, basically, which we will talk through the talk. As you might have heard, [00:23.620 --> 00:28.580] there have been some issues with the talk in the past, so I will address it later. So [00:28.580 --> 00:35.600] before we start with the topic, let me introduce myself real quick. So I'm Dennis, I'm a security [00:35.600 --> 00:41.000] researcher or also a hardware hacker. And I basically am interested in wireless and [00:41.000 --> 00:44.560] embedded security and privacy. So I take a look at all kinds of interesting devices which [00:44.560 --> 00:51.180] are around me. Primarily this is vacuum robots, but I generally look at all kinds of things. [00:51.460 --> 00:55.540] That's why I call myself also a vacuum robot and IoT collector, so I have probably way [00:55.540 --> 01:03.360] over 600, 700 devices and 60 or 70 vacuum robots by now. So my main goal typically is [01:03.360 --> 01:07.540] to root vacuum robots, but again, I look at all the other things. And if you're interested [01:07.540 --> 01:13.080] in vacuum robots, by the way, I have a website which documents all the hardware and everything. [01:15.320 --> 01:21.720] One thing which is kind of new in the slides, so I have been a target of a cease and desist [01:21.720 --> 01:27.060] at DEF CON, so I think this is like a, you know, interesting thing. Which by the way [01:27.060 --> 01:32.380] was withdrawn as today in the morning or at night, so yeah. And now we would like to introduce [01:32.380 --> 01:33.140] Braylyn. [01:36.340 --> 01:41.980] Cool. Hi, I'm Braylyn. I hack things for the Leviathan security group during the day, but [01:41.980 --> 01:45.840] I'm here representing myself as an independent security researcher and this talk does not [01:45.840 --> 01:52.100] reflect their views. My general focus has been application security and APIs, but I've [01:52.100 --> 01:58.340] started hardware hacking for fun. Looking at things like robots, cameras, and smart [01:58.340 --> 02:04.240] locks. And this is my first DEF CON talk and I was also named in the cease and desist, [02:04.240 --> 02:06.860] so that's pretty fun. [02:12.370 --> 02:16.270] All right. So let's talk about some previous work. So this is not necessarily the first [02:16.270 --> 02:20.310] lock which we took a look at. Like exactly ten years ago, well, a little bit more than [02:20.310 --> 02:25.050] ten years ago, I was working on a group which looked at Siemens and Foss door locks and [02:25.050 --> 02:30.870] we published a paper about that. Also some while ago I was taking a look at Schlage electronic [02:30.870 --> 02:35.110] locks which you find especially in America, like, you know, in government buildings, universities. [02:37.390 --> 02:41.830] So what are the goals of this talk? Well, first we want to give you some overview of [02:41.830 --> 02:46.630] the reverse engineering of digilock and SAG locks. We want to tell you something about [02:46.630 --> 02:52.430] vulnerabilities and we want to show you some ideas and methods how you can extract typically [02:52.430 --> 02:57.670] firmware and configurations from that kind of devices. One thing which is the most important [02:57.670 --> 03:02.630] part of this talk is basically we want to raise awareness about pin numbers. As a general [03:02.630 --> 03:07.650] side note, we use digilock and SAG as examples and we're not claiming that they're more or [03:07.650 --> 03:11.630] less secure than other companies. We're kind of just unlucky that they're one of the market [03:11.630 --> 03:16.910] leaders and that they build good products. So, yeah, so we basically have chosen them [03:16.910 --> 03:20.110] because they have a good reputation, they have a quality of products, we just might [03:20.110 --> 03:25.030] have made some mistakes. We reported the things also to the vendors and digilock is [03:25.030 --> 03:29.430] actively working on fixing the issues and I will tell, give you some information later [03:29.430 --> 03:37.270] on that. So, about this talk. It's basically a continuation of my Nulcon talk at Nulcon [03:37.270 --> 03:43.110] Berlin 24. The focus, and this is the important part, on offline locks which are managed, [03:43.110 --> 03:46.850] so if there's like a master key or something, if you think of a gem or, you know, master [03:46.850 --> 03:51.610] key systems. And we do not cover a couple of things. For example, we do not cover management [03:51.610 --> 03:56.710] software, we do not cover reprovisioning, so how to, you know, factory reset the lock. We [03:56.710 --> 04:01.770] also don't talk about physical attacks using magnets or destructive attacks like drilling, [04:01.770 --> 04:07.090] you know, decapping, all other kinds of things. And later on, we have included a statement [04:07.090 --> 04:13.890] of digilock in regard to their cease and desist. All right, so what is our motivation here? [04:13.890 --> 04:20.230] So, generally, back when I was, you know, looking at locks, I realized quite quickly [04:20.230 --> 04:25.550] that hacking locks is not that, you know, new. There's a lot of people who were hacking [04:25.550 --> 04:29.590] like high security locks, so a lot of researchers were kind of focusing on that, especially [04:29.590 --> 04:34.870] like safe locks, because there's probably very important stuff in there. A lot of research [04:34.870 --> 04:39.290] has been put into side channel attacks, you know, safes contain expensive things, and [04:39.290 --> 04:45.090] the impact is like very high if they're insecure. The general problem is for, you know, manufacturers [04:45.090 --> 04:48.450] or for even companies who have this kind of devices, it's very hard to defend against [04:48.450 --> 04:53.030] physical attacks and highly motivated attackers. So, if I'm an attacker, if I have unlimited [04:53.030 --> 04:58.970] time and money, then I will get into whatever it is. In regard to consumer devices, it's [04:58.970 --> 05:03.670] slightly different. Consumer locks, safes and cabinets are known to be bad, and there's [05:03.670 --> 05:08.150] mechanical flaws, there's trivial bypasses using magnets and other things, and there's [05:08.150 --> 05:13.210] insecure software. I have an example here from one of my favourite YouTubers, a lock-picking [05:13.210 --> 05:18.770] lawyer, where he has a gun safe kind of thing where you put the gun in, and you just pry [05:18.770 --> 05:23.970] open the plastic handle and you can just pull the gun out, you don't care about the lock. [05:26.190 --> 05:32.390] Sometimes you don't need to even attack locks, there's other ways around that. Okay. So, [05:32.990 --> 05:38.090] how did we start with this particular research? So I was in the University around 2018, and [05:38.090 --> 05:43.410] they introduced lockers in the labs. One of the ideas was you can put your stuff in, [05:43.410 --> 05:47.170] and you just choose your own pen, lock it, and if you come back, you unlock it again [05:47.170 --> 05:51.550] and the next one can use it. But also, when we were travelling around, we saw these locks [05:51.550 --> 05:56.750] in many, many co-working spaces, banks, airports, hotels, gyms, so we were literally everywhere. [05:56.850 --> 06:03.310] At some point, you develop an eye for interesting things around you. And one thing which we [06:03.310 --> 06:07.070] figured out very quickly is there's only a few widely used vendors which are out there, [06:07.070 --> 06:12.330] so there's groups in the US in particular, like Digilock, or in Europe, SAG, there's [06:12.330 --> 06:17.350] some very limited kind of vendors out there. And these kind of locks, they stay for a very, [06:17.350 --> 06:21.830] very long time in use, because why would you change a gym lock after five years, or after [06:21.830 --> 06:25.830] four years, or whatever? These things typically stay in use for ten years, 20 years, until [06:25.830 --> 06:31.890] they're broken, basically. Okay. The question is now why do we hack cabinet lockers, or [06:31.890 --> 06:36.810] lockers generally, and not saves? Well, lockers and cabinets are basically everywhere, and [06:36.810 --> 06:41.210] they're used in public spaces, or spaces which are accessible to the public, or shared workspaces. [06:41.670 --> 06:44.450] And there might be many reasons why you want to hack them. For example, you forgot your [06:44.450 --> 06:50.230] pin, you lost your key, or you do a red team penetration test. Also, sometimes the audit [06:50.230 --> 06:55.790] locks are not super correct, so you want to correct them. And they might contain a lot [06:55.790 --> 06:59.850] of interesting stuff, including our own. And this is what I want to say, one of the reasons [06:59.850 --> 07:03.330] why we do the research is because we're kind of slightly annoyed because our stuff is also [07:03.330 --> 07:07.150] about kind of lockers, so this is one big motivation from us. So what kind of things [07:07.150 --> 07:11.670] do you might store there? Well, you might store your backpack, laptop, employee ID, [07:11.670 --> 07:18.630] phone, keys, money, credit cards, USB sticks, important documents, your bitcoins, or candy. [07:19.450 --> 07:24.230] So the question is, well, did you use the same pin which you used to lock the locker [07:24.230 --> 07:34.740] also for your phone, notebook, or credit card? Quick survey, who has a friend that does this? [07:34.740 --> 07:39.860] Who reuses their pins? No, you're not supposed to admit that. [07:41.960 --> 07:45.260] To be fair, I mean, in the beginning, before I was doing the research, I caught myself [07:45.260 --> 07:50.780] using the same pin all over again, so it gets a little bit complicated. Anyway, so what [07:50.780 --> 07:55.220] kind of attack ideas do we have, and how do we do it? So what are we looking for generally [07:55.220 --> 07:59.840] in this kind of devices? Well, we try to extract somehow the firmware, because firmware can [07:59.840 --> 08:04.560] give us some secret backdoors or bugs. It helps us to understand functionality, and [08:04.560 --> 08:09.740] it can allow an attacker to create custom firmware. You know, like basically de-clouding [08:09.740 --> 08:15.180] or n-certification of your smart locks. The other thing is, which is obviously the crown [08:15.180 --> 08:21.960] jewel here, is the interesting data in terms of key IDs, user pins, RFID IDs, or lock files. [08:22.540 --> 08:26.920] And the other thing, if you do lockpicking, you know you try to find any easy way to bypass [08:26.920 --> 08:33.200] things into open locks. So, our idea, and this is why we want to kind of stress on that, [08:33.200 --> 08:36.540] it's not necessary that we want to steal your stuff, but we don't want to steal your stuff [08:36.540 --> 08:41.200] anyway, but I mean, theoretically as attackers. But lateral movement, and that's the core [08:41.200 --> 08:46.420] idea of our talk. So how do we do it? So we have in this particular example three cabinets, [08:46.420 --> 08:49.980] basically one of them is open, two of them are locked, one is locked with a pin, the other [08:49.980 --> 08:54.380] one is locked with an RFID. And so what we do is we try to extract the manager key from the [08:54.380 --> 08:58.200] locker which is open. As soon as we have the manager key, this is like a key which you use [08:58.200 --> 09:01.620] to kind of unlock the locker, to audit things in there so that there's nothing, you know, [09:01.620 --> 09:06.540] like the Defcon hotel, it's like sketchy things, your flipper. And you can lock it again [09:06.540 --> 09:11.480] without resetting the pin. So, by having this manager key, what we can do is basically we [09:11.480 --> 09:18.020] can unlock other lockers, and we can extract from the lockers, like with the pin, we can [09:18.020 --> 09:22.940] extract the user pin. At the same time, we can obviously access whatever is in the locker. [09:22.940 --> 09:26.420] So, if you have a laptop in there, and if you have your phone in there, well, we might be [09:26.420 --> 09:30.900] able to use the pin which you use to lock the locker to, you know, unlock that. But it gets [09:30.900 --> 09:36.640] even more interesting because, well, we can also extract the RFID, you know, ID or secret, [09:36.640 --> 09:42.020] in some cases, from a lock which was used to lock the locker with an RFID or employee badge. [09:42.120 --> 09:45.620] And then we can go to an interesting door, like a server room or something, and can use that [09:45.620 --> 09:50.880] to unlock that. Especially SAG, they use test fire encryption, so they store the keys, [09:50.880 --> 09:56.180] which gets very, very interesting here. All right, so how do you get that kind of locks? [09:56.180 --> 10:00.900] What's the logistics behind that? The problem is, if you do that kind of research, you need to [10:00.900 --> 10:06.340] invest a lot of time and money, and experiments typically require multiple devices. And you [10:06.340 --> 10:10.840] obviously cannot use someone else's property because there might be one or two bricks in the [10:10.840 --> 10:16.340] process of reverse engineering that. These locks are also expensive, so typically you pay [10:16.340 --> 10:22.420] more than $100 for a lock and more than $50 for a key, or way more than $50. We will talk about [10:22.420 --> 10:28.520] that later. But the good thing was, for us, there's surplus on eBay. And it's a little mean, [10:28.520 --> 10:32.200] but COVID kind of helped us a little bit because a lot of gyms kind of got bankrupt, so they kind [10:32.200 --> 10:37.440] of offset their locks and other things on eBay. And we got a lot of cheap provisioned locks, [10:37.440 --> 10:40.740] so locks which were already provisioned to some manager key or programming key, [10:40.740 --> 10:45.040] which we were able to play around with. And the other thing is, especially in Germany, [10:45.040 --> 10:50.220] we got a lot of locks from failed projects. Basically, we have a big gym, which didn't [10:50.220 --> 10:54.080] happen, so we had stacks and stacks of these locks, and we kind of sell them on eBay for a [10:54.080 --> 11:00.600] cheap price. So we spent probably more than $1,000 or $2,000 on buying random locks, which [11:00.600 --> 11:06.300] we don't even have so many lockers for. So as mentioned, we were going on a shopping tour on [11:06.300 --> 11:13.500] eBay and bought a lot of locks. So let's talk about the DigiLock ecosystem, and this is our [11:13.500 --> 11:19.120] first candidate for which devices we looked at. So DigiLock itself, we're like a brand of [11:19.120 --> 11:23.020] Security People Inc., which is U.S.-based, and they are in the industry for a very, very long [11:23.020 --> 11:27.400] time. So they're very experienced, especially also with mechanical locks. They call themselves [11:27.400 --> 11:31.220] the global leader in keyless lock solutions, and they have many different bands of locks. [11:31.220 --> 11:34.440] So they have connected locks, which we're not talking about. We have offline locks. We have [11:34.440 --> 11:39.560] mechanical locks. And as access media, you can use RFIDs, the pins, key fobs, [11:39.560 --> 11:43.580] smartphones with the newest generation. And you might see them under different brands. For [11:43.580 --> 11:47.940] example, DigiLock, Nex, Numeris, so there's different ones. If you take a look at their [11:47.940 --> 11:52.060] website, I mean, they kind of say we're literally in all the industries, which is like, I mean, [11:52.060 --> 11:55.860] that's the reason why we kind of saw them in the first place, because we're in education, [11:55.860 --> 11:59.560] in gyms, in some professional sports organizations, so we're literally everywhere. [12:00.560 --> 12:05.140] The way how you can typically identify them is, this is some examples right now, [12:05.140 --> 12:10.520] by the three-pin connector, which we use, which is very specific for DigiLock. Other lock vendors [12:10.520 --> 12:13.660] use slightly different kind of connectors, but this is like a thing, if you see that, [12:13.660 --> 12:17.600] it's kind of like, you know, kind of know what it is. If you take a look at the lock hardware [12:17.600 --> 12:23.180] itself, the good thing for us is that they use more or less the same or very similar hardware, [12:23.180 --> 12:27.060] so they use a similar type of MCU. So if you're kind of familiar with one of them, you kind of [12:27.060 --> 12:32.040] know how the others work in a way. So this makes it also a great kind of thing for us as reverse [12:32.040 --> 12:37.460] engineers. And they didn't have tamper switches, so if you just assemble one, then there's nothing [12:37.460 --> 12:43.640] which triggers, which is, by the way, very, very normal for low security or middle security locks. [12:43.640 --> 12:48.080] Only safe locks have some tamper switches and other things. The lock state is controlled by [12:48.080 --> 12:51.180] the latch, which is kind of interesting for us, and we'll kind of talk about that later. [12:52.100 --> 12:55.580] And because we have so much experience with mechanical locks, we added a lot of mechanical [12:56.440 --> 13:00.220] protections against physical attacks. So for example, you cannot use bypassing things. We [13:00.220 --> 13:03.920] tried a couple things with needles, so there's no way to kind of, you know, bypass things. So we [13:03.920 --> 13:08.980] did a very good job there. The features which you get per lock are kind of dependent on the brand, [13:08.980 --> 13:14.440] so some of them support audit locks, so you can basically record who opened or locked the locker. [13:14.860 --> 13:19.560] And they have assigned and shared locker functionality, which means sometimes you can [13:19.560 --> 13:24.580] give an employee just one locker and only that person can use it, or you have a scenario like [13:24.580 --> 13:29.040] in the gym. If you take a look closer at the hardware, one thing which is kind of great for [13:29.040 --> 13:34.120] us is all of them have a PIC programming interface exposed. Many of them have EEPROM. We have [13:34.120 --> 13:39.560] obviously an MCU. We have a connection to the inside unit, which kind of contains the latch [13:39.560 --> 13:45.040] and the motor, and it gets also power from there. We have a piezo for the sound. And the most [13:45.480 --> 13:49.860] interesting thing for us was the interface. As you see, we soldered some wires to that to kind [13:49.860 --> 13:56.560] of intercept that, which is basically one wire. Hardware-wise, if you take a closer look at the [13:56.560 --> 14:01.860] microcontrollers, we use most of the time PIC18 controllers, but sometimes, especially newer [14:01.860 --> 14:07.860] models, we use PIC24s. We have EEPROM for audit locks and for credential storage in some of them [14:07.860 --> 14:15.440] devices. And if you have a device which supports RFIDs, you have an ST controller for NFCs. [14:15.560 --> 14:22.720] All the newer ones have a logic IC, which is also an HSM. And from what they told us, basically, [14:22.720 --> 14:27.680] in new generations of these locks, we use the HSM to store some kind of secrets, which we can [14:27.680 --> 14:32.700] confirm because it's not on eBay right now. So I need to wait until it shows up on eBay. [14:34.740 --> 14:39.520] So if you look inside at the locker hardware, the thing which was for me, as someone who's [14:39.520 --> 14:43.940] like doing physical security for quite a while, is like it's extremely well-built and engineered. [14:44.240 --> 14:47.700] And what I mentioned before is that the inside lock kind of defines if it's locked or unlocked. [14:47.700 --> 14:53.820] You have some read contacts, which are kind of sensing if the latch is locked or not locked. [14:54.920 --> 15:00.160] There's also different variants of the lock, where everything is just in the front, and we have, [15:00.160 --> 15:04.820] again, read contacts, which kind of detect a couple things. But all of the locks have some [15:04.820 --> 15:10.880] kind of debug pins. So let's talk about the keys. So there's a bunch of keys, and you see we have [15:11.000 --> 15:16.220] a stack of them because we were going on shopping trips. The most important one is the yellow key, [15:16.220 --> 15:20.800] which is the programming key. Only one of them exists in the locking system. This is basically [15:20.800 --> 15:25.080] the main provisioning key. It allows you to add manager keys, to remove them, to overwrite the [15:25.080 --> 15:30.520] lock, so if you need to open the lock. It also is used to power deadlocks. So if a battery is empty, [15:30.520 --> 15:35.540] you can use it to power jump it. And it has some additional functions like cloning, functionality, [15:35.540 --> 15:40.540] audits, and some other things. Another key which is important is the black key, which is the [15:40.540 --> 15:46.200] manager key. And this is basically typically your administrator, whatever has it, you kind of, [15:46.200 --> 15:52.720] to open the locker so that you can get your stuff, or to kind of check if you have a flipper in there, [15:52.940 --> 15:57.480] a legal flipper in there. So this is kind of things which it's used for. And one thing which is very, [15:57.480 --> 16:01.120] very special for Digilog, and this is kind of, I think, one very important feature for a lot of [16:01.120 --> 16:07.080] people, is the so-called ADA key, which is in blue. And ADA means Americans with Disabilities [16:07.080 --> 16:12.680] Act. So this key allows you basically for people who cannot enter a pin physically, you just tap [16:12.680 --> 16:20.820] the key fob, and it will kind of act as a pin or as a key. Yeah, so if you take a look closer [16:20.820 --> 16:24.940] into these keys, well, all of them are kind of the same. So programming the manager keys, by the way, [16:24.940 --> 16:29.460] have exactly the same hardware, just the case is different. But price-wise, they are very different. [16:30.180 --> 16:35.080] They have a battery in there, they have a PIC18, and they have, again, very nice for us, a PIC [16:35.080 --> 16:41.720] programming interface. The ADA key is basically an I button, which will be later we will use for [16:41.720 --> 16:47.500] some things. There's one special key, which we're not going too deep into, it's a so-called data [16:47.500 --> 16:52.340] key, and what it does is basically it connects over USB to a tablet, and you can basically use [16:52.340 --> 16:56.440] it as a programming or manager key, you can have audit logs, you can pull things, you can clone [16:56.440 --> 17:00.500] logs and some other things. So this is like an additional thing, which I think they have in [17:00.500 --> 17:06.460] their fifth generation or something. It's a little more expensive, but it doesn't matter for us. [17:06.860 --> 17:13.540] All right, so what is the communication between log and key? [17:13.660 --> 17:17.040] And the thing here is, which you probably figured out very quickly already, is OneWire. [17:17.260 --> 17:21.420] And OneWire, by the way, is a very standard protocol. You find it in a lot of alarm systems, you find it [17:21.420 --> 17:26.480] like if you go to a restaurant to unlock the cash register and some other things, it's a [17:26.480 --> 17:31.200] very standard kind of thing. Which makes it great to be intercepted with logic [17:31.200 --> 17:34.920] analyzers, so there's some tools out there which you can use to basically decode the stream. [17:35.620 --> 17:42.060] They use the readrom command to ask the key for its ID, and the key returns [17:42.060 --> 17:47.760] eight bytes of ID to the log, and this is basically authentication. And the key types are [17:47.760 --> 17:53.380] identified basically by the first byte of the ID. One thing which is important if you want to [17:53.380 --> 17:58.400] do side-channel attacks or timing attacks, the bus resets for every transaction. In our talk at [17:58.400 --> 18:03.440] the Nulcon, we described how you potentially could do side-channels. One key thing to take [18:03.440 --> 18:07.940] away here is we don't use any crypto, so we kind of rely on whatever security guarantees [18:08.440 --> 18:15.180] OneWire has. All right, I want to give a quick rundown of PIC MCUs because it's kind of [18:15.180 --> 18:20.680] important to understand what's going on here. So PICs generally are microcontrollers by [18:20.680 --> 18:24.840] microchip. They're very common in locks, so literally everyone is using them. Siemens and [18:24.840 --> 18:30.860] Floss use them, Schlage use them, Kitlock uses them, so everyone uses them. And they are [18:30.860 --> 18:35.300] ideal because they are low power and ideal for battery operations. There's two flavors which [18:35.300 --> 18:40.860] we see for Digilock in particular, or for other locks. It's a PIC18, which is an 8-bit MCU which [18:40.860 --> 18:49.640] was released back in 2000, and the PIC24, which has a 16-bit MCU, which has no EEPROM data on [18:49.640 --> 18:52.880] board. So basically you can't flash the firmware onto it, but you need to store your data somewhere [18:52.880 --> 19:00.000] else. Okay, so this is an example of a random PIC18. So we have some SRAM, we have flash, [19:00.000 --> 19:05.920] we have EEPROM, as mentioned, and they support some protections. For example, you can enable [19:05.920 --> 19:09.440] code protection, you can enable write protection, and there's also a thing which is called external [19:09.440 --> 19:15.520] block table read. And on the right you can see it's consisting of multiple blocks, and at the [19:15.520 --> 19:21.160] bottom is the EEPROM part. So let's talk about the code protection. Speaking of which, code [19:21.160 --> 19:26.680] protection is, I think, a very PIC-specific term. If you work with other processors, you might know [19:26.680 --> 19:31.640] it as readout protection. And the basic idea is we have here an example log, which is not an example [19:31.640 --> 19:36.760] log, just an example chip, where the first two blocks are protected, the data is protected, and [19:36.760 --> 19:41.020] if you connect our programmer to it, what will happen is we will get, for the blocks which are [19:41.020 --> 19:48.040] protected, all zeros, but the blocks which are not protected, we get data back. So write protection, [19:48.040 --> 19:51.880] similar thing. The first two blocks are protected, the last one is protected. If you try to write [19:51.880 --> 19:57.360] with our programmer something to that, the writes will fail for them, but the other blocks are [19:57.360 --> 20:05.100] programmed. Speaking of security of these chips, these MCUs, they offer basically only basic [20:05.100 --> 20:09.320] protection against attacks. So there's many attacks which exist for these chips, even if [20:09.320 --> 20:16.340] protections are enabled. There's optical laser attacks back in 2002, there's UV erasure attacks, [20:16.340 --> 20:20.200] there's glitching, there's like overwriting of individual blocks. So there's a lot of attacks [20:20.200 --> 20:26.000] out there. So a lot of people kind of already figured out how to break these chips. [20:27.180 --> 20:34.060] Okay, let's talk about the attacks. So our naive approach was like, hey, what happens if you just [20:34.060 --> 20:38.260] connect a debugger and we do some magic with power and other things? It's not as trivial as it seems. [20:38.900 --> 20:45.780] And we try to dump the MCU. We had the luck that we exposed the data pins, both for the [20:46.280 --> 20:50.660] locks and the keys. And one thing which we found is basically that the protection settings, [20:50.660 --> 20:56.020] which we did on the locks, were very inconsistent. So what do we mean with that? So typically, [20:56.020 --> 21:01.020] as mentioned, if readout protection is enabled, you get all back, all zeros back, like on the [21:01.020 --> 21:06.200] right side. And one thing which we saw very quickly is that we didn't have the right protection [21:06.200 --> 21:11.120] enabled, which is by itself not really an issue. But the bigger thing was that if you use an [21:11.120 --> 21:15.160] external EEPROM, like this external chip, but it's not encrypted, so you can dump it basically. [21:15.820 --> 21:19.760] And this is basically the result which we had for the manager keys, for the data keys, [21:19.760 --> 21:25.900] and everything. One thing which you will see is for most locks which use more modern chips, [21:25.900 --> 21:31.380] they are not protecting the code. And all of them are not protecting the EEPROM. Which is in the [21:31.380 --> 21:36.440] case of some of them doesn't matter too much, but for especially the locks, it matters a lot. [21:39.800 --> 21:45.340] So what are we doing? So for unprotected devices, which don't have any code protection enabled, [21:45.340 --> 21:49.900] we can just dump the code memory and the EEPROM directly. So we need a programmer, [21:49.900 --> 21:52.900] we need some other hardware, but generally, you know, if you work with embedded systems, [21:52.900 --> 21:56.800] you know how to do that. For partially protected devices, it gets a little bit more tricky. So [21:56.800 --> 22:01.580] and this is an example for a lock which had the first three blocks protected, but the code was [22:01.580 --> 22:07.400] creeping into the fourth one, which was not protected. So what we were doing is we can dump [22:07.400 --> 22:14.220] the fourth block, and you can put a custom dumper into that block, which hopefully gets hit by some [22:14.220 --> 22:19.760] code or branch link, and then we can dump the other ones. There's some other methods out there, [22:19.760 --> 22:23.540] but because we kind of cash strapped and don't want to spend too much time on like buying more [22:23.540 --> 22:27.760] locks of the same kind of thing and hoping that it's the same firmware, this is basically, you [22:27.760 --> 22:32.480] know, one of the things you can do. Otherwise, you can just access the EEPROM data directly. [22:32.920 --> 22:38.760] So as the same as the other ones. We described this attack at Nucon in the talk. So if you're [22:38.760 --> 22:42.860] interested in that, but it's a very generic attack. It's kind of well known for quite a while. [22:43.420 --> 22:48.860] So basically the firmware extraction can be successful for all the locks, so we can get [22:48.860 --> 22:53.720] back the firmware. You can analyze the firmware, you can modify it if you want, you can basically [22:53.720 --> 22:59.280] load it into Ghidra because it has big support. There's no real signatures, integrity checks, [22:59.280 --> 23:04.580] which is kind of normal for that kind of things. And the methods are well established. Basically, [23:04.580 --> 23:09.080] but the thing for us is like we don't necessarily need to even look at the firmware if you have the [23:09.080 --> 23:13.700] data. So that's just like a thing. So let's talk about the EEPROM contents, because that's where [23:13.700 --> 23:18.680] the current rules are. And one thing is it requires quite a while and a lot of trial and error to [23:18.680 --> 23:22.180] figure out which data fields are for what. Especially if you have only provisioned locks [23:22.180 --> 23:25.200] and you don't have like clean locks, which are provisioned, you kind of see what the differences [23:25.200 --> 23:30.600] are. And the data fields also differ slightly between lock generations and between lock types. [23:30.600 --> 23:34.820] So this is not accurate for all the locks. It's just one example for like an older fourth [23:34.820 --> 23:40.780] generation lock. But what we see typically is we have a partial programming ID. We see the amount [23:40.780 --> 23:47.200] of manager keys. We see what kind of manager key is provisioned on that. We see if like a pin was [23:47.200 --> 23:55.340] set, ADA key ID, or like RFID UID. So if you tap the UID, you know, RFID. And there's also failed [23:55.340 --> 24:00.620] pin counter. And for older locks, bad things might happen if you run over that. Just don't. [24:00.620 --> 24:06.880] Okay, as a general observation is some locks don't wipe the user pin or the key after it has been [24:06.880 --> 24:11.400] unlocked by the user. And some, especially newer versions do. So at some point, I think we figured [24:11.400 --> 24:16.300] out there's a problem and we kind of fixed that. All right, so let's talk about emulation and [24:16.300 --> 24:23.660] cloning keys. Well, and this kind of thing applies to both RFIDs and keys. So we only need the ID [24:23.660 --> 24:29.480] basically to clone the key. And we cannot extract from the key or the flash depending on, you know, [24:29.480 --> 24:34.480] what kind of media we have. And we can emulate it with an Arduino, with a Flipper Zero, or in [24:34.480 --> 24:40.780] case of RFIDs with a Proxmark. The thing is, it looks a little bit easy, but you have to kind of [24:40.780 --> 24:45.020] build like a custom PCB, which does a couple things to kind of, you know, wake up the lock in [24:45.060 --> 24:48.680] a particular way. So it's not as trivial as you can do it right now. You need to kind of put some [24:48.680 --> 24:53.720] effort into that. So don't go home and just program an Arduino. It won't work. All right, [24:53.720 --> 24:57.560] what kind of other ideas could you have if you want to attack them? Well, you could try to brute [24:57.560 --> 25:02.260] force pins and keys, which works for older locks very well, but for newer locks not so much. You [25:02.260 --> 25:05.380] can do side-channel attacks, which works for all of them as far as we know, but it's very [25:05.380 --> 25:10.420] complicated, takes like days. You can clone the lock configuration by one wire if you have a valid [25:10.420 --> 25:16.240] key, and you can try to modify the contents of EEPROMs. Also, you could think of like building [25:16.400 --> 25:20.880] a malicious firmware. We thought about that, but I mean, it's not really necessary to do. [25:21.700 --> 25:25.840] If you're interested in the first two attacks, you can take a look at the slides at NuCon. [25:26.800 --> 25:31.520] Now, probably one of the reasons why you guys are here is the cease and desist incident. [25:31.580 --> 25:37.140] So our talk was basically meant to be on Friday at 11 a.m., and the day before at 2 p.m., we basically [25:37.140 --> 25:42.320] got an email, cease and desist, which kind of came to a couple of things, like Copyright Act, [25:42.320 --> 25:47.800] Defend Trade Secrets Act, you know, obviously other things like the Computer Fraud and Abuse Act, [25:47.800 --> 25:53.080] and the DMCA. And the interesting thing here is, and I want to especially thank [25:54.500 --> 25:59.840] Corey to kind of connect us so quickly, who's sitting in the front, thank you. By 3.30, [25:59.840 --> 26:03.580] basically slightly more than an hour later, we were sitting already in a hotel room and talking [26:03.580 --> 26:10.100] to lawyers from the EFF and also from Kurt, and we were basically figuring out what was going on. [26:10.260 --> 26:13.980] And so to kind of, because it was very short notice, we kind of moved the talk from Friday [26:13.980 --> 26:17.480] to Sunday. We probably could have given the talk on Friday, but we decided like, okay, [26:17.480 --> 26:21.860] it might be worth to kind of figure out what's going on. On Saturday, so yesterday, we had a [26:21.860 --> 26:27.440] phone call in both of everyone, we kind of exchanged views, we kind of resolved our differences, [26:27.440 --> 26:31.160] and in that call, we kind of pulled the cease and desist back. And officially today, [26:31.160 --> 26:35.360] shortly after midnight, we got like the withdrawal in writing for the cease and desist. [26:35.800 --> 26:39.980] One thing which I want to quickly say is like, there's like a kind of official response from [26:39.980 --> 26:43.460] Digilog. They kind of acknowledged that we communicated with them prior to DEF CON, [26:43.460 --> 26:50.100] we gave them the slides even, which was maybe a mistake, maybe not. They promised to do some [26:50.100 --> 26:54.440] improvements. For example, they want to enable code protection on their logs. For the data [26:54.440 --> 27:00.280] blocks, they want to enable for the firmware. They want to encrypt somehow the communication [27:00.280 --> 27:06.600] between the keys and the log, so that you cannot clone the UID anymore, and they want to encrypt [27:06.600 --> 27:12.720] EEPROM data if it's external. They also told us that in over 32 years, we had no reported security [27:12.720 --> 27:19.100] incidents due to a hacked log, which I believe. And they also are very committed to the security [27:19.700 --> 27:25.360] solution for their customers. And I put a full statement, which they sent us on slide 70. So [27:25.360 --> 27:30.480] if you look later on the slides, you'll find it in the back. All right, that's all for Digilog. [27:30.660 --> 27:44.730] Let's move on with the next company and Braylon. Cool. So let's shift gears and talk about a [27:44.730 --> 27:52.790] being Schulte Schlagbaum AG. So this is a German company. They've been in business since 1833. So [27:52.790 --> 27:58.570] quite an old company. These are more widely used in Europe and Germany. They produce both [27:58.570 --> 28:04.230] mechanic and electronic locker locks. We took a look at the brand called Sabotronic. They also [28:04.230 --> 28:10.770] produce door locks, but we didn't take a look at those. We think they might be on the same platform, [28:10.770 --> 28:19.370] but we're not entirely sure. So the electronic locks accept both pin and RFIDs or RFID plus pins [28:19.370 --> 28:25.790] as access mediums. And they do provide audit log support. So let's talk about the LS series [28:25.790 --> 28:32.970] of locks. These are based on the STM32 MCU, and they also have SPI EEPROM. As for security, [28:32.970 --> 28:38.290] we found that SWD and debugging was not disabled and their EEPROM is not encrypted. [28:38.930 --> 28:43.050] And we noticed a lack of physical tamper switches in the locks. [28:44.050 --> 28:50.850] So as you can see, these are PCBs for three different locks. We think that they tried to [28:50.850 --> 28:57.230] save money by using the same design for nearly a decade. They use the same PCB, but they leave [28:57.230 --> 29:04.010] ICs unpopulated. So if you buy a lock that has pin support, you'll get an MCU for the keypad [29:04.630 --> 29:11.670] and a different MCU for RFID, and you'll get both for the RFID and pin supported locks. [29:11.670 --> 29:20.430] We also noted a difference in SPI EEPROM sizes. Okay, so let's talk about the management keys for [29:21.610 --> 29:28.990] some of the RFID SAG locks. So their RFID locks support MyFair Classic, MyFair Deskfire, [29:28.990 --> 29:35.210] and some ISO compatible tags. For the higher end locks, there are special RFID keys that are [29:35.210 --> 29:39.990] required for programming. There's a master key one and two. Those are used for unlocking and [29:39.990 --> 29:46.790] relocking lockers. There's also a data RFID tag for data transport, if you need to like pull audit [29:46.790 --> 29:52.230] logs off of certain locks. There's also like a physical communicator device, which is like [29:52.230 --> 29:57.510] an advanced handheld programmer, but we didn't take a look at that. We tried to procure a set [29:57.510 --> 30:06.210] of these programming keys, but they were $1,400 for eight MyFair Classic tags. So we didn't think [30:06.210 --> 30:12.950] it was worth the money, so we didn't take a look at those. So just a quick overview on how we dumped [30:12.950 --> 30:19.890] EEPROM contents just using an SOIC clip. We were able to interface with the EEPROM and dump the [30:19.890 --> 30:27.170] context, as you can see in the hex file. We were able to pull the master pin and the user set pin, [30:27.170 --> 30:33.590] this is just totally unencrypted EEPROM with pins that are available for anyone who can read it to [30:33.590 --> 30:40.950] see it. We also found that there are audit logs on the EEPROM as well. There are 500 entries, [30:40.950 --> 30:47.670] including a timestamp and a status code, with the status code 50 allowing you to see used pins and [30:47.670 --> 30:54.670] the RFID UIDs that have been used. So the last 500 you can see, yeah, all of that. [30:55.670 --> 31:02.490] So how did we extract firmware? We noticed on the PCB there was solder mask covering the SWD, [31:02.490 --> 31:06.970] like copper pads, so we scratched that off and we were able to interface with it [31:06.970 --> 31:13.730] and connect to SWD. And that allowed us to see that the devs didn't set the read protection byte. [31:14.330 --> 31:18.230] And as such, we were able to get the full firmware from these locks. [31:19.450 --> 31:26.150] So there are a couple of physical flaws on these locks. We noticed that the motor power wires [31:26.650 --> 31:32.970] and potentially debug pins are accessible from outside of the lock through a clipped plastic [31:32.970 --> 31:43.030] cover. So there's just a huge gap, as you can see, the power wires to the actual motor. [31:44.610 --> 31:49.570] And yeah, as you can see on the right, we were able to fit like a whole card under there. So [31:49.570 --> 31:56.230] that might allow us to tamper with the lock motor and do some physical hacking there. [31:56.910 --> 32:01.550] So we'll take it, we'll talk about a couple of other manufacturers now. One of them being [32:01.550 --> 32:06.950] Compact Security Company. This is a US company founded in 1903. So again, another pretty old [32:06.950 --> 32:14.430] company. We took a look at the regulator series. These use the PIC-16 MCU. And these locks accept [32:14.430 --> 32:20.750] user pins, technician pins, master pins. And there is some audit logging support for some models. [32:21.430 --> 32:26.690] As for security, we found that code data and write protection were enabled on all these locks. So [32:26.690 --> 32:32.470] that's good for them, but not very fun for us. So we kind of moved on. But we took a look at [32:32.470 --> 32:37.430] their documentation and saw what they were using for a programming slash audit tool. [32:37.850 --> 32:46.010] An Excel spreadsheet. I don't know what kind of Excel macro hell is happening here. I'm glad I'm [32:46.010 --> 32:51.370] not the person who has to maintain this and write this. But if it works for them, I'm happy for them. [32:51.370 --> 32:59.330] So next we'll talk about Kitlock. This is a sub-brand of CodeLocks. This is a UK-based [32:59.330 --> 33:06.930] company founded in 1991. This also uses the PIC-16 MCU. And again, accepts user pins, technician [33:06.930 --> 33:12.510] pins, and master pins. And again, they had code data and write protection enabled. So good for [33:12.510 --> 33:19.970] them, not fun for us. So for good measure, we took a look at a couple of no-name RFID locks from [33:19.970 --> 33:26.030] Amazon and eBay. These are just like $20 locks. Super cheap. We took them apart and found that [33:26.030 --> 33:32.670] they had EPROM and some kind of mystery MCU. If you like mystery MCUs and know what this is, let [33:32.670 --> 33:42.890] us know. Obviously, you can't really have many expectations of security on these cheap devices. [33:42.890 --> 33:48.930] So there's no encryption, no protection, and plain text RFID UIDs are just there for anyone to read [33:48.930 --> 33:58.810] it. Okay, so we're going to do a quick demo now to show how you can hack some of these locks. [33:59.630 --> 34:04.170] All right, due to the season, we will change the demo slightly. So usually, we were kind of [34:04.170 --> 34:08.890] thinking of doing a whole rundown on how we can extract manager keys and other things. What I [34:08.890 --> 34:13.730] would do instead is I would showcase our custom PCB, which we built ourselves and took us some [34:13.730 --> 34:18.670] time to develop it. What it basically does is it emulates the same function as a manager key, [34:18.670 --> 34:23.290] so I will just show you. So I locked all the lockers from DigiLock in this case, [34:23.290 --> 34:28.130] and I will just kind of show how I can hopefully open them again. Yeah. [34:29.370 --> 34:35.930] Okay, just like a quick example of a theoretical scenario. So we're going to assume that the [34:35.930 --> 34:43.350] attacker has access to any open locker or cabinet with the tools, the microchip, [34:43.630 --> 34:49.010] a picket 3 debugger, a Phillips screwdriver, and an Arduino and or flipper. We're using the [34:49.010 --> 35:01.750] flipper here. So our criminal has already set the key onto the flipper, and we are able to access [35:01.750 --> 35:10.710] the locks. Yeah, so to be fair, we put a lot of effort into like figuring it out already. So this [35:10.710 --> 35:15.770] is like basically if you got access to a lock, you somehow extracted that, you built that kind [35:15.770 --> 35:22.970] of tool. There's a magic back set which we don't show. So the attack will work very quickly after [35:22.970 --> 35:26.550] that. Now the obvious thing is if you want to extract secrets from these locks, you need to [35:26.550 --> 35:30.610] kind of disassemble them, so you need a screwdriver. The locks which are kind of just having the front [35:30.610 --> 35:34.630] part are super annoying because you need like a very special key to kind of unscrew them. [35:34.710 --> 35:39.170] But generally, to open and relock them again without resetting the original pin, [35:39.170 --> 35:43.530] that's basically all you need. But this might take you some time to do. [35:43.650 --> 35:48.490] All right. That's for that. Let's go to the conclusion. [35:49.850 --> 35:55.310] Okay. In summary, we were able to extract firmware and keys from these brands of locks. [35:56.450 --> 36:02.530] So access to one lock can give you access to all locks in one system or one location. [36:03.170 --> 36:09.490] Cloning and emulating keys is possible. And these attacks don't require complicated tools [36:09.490 --> 36:13.750] and are sometimes cheap unless you're using the flipper. That's a little bit more expensive. [36:14.250 --> 36:20.230] So how secure is your stuff in electronic lockers? Not super secure. But we need to be [36:20.230 --> 36:24.990] fair because these locks are not being sold as high security devices. They're not promising [36:24.990 --> 36:32.190] like military grade security or anything. These are just standard use locks. So how can we fix [36:32.190 --> 36:38.090] this? Of course we would recommend a security by design approach from the beginning. So enable all [36:38.090 --> 36:43.710] security features and always expect physical attacks when you're producing locks. Encrypt [36:43.710 --> 36:49.430] your secrets, store them in a secure way. So the best solution for vulnerable locks would be to [36:49.430 --> 36:54.370] have firmware updates for all of them. But depending on the age of the locks, this might [36:54.370 --> 37:01.410] not be possible. And in our opinion, it seems unfixable. So the workaround could be to use a [37:01.410 --> 37:06.610] programmer to enable code protection. But this only works if data is stored on the MCU and not [37:06.610 --> 37:13.730] on an external EEPROM chip. So this task is kind of complicated for an average and non-tech savvy [37:13.730 --> 37:19.890] user. So it's not a reasonable expectation. So the likely solution would be to buy new locks or just [37:19.890 --> 37:28.610] ignore the problem and hope it goes away. So takeaway lessons. Please don't reuse your important [37:28.610 --> 37:36.390] pins for lockers. Like public use lockers. Again, don't reuse your pins for your debit cards, your [37:36.390 --> 37:41.290] phone. Use separate things. Use like we're all using separate passwords now for everything I [37:41.290 --> 37:49.250] hope. So treat your pin like a password and never loan out your electronic keys. And always be [37:49.250 --> 37:55.190] aware of security limitations of devices. And you cannot trust audit logs of these devices because [37:55.190 --> 38:00.810] they can be tampered with. So even experienced and big companies make mistakes. And developing [38:00.810 --> 38:08.950] stuff is way harder than breaking it in 90% of cases. So be nice to developers. It's hard when [38:08.950 --> 38:13.410] people are attacking your stuff. And always remember there might be interesting cyber physical [38:13.410 --> 38:19.670] systems around you. So don't forget the human factor. Can you just ask nicely for the manager [38:19.670 --> 38:27.630] key? So final notes. Please don't break into lockers you don't own. I know these systems are [38:27.630 --> 38:34.210] in a lot of places. Hotels and such. But please don't. Messing with these locks can also permanently [38:34.210 --> 38:38.810] break them. Which is kind of the standard expectation when you're hardware hacking. You can [38:38.810 --> 38:45.710] always break things quite easily. Be careful. There are more attacks that we haven't covered here. [38:46.390 --> 38:51.450] Other companies and products are possibly vulnerable too. And just because they claim [38:51.450 --> 38:59.390] that they've never been hacked doesn't mean they're unhackable. Of course. And yeah. Thanks all. [39:05.060 --> 39:10.460] So I would like to also give special thanks to Corey who kind of connected us with Delorios. [39:10.460 --> 39:17.600] To Tara who did that too. To our counsel Hannah and Kurt. And to Andrew. And everyone at EFF. [39:17.600 --> 39:24.280] This kind of gave me again a motivation to definitely donate a lot of money to the EFF. [39:24.660 --> 39:30.940] One maybe side story is that Braylon was at B-Sides before this event and was getting a [39:30.940 --> 39:34.840] membership for EFF and was kind of joking like oh we might need you tomorrow. And lo and behold [39:34.840 --> 39:40.840] literally one day after that, on her birthday of all effects, both of us got a cease and desist [39:40.840 --> 39:45.920] letter. So if you have questions, we might be still around here. Otherwise feel free to contact [39:45.920 --> 39:53.400] us. Yeah. And thank you very much for being here. Right. So yeah. If you also want to read the [39:53.400 --> 39:58.260] statement, it will be in the slides. And I hope we will find a solution also to kind of fix the [39:58.260 --> 40:02.560] older locks. So there's probably a way we will figure it out together. Thank you.