WEBVTT

00:00.000 --> 00:06.720
I'd like to welcome you on our talk, Nano Enigma, Uncovering the Secrets Within EFUSE Memories.

00:06.960 --> 00:09.040
First of all, allow me a brief introduction.

00:09.140 --> 00:12.300
My name is Martin and I'm here together with my colleague Michal.

00:12.300 --> 00:20.180
We also have a third partner in crime named Hayan, however he couldn't come here with us so we just have a pre-recorded message from him.

00:20.500 --> 00:29.520
We all work in the embedded system security testing team that's based in Prague, Czech Republic, which is under Accenture Umbrella, and we all have different fields of focus.

00:29.520 --> 00:35.020
So for me that's reverse engineering, so I'm usually that person that wants that firmware image unencrypted.

00:35.200 --> 00:38.740
So making me shut up was partial motivation of this talk.

00:39.540 --> 00:46.660
I'm pretty sure the other guys will tell you briefly about themselves when their time comes, so I'm just going to jump straight ahead into the overview.

00:47.120 --> 01:02.960
We have it in the title, we will be talking about EFUSEs, and EFUSE is an electronic component which is just two points interconnected with a connection that has a property that it burns or terminates when the current flowing through it exceeds certain threshold.

01:03.200 --> 01:12.580
This is really useful when you want to protect your home appliances from overcurrent, but it's also really useful when you want to create something called one-time programmable memory.

01:12.840 --> 01:22.160
Because if you represent bits with EFUSEs, once you change state of a bit from zero to one, you cannot ever unchange it back to zero.

01:22.160 --> 01:28.060
This basically means that you can change the state of the device permanently.

01:28.060 --> 01:39.620
This is really useful for security because now you can use these types of memories to, for example, disable debugging interfaces or enable secure boot or put there public keys for secure boot.

01:39.720 --> 01:49.640
However, some manufacturers took it one step further and they actually used these EFUSE based memories for storing information that requires confidentiality protection.

01:49.680 --> 01:56.760
Meaning that you can find there also flash memory encryption keys or passwords for debugging interfaces.

01:56.880 --> 02:03.560
But since I mentioned that that connection burns or terminates, there's actual physical change inside that component.

02:03.580 --> 02:09.220
So how do you protect confidentiality of something that could be observed through microscope?

02:09.220 --> 02:15.840
Because, for example, if I Google EFUSE microscope, you're going to get all the images like burned and unburned examples.

02:16.060 --> 02:22.300
So the protection measure you mainly used in some of the chips we looked at was layering.

02:22.300 --> 02:27.760
So layering is normal way of making chips where you stack components on top of each other.

02:27.800 --> 02:35.620
However, if you put that EFUSE based memory in the very bottom layer, you can then consider it protection because you can't directly observe it.

02:35.840 --> 02:48.620
This is based mainly on an assumption that performing the layering process, so removing carefully the layers from the chip so that you can extract information from it, is very complex and expensive process.

02:48.620 --> 02:53.000
But we are here at DEF CON because we have proved this assumption wrong.

02:53.060 --> 02:59.080
And we will demonstrate you all these techniques on an ESP32 chip from Espressif.

02:59.080 --> 03:08.200
However, keep in mind that all of what we will be presenting here is also generally applicable to just about any chip that is using an EFUSE based memory.

03:08.500 --> 03:14.620
And with that, I'd like to pass my word to Michal, who's going to walk you through the details of the attack.

03:17.740 --> 03:27.500
Hello, my name is Michal Grigarek and I'm also a part of Accenture Prague.

03:27.580 --> 03:35.640
At first, I must say I'm really proud to be here on this stage to present you results of our work.

03:37.880 --> 03:42.760
So my colleague Martin just explained what EFUSE is for.

03:42.760 --> 03:53.180
And now let's take a look more closely how we can observe these structures in much more detail and what technologies and skills we will need.

03:57.440 --> 04:01.920
First, we must decapsulate the chip.

04:01.920 --> 04:08.460
Decapsulation is the process when we extract the silicon plate from the epoxy housing.

04:08.820 --> 04:20.360
Of course, there exists some other material for housings, but for purposes of this presentation, we only consider only epoxy materials.

04:20.680 --> 04:27.760
There we see four basic techniques for decapsulation.

04:27.760 --> 04:31.260
Thermal, chemical, laser and plasma.

04:31.880 --> 04:51.080
Thermal method, this method uses only a blowtorch or a heat gun, simply to heat up the epoxy housing and then slowly and carefully break it and obtain the epoxy silicon plate.

04:51.080 --> 04:59.680
Chemical decapsulation uses concentrated chemicals, concentrated acid to dissolve the epoxy housings.

04:59.680 --> 05:07.700
Laser etching uses a strong laser beam to vaporize the epoxy material.

05:07.700 --> 05:16.260
But this method is quite risky because it is very easy to burn the silicon plate.

05:16.260 --> 05:24.080
And my problem lies in the heat deposition to the sample.

05:24.100 --> 05:26.420
And the last, plasma one.

05:26.420 --> 05:33.220
This process involves ionized gas or plasma to selective etching of materials.

05:36.790 --> 05:44.910
So, due to its availability and good traceability, we decided to use a chemical method of decapsulation.

05:45.010 --> 05:48.630
Especially, we used concentrated acid.

05:48.630 --> 06:04.690
In our case, concentrated acid means 96% of concentration, which must be heated to approximately 250 degrees Fahrenheit.

06:05.250 --> 06:09.810
The chemical methods can be effectively combined with laser ablation.

06:10.310 --> 06:18.710
At first, laser removes a large part of the housing and then the remaining can be dissolved in the acid.

06:19.190 --> 06:29.010
This shortens the process during the GPS exposure to the acid which is needed.

06:32.390 --> 06:42.290
The acid will dissolve the housing residue, leaving only the dye.

06:43.290 --> 06:48.390
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:27.080
So, we must etch the surface to obtain these structures.

07:27.080 --> 07:29.900
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:43.680
Mechanical is the cheapest and starting at about $100.

07:43.900 --> 07:50.540
Chemical, when we consider only chemical, it is also not expensive.

07:51.200 --> 08:07.580
Laser ablation uses very short, precise femtoseconds pulses of laser beam to ablate the surface, but it is quite costly, starting at 50k USD.

08:08.400 --> 08:27.490
And the last, the plasma, this is simply the nanomachining using an ion beam, 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:40.910
I just slide a piece of silicon with my finger over the stone.

08:41.410 --> 08:46.510
Of course, we must use a grinding stone with the highest possible grit size.

08:46.510 --> 08:49.350
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:15.770
But with patience and systematic polishing, we can obtain a beautiful etched chip within 30 minutes or one hour.

09:18.370 --> 09:24.870
Unfortunately, wet stone etching alone isn't enough.

09:25.250 --> 09:42.810
Our stone head grain size is about 2 microns, but for the final stage, it is necessary to use a diamond lapping foil, which grain size is less than 0.5 microns.

09:42.810 --> 09:51.970
These foils make a significant difference, 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:20.610
And as we see on these pictures, mostly the same results can be achieved when I use 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:39.240
The largest part of the chip is taken up by logical circuits.

10:39.240 --> 10:44.660
It is easily identified and can be skipped.

10:45.000 --> 10:47.740
The other radio frequency part is

10:50.880 --> 10:54.980
good visible, too, and can be skipped.

10:54.980 --> 11:05.380
And the rest will have the rectangular purple areas, and these are memory types such as RAM, flash, and our eFuses.

11:06.920 --> 11:16.680
The eFuse memory cell is essentially a fuse, which is a conductive structure with a weak point.

11:17.020 --> 11:23.480
In our case, it's looking like some triangle with a line going through it.

11:24.500 --> 11:27.480
It's looking like a flag, maybe.

11:28.100 --> 11:37.180
And at approximately 500 times 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:13.870
And now optical microscopy.

12:13.870 --> 12:17.850
Observation with optical microscopy has its limits.

12:18.410 --> 12:29.530
Maximum resolution of optical microscopy is around 400 nanometers, which corresponds with 2000 times magnification.

12:29.530 --> 12:32.630
That is nearly physical limits.

12:32.850 --> 12:40.950
This magnification is suitable for locating our structures, our eFuse bank.

12:41.190 --> 12:51.590
And on well-prepared sample, we can even see if the eFuse is burned or not, or programmed or not.

12:51.590 --> 13:09.890
The term burned is fitting, because when we program data into the eFuse memory bits, during programmation, current flows through the eFuse and physically change its structures.

13:09.890 --> 13:18.410
And these changes are observable by optical or scanning electron microscopy technology.

13:19.290 --> 13:26.350
For the size comparison, a human hair is 100 times bigger than our eFuses.

13:29.960 --> 13:38.740
In order to read their states correctly and repeatedly, we of course need some much more advanced imaging technique.

13:38.920 --> 13:44.620
And it is scanning electron microscopy, which provides much higher resolution.

13:45.900 --> 13:52.200
Scanning electron microscopy provides approximately 100 times better resolution.

13:52.480 --> 14:08.040
As I said, since optical microscopy has a resolution around 300 nanometers, scanning electron microscopy has a resolution approximately 5 nanometers, which corresponds to magnification 100,000 times.

14:08.040 --> 14:14.060
Of course, these parameters can apply specifically to our scanning electron microscope.

14:14.060 --> 14:16.440
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:43.400
Everything is visible at the nanoscale.

14:43.540 --> 14:52.700
On the right image, right bottom, we see detail of unburned eFuse, clear eFuse, representing logical zero.

14:52.700 --> 14:59.800
And on the left image, we see burned eFuse, representing logical one.

15:03.040 --> 15:11.500
Once we obtain higher resolution images of our eFuses, we can read the data stored in them.

15:11.500 --> 15:24.830
In my initial experiments, I manually transcript 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:42.540
It takes about 10 hours to read one bit of 4,096 bits.

15:42.720 --> 15:50.300
And additionally, mapping the logical memory address to a specific cell on the silicon die was also very, very challenging.

15:52.360 --> 16:00.720
I had to carefully read and transcript about 20 kilobytes of data before we had enough for our analysis.

16:00.920 --> 16:04.780
It truly feels like a forensic investigation.

16:05.560 --> 16:12.400
And now my colleague 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:27.980
Now that we have the raw data, we have to somewhat put meaning to it so that we have some useful information out of it.

16:27.980 --> 16:36.220
The best place to start with is documentation because it actually mentions a lot of information about both logical and physical alignment of the memory.

16:36.480 --> 16:44.280
From the logical perspective, it will tell us that there are 11 of eFuse blocks and that 0, 1, and 2 are used for system purposes.

16:44.280 --> 16:49.360
These basically store MAC address, chip ID, and chip configuration that you can set.

16:49.740 --> 16:54.160
The rest of the blocks are user programmable, meaning you could put whatever you want there.

16:54.160 --> 17:00.520
However, their primary purpose is actually to store the secure boot keys or the flash memory encryption keys.

17:01.040 --> 17:14.460
From the physical perspective, the information is a little scarce, but it will tell us that there are four backups of block 0, 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:29.860
This is just 12 bytes added to each of the blocks, but it could prove useful in case we cause some damage during the layering process, so we'll talk about that briefly later.

17:30.140 --> 17:32.640
So with that, let's summarize what we want to know.

17:32.640 --> 17:34.240
We have a lot of bits.

17:34.240 --> 17:36.220
We now need to assign them to the bytes.

17:36.220 --> 17:46.200
Then we want to take those bytes, put them in the correct order, and have them assigned in the blocks, and then voila, we will have our flash memory encryption key.

17:46.800 --> 17:52.880
To do that, we performed several experiments, and the first one was a really stupid one, and I came up with it.

17:53.000 --> 17:59.080
And it was like, let's burn values FF into the first block of an eFuses so that we can locate where it is.

17:59.100 --> 18:03.300
However, at that time, we didn't really know how painful it is to actually read them.

18:03.460 --> 18:22.520
So we kind of wasted this experiment, because if you burn only FF values, you can very well detect where the first block is, but you really can't detect how the bit assignment works inside these bytes and how the byte order works in the blocks, because that information just doesn't exist in such a memory.

18:22.620 --> 18:25.180
So we quickly transitioned to the second experiment.

18:25.200 --> 18:41.820
In this case, we were a bit smarter, so we burned in unique patterns into the eFuse blocks, and these unique patterns had something in common, and that is that the most significant bits of all of the bytes in these patterns were set to one, either three or four of them.

18:42.380 --> 18:54.480
This was because, just from an overview of the memory, if you look at the middle picture, the big one, you can see a lot of red color in the upper portion, those are the ones, and that the lower portion has a lot of variety in it.

18:54.480 --> 18:59.580
You may think there's an ASCII text written at the bottom line, at the bottom of the picture.

18:59.580 --> 19:02.960
There are no hidden messages, this is purely coincidence.

19:03.620 --> 19:15.260
But if we take the only useful information from the very first experiment and filter out in those Excel files the rows that were associated with the first block, we can clearly see our pattern.

19:15.260 --> 19:25.520
So in this case, we now know that the bits are organized in columns with the most significant bits in the upper portion of the memory, and we also know the byte-endianess inside the blocks.

19:25.520 --> 19:30.660
This is enough for us to just extract any information we want from these memories.

19:31.300 --> 19:42.020
We did several other experiments, mainly to confirm that the memory is working the 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:51.720
And the third one I'm showing you here isn't really interesting from the memory layout evaluation, but it's rather interesting because of those white fields there.

19:52.120 --> 20:09.760
Again, I am to blame for that, because when you do the layering on the whetstone and you don't clean the whetstone, you have a debris that's left there, and when you keep scratching with your finger, you create these gigantic canyons in that memory, where the e-fuses are just completely gone.

20:09.760 --> 20:16.660
In this case, that Reed-Solomon automatic error correction could actually prove useful to recover the information.

20:16.660 --> 20:29.880
However, for future-proofing these methods, we rather spend the time on improving the layering method, because, for example, block 0 here doesn't have any automatic error correction, and the other chips don't have that as well.

20:29.880 --> 20:37.580
It was just that in the case of ESP32, if you do some damage to the chip, you can actually recover for it using this automatic error correction.

20:38.320 --> 20:55.980
So now, this image will show you the layout of the memory, so the full green row at the top and the bottom of the picture, and six others, full green rows in between, that's block 0, so that's where those four times duplicated values actually go to.

20:56.220 --> 21:01.080
For example, if you disable JTAG, that's where four e-fuses will be burned.

21:01.780 --> 21:07.360
And the rest of the colorful blocks, and I'm sorry for using too many shades of green, but I'm bad with colors.

21:07.500 --> 21:12.100
Anyway, the rest of the blocks here are the user-writable blocks.

21:12.100 --> 21:27.020
Most tutorials on the internet will just tell you, please put your encryption key into the purple one here, so that's where we will be focusing the most, but once you know the alignment of the blocks, it doesn't really matter which blocks you extract,

21:27.020 --> 21:30.380
you just get the coordinates from the extracted data.

21:30.800 --> 21:44.120
The biggest problem at this point was that Michael refused to read that manually anymore, after whatever amount of bits he read, so we had to turn to our machine learning guru to help us automate the process.

21:44.260 --> 21:54.180
His name is Hayan and he unfortunately couldn't be here with us, but he pre-recorded the message, pre-recorded his part of the presentation, which I'll try to play now.

21:54.180 --> 21:57.220
There's about a 50% chance it's going to play.

21:57.880 --> 22:03.440
If it does not, I will still play it and I'll try to comment it, so you will not learn anything useful.

22:03.440 --> 22:04.420
So, let's see.

22:05.520 --> 22:13.120
Hello, I'm Hayan Ali, security delivery senior analyst in Accenture, and also I'm doing a PhD in using machine learning for violin clubs.

22:13.120 --> 22:18.560
I will go through the automation process and show you finally a demo about it.

22:18.560 --> 22:19.460
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:49.360
First, we stitched these images to get only one image per bank, then pre-processing before applying the machine learning, then applying the machine learning object detection model, then extracting the effuses values into the arrays.

22:49.860 --> 22:54.780
The microscope provides high-resolution images when working in zigzag mode.

22:54.780 --> 23:04.620
In zigzag mode, the microscope scans the bank in zigzag line, as we see here in the figure, generating around 200 images for each bank.

23:04.620 --> 23:08.740
Each image is 2,560 by 1,920.

23:09.020 --> 23:21.620
We can see this image is high-resolution image, as we can distinguish between the off effuse, which is the default state, and the one which is the on case.

23:22.500 --> 23:28.980
We keep margin by 35% between images to avoid wasting any pixels.

23:30.300 --> 23:36.160
Then we stitch these images to get one image per bank.

23:36.160 --> 23:43.740
But when using the embedded stitching tool in the microscope, we get bad stitching.

23:43.920 --> 23:51.200
For example, there is misalignment between zero and 1, or 2-1, 2-2, or between first row and second row.

23:51.620 --> 23:58.860
The reason behind this misalignment is that the margin is theoretically 35%.

23:58.860 --> 24:04.240
But practically speaking, it's something random around this value.

24:05.920 --> 24:09.600
That's why we suggested a new stitching method.

24:10.160 --> 24:22.460
In this method, to stitch two images, one and two, we define a comparison step in the first image and look for the similar step in a stitching area in the second image.

24:22.460 --> 24:27.600
A stitching area is plus-minus 200 pixels around the margin line.

24:28.740 --> 24:36.080
When defining the similar step, we determine the margin accurately, and also there is a vertical shift between images.

24:36.080 --> 24:39.580
Here we can see the result of stitching image one and two.

24:40.050 --> 24:47.320
The advantage of this method is to accurate, but downside is the long time it takes.

24:47.320 --> 24:54.000
For example, to stitch 200 images to constitute one bank image, it will take around five hours.

24:54.620 --> 24:58.920
Here we can see the result of stitching for one bank image.

24:58.920 --> 25:06.430
Its high resolution image is 34000 by 12000 image.

25:06.470 --> 25:13.590
To effectively use AI to extract the fuses, we use Jetson SGX Orion from NVIDIA.

25:13.590 --> 25:27.310
It has 64 gigabyte RAM and 2048 CUDA cores and 64 tensor cores, which makes it good for the image-based AI projects like object detection projects.

25:27.310 --> 25:34.630
We use also MobileNet SSD model, which provides a balance between speed and accuracy.

25:35.170 --> 25:47.150
This model is trained to detect effuses in the images in terms of the coordinates of the effuses in the images, and also it's a class whether it is on or off.

25:47.230 --> 25:56.310
Here we see the example of on effuse, and this is off effuse, which is the default state of the effuse.

25:58.770 --> 26:01.980
What is the optimal input of the model?

26:03.330 --> 26:12.850
We read from the MobileNet SSD model documents, the optimal size for training and also for inference is 300 by 300.

26:13.390 --> 26:25.490
Also, we should meet another condition, which is the object, which is effuse size to the image size, should be bigger than predefined ratio.

26:25.490 --> 26:29.830
This ratio, in our case, is defined using practical experience.

26:29.830 --> 26:32.030
It is 0.04.

26:32.610 --> 26:41.430
Here we can see the example of the optimal image, and we can see also the size of the effuse regarding to the image size.

26:42.030 --> 26:46.330
We meet these two conditions using resizing and tiling.

26:46.850 --> 26:58.990
When tiling the stitched image, we keep 100 pixels overlapping between tiles to be sure that the whole size of effuse is exist, at least in one tile.

27:00.870 --> 27:08.110
When training the model, we used 3,500 training tiles with balanced number between on and off effuses.

27:08.170 --> 27:15.370
We used CVAT tool, which is a web-based AI free tool to annotate effuses.

27:15.370 --> 27:18.190
Here we can see an example of annotation.

27:18.190 --> 27:23.180
We use different colors when drawing boxes about the on and off effuses.

27:24.590 --> 27:44.880
The training results are detection accuracy 99%, classification accuracy 97%, and also we get fake detection where none effuse objects are predicted as effuses, but these fake detections will be resolved during the post-processing after prediction.

27:46.570 --> 27:48.930
Now, we have a stitched image.

27:48.930 --> 27:52.890
What do we do to extract the effuses?

27:53.330 --> 28:07.490
First, we tile this stitched image to 2,500 tiles, then we apply the inference using the trained machine learning model that inference results for each tile have three things.

28:07.490 --> 28:23.230
First, the convenience of effuses in the tile and also the classification of the effuses, whether they are on or off, and also the confidence score, which corresponds to how the machine learning model is confident about the classification.

28:24.070 --> 28:31.910
These three things, results from all the tiles will be re-aggregated again in the stitched image.

28:31.910 --> 28:41.290
Then, the duplicates will be removed with keeping only the highest confidence score.

28:41.350 --> 28:50.970
Finally, any effuse with a confidence score less than 95% will be visually checked.

28:51.910 --> 29:01.790
Finally, we will use dbScan clustering method to define outliers out of the columns and remove them.

29:01.790 --> 29:13.470
Then, we use another clustering method to group the effuses in columns and exporting their values into the arrays 1s and 0s.

29:13.470 --> 29:16.450
We repeat the same process for the another bank.

29:16.450 --> 29:20.230
As we know, there are lower bank and upper bank.

29:20.530 --> 29:28.650
Finally, we will get 64 by 64 array and then we'll go through the next steps as my colleagues explained.

29:30.530 --> 29:39.590
We will extract the encryption key from the array and use this key to decrypt the encrypted firmware.

29:39.590 --> 29:43.150
We will see these steps in the demo.

29:43.850 --> 29:45.190
Let's go.

29:51.310 --> 30:01.010
We have a firmware image where the main program prints periodically the sentence Hello Las Vegas.

30:01.090 --> 30:03.010
This firmware is encrypted.

30:03.010 --> 30:06.710
That's why when we look for Hello World, we can find nothing.

30:10.890 --> 30:19.530
Here, we will see the images of lower bank and upper bank of the chip holding the encrypted firmware.

30:21.910 --> 30:28.090
Here are the images of lower bank before stitching.

30:28.250 --> 30:35.370
Here, the image of stitched lower bank.

30:35.570 --> 30:40.150
You can see the high resolution of the stitched image.

30:40.150 --> 30:46.030
Now, we will apply the diffuse detection script.

30:46.310 --> 31:01.790
This script will go through the stitched lower bank and upper bank, do pre-processing, tiling of the images, and prepare the images to be optimal input for the model.

31:02.990 --> 31:12.290
These tiles will be stored in the folder for inference, this folder.

31:12.510 --> 31:21.470
Now, the script will run the machine learning model, which is trained.

31:21.470 --> 31:35.230
This model will do the inference and detect the diffuses, coordinates, diffuses classes on and off, and also the confidence scores of the classifications.

31:35.230 --> 31:42.810
Starting from the upper bank, then the lower bank

31:48.020 --> 31:57.040
, the script will store all of these inferences also in folder inference results.

31:57.660 --> 32:08.780
Now, the script will ask for visually checking the diffuses where there are different classifications due to tiles overlapping.

32:09.100 --> 32:14.400
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 --> 32:57.150
Check visually if the diffuse with confidence score is than 95%.

32:57.150 --> 33:05.530
We have eight diffuses to be checked in the lower bank, and 13 in the upper bank.

33:28.320 --> 33:33.520
After that, the script will show us the distribution of the diffuses in the image.

33:33.660 --> 33:41.160
We can note that no all players, and also in the upper bank.

33:41.380 --> 33:50.100
As everything is okay, the script will export the values of diffuses as zeros at once.

33:53.310 --> 34:07.550
The script also will extract the flush key file which contains the encryption keys from the firmware, and here the 64 by 64 array of ones and zeros.

34:10.230 --> 34:24.290
We will use the flush key file to decrypt the encrypted firmware and get the decrypt.bin file which is the decrypted firmware.

34:29.450 --> 34:31.850
Here is the decrypted.bin file.

34:32.050 --> 34:39.830
We should look for hello world in this file, and we should find something.

34:43.440 --> 34:44.740
And here we are.

34:44.860 --> 34:45.980
Thanks.

34:46.460 --> 34:51.240
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:01.500
Now to conclude real quick.

35:01.660 --> 35:17.140
If you have any information that you would like to store if you have an information that you would like to keep secret and you need to store it in a chip and you have a choice to do so, please do not put it in any fuse-based memory.

35:17.160 --> 35:24.920
In the case of ESP32 chip, if you want to encrypt the flash memory, and you really should if you want to, you have no other choices.

35:24.920 --> 35:34.400
So in this case, you should use countermeasures such as using a unique key per each chip, not just use the same key for every device.

35:35.090 --> 35:55.580
If you have a choice to store it in some HSM module, physical unclonable functional protected memory, or anti-fuses, whatever you have, it would be a better way, because an eFuse-based memory is just readable based on its physical properties, and the readability protection methods such as layering,

35:55.580 --> 36:02.540
they do increase the effort by putting obstacles in between the malicious actor and the information that you're trying to protect.

36:02.540 --> 36:04.120
They don't prevent reading.

36:04.400 --> 36:18.800
In this case, we had to destroy the chip in process of recovering this information, but since our goal was to recover an unencrypted firmware image, we didn't really care about that, because we don't need it to run, we just want to read the firmware.

36:19.840 --> 36:44.580
The assumption about the delayering being expensive, complex, and whatnot has basically been destroyed, because if you have a sink, a wet stone, and at least two fingers, you could do that in your home conditions, and if you also can rent a microscope on your local university for a couple hours to just scan some location on chip,

36:44.580 --> 36:47.900
then you can do the recovery of the information at home.

36:47.900 --> 36:54.320
So it's rather easy and cheap if you're willing to sacrifice a bit of your fingers.

36:55.100 --> 36:58.280
Are there two things I'd like to point out still?

36:58.280 --> 37:07.140
The first one is to thank to Espressif, because they allowed us to have this talk, and the communication with them was really smooth, so thanks for that.

37:07.160 --> 37:18.180
And finally, I'd like to admit to a lie, because at the very beginning, I told you that if you burn an eFuse from state 0 to 1, you cannot unburn it.

37:18.420 --> 37:20.420
I lied, because you can.

37:20.880 --> 37:37.640
But the processes around this are really complex and really expensive, so I'd like to keep this as a separate topic for perhaps next time, and we can transition into the Q&A session, which, as I've heard, we will be doing as we will be going.

37:37.640 --> 37:39.960
But wait, we also have a giveaway.

37:39.960 --> 37:48.820
We have 20 decapsulated ESP32 chips in a vials that look like that they hold some bacteria, but we promise that they did not.

37:49.380 --> 37:56.200
And you could just take them and try the layering process at home if you want to, or just as a souvenir.

37:56.580 --> 38:00.420
So thank you for your attention, and we will be answering questions as we go.

