[00:00.000 --> 00:05.380] I'd like to welcome you on our talk, Nano Enigma, Uncovering the Secrets Within [00:05.380 --> 00:10.180] EFUSE Memories. First of all, allow me a brief introduction. My name is Martin and I'm [00:10.180 --> 00:15.120] here together with my colleague Michal. We also have a third partner in crime named [00:15.120 --> 00:19.480] Hayan, however he couldn't come here with us so we just have a pre-recorded message from [00:19.480 --> 00:24.700] him. We all work in the embedded system security testing team that's based in Prague, [00:24.700 --> 00:29.120] Czech Republic, which is under Accenture Umbrella, and we all have different fields of [00:29.120 --> 00:33.560] focus. So for me that's reverse engineering, so I'm usually that person that wants that [00:33.560 --> 00:40.060] firmware image unencrypted. So making me shut up was partial motivation of this talk. I'm [00:40.060 --> 00:44.080] pretty sure the other guys will tell you briefly about themselves when their time comes, so [00:44.080 --> 00:48.660] I'm just going to jump straight ahead into the overview. We have it in the title, we will [00:48.660 --> 00:53.960] be talking about EFUSEs, and EFUSE is an electronic component which is just two points [00:53.960 --> 00:59.720] interconnected with a connection that has a property that it burns or terminates when the [00:59.720 --> 01:04.940] current flowing through it exceeds certain threshold. This is really useful when you want to [01:04.940 --> 01:09.580] protect your home appliances from overcurrent, but it's also really useful when you want to [01:09.580 --> 01:14.700] create something called one-time programmable memory. Because if you represent bits with [01:14.700 --> 01:21.340] EFUSEs, once you change state of a bit from zero to one, you cannot ever unchange it back to [01:21.340 --> 01:28.380] zero. This basically means that you can change the state of the device permanently. This is [01:28.380 --> 01:32.980] really useful for security because now you can use these types of memories to, for example, [01:32.980 --> 01:39.620] disable debugging interfaces or enable secure boot or put there public keys for secure boot. [01:39.720 --> 01:44.840] However, some manufacturers took it one step further and they actually used these EFUSE [01:44.840 --> 01:50.040] based memories for storing information that requires confidentiality protection. Meaning [01:50.040 --> 01:55.520] that you can find there also flash memory encryption keys or passwords for debugging [01:55.520 --> 02:01.380] interfaces. But since I mentioned that that connection burns or terminates, there's actual [02:01.380 --> 02:07.000] physical change inside that component. So how do you protect confidentiality of something that [02:07.000 --> 02:11.780] could be observed through microscope? Because, for example, if I Google EFUSE microscope, [02:11.780 --> 02:17.140] you're going to get all the images like burned and unburned examples. So the protection [02:17.140 --> 02:23.020] measure you mainly used in some of the chips we looked at was layering. So layering is [02:23.020 --> 02:28.380] normal way of making chips where you stack components on top of each other. However, if [02:28.380 --> 02:32.820] you put that EFUSE based memory in the very bottom layer, you can then consider it [02:32.820 --> 02:38.220] protection because you can't directly observe it. This is based mainly on an assumption [02:38.220 --> 02:43.400] that performing the layering process, so removing carefully the layers from the chip so [02:43.400 --> 02:48.980] that you can extract information from it, is very complex and expensive process. But we [02:48.980 --> 02:54.660] are here at DEF CON because we have proved this assumption wrong. And we will demonstrate [02:54.660 --> 03:01.240] you all these techniques on an ESP32 chip from Espressif. However, keep in mind that all [03:01.240 --> 03:06.180] of what we will be presenting here is also generally applicable to just about any chip that [03:06.180 --> 03:12.120] is using an EFUSE based memory. And with that, I'd like to pass my word to Michal, who's [03:12.120 --> 03:14.620] going to walk you through the details of the attack. [03:17.740 --> 03:28.980] Hello, my name is Michal Grigarek and I'm also a part of Accenture Prague. At first, I must say I'm [03:28.980 --> 03:39.080] really proud to be here on this stage to present you results of our work. So my colleague [03:39.080 --> 03:46.360] Martin just explained what EFUSE is for. And now let's take a look more closely how we can [03:46.360 --> 03:53.180] observe these structures in much more detail and what technologies and skills we will need. [03:57.440 --> 04:04.800] First, we must decapsulate the chip. Decapsulation is the process when we extract the [04:04.800 --> 04:13.020] silicon plate from the epoxy housing. Of course, there exists some other material for housings, but [04:13.020 --> 04:22.680] for purposes of this presentation, we only consider only epoxy materials. There we see four basic [04:25.040 --> 04:34.340] techniques for decapsulation. Thermal, chemical, laser and plasma. Thermal method, this method [04:34.340 --> 04:42.300] uses only a blowtorch or a heat gun, simply to heat up the epoxy housing and then slowly and [04:42.300 --> 04:54.440] carefully break it and obtain the epoxy silicon plate. Chemical decapsulation uses concentrated [04:54.440 --> 05:03.960] chemicals, concentrated acid to dissolve the epoxy housings. Laser etching uses a strong laser [05:03.960 --> 05:12.920] beam to vaporize the epoxy material. But this method is quite risky because it is very easy to [05:12.920 --> 05:24.820] burn the silicon plate. And my problem lies in the heat deposition to the sample. And the last, [05:24.820 --> 05:33.220] plasma one. This process involves ionized gas or plasma to selective etching of materials. [05:36.790 --> 05:43.270] So, due to its availability and good traceability, we decided to use a chemical method of [05:43.270 --> 05:54.030] decapsulation. Especially, we used concentrated acid. In our case, concentrated acid means 96% [05:54.030 --> 06:04.690] of concentration, which must be heated to approximately 250 degrees Fahrenheit. [06:05.250 --> 06:12.310] The chemical methods can be effectively combined with laser ablation. At first, laser removes a [06:12.310 --> 06:21.030] large part of the housing and then the remaining can be dissolved in the acid. This shortens the [06:21.030 --> 06:35.750] process during the GPS exposure to the acid which is needed. The acid will dissolve the housing [06:35.750 --> 06:48.390] residue, leaving only the dye. Of course, we must use appropriate protective equipment. [06:49.530 --> 06:59.230] After this process, we obtain a beautiful etched chip suitable for other investigations. [07:04.190 --> 07:17.820] Because the chip has typically metallization on its top layers, we do not see any internal layers at the first. [07:19.080 --> 07:29.900] So, we must etch the surface to obtain these structures. And this process is called the layering. [07:30.300 --> 07:37.400] Again, we have seen on this slide four types of basic methods of the layering. [07:37.900 --> 07:47.300] Mechanical is the cheapest and starting at about $100. Chemical, when we consider only [07:47.300 --> 07:58.020] chemical, it is also not expensive. Laser ablation uses very short, precise femtoseconds pulses of [07:58.480 --> 08:07.580] laser beam to ablate the surface, but it is quite costly, starting at 50k USD. [08:08.400 --> 08:15.700] And the last, the plasma, this is simply the nanomachining using an ion beam, [08:15.700 --> 08:27.490] offers maximum precision, but comes, of course, with maximum price tag as well. [08:27.490 --> 08:34.110] Due to the cost-effectiveness, we choose to do mechanical etching with a wet stone. [08:34.850 --> 08:42.430] I just slide a piece of silicon with my finger over the stone. Of course, we must [08:42.430 --> 08:49.350] use a grinding stone with the highest possible grit size. In our case, it is 8000 grit. [08:50.850 --> 08:59.310] Of course, it requires some skill, and I personally mastered it around 10 samples. [08:59.570 --> 09:04.690] Too much pressure quickly obtains the background, and it means we must start again. [09:05.250 --> 09:13.890] But with patience and systematic polishing, we can obtain a beautiful etched chip within 30 minutes [09:13.890 --> 09:26.310] or one hour. Unfortunately, wet stone etching alone isn't enough. Our stone head grain [09:26.310 --> 09:34.990] size is about 2 microns, but for the final stage, it is necessary to use a diamond lapping foil, [09:35.530 --> 09:45.770] which grain size is less than 0.5 microns. These foils make a significant difference, [09:45.770 --> 09:51.970] providing a much smoother surface and, of course, reducing the number of scratches. [09:54.110 --> 10:04.270] I tried to prepare the sample on the industrial machine, costing around 60-65 TSD. [10:04.910 --> 10:13.890] And as we see on these pictures, mostly the same results can be achieved when I use [10:14.610 --> 10:20.610] wet knife etching stone and the lapping foils purchased on Aliexpress for 100 bucks. [10:25.740 --> 10:31.440] Another important task is to locate the eFuse memory bank itself. [10:32.000 --> 10:42.060] The largest part of the chip is taken up by logical circuits. It is easily identified and [10:42.840 --> 10:47.740] can be skipped. The other radio frequency part is [10:50.880 --> 10:58.120] good visible, too, and can be skipped. And the rest will have the rectangular [10:58.780 --> 11:05.380] purple areas, and these are memory types such as RAM, flash, and our eFuses. [11:06.920 --> 11:13.260] The eFuse memory cell is essentially a fuse, which is a conductive structure [11:14.040 --> 11:23.480] with a weak point. In our case, it's looking like some triangle with a line going through it. [11:24.500 --> 11:30.660] It's looking like a flag, maybe. And at approximately 500 times [11:30.660 --> 11:37.180] magnification, clear, repeating, isolated structures of our eFuses become visible. [11:37.180 --> 11:45.960] They are relatively small, and each eFuse represents one bit smaller than one micron. [11:47.240 --> 11:56.780] We have successfully located these eFuse banks on ESP32 version S2, S3, and C6. [11:56.780 --> 12:07.160] It is positioned slightly differently on the C6, but the construction is the same. [12:09.410 --> 12:17.850] And now optical microscopy. Observation with optical microscopy has its limits. [12:18.410 --> 12:25.530] Maximum resolution of optical microscopy is around 400 nanometers, which corresponds with [12:26.450 --> 12:36.450] 2000 times magnification. That is nearly physical limits. This magnification is suitable for [12:36.450 --> 12:40.950] locating our structures, our eFuse bank. [12:41.190 --> 12:49.710] And on well-prepared sample, we can even see if the eFuse is burned or not, [12:49.710 --> 12:57.350] or programmed or not. The term burned is fitting, because when we program data into the eFuse [12:57.350 --> 13:08.790] memory bits, during programmation, current flows through the eFuse and physically change [13:08.790 --> 13:16.350] its structures. And these changes are observable by optical or scanning electron microscopy [13:16.870 --> 13:26.350] technology. For the size comparison, a human hair is 100 times bigger than our eFuses. [13:29.960 --> 13:36.640] In order to read their states correctly and repeatedly, we of course need some much more [13:36.640 --> 13:42.880] advanced imaging technique. And it is scanning electron microscopy, which provides much higher [13:42.880 --> 13:52.200] resolution. Scanning electron microscopy provides approximately 100 times better resolution. [13:52.480 --> 13:56.300] As I said, since optical microscopy has a resolution around [13:56.300 --> 14:02.140] 300 nanometers, scanning electron microscopy has a resolution approximately [14:02.140 --> 14:08.760] 5 nanometers, which corresponds to magnification 100,000 times. Of course, [14:08.760 --> 14:16.440] these parameters can apply specifically to our scanning electron microscope. It is Hitachi FlexSAM. [14:17.240 --> 14:22.680] The image compares the level of detail we can achieve with these methods. [14:22.680 --> 14:25.080] And the difference is significant. [14:27.180 --> 14:33.820] This is what the eFuse looks like at even higher magnification using a large electron microscope. [14:34.240 --> 14:40.720] And this image shows their 3D structures, which essentially looks like a printed circuit board. [14:40.760 --> 14:47.640] Everything is visible at the nanoscale. On the right image, right bottom, we see detail of [14:47.640 --> 14:56.460] unburned eFuse, clear eFuse, representing logical zero. And on the left image, we see burned eFuse, [14:56.460 --> 15:07.470] representing logical one. Once we obtain higher resolution images of our eFuses, [15:08.000 --> 15:14.980] we can read the data stored in them. In my initial experiments, I manually transcript [15:14.980 --> 15:24.830] the data to the Excel bit-by-bit, fuse-by-fuse, which was extremely time-consuming. [15:25.960 --> 15:33.290] And it requires intense focus to avoid error because bits look very similar. [15:34.440 --> 15:44.420] It takes about 10 hours to read one bit of 4,096 bits. And additionally, mapping the [15:44.420 --> 15:50.300] logical memory address to a specific cell on the silicon die was also very, very challenging. [15:52.360 --> 15:59.080] I had to carefully read and transcript about 20 kilobytes of data before we had enough [15:59.080 --> 16:06.800] for our analysis. It truly feels like a forensic investigation. And now my colleague [16:06.800 --> 16:12.400] demonstrates how to assign a logical address to a physical location of a given memory. [16:12.400 --> 16:13.500] Please, Martina. [16:16.160 --> 16:20.540] Thank you, Michal, for extracting all this data during your vacation. [16:21.740 --> 16:25.960] Now that we have the raw data, we have to somewhat put meaning to it so that we have [16:25.960 --> 16:30.900] some useful information out of it. The best place to start with is documentation because [16:30.900 --> 16:36.220] it actually mentions a lot of information about both logical and physical alignment of the memory. [16:36.480 --> 16:40.340] From the logical perspective, it will tell us that there are 11 of eFuse blocks and that [16:40.340 --> 16:46.920] 0, 1, and 2 are used for system purposes. These basically store MAC address, chip ID, [16:46.920 --> 16:52.120] and chip configuration that you can set. The rest of the blocks are user programmable, [16:52.120 --> 16:56.460] meaning you could put whatever you want there. However, their primary purpose is actually to [16:56.460 --> 17:02.720] store the secure boot keys or the flash memory encryption keys. From the physical perspective, [17:02.720 --> 17:07.660] the information is a little scarce, but it will tell us that there are four backups of block 0, [17:07.660 --> 17:14.460] meaning that any single eFuse burned in block 0 will actually result in four actual fuses burned. [17:14.800 --> 17:19.620] And blocks 1 to 10 are using Reed-Solomon coding scheme for automatic error correction. [17:19.620 --> 17:25.380] This is just 12 bytes added to each of the blocks, but it could prove useful in case we [17:25.380 --> 17:29.860] cause some damage during the layering process, so we'll talk about that briefly later. [17:30.140 --> 17:34.860] So with that, let's summarize what we want to know. We have a lot of bits. We now need to [17:34.860 --> 17:39.200] assign them to the bytes. Then we want to take those bytes, put them in the correct order, [17:39.660 --> 17:45.500] and have them assigned in the blocks, and then voila, we will have our flash memory encryption [17:45.500 --> 17:51.480] key. To do that, we performed several experiments, and the first one was a really stupid one, [17:51.480 --> 17:57.040] and I came up with it. And it was like, let's burn values FF into the first block of an eFuses [17:57.040 --> 18:01.580] so that we can locate where it is. However, at that time, we didn't really know how painful it [18:01.580 --> 18:07.500] is to actually read them. So we kind of wasted this experiment, because if you burn only FF [18:07.500 --> 18:13.300] values, you can very well detect where the first block is, but you really can't detect how the [18:13.300 --> 18:17.960] bit assignment works inside these bytes and how the byte order works in the blocks, because that [18:17.960 --> 18:25.180] information just doesn't exist in such a memory. So we quickly transitioned to the second experiment. [18:25.200 --> 18:30.960] In this case, we were a bit smarter, so we burned in unique patterns into the eFuse blocks, [18:30.960 --> 18:35.160] and these unique patterns had something in common, and that is that the most significant [18:35.160 --> 18:41.820] bits of all of the bytes in these patterns were set to one, either three or four of them. [18:42.380 --> 18:46.660] This was because, just from an overview of the memory, if you look at the middle picture, [18:46.660 --> 18:51.260] the big one, you can see a lot of red color in the upper portion, those are the ones, [18:51.260 --> 18:56.600] and that the lower portion has a lot of variety in it. You may think there's an ASCII text written [18:56.600 --> 19:01.900] at the bottom line, at the bottom of the picture. There are no hidden messages, this is purely [19:01.900 --> 19:07.620] coincidence. But if we take the only useful information from the very first experiment [19:07.620 --> 19:13.560] and filter out in those Excel files the rows that were associated with the first block, [19:13.560 --> 19:18.540] we can clearly see our pattern. So in this case, we now know that the bits are organized in columns [19:18.540 --> 19:23.720] with the most significant bits in the upper portion of the memory, and we also know the [19:23.720 --> 19:29.480] byte-endianess inside the blocks. This is enough for us to just extract any information we want from [19:29.480 --> 19:36.540] these memories. We did several other experiments, mainly to confirm that the memory is working the [19:36.540 --> 19:42.020] same way also on the other lines of the chip, so we did on S2, S3, C6, as Michael was saying. [19:42.400 --> 19:47.380] And the third one I'm showing you here isn't really interesting from the memory layout evaluation, [19:47.380 --> 19:54.100] but it's rather interesting because of those white fields there. Again, I am to blame for that, [19:54.100 --> 19:58.500] because when you do the layering on the whetstone and you don't clean the whetstone, you have a [19:58.500 --> 20:04.600] debris that's left there, and when you keep scratching with your finger, you create these [20:04.600 --> 20:10.960] gigantic canyons in that memory, where the e-fuses are just completely gone. In this case, [20:10.960 --> 20:16.660] that Reed-Solomon automatic error correction could actually prove useful to recover the information. [20:16.660 --> 20:22.440] However, for future-proofing these methods, we rather spend the time on improving the [20:22.440 --> 20:27.680] layering method, because, for example, block 0 here doesn't have any automatic error correction, [20:27.680 --> 20:32.280] and the other chips don't have that as well. It was just that in the case of ESP32, [20:32.280 --> 20:36.480] if you do some damage to the chip, you can actually recover for it using this automatic [20:36.480 --> 20:44.320] error correction. So now, this image will show you the layout of the memory, so the full green row at [20:44.320 --> 20:50.660] the top and the bottom of the picture, and six others, full green rows in between, that's block [20:50.660 --> 20:57.560] 0, so that's where those four times duplicated values actually go to. For example, if you disable [20:57.560 --> 21:04.480] JTAG, that's where four e-fuses will be burned. And the rest of the colorful blocks, and I'm sorry [21:04.480 --> 21:10.260] for using too many shades of green, but I'm bad with colors. Anyway, the rest of the blocks here [21:10.260 --> 21:16.520] are the user-writable blocks. Most tutorials on the internet will just tell you, please put your [21:16.520 --> 21:21.860] encryption key into the purple one here, so that's where we will be focusing the most, but [21:23.000 --> 21:27.020] once you know the alignment of the blocks, it doesn't really matter which blocks you extract, [21:27.020 --> 21:33.080] you just get the coordinates from the extracted data. The biggest problem at this point was that [21:33.080 --> 21:39.740] Michael refused to read that manually anymore, after whatever amount of bits he read, so we had [21:39.740 --> 21:45.820] to turn to our machine learning guru to help us automate the process. His name is Hayan and he [21:45.820 --> 21:51.260] unfortunately couldn't be here with us, but he pre-recorded the message, pre-recorded his part [21:51.260 --> 21:57.220] of the presentation, which I'll try to play now. There's about a 50% chance it's going to play. [21:57.880 --> 22:02.780] If it does not, I will still play it and I'll try to comment it, so you will not learn anything [22:02.780 --> 22:04.420] useful. So, let's see. [22:05.520 --> 22:10.800] Hello, I'm Hayan Ali, security delivery senior analyst in Accenture, and also I'm doing a PhD [22:10.800 --> 22:15.340] in using machine learning for violin clubs. I will go through the automation process [22:15.340 --> 22:19.460] and show you finally a demo about it. Let's go. [22:20.320 --> 22:26.600] Instead of a visual reading of the effuses from the images, we automated the process. [22:26.600 --> 22:32.700] We started from the output of microscope, where there are around 200 images for each one. [22:33.020 --> 22:36.520] First, we stitched these images to get only one image per bank, [22:36.520 --> 22:41.420] then pre-processing before applying the machine learning, then applying the machine learning [22:41.420 --> 22:49.360] object detection model, then extracting the effuses values into the arrays. [22:49.860 --> 22:55.600] The microscope provides high-resolution images when working in zigzag mode. In zigzag mode, [22:55.600 --> 23:02.200] the microscope scans the bank in zigzag line, as we see here in the figure, generating around [23:02.200 --> 23:11.980] 200 images for each bank. Each image is 2,560 by 1,920. We can see this image is high-resolution [23:11.980 --> 23:17.520] image, as we can distinguish between the off effuse, which is the default state, and the [23:17.520 --> 23:28.980] one which is the on case. We keep margin by 35% between images to avoid wasting any pixels. [23:30.300 --> 23:39.280] Then we stitch these images to get one image per bank. But when using the embedded stitching tool [23:39.280 --> 23:46.640] in the microscope, we get bad stitching. For example, there is misalignment between zero and [23:46.640 --> 23:54.560] 1, or 2-1, 2-2, or between first row and second row. The reason behind this misalignment is that [23:55.320 --> 24:04.240] the margin is theoretically 35%. But practically speaking, it's something random around this value. [24:05.920 --> 24:13.420] That's why we suggested a new stitching method. In this method, to stitch two images, one and two, [24:13.420 --> 24:20.900] we define a comparison step in the first image and look for the similar step in a stitching area [24:20.900 --> 24:27.600] in the second image. A stitching area is plus-minus 200 pixels around the margin line. [24:28.740 --> 24:33.780] When defining the similar step, we determine the margin accurately, and also there is a vertical [24:33.780 --> 24:39.580] shift between images. Here we can see the result of stitching image one and two. [24:40.050 --> 24:47.760] The advantage of this method is to accurate, but downside is the long time it takes. For example, [24:47.760 --> 24:54.000] to stitch 200 images to constitute one bank image, it will take around five hours. [24:54.620 --> 25:00.810] Here we can see the result of stitching for one bank image. Its high resolution image is [25:03.050 --> 25:12.510] 34000 by 12000 image. To effectively use AI to extract the fuses, we use Jetson SGX Orion [25:12.510 --> 25:20.090] from NVIDIA. It has 64 gigabyte RAM and 2048 CUDA cores and 64 tensor cores, which makes it [25:20.090 --> 25:28.890] good for the image-based AI projects like object detection projects. We use also MobileNet SSD [25:28.890 --> 25:38.170] model, which provides a balance between speed and accuracy. This model is trained to detect [25:38.170 --> 25:45.010] effuses in the images in terms of the coordinates of the effuses in the images, and also it's a [25:45.010 --> 25:53.190] class whether it is on or off. Here we see the example of on effuse, and this is off effuse, [25:53.190 --> 26:01.980] which is the default state of the effuse. What is the optimal input of the model? [26:03.330 --> 26:10.230] We read from the MobileNet SSD model documents, the optimal size for training and also for [26:10.230 --> 26:17.950] inference is 300 by 300. Also, we should meet another condition, which is the [26:18.830 --> 26:25.490] object, which is effuse size to the image size, should be bigger than predefined ratio. [26:25.490 --> 26:33.450] This ratio, in our case, is defined using practical experience. It is 0.04. Here we can see [26:33.450 --> 26:40.410] the example of the optimal image, and we can see also the size of the effuse regarding to the image [26:40.410 --> 26:48.950] size. We meet these two conditions using resizing and tiling. When tiling the stitched image, [26:48.950 --> 26:55.450] we keep 100 pixels overlapping between tiles to be sure that the whole size of effuse [26:56.150 --> 27:05.230] is exist, at least in one tile. When training the model, we used 3,500 training tiles with [27:05.230 --> 27:11.250] balanced number between on and off effuses. We used CVAT tool, which is a web-based AI [27:11.960 --> 27:18.450] free tool to annotate effuses. Here we can see an example of annotation. We use [27:18.450 --> 27:23.180] different colors when drawing boxes about the on and off effuses. [27:24.590 --> 27:32.750] The training results are detection accuracy 99%, classification accuracy 97%, and also we [27:32.750 --> 27:39.850] get fake detection where none effuse objects are predicted as effuses, but these [27:40.660 --> 27:44.880] fake detections will be resolved during the post-processing after prediction. [27:46.570 --> 27:54.870] Now, we have a stitched image. What do we do to extract the effuses? First, we tile this [27:54.870 --> 28:01.370] stitched image to 2,500 tiles, then we apply the inference using the trained machine learning model [28:02.310 --> 28:10.910] that inference results for each tile have three things. First, the convenience of effuses in the [28:10.910 --> 28:17.030] tile and also the classification of the effuses, whether they are on or off, and also the [28:17.030 --> 28:22.150] confidence score, which corresponds to how the machine learning model is confident about the [28:22.150 --> 28:29.230] classification. These three things, results from all the tiles will be re-aggregated again [28:29.230 --> 28:39.310] in the stitched image. Then, the duplicates will be removed with keeping only the highest [28:39.310 --> 28:49.850] confidence score. Finally, any effuse with a confidence score less than 95% will be visually [28:49.850 --> 28:59.250] checked. Finally, we will use dbScan clustering method to define outliers out of the columns [28:59.930 --> 29:07.570] and remove them. Then, we use another clustering method to group the effuses in columns and [29:07.570 --> 29:15.190] exporting their values into the arrays 1s and 0s. We repeat the same process for the [29:15.190 --> 29:22.510] another bank. As we know, there are lower bank and upper bank. Finally, we will get 64 by 64 [29:23.030 --> 29:28.650] array and then we'll go through the next steps as my colleagues explained. [29:30.530 --> 29:38.710] We will extract the encryption key from the array and use this key to decrypt the encrypted [29:38.710 --> 29:56.110] firmware. We will see these steps in the demo. Let's go. We have a firmware image where the [29:56.110 --> 30:03.010] main program prints periodically the sentence Hello Las Vegas. This firmware is encrypted. [30:03.010 --> 30:12.490] That's why when we look for Hello World, we can find nothing. Here, we will see the [30:13.130 --> 30:19.530] images of lower bank and upper bank of the chip holding the encrypted firmware. [30:21.910 --> 30:30.670] Here are the images of lower bank before stitching. Here, [30:30.670 --> 30:40.150] the image of stitched lower bank. You can see the high resolution of the stitched image. [30:40.150 --> 30:49.010] Now, we will apply the diffuse detection script. This script will go through the [30:49.010 --> 30:56.390] stitched lower bank and upper bank, do pre-processing, tiling of the images, [30:56.390 --> 31:05.030] and prepare the images to be optimal input for the model. These tiles will be stored in the folder [31:05.590 --> 31:19.490] for inference, this folder. Now, the script will run the machine learning model, [31:19.490 --> 31:26.630] which is trained. This model will do the inference and detect the diffuses, [31:27.630 --> 31:35.230] coordinates, diffuses classes on and off, and also the confidence scores of the classifications. [31:35.230 --> 31:49.660] Starting from the upper bank, then the lower bank, [31:49.660 --> 31:57.040] the script will store all of these inferences also in folder inference results. [31:57.660 --> 32:05.500] Now, the script will ask for visually checking the diffuses where there are different [32:05.500 --> 32:14.400] classifications due to tiles overlapping. For the lower bank, we have 11 diffuses should be checked. [32:15.940 --> 32:27.420] The checking should be whether the diffuse unbound means off or bound means on or not diffuse. [32:32.140 --> 32:36.820] For the upper bank, we have zero diffuses to be checked. [32:50.430 --> 33:00.050] Check visually if the diffuse with confidence score is than 95%. We have eight diffuses to be [33:00.050 --> 33:30.420] checked in the lower bank, and 13 in the upper bank. After that, the script will show us the [33:30.420 --> 33:40.200] distribution of the diffuses in the image. We can note that no all players, and also in the upper [33:40.200 --> 33:50.100] bank. As everything is okay, the script will export the values of diffuses as zeros at once. [33:53.310 --> 33:59.650] The script also will extract the flush key file which contains the encryption keys [34:00.870 --> 34:07.550] from the firmware, and here the 64 by 64 array of ones and zeros. [34:10.230 --> 34:20.450] We will use the flush key file to decrypt the encrypted firmware and get the decrypt.bin file [34:21.390 --> 34:34.170] which is the decrypted firmware. Here is the decrypted.bin file. We should look for hello [34:35.730 --> 34:39.830] world in this file, and we should find something. [34:43.440 --> 34:51.240] And here we are. Thanks. I will go back to my colleagues to conclude the presentation. [34:53.060 --> 34:58.060] Okay, I know it's 3 a.m in Prague, but Hayan, if you're watching, thanks for the video. [34:58.980 --> 35:05.440] Now to conclude real quick. If you have any information that you would like to store [35:06.740 --> 35:11.640] if you have an information that you would like to keep secret and you need to store it in a chip [35:12.380 --> 35:17.140] and you have a choice to do so, please do not put it in any fuse-based memory. [35:17.160 --> 35:22.440] In the case of ESP32 chip, if you want to encrypt the flash memory, and you really should if you [35:22.440 --> 35:27.880] want to, you have no other choices. So in this case, you should use countermeasures such as [35:27.880 --> 35:34.400] using a unique key per each chip, not just use the same key for every device. [35:35.090 --> 35:40.400] If you have a choice to store it in some HSM module, physical unclonable functional protected [35:40.400 --> 35:47.040] memory, or anti-fuses, whatever you have, it would be a better way, because an eFuse-based [35:47.040 --> 35:53.640] memory is just readable based on its physical properties, and the readability protection [35:53.640 --> 35:59.220] methods such as layering, they do increase the effort by putting obstacles in between the [35:59.220 --> 36:04.120] malicious actor and the information that you're trying to protect. They don't prevent reading. [36:04.400 --> 36:09.280] In this case, we had to destroy the chip in process of recovering this information, but since [36:09.280 --> 36:15.160] our goal was to recover an unencrypted firmware image, we didn't really care about that, because [36:15.160 --> 36:21.980] we don't need it to run, we just want to read the firmware. The assumption about the delayering [36:21.980 --> 36:30.580] being expensive, complex, and whatnot has basically been destroyed, because if you have a sink, [36:30.580 --> 36:38.220] a wet stone, and at least two fingers, you could do that in your home conditions, and if you also [36:38.220 --> 36:43.600] can rent a microscope on your local university for a couple hours to just scan some location on [36:43.600 --> 36:51.380] chip, then you can do the recovery of the information at home. So it's rather easy and cheap [36:51.380 --> 36:57.220] if you're willing to sacrifice a bit of your fingers. Are there two things I'd like to point [36:57.220 --> 37:03.300] out still? The first one is to thank to Espressif, because they allowed us to have this talk, [37:03.300 --> 37:08.800] and the communication with them was really smooth, so thanks for that. And finally, I'd like to admit [37:08.800 --> 37:16.060] to a lie, because at the very beginning, I told you that if you burn an eFuse from state 0 to 1, [37:16.060 --> 37:23.940] you cannot unburn it. I lied, because you can. But the processes around this are really complex [37:23.940 --> 37:30.200] and really expensive, so I'd like to keep this as a separate topic for perhaps next time, [37:30.200 --> 37:37.080] and we can transition into the Q&A session, which, as I've heard, we will be doing as we will be [37:37.080 --> 37:44.740] going. But wait, we also have a giveaway. We have 20 decapsulated ESP32 chips in a vials that look [37:44.740 --> 37:51.260] like that they hold some bacteria, but we promise that they did not. And you could just take them [37:51.260 --> 37:57.060] and try the layering process at home if you want to, or just as a souvenir. So thank you [37:57.060 --> 38:00.420] for your attention, and we will be answering questions as we go.