1 00:00:00,000 --> 00:00:01,660 Thank you, everyone, for coming. 2 00:00:01,980 --> 00:00:05,420 This is our penultimate talk of the day. 3 00:00:06,520 --> 00:00:07,780 This is Dennis. 4 00:00:07,780 --> 00:00:13,600 He's going to be doing a talk on, you know, privacy leaks by dumpster diving, more or less, correct? 5 00:00:13,820 --> 00:00:14,260 Yeah. 6 00:00:14,260 --> 00:00:25,500 So if you ever get, you know, cool technology at eBay or the Goodwill store or in the dumpster, maybe there's some stuff that got left over even after like a factory reset. 7 00:00:25,500 --> 00:00:27,460 So he's going to get into all that today. 8 00:00:27,460 --> 00:00:28,800 I think it's going to be pretty cool. 9 00:00:29,140 --> 00:00:32,060 Can everyone in the back hear me okay? 10 00:00:33,240 --> 00:00:36,100 If I talk like this, would you really hear me okay? 11 00:00:36,800 --> 00:00:37,560 Okay. 12 00:00:37,560 --> 00:00:39,600 So you have to talk as loud as that. 13 00:00:41,260 --> 00:00:44,300 Because he's going to start talking and he's going to be like, can you hear me? 14 00:00:44,300 --> 00:00:46,140 It's pretty good talk, right, guys? 15 00:00:46,380 --> 00:00:46,880 See? 16 00:00:47,020 --> 00:00:47,900 Negative thumbs. 17 00:00:47,900 --> 00:00:50,160 So you got to get real close. 18 00:00:50,160 --> 00:00:50,800 Are you ready? 19 00:00:50,800 --> 00:00:51,580 All right. 20 00:00:51,580 --> 00:00:52,420 I try. 21 00:00:52,440 --> 00:00:54,800 Can you hear me in the back? 22 00:00:54,880 --> 00:00:55,900 Yes, maybe. 23 00:00:55,900 --> 00:00:57,800 Should I speak louder? 24 00:00:58,160 --> 00:00:59,660 Loud enough? 25 00:01:01,080 --> 00:01:02,320 What about now? 26 00:01:02,960 --> 00:01:03,900 Yeah, okay. 27 00:01:03,900 --> 00:01:04,680 Great. 28 00:01:05,040 --> 00:01:05,900 All right. 29 00:01:05,900 --> 00:01:11,160 So welcome to my talk about privacy leaks in smart devices. 30 00:01:11,160 --> 00:01:13,840 The introduction was mostly correct in terms of like dumpster diving. 31 00:01:13,840 --> 00:01:18,260 What I do more is like shop on Amazon warehouse deals or like eBay. 32 00:01:18,460 --> 00:01:25,000 And the main idea of this talk is to speak about the extraction of data of used smart home devices. 33 00:01:25,760 --> 00:01:27,740 So the outline for this talk is the following. 34 00:01:27,740 --> 00:01:29,300 I start with the motivation. 35 00:01:29,300 --> 00:01:34,400 Then I will speak about how data is stored or what kind of data is stored on IoT devices. 36 00:01:34,460 --> 00:01:39,840 Then how is it stored and what kind of reset states you can imagine if you get like a used device. 37 00:01:39,880 --> 00:01:42,740 What kind of data is maybe there or won't be there. 38 00:01:42,980 --> 00:01:47,840 In the next topic, I will talk about the data extraction methods. 39 00:01:47,840 --> 00:01:49,680 So how you get the data off the device. 40 00:01:49,760 --> 00:01:57,420 And later on, I will have some example devices where I will tell you how I got the data off and how I found, for example, like the previous owner of that. 41 00:01:58,060 --> 00:01:59,520 So some information about me. 42 00:01:59,520 --> 00:02:03,640 I'm a PhD student at Northeastern University and I'm working there with Professor Gibraltar Beer. 43 00:02:03,640 --> 00:02:07,760 So we're doing mostly wireless security but I'm kind of into this IoT stuff. 44 00:02:08,000 --> 00:02:10,940 I'm also right now a grad student at DTU Darmstadt in Germany. 45 00:02:10,940 --> 00:02:13,040 I'm working there with Matthias Horlich. 46 00:02:13,100 --> 00:02:17,680 And my main interest is like reverse engineering with any kind of interesting devices. 47 00:02:17,680 --> 00:02:19,380 It can be nearly everything. 48 00:02:19,420 --> 00:02:23,100 But at the moment it's more like IoT and smart locks. 49 00:02:23,220 --> 00:02:26,060 But I do also physical locks which is kind of like the same thing. 50 00:02:26,320 --> 00:02:29,560 And so you find me also in the tool lockpicking village. 51 00:02:29,920 --> 00:02:31,500 Some side notes about my talk. 52 00:02:31,640 --> 00:02:33,180 It's not a Xiaomi bashing talk. 53 00:02:33,180 --> 00:02:37,300 So maybe some of you know me from last year where I was giving a lot of talks about Xiaomi. 54 00:02:37,580 --> 00:02:42,140 The problem is I have a lot of these devices so basically I need to talk about them. 55 00:02:42,700 --> 00:02:46,020 Most of the methods I present are already known and used for other things. 56 00:02:46,560 --> 00:02:53,300 There are some ethical and legal questions in this presentation so I had to censor most of the data and like mock it up a little bit. 57 00:02:53,740 --> 00:02:59,480 If you use any of the methods, for example if you want to do like BGA on soldering and you break it then it's kind of on you. 58 00:02:59,500 --> 00:03:01,180 I'm not responsible for that. 59 00:03:01,500 --> 00:03:05,540 And a lot of technical aspects I totally simplified. 60 00:03:05,540 --> 00:03:10,980 So basically NAND flash is way more complex but I did it for the sake of the talk to simplify. 61 00:03:11,480 --> 00:03:14,100 And there's particular things which are out of the scope of this talk. 62 00:03:14,100 --> 00:03:20,640 For example how to interpret NAND data or reassemble it or for example how to do device specific routing. 63 00:03:20,640 --> 00:03:23,520 I mean there's a lot of manuals out there so I won't cover that. 64 00:03:24,000 --> 00:03:27,120 So let's start with the motivation of this talk. 65 00:03:27,560 --> 00:03:34,620 Traditionally we had like nearly forever like the problem that there's a lot of second hand devices which still contain data. 66 00:03:34,860 --> 00:03:38,620 This issue literally existed forever since the hard drive exists. 67 00:03:38,640 --> 00:03:43,720 But I think it was increased as soon as people started to buy or sell hard drives on eBay. 68 00:03:43,780 --> 00:03:51,460 And most of those hard drives on eBay they still contain data like some personal information, emails, pictures or any other media. 69 00:03:51,460 --> 00:03:54,480 Sometimes even sensitive documents if the government sold hard drives. 70 00:03:54,580 --> 00:03:59,020 And the awareness for this kind of topic was raised like in the beginning of the 2000s. 71 00:03:59,020 --> 00:04:06,580 There was for example like a paper where the researchers analyzed like what kind of data is still there and what you have to do to basically get rid of all the data. 72 00:04:07,860 --> 00:04:13,600 Interestingly this not only affected like computers but it also affected like multi-function printers or lab instruments. 73 00:04:13,740 --> 00:04:20,400 And the NIST kind of recognized that in 2006 and they published a standard how to kind of wipe your devices to get rid of the data. 74 00:04:20,400 --> 00:04:32,760 And some of the solution was for example like you need to wipe your device and actually verify it or you sell devices without hard drive and destroy the hard drive like in the one picture which is like the example there we just shredded. 75 00:04:33,380 --> 00:04:39,340 But there was still like a big problem and the problem was that the lack of knowledge and awareness of the user. 76 00:04:39,340 --> 00:04:42,780 So for example most of the people didn't know how to securely erase hard drives. 77 00:04:42,800 --> 00:04:46,100 They format their USB stick and they thought like okay everything is fine. 78 00:04:46,340 --> 00:04:47,940 Some people didn't care. 79 00:04:47,940 --> 00:04:49,860 They said like yeah I have nothing to hide. 80 00:04:50,080 --> 00:04:52,720 And there's one particular problem if you have a broken device. 81 00:04:52,720 --> 00:04:54,100 For example a broken laptop. 82 00:04:54,220 --> 00:04:57,060 Most people don't know how to remove the hard drive and to format it. 83 00:04:58,440 --> 00:05:08,240 For a long time I thought this problem was actually kind of solved but this year there has been like a study where someone bought like 159 hard drives from Ebay and 66 of them still contain data. 84 00:05:08,240 --> 00:05:09,940 So it's like still apparently like an issue. 85 00:05:10,540 --> 00:05:16,100 The whole problem become a little bit more interesting with smartphones because smartphones also contain a lot of data. 86 00:05:16,100 --> 00:05:18,320 Sometimes even more than your personal computer. 87 00:05:18,420 --> 00:05:19,200 Pictures. 88 00:05:19,340 --> 00:05:20,640 All kind of pictures. 89 00:05:21,000 --> 00:05:23,080 Messages, accounts, credentials, call lists. 90 00:05:23,300 --> 00:05:27,680 And one thing which people didn't know for a long time is that the phones are not encrypted by default. 91 00:05:27,680 --> 00:05:30,160 At least not up to 2014, 2015. 92 00:05:30,160 --> 00:05:32,420 So very long time the phones were not encrypted. 93 00:05:32,560 --> 00:05:36,740 And this was, this was only introduced with iOS 8 for example by Apple in 2014. 94 00:05:36,760 --> 00:05:38,780 Or with Android 6 in 2015. 95 00:05:39,080 --> 00:05:49,600 There have been some researchers who didn't analyze on like um how the devices uh do the um factory reset and they figured out that most devices actually don't do it correctly but still there's a lot of data. 96 00:05:49,880 --> 00:05:52,520 And this was kind of addressed again by NIST in 2014. 97 00:05:52,520 --> 00:05:57,460 They figured out okay smartphones is a big risk so um we should address that in this new standard. 98 00:05:58,360 --> 00:06:01,320 So now the next topic comes with IOT. 99 00:06:01,520 --> 00:06:05,600 Um IOT in contrast to smartphones and uh PCs has like a big difference. 100 00:06:05,600 --> 00:06:11,460 And um there's literally no a small or like no user interface um available. 101 00:06:11,460 --> 00:06:15,500 So as a user you cannot really access directly the data which is on a device . 102 00:06:15,500 --> 00:06:17,800 Like you go in the file browser or something and look at that. 103 00:06:17,960 --> 00:06:21,900 Um so you don't know what kind of data is also collected by this device. 104 00:06:21,900 --> 00:06:25,380 So um you literally don't know anything about your device. 105 00:06:25,380 --> 00:06:29,620 If you do a factory reset then you cannot really verify that this device is really empty. 106 00:06:29,960 --> 00:06:34,860 Um the other thing is you kind of don't know what kind of implementation of the factory reset was done by the vendor. 107 00:06:34,900 --> 00:06:39,660 So and this depends from vendor to vendor, from device to device, and sometimes even from one version to another. 108 00:06:39,660 --> 00:06:44,000 So you could have a version which does it correctly and then the next version may do something completely different. 109 00:06:45,000 --> 00:06:53,620 So the main motivation for this talk is um when I was writing my master thesis uh at XAML and uh was analyzing a lot of security uh the security of a lot of uh IOT devices. 110 00:06:53,700 --> 00:06:57,580 I had to do like a lot of root access methods and had to factory reset them regularly. 111 00:06:57,580 --> 00:07:03,000 And I figured out every time I do a factory reset with this device all the data is still there or there's still data left . 112 00:07:03,000 --> 00:07:05,680 So I was kind of figuring out like hey maybe I should look into that. 113 00:07:06,220 --> 00:07:13,780 Um another important thing is um not only we as kind of hackers are interested in the data but other people are also uh interested in the data. 114 00:07:13,780 --> 00:07:22,760 And this is like an example from Germany where the police figured out like hmm smart devices that might be interesting to look at like for forensic to solve crimes. 115 00:07:23,100 --> 00:07:29,560 Um so more and more people come now on the idea to um actually do forensics analysis of um IOT devices. 116 00:07:29,660 --> 00:07:37,920 Um so this kind of talk is about like if you get a used device or if the cops bust your door and actually take your device so what kind of data you can expect there. 117 00:07:38,460 --> 00:07:41,820 Alright, let's talk about the data on IOT devices. 118 00:07:41,820 --> 00:07:45,980 Um in general the data that you find on a device is basically dependent on the device type. 119 00:07:45,980 --> 00:07:48,360 There's different device types which contain more or less data. 120 00:07:48,920 --> 00:07:54,680 However there's one important thing which is like the same for all IOT devices and this is basically we need to have Wi-Fi credentials. 121 00:07:54,800 --> 00:07:58,500 Without Wi-Fi credentials it's not IOT because it cannot connect to the internet. 122 00:07:58,920 --> 00:08:08,020 Um the other thing what you most of the time have is like some kind of cloud credentials because the device needs to authenticate itself against the cloud to like upload data to download data whatever. 123 00:08:08,500 --> 00:08:16,060 Um as a rule of thumb what I found is the more performance functions or storage a device has the more data is on it or will be collected. 124 00:08:16,120 --> 00:08:20,380 So it is like a thing if you have a very powerful device you can expect it to definitely collect something. 125 00:08:21,020 --> 00:08:31,360 So let's start with the first kind of group of devices and this are the vacuum cleaning robots which most of the time additional to create the credentials contain uh connection log files, maps, cleaning logs , user IDs. 126 00:08:31,360 --> 00:08:36,540 And you see like an example for like um uh like a map um like there on the screen . 127 00:08:36,620 --> 00:08:39,000 Um I did an analysis over a lot of vacuum cleaners. 128 00:08:39,000 --> 00:08:42,300 I have a lot of vacuum cleaners you see like a small collection there but I have even more. 129 00:08:42,420 --> 00:08:44,760 So I had a lot of fun with them. 130 00:08:45,140 --> 00:08:47,880 Um another second group is smart home gateways. 131 00:08:47,880 --> 00:08:50,940 Um this can be anything which controls any functions in your home. 132 00:08:50,960 --> 00:08:56,800 Um they also connect uh contain um connection log files, sensor actuators, binding bindings. 133 00:08:56,800 --> 00:09:01,700 So for example if you have like any sensors in your home they know obviously what kind of sensors you have. 134 00:09:01,740 --> 00:09:08,420 Sometimes they collect also data in terms of like if sensors are triggered like temperature sensors you have like log files about temperatures in your home. 135 00:09:08,940 --> 00:09:14,000 Um depending on the device you might have also key material on it or like user ID again. 136 00:09:14,740 --> 00:09:16,740 The next group, cameras. 137 00:09:16,740 --> 00:09:25,240 Um here again depending on what kind of camera you have um it might contain uh cache snapshots or video clips, recorded video, event logs. 138 00:09:25,240 --> 00:09:33,720 For example if you have this nice uh doorbell cameras and they detect if someone is in front of it then most of the time this device is sometimes or sometimes this device is locked that. 139 00:09:33,980 --> 00:09:51,160 Um it might contain again user IDs and for for cameras in particular they might have a cloud storage credentials because we need to upload like uh video files to some kind of space and um sometimes you can use the storage credentials to download data again so it's like depends on the device. 140 00:09:51,960 --> 00:09:56,220 Another thing which is not directly smart home but uh which is also important are routers. 141 00:09:56,220 --> 00:09:59,600 Um you can buy a lot of routers out of ebay by the way. 142 00:09:59,600 --> 00:10:05,940 So um people update them on a regular base but what they forgot is forget actually is to erase them. 143 00:10:06,080 --> 00:10:22,140 And interesting information for example is there a DCP leases so you see the MAC address to IP binding, you see time stamps, you see like log files you can potentially track down like when this person is home or not home because if you go home your smart phone is logging into your wifi so this kind of stuff is still stored in your device. 144 00:10:22,400 --> 00:10:27,920 Firewall configurations if you have any interesting service behind um like your firewall. 145 00:10:27,980 --> 00:10:35,780 Media files where it's like very powerful like media routers um which contain also like media files and all kind of other log files. 146 00:10:35,780 --> 00:10:49,780 Connections, DNS, some people activate actually DNS logging on their router and sell it later which is maybe not the best idea because you see all the DNS requests and especially parents are a little bit paranoid and set like um children like you know parenting filters and other things, 147 00:10:49,780 --> 00:10:50,580 other stuff. 148 00:10:50,580 --> 00:10:54,920 And also other credentials so some people put whatever in their router. 149 00:10:55,700 --> 00:10:58,000 Another interesting example, media players. 150 00:10:58,360 --> 00:11:00,820 Um this is a kind of a critical thing for me. 151 00:11:01,060 --> 00:11:16,720 Um so they contain again um connection logs, sometimes uh or most of the time media libraries, playlists, caches, um some people are using this kind of devices also for in their home to browse on a TV so basically we have Firefox or some other browser installed, 152 00:11:16,720 --> 00:11:24,380 we have e-mails installed and so on and they contain also um credentials like for Google Play Store or for network shares so people are using them for network shares. 153 00:11:24,760 --> 00:11:37,920 Um there's one important thing which I have to change in my presentation um and it's basically for ethical reasons I need to skip this device because uh this device contains um interesting information or interesting pictures let's say so. 154 00:11:38,080 --> 00:11:40,220 Um with a very interesting taste. 155 00:11:40,220 --> 00:11:48,700 Um I heard from someone else that um this is not that uncommon that someone bought a PlayStation 3 and it contained also like a lot of adult movies and whatever. 156 00:11:49,280 --> 00:11:52,700 Um another thing which I added also um are toys. 157 00:11:52,740 --> 00:11:55,660 Um most of the people don't know that toys can also record a lot of data. 158 00:11:55,660 --> 00:11:57,620 For example I have this nice drone. 159 00:11:57,840 --> 00:12:08,360 Um and this device can also like record uh audio and video data and if you crash it you have no way to reset it and most of the time like this device you cannot reset it anyway in the first place so yeah. 160 00:12:08,920 --> 00:12:09,580 Right. 161 00:12:09,640 --> 00:12:19,140 Um this is like a little bit more technical now, the storage of um IOT devices but this is like a little bit um this is actually important to understand why you kind of screwed up in particular situations. 162 00:12:19,800 --> 00:12:25,600 Um if you talk about storage on IOT devices you have um more or less 2 kinds of flash types which you use. 163 00:12:25,600 --> 00:12:28,620 You use the raw flash um and the block devices. 164 00:12:28,620 --> 00:12:38,260 Um for raw flash the typical things which most of you probably know or see in IOT devices is SPI flash uh which can come in 2 flavors NAND and NOR. 165 00:12:38,360 --> 00:12:43,400 For this presentation we just stick to NAND and uh the parallel uh NAND flash. 166 00:12:43,400 --> 00:12:47,540 Parallel NAND flash is in the green box more or less space also like different flavors of that. 167 00:12:47,720 --> 00:12:53,680 Uh the other group are the block devices which are EMMC, EMCP which is like in your smartphone or SD cards. 168 00:12:53,700 --> 00:13:08,080 And depending what kind of uh storage type you have chosen it affects more or less the um the selection of file systems which you can use for your IOT device and this becomes more or less later uh this becomes important later for the forensic analysis. 169 00:13:08,960 --> 00:13:11,620 Um let's start first with the with the raw NAND flash. 170 00:13:11,620 --> 00:13:22,880 Um if you have SPI flash for example most of the time it's like smaller than 64 megabyte and you see it like in small packages like um let's see like in this kind of uh like 8 pin package. 171 00:13:22,900 --> 00:13:28,740 If you have bigger uh sized uh NAND flash then um it's most of the time like parallel NAND flash. 172 00:13:28,740 --> 00:13:37,640 It's a raw NAND and um this can vary from 128 megabyte to 4 gigabyte and it can come in all kind of different like uh packages like BGA or TSOP or whatever. 173 00:13:37,800 --> 00:13:43,560 Um the reason why vendors are liking or love this kind of flash is because it's cheap and fast. 174 00:13:43,920 --> 00:13:48,520 Um but the problem with that is that it has uh that it produces a lot of bit errors which you need to correct. 175 00:13:48,580 --> 00:14:00,700 And you see on the right how the access is going so basically we have the raw NAND flash and um this is connected to the host processor and the host processor in this case need to take care of their leveling, the ECC correction, and the bad block management. 176 00:14:01,260 --> 00:14:12,180 If you work with Linux this is usually done by the memory technology devices subsystem which takes care of that and it's basically converts the character device into a block device and it kind of takes care of all the things for you. 177 00:14:13,100 --> 00:14:25,560 Um if you take a closer look like to the properties of NAND flash um then what you see at some point is that it's organized in blocks which are then organized uh like in blocks and pages and a block contains multiple pages. 178 00:14:25,560 --> 00:14:32,480 The problem with NAND flash is if you want to erase data you need to erase a whole block which contains a lot of pages. 179 00:14:32,760 --> 00:14:36,620 Um and erasing of a block means basically you set all the things to one. 180 00:14:37,060 --> 00:14:49,280 Um the typical size of these blocks are between 16 and 512 kilobyte so if you want to erase like one particular small area of memory then you need to erase like 512 kilobytes and you need to copy them somewhere. 181 00:14:49,720 --> 00:14:57,160 Interestingly the programming works on page level so the programming you can do it on uh on 2 kilobyte but if you want to erase it you need to erase a big block. 182 00:14:57,760 --> 00:15:08,020 Um the other thing in addition to the data um space there's also like an out of band data um space which is uh for management and for ECC reasons. 183 00:15:08,580 --> 00:15:19,780 Um because NAND flash is so unstable a lot of vendors are adding a lot of some like 2% of uh additional blocks for spare so if um if you have like a lot of bad blocks then basically they are used for that. 184 00:15:19,960 --> 00:15:35,060 And again like I said the ECC is computed by the host CPU and the problem here at some point is that depending on what kind of host CPU you use or NAND controller it can do particular computations differently so you you cannot really swap one flash to another maybe like and read it out. 185 00:15:35,640 --> 00:15:38,980 So let's talk about rare leveling of raw flash. 186 00:15:38,980 --> 00:15:45,580 Um and the problem of uh raw flash is basically that individuals flash cells have very limited uh uh lifetimes and writes. 187 00:15:45,580 --> 00:15:48,200 So you can write on one cell only 1000 times. 188 00:15:48,360 --> 00:15:52,480 And file systems like X2, X3, X4 are not uh rare leveling aware. 189 00:15:52,480 --> 00:16:03,300 So basically if you run an X2 or X3 system uh file system on a NAND flash uh without any other layer in between it will just destroy it with like multiple writes as soon as you write too much. 190 00:16:03,480 --> 00:16:07,460 And the solution for that is basically that you have flash aware file systems or additional layer. 191 00:16:07,460 --> 00:16:16,420 So on the right side you see like one example you might have like a um JFFS2 for example is like a file system which is like flash aware which works on a partition layer. 192 00:16:16,640 --> 00:16:17,660 A level. 193 00:16:17,780 --> 00:16:22,740 And um the other thing which you can do is like you can add an additional level between the flash and the file system. 194 00:16:22,740 --> 00:16:27,200 And this is um an example for that is like UBI or UBF- UBFS. 195 00:16:27,280 --> 00:16:28,980 And this works on the whole level. 196 00:16:29,060 --> 00:16:33,640 There's a particular pro and cons for the decision but this is like more or less depends on the vendor what they want to do. 197 00:16:33,640 --> 00:16:35,140 This is not that important for now. 198 00:16:35,160 --> 00:16:40,640 But uh the thing here is that the support for the bad block management and rare leveling is again done in the operation system. 199 00:16:40,660 --> 00:16:44,480 And the main idea of that is um of this rare leveling in particular. 200 00:16:44,760 --> 00:16:48,980 Um deleted blocks are not erased because that would cause again like many rights. 201 00:16:48,980 --> 00:16:52,120 Instead they are just marked as dirty or deleted. 202 00:16:52,540 --> 00:16:55,560 And uh the actual change information is copied into a new block. 203 00:16:55,600 --> 00:16:59,800 And at some point if necessary the garbage collector will take care of like the old data. 204 00:16:59,800 --> 00:17:03,040 But if you don't need to take care of it then it stays there. 205 00:17:03,740 --> 00:17:05,320 I did the graph for that. 206 00:17:05,400 --> 00:17:07,320 Um so this is again simplified. 207 00:17:07,320 --> 00:17:08,600 So um bear with me. 208 00:17:08,600 --> 00:17:11,700 It's like uh not totally correct in terms of like terms. 209 00:17:11,920 --> 00:17:13,800 Um but imagine we have like a data block. 210 00:17:14,060 --> 00:17:15,740 This one which we want to change. 211 00:17:15,740 --> 00:17:19,980 And it's assigned to the um use block um the physical use block there. 212 00:17:20,040 --> 00:17:24,320 And now what happens is if you want to change it the original the old use block is red. 213 00:17:24,600 --> 00:17:29,000 Then the information with the modified information is written to a new free block. 214 00:17:29,160 --> 00:17:32,880 Um the link is more or less um set to the new block. 215 00:17:32,880 --> 00:17:35,020 And the old block is just marked as dirty. 216 00:17:35,120 --> 00:17:38,220 And the important thing here is the data is still present. 217 00:17:38,220 --> 00:17:39,180 The data is not erased. 218 00:17:39,180 --> 00:17:40,200 It's still there. 219 00:17:40,380 --> 00:17:48,080 Um the interesting thing in particular for IOT is if you if you change a particular file more often then you have more more and more copies of that. 220 00:17:48,420 --> 00:17:52,940 So uh the thing is you have multiple copies on flash. 221 00:17:53,060 --> 00:17:56,660 Um and this data is also not erased as long as this whole block is not erased. 222 00:17:56,660 --> 00:18:00,800 And if you have some data in there which is never touched then it's probably never erased. 223 00:18:01,080 --> 00:18:08,560 Um the interesting thing for us is uh to reverse engineer or like to extract data is basically that the copies have like a size bigger than 2 kilobytes. 224 00:18:08,560 --> 00:18:12,280 So you can put like a text file, credentials file, whatever into that. 225 00:18:12,400 --> 00:18:19,480 And the more data gets changed, for example log files or wi-fi credentials or pictures, uh the more copies you have in NAND flash. 226 00:18:19,480 --> 00:18:23,040 So basically it's like kind of like a backup just without being a backup. 227 00:18:23,680 --> 00:18:25,880 Um so this was super simplified. 228 00:18:25,880 --> 00:18:34,180 If you are more interested in that there's a great talk uh from the back at USA 2014 about reverse engineering flash memory for fun of fun and benefit from Matt O. 229 00:18:34,200 --> 00:18:37,560 And you have given like an introduction into the communication protocol of NAND. 230 00:18:37,560 --> 00:18:42,820 Um the soldering of NAND flash and how to reverse engineer the um NAND formats. 231 00:18:43,080 --> 00:18:48,800 Uh another interesting talk is also like from uh or it's a block entry actually uh from NAND chips to files. 232 00:18:48,980 --> 00:18:52,080 Um from uh John Michael Picotte. 233 00:18:52,080 --> 00:18:54,260 And uh there's also like a recommended thing. 234 00:18:54,940 --> 00:19:00,840 As a side note, by the way, even vendors of devices are not aware of particular features of their file systems. 235 00:19:00,840 --> 00:19:04,440 For example, this is like from uh this is an example from my talk last year at DEF CON. 236 00:19:04,560 --> 00:19:10,880 Um where developers leaked actually like a key um where developer keys in the JFFS2 file system. 237 00:19:10,880 --> 00:19:15,400 So they basically deleted the file and just imaged the whole file system and put it on millions of devices. 238 00:19:15,400 --> 00:19:18,640 And all the millions of devices still had like somewhere the fragments of the key. 239 00:19:18,640 --> 00:19:21,140 So even vendors are not safe from that. 240 00:19:21,700 --> 00:19:23,980 Let's talk about block devices. 241 00:19:24,380 --> 00:19:28,100 Um so block devices are in general known as managed NAND. 242 00:19:28,100 --> 00:19:31,980 Um they have multiple standards uh uh EMMC4, EMMC5. 243 00:19:31,980 --> 00:19:36,060 The higher the standard, the more difficult it gets for us as reverse engineers or like forensics. 244 00:19:36,700 --> 00:19:39,700 Um the classical thing that most people know is like EMMC. 245 00:19:39,880 --> 00:19:44,300 And uh EMMC in tech- technically speaking is a flash with integrated controllers. 246 00:19:44,300 --> 00:19:46,760 So basically the controller is like on the chip. 247 00:19:46,760 --> 00:19:53,400 So it's not necessary anymore that you have- that you do the bare leveling or the other things in like in uh like on the operation system. 248 00:19:53,820 --> 00:19:59,000 Um another flavor of um of this kind of uh memory is EMCP. 249 00:19:59,020 --> 00:20:01,320 And this is typical things which you find on your smartphone. 250 00:20:01,540 --> 00:20:05,760 Um because it's basically EMMC with an additional DRAM on one chip. 251 00:20:05,760 --> 00:20:09,340 And the advantage is you- for the vendor for supply chain basically you have only one chip. 252 00:20:09,340 --> 00:20:11,600 It contains DRAM and flash at the same time. 253 00:20:11,600 --> 00:20:14,600 You see it gets a little bit more complicated with the pins down there. 254 00:20:14,760 --> 00:20:19,620 Um under Linux, this devices are kind of seen as normal block storage devices like an SD card. 255 00:20:19,620 --> 00:20:23,040 And so they support all file systems X2, X3, X4. 256 00:20:23,740 --> 00:20:32,180 Um and the advantage of them kind of is like for complexity reasons that um the bare leveling, the ECC and bad block management is already integrated in them. 257 00:20:32,180 --> 00:20:33,820 So you don't have to take care of that. 258 00:20:34,560 --> 00:20:44,740 Now if you want to access deleted data then it gets a little bit more complicated because the EMMC controller doesn't really allow us to get raw access on the- on the- on the device like with a raw NAND. 259 00:20:44,820 --> 00:20:50,700 Um so but the thing is that the- this kind of chips they're using a raw NAND internally. 260 00:20:50,760 --> 00:20:58,540 And they're like possibilities where you can just um bypass the EMMC controller and directly attach to the NAND internally and just bypass all the security things. 261 00:20:58,980 --> 00:21:04,740 Um the challenge is just that some EMMC controllers are doing some kind of weird format so you need to figure out what- what we do internally. 262 00:21:04,840 --> 00:21:09,280 Again recommended talk here is uh the EMMC chips data recovery beyond the controller. 263 00:21:09,460 --> 00:21:12,920 Uh by a company who is doing like a lot of um recovery things. 264 00:21:12,940 --> 00:21:13,920 Resolute I think. 265 00:21:14,060 --> 00:21:21,160 And the summary is basically even if you delete all the data from the EMMC, all the data is still in there in the- in the- in the chip. 266 00:21:21,160 --> 00:21:22,340 So you can extract it. 267 00:21:22,340 --> 00:21:24,320 Uh but this is a little bit out of scope for this talk. 268 00:21:24,960 --> 00:21:34,740 Alright um let's talk about reset states which you can find if you buy like a used device or if you do dumpster diving or if your neighbor gives you some broken device. 269 00:21:35,220 --> 00:21:38,740 So the reset states most of the time depend on the previous owner. 270 00:21:38,740 --> 00:21:50,480 So some previous owner think like yeah I have nothing to hide so for example for this media box um for the critical one um I don't need to- to reset it at all so basically this device contains still all the data, all the configurations. 271 00:21:50,920 --> 00:21:58,100 Um and one of the reasons why it might be the case is that the knowledge is just missing so the people don't know how to reset this thing. 272 00:21:58,840 --> 00:22:02,280 Another level which can be uh the Wi-Fi configuration reset. 273 00:22:02,620 --> 00:22:08,160 So this device might still contain all the data or most of the data but it's like in an unprovisioned state. 274 00:22:08,280 --> 00:22:10,720 That means if you power it on it won't connect to any Wi-Fi. 275 00:22:10,720 --> 00:22:13,960 It expects more or less you to provision it again to a new Wi-Fi. 276 00:22:14,360 --> 00:22:18,580 And um interestingly many devices only offer this Wi-Fi reset. 277 00:22:18,580 --> 00:22:24,680 Uh so basically if you see a reset button on your device then most of the time it's a Wi-Fi reset it's not the device wipe which is the next thing. 278 00:22:25,020 --> 00:22:36,080 Um device wipes in contrast to that they just delete all the data uh put the device back in a factory state and um but even in this case there might be still traces of data there. 279 00:22:36,100 --> 00:22:44,180 Um interestingly not all the devices support that because it's basically from technical reasons if they built a device incorrectly then they can't just wipe the device. 280 00:22:45,680 --> 00:22:50,740 So in comparison both so some devices actually support both features. 281 00:22:50,820 --> 00:22:56,800 Um so Wi-Fi reset is usually marked by a special button if you have a reset button you click it um it's basically doing a Wi-Fi reset. 282 00:22:56,820 --> 00:23:03,280 Um device wipe um is usually available over the app if you have an app or you need to press like multiple keys. 283 00:23:03,420 --> 00:23:06,520 And now the idea of this Wi-Fi reset is like a very logical one. 284 00:23:06,520 --> 00:23:11,820 So basically you don't want to erase the whole device every time you do want to change the Wi-Fi. 285 00:23:11,980 --> 00:23:15,260 So basically this device can be reconnected quickly to a new Wi-Fi. 286 00:23:15,300 --> 00:23:22,300 So you don't have to wait like for 5 minutes or 10 minutes until the flash gets erased so you want to just move the thing. 287 00:23:22,560 --> 00:23:29,760 In contrast to that I mean with the device wipe you want to erase all the data and you want to get rid of everything and get bring it back in a factory mode. 288 00:23:29,760 --> 00:23:35,680 But this is like these things are like not necessarily the same in terms of like um what people understand under reset you know. 289 00:23:35,680 --> 00:23:39,440 So it's basically for people think they reset the device most of the time it's a Wi-Fi reset. 290 00:23:40,440 --> 00:23:42,960 Alright let's talk about data extraction methods. 291 00:23:43,480 --> 00:23:47,660 Um for me the idea is extract all available data. 292 00:23:47,660 --> 00:23:49,240 Everything which I can get from this device. 293 00:23:49,240 --> 00:23:50,920 And there are multiple methods to do that. 294 00:23:50,920 --> 00:23:55,700 For example if I somehow can get root access on a device then I can extract it by software. 295 00:23:55,920 --> 00:24:00,500 Um sometimes I can dump the flash contents without actually disordering anything. 296 00:24:00,580 --> 00:24:03,640 In the worst case I need to disorder like the flash for example. 297 00:24:03,640 --> 00:24:06,080 So this is like typically the chip off method. 298 00:24:07,060 --> 00:24:18,480 So if you talk about software methods for many IOT devices especially for the cheap ones where like some public methods are available where people tell you how to access like the file system. 299 00:24:18,480 --> 00:24:19,960 How to root a device. 300 00:24:19,960 --> 00:24:21,300 How to do like whatever. 301 00:24:22,080 --> 00:24:26,760 Um and most devices support also like installation of custom firmware or access over USB. 302 00:24:26,760 --> 00:24:30,280 For example ADB or UART. 303 00:24:30,360 --> 00:24:36,920 Um for some devices especially for cameras there's like some special modes where you can boot a system from the uh SD card for example. 304 00:24:37,140 --> 00:24:43,960 And if you have no root shell at some point what you, the thing what you want to do is like basically dump all the flash contents via DD. 305 00:24:44,400 --> 00:24:47,700 Um the advantage for DD is basically DD is not flash aware. 306 00:24:47,700 --> 00:24:54,420 So it doesn't know anything about out of uh out of um data blocks, out of band blocks or ECC. 307 00:24:54,420 --> 00:24:55,580 So it just dumps everything. 308 00:24:55,960 --> 00:24:57,780 Um which is very helpful for us. 309 00:24:57,780 --> 00:25:05,440 Usually you shouldn't use DD by the way if you ever do backups of NAND flashes because you can't restore them again without breaking a system. 310 00:25:05,960 --> 00:25:10,220 Um you extract the data usually by external media SSH or Netcat. 311 00:25:10,220 --> 00:25:12,660 Netcat is probably the most easiest thing to do. 312 00:25:12,940 --> 00:25:18,120 Uh this method of software works especially good for uh file systems if it's like JFFS2 or UBFS. 313 00:25:18,160 --> 00:25:21,860 The disadvantage here is you can only do things with the kernels allowing you. 314 00:25:21,860 --> 00:25:24,860 So basically sometimes the kernel is not allowing you low level access on the flash. 315 00:25:24,860 --> 00:25:26,600 So you might be a little bit limited there. 316 00:25:27,740 --> 00:25:32,380 Um the other thing which you can do is like um you can dump flash without disordering. 317 00:25:32,380 --> 00:25:36,040 And it works mainly very good for SPI flash or EMMC. 318 00:25:36,320 --> 00:25:40,480 Um some of the devices if you get them they allow in system programming. 319 00:25:40,480 --> 00:25:46,860 And how it works basically you take your uh flash reader and you attach it to particular test pins and then you can directly access the memory. 320 00:25:46,920 --> 00:25:50,760 The problem is um the processor shouldn't interfere with this process. 321 00:25:50,760 --> 00:25:54,720 So you need to kind of make sure that the processor or the sock is kind of like not working. 322 00:25:54,740 --> 00:26:02,560 And you can do that um sometimes by pulling like the reset pin or you just ground the uh clock, the crystal so that it doesn't do anything. 323 00:26:02,560 --> 00:26:07,400 The advantage of this thing is well you have a reduced risk of destroying your hardware. 324 00:26:07,400 --> 00:26:13,100 If you're not very good in BGA re-soldering or like um un-soldering then you probably break your device. 325 00:26:13,240 --> 00:26:17,440 The disadvantage is you need to fight the test pins first or you get the traces. 326 00:26:17,460 --> 00:26:24,280 And some vendors do um the four layer PCBs they do so that they hide things like in the middle layers and it's kind of nasty. 327 00:26:25,540 --> 00:26:30,360 Um the last method of re-sort is more or less dumping the flash by de-soldering. 328 00:26:30,360 --> 00:26:34,700 So this works literally for all the flash methods uh for all the flash chips. 329 00:26:35,480 --> 00:26:41,200 Um I'm confused. 330 00:26:43,240 --> 00:27:01,160 Well ok so how does ok um how this works is usually that um the recommended thing is you heat up the PCB um before you do any soldering because if you don't heat up the PCB then um at some point you might accidentally pull pins because you have like a ground pin. 331 00:27:01,900 --> 00:27:23,400 Um if you have accessible pins for like for TSOP um one one trick which you can do is like basically create like a low temperature alloy and a low temperature alloy you just take like a um like an alloy like a soldering alloy which is like 120 137 uh degrees Celsius and then you just mix it with the existing alloy and you can do that uh with a normal soldering iron so you don't need too much special tools. 332 00:27:23,560 --> 00:27:25,860 For BGA chips it gets a little bit more complicated. 333 00:27:26,440 --> 00:27:32,600 Um you most of the time need like some hot air station, infrared or a flow oven or a flow soldering station. 334 00:27:32,620 --> 00:27:36,020 Some people use also a pizza oven but I might not recommend that. 335 00:27:36,500 --> 00:27:52,560 Um in general the disadvantage of BGA chips is um if you want to reuse the device later you need to um re-bore the chip and um to re-solder it and this might be complicated and might be might require a lot of um patience. 336 00:27:53,120 --> 00:28:00,100 Um especially one one thing about NAND devices is that you might need um a special adapter to use them because of the high pin count. 337 00:28:00,300 --> 00:28:04,660 Alright let's start with the tools which you need to do uh which you which you can use for particular things. 338 00:28:04,840 --> 00:28:11,020 Um if you want to access SPI flash um you can literally take any device which can bit ba- do bit banging on GPIOs. 339 00:28:11,020 --> 00:28:14,660 You can use a Raspberry Pi, you can use Adrenos, you can use Bus Pirates. 340 00:28:14,840 --> 00:28:20,000 Um for Raspberry Pi you have the software FlashROM which can natively speak to most of the um flash chips. 341 00:28:20,220 --> 00:28:21,520 So that's kind of easy. 342 00:28:21,520 --> 00:28:28,060 My favorite tool because I use it also for other things is FlashCat USB which is I don't know a couple like 30-40 bucks or so. 343 00:28:28,180 --> 00:28:30,220 Um this is also for that purpose. 344 00:28:30,720 --> 00:28:39,600 Um if you if you want to access EMMC flash um the advantage of EMMC flash is it speaks the same protocol like SD card so you can use potentially like SD card readers. 345 00:28:39,960 --> 00:28:45,780 Um here the important thing is you want to double check the data sheet of the EMMC flash because some of them are low voltage. 346 00:28:45,780 --> 00:28:52,060 So it's like 1.8 volt if you connect it with 3.3 then you have a very hard time and you need to buy new devices. 347 00:28:52,420 --> 00:28:59,560 Um one very cheap method is here um there's a like an um expert tiers uh EMMC adapter for 10 bucks which you can get. 348 00:28:59,560 --> 00:29:01,760 You can just connect it into a SD card reader. 349 00:29:01,760 --> 00:29:08,760 You sort of the um um the cables uh um to to the chip and you can can read it out. 350 00:29:08,820 --> 00:29:16,700 The disadvantage of that is um the chips are very small and um so you might have good eyes to do that or you need a microscope or something. 351 00:29:16,880 --> 00:29:33,900 Um and uh the disadvantage of this particular method is also that you might not be able to access all the partitions which might be which is actually not a real problem for us in this our use case of getting data from those devices but if you do more reverse engineering you also want to access the special partitions like the boot partitions but this doesn't matter here. 352 00:29:34,660 --> 00:29:47,280 Um another method um by the way for EMMC flash is if you get some cheap stuff from China like this uh BGA adapters where you can just put your BGA chip in there and j-jiggle a little bit around and then get a very good connection. 353 00:29:47,480 --> 00:29:52,440 Um the advantage of this is that they support dual volag- uh dual voltage chips. 354 00:29:52,540 --> 00:29:54,820 So uh you should be good to go with that. 355 00:29:54,860 --> 00:30:01,700 Disadvantages with that by the way um you need to find the correct position of the uh of the chip so you need to try a little bit. 356 00:30:01,720 --> 00:30:15,680 And I wouldn't recommend to use the original software because it's detected as malware and the typical recommendation of the developers of the software is yeah it's fine just disable your antivirus and uh doesn't sound very um trustworthy. 357 00:30:16,220 --> 00:30:29,880 Alright um if you want to access uh raw NAND this gets a little bit more complicated because the pin count gets higher so you need like at least um uh I think 16 pins uh which you need to connect um to the chip. 358 00:30:30,340 --> 00:30:33,280 Um and this requires some kind of NAND controller. 359 00:30:33,280 --> 00:30:37,820 You can again look into the uh talk about the reverse engineering flash memory for fun and benefit. 360 00:30:37,820 --> 00:30:39,760 They have like very very cheap method to do that. 361 00:30:39,960 --> 00:30:49,580 But again here there's like more or less professional um devices available where you can just um use like a socket to put the chip in and read it out um and dump all the data. 362 00:30:49,580 --> 00:30:57,920 The problem with that kind of devices is um most of the time that they cannot interpret uh the ECC or the band data so it might be a hit or miss. 363 00:30:58,700 --> 00:31:02,260 Um another method if you have access to that, evaluation boards. 364 00:31:02,260 --> 00:31:04,740 So just take a look at the processor which is used in your device. 365 00:31:04,740 --> 00:31:06,440 So I did a lot of vacuum cleaners. 366 00:31:06,440 --> 00:31:09,520 I have some development boards which I have exactly the same chip. 367 00:31:09,520 --> 00:31:18,480 So I can just solder the chip onto this evaluation board and can just use the processor like it is to read and dump all the information. 368 00:31:18,480 --> 00:31:24,000 And can also use it to write information to that without thinking on how to calculate the ECC and how to do other things. 369 00:31:24,260 --> 00:31:31,440 Um the disadvantage of this method is obviously you need to get this board somehow and sometimes they're not available or if they're available they're extremely expensive. 370 00:31:31,440 --> 00:31:33,660 So it's kind of yeah, difficult. 371 00:31:34,740 --> 00:31:37,020 Um at the moment we extracted the data. 372 00:31:37,020 --> 00:31:39,920 There's like a lot of um there's a whole zoo of tools which you can use. 373 00:31:39,920 --> 00:31:42,580 Um the typical thing that most people just do is like bin walk. 374 00:31:42,780 --> 00:31:48,280 Um if you just extract if you just want to extract some data like credentials then you can just use a hex editor. 375 00:31:48,760 --> 00:31:56,620 Um at some point if you want to interpret uh NAND flash dumps um there's like some tools like the dump flash tool or uh NAND's dump tool. 376 00:31:56,660 --> 00:32:09,460 The problem with this particular tool is um even though that they're open source um they don't handle exotic out of band data sizes correctly sometimes or also the ECC data is kind of like uh difficult. 377 00:32:09,460 --> 00:32:11,780 So it depends more or less on the sock which was used. 378 00:32:12,300 --> 00:32:16,820 If you at some point have like a UB image you can just dump the whole content of that. 379 00:32:17,060 --> 00:32:20,920 Um JFFS images uh it's also easy but it's like also tools for that. 380 00:32:20,920 --> 00:32:23,820 So basically for most of the things you have open source tools available. 381 00:32:24,220 --> 00:32:25,640 Um you should be good to go with that. 382 00:32:26,160 --> 00:32:28,560 Alright let's start with the device analysis. 383 00:32:28,900 --> 00:32:41,500 Um so some of the methods which I use um where basically disassemble the device, um unsolder the flash, dump the flash, put the flash on again, then power the device on again and um maybe try to root it. 384 00:32:41,500 --> 00:32:43,360 Sometimes it works sometimes it doesn't work. 385 00:32:43,700 --> 00:32:48,860 Um the one thing which I try to do is I basically try to connect the device also to the app. 386 00:32:48,860 --> 00:32:55,580 So as a new user kind of I connect to um the device to the app and hope that I still get some old information. 387 00:32:56,120 --> 00:33:06,640 Um the other thing is like as a kind of test I do um I use the devices for example uh I ran vacuum cleaners in my uh in my lab and then I reset them and then I just compare the data which I had before and after that. 388 00:33:06,640 --> 00:33:09,820 So to get an idea of what kind of how good the factory set is. 389 00:33:10,140 --> 00:33:13,520 So the first device where I would start is uh the Echovox D-Bot 900. 390 00:33:13,520 --> 00:33:16,380 I think it's mostly it's very popular in Europe. 391 00:33:16,380 --> 00:33:18,540 I'm not sure how popular it is in America. 392 00:33:18,840 --> 00:33:23,240 I got this device in 2019 and the previous owner told me that he erased it. 393 00:33:23,420 --> 00:33:24,960 So I was kind of curious about that. 394 00:33:24,980 --> 00:33:26,360 This thing runs Linux. 395 00:33:26,480 --> 00:33:29,100 Um it has this weird rock chip, a sock. 396 00:33:29,120 --> 00:33:33,960 And we use a 128 megabyte of uh NAND flash in TSOP um 48 format. 397 00:33:33,960 --> 00:33:36,440 So you see like this green thing on the on the left. 398 00:33:36,760 --> 00:33:43,320 Um the approach that I use is basically I dump the NAND flash and then I connect to the UI to get some additional information uh to figure out what's going on. 399 00:33:43,920 --> 00:33:52,840 After I unsoldered the flash, I wanted to verify um that this device was actually factory resetted because otherwise it's kind of like a little bit unfair. 400 00:33:53,020 --> 00:34:01,140 And the thing is what I found is actually that um I found a log file which is where it says that this device was erased before I got it. 401 00:34:01,140 --> 00:34:05,160 So basically it was it was new for sure but this device was erased. 402 00:34:05,200 --> 00:34:10,440 The next thing what I found there is like lots lots of fragments of log files, keys, maps, bifurc credentials. 403 00:34:10,960 --> 00:34:18,840 The only problem with what I had with this particular device is that I didn't know how to how to uh how to read uh the out of band data to reassign all the blocks correctly. 404 00:34:18,840 --> 00:34:21,020 So this is like still something which I'm working on. 405 00:34:21,180 --> 00:34:27,640 Um the next step what I did is I connected over UART and was hoping that I can get some shell to extract the data very easy. 406 00:34:27,640 --> 00:34:33,120 But unfortunately they did um protect that by making the uh like UART read only. 407 00:34:33,180 --> 00:34:34,920 But I found some information about it. 408 00:34:34,920 --> 00:34:43,020 So the one information I could figure out is that the rock chip is using this very specific like driver to communicate with the uh with the flash and they do a variable link by themselves. 409 00:34:43,220 --> 00:34:48,400 And the other thing what I knew is um that the root partition is squashfs and that the data partition x4 is x4. 410 00:34:48,400 --> 00:34:52,260 So um basically I could expect that I find more more traces. 411 00:34:52,980 --> 00:34:55,600 So this is like the example with the credentials. 412 00:34:55,600 --> 00:35:00,260 So basically um this device um at some point you need obviously to have files which store the credentials. 413 00:35:00,260 --> 00:35:05,540 And what you can see here from the from the top to the bottom uh this was the original file which was created in the factory. 414 00:35:05,540 --> 00:35:13,660 So you still see the factory credentials of the SDSSID and the Wi-Fi password for the factory somewhere in Changshan or wherever this vacuum cleaner was designed. 415 00:35:13,940 --> 00:35:22,260 And over the time when the previous owner was adding Wi-Fi's or was connecting this device to the Wi-Fi, you see that more and more Wi-Fi's were like added to this. 416 00:35:23,160 --> 00:35:25,360 Um the other, I had to censor things. 417 00:35:25,360 --> 00:35:26,720 So the blue things are censored. 418 00:35:26,920 --> 00:35:38,000 Um the other thing what you see out of the log files is every time uh when the vacuum cleaner was connected to the Wi-Fi or when the original point where the owner was provisioning this device first time to the Wi-Fi. 419 00:35:38,000 --> 00:35:45,660 So in this case I knew that this the person had like a Galaxy phone because you can see it in the in the log files that the Galaxy phone was connected to this. 420 00:35:46,020 --> 00:35:50,640 So now we have some of the information so what about locating the former owner? 421 00:35:50,800 --> 00:35:55,940 And um there's like a very useful uh API for that, the Google geolocation API. 422 00:35:56,080 --> 00:36:03,000 And what it does is you give it uh two MAC addresses and the signal strength and it gives you back the coordinates and the accuracy rating. 423 00:36:03,440 --> 00:36:10,900 Um the problem with this particular device was um unfortunately it had only one MAC address so I couldn't use this API to find the original position of that. 424 00:36:11,160 --> 00:36:17,480 Um but there's another website where you can just enter the SSID and then you can just look around the world where this SSID is coming from. 425 00:36:17,640 --> 00:36:30,060 And the thing about this particular SSID is that it was like a provider modem which had like a random random number SSID so I found exactly only one um position where this SSID was used. 426 00:36:30,060 --> 00:36:38,920 At the second SSID from the same owner, I checked, double checked it and figured out it's somewhere in the middle of Germany so I have also the exact address but I didn't have it here. 427 00:36:39,520 --> 00:36:49,020 Um right, so as a summary for this particular device, uh most of the user data was still existing on this device even though it was swiped. 428 00:36:49,040 --> 00:36:54,620 Um I could see the XMMP log files um this device is using XMMP for the communication with the cloud. 429 00:36:54,700 --> 00:36:56,840 Um I could see the maps, the credentials. 430 00:36:57,160 --> 00:37:02,920 Um because the maps are using some kind of weird format I couldn't really reassemble them but I might at some point. 431 00:37:02,980 --> 00:37:09,780 Um I also tried to reset this device 3 times in a row and still could get all the fragments so factory resetting is not very effective there. 432 00:37:09,960 --> 00:37:21,940 Um one interesting aspect is I also found the factory locks so where the sensors and all the other stuff was tested and I think these files are actually not existing anymore in the logical space but they're still on this thing. 433 00:37:22,460 --> 00:37:26,820 Um again I could uh track the previous owner of this device. 434 00:37:26,860 --> 00:37:29,240 However there's one small good news. 435 00:37:29,340 --> 00:37:43,320 Um if you connect this vacuum cleaner now to the to the um wifi and to your uh account then basically the app doesn't leak previous information so it's kind of this is kind of okay so the data is apparently not there anymore in the form that everyone can see it. 436 00:37:43,480 --> 00:37:47,720 Um interesting thing is I found the similar results also for other vacuum cleaners. 437 00:37:47,940 --> 00:37:56,300 I'm not sure if I mean everyone who's using um this kind of raw NAND chips is kind of like want to save money so a lot of devices have exactly the same issue. 438 00:37:57,000 --> 00:38:06,140 Right um the second device which I analyzed um because I do many research on Xiaomi so I bought random used devices and broken devices out of ebay. 439 00:38:06,180 --> 00:38:08,320 Um this is a device which I got in 2018. 440 00:38:08,480 --> 00:38:11,960 Um I didn't really know what kind of condition it had because it was broken. 441 00:38:12,240 --> 00:38:19,660 Um in general the Xiaomi devices they have uh they run an Ubuntu 14.4 uh with a quad core um and they have a 4 gigabyte of EMMC. 442 00:38:19,720 --> 00:38:27,120 And here the approach was that I connect over uh UART and dump the partitions um over UART and then later on I tried to connect it again to the cloud. 443 00:38:27,900 --> 00:38:31,680 Um the good thing about the Xiaomi vacuum cleaners is that routing methods exist. 444 00:38:31,680 --> 00:38:34,280 Um I found them I think 2 years ago and presented them. 445 00:38:34,480 --> 00:38:39,180 Um you can get root shell over UART or you just can push your custom firmware onto that. 446 00:38:39,180 --> 00:38:44,220 The good thing with pushing custom firmware is it doesn't destroy the data so the data is still there so which is kind of good. 447 00:38:44,700 --> 00:38:48,220 Um and later on you can exfiltrate all the data via SSH. 448 00:38:48,540 --> 00:38:55,120 Um the alternative method is if this device is totally broken um you can still remove and dump the flash content but still works. 449 00:38:56,000 --> 00:39:03,560 Um to give you like an idea of for what to look for um this system this is like the EMMC layout um how it looks like. 450 00:39:03,560 --> 00:39:05,960 So you see that it has like 3 copies of the operation system. 451 00:39:06,280 --> 00:39:14,200 Uh then on the um pre last line there's the reserve partition which contains all the usage data so how much how often this device was used. 452 00:39:14,520 --> 00:39:19,480 Um what is the status of like all the sensors, the uh HEPA filter and so on. 453 00:39:19,480 --> 00:39:26,620 And then there's a user partition which is the udisk partition which contains all the logs uh maps, wifi configuration and user ID. 454 00:39:27,060 --> 00:39:30,620 Um and this is like the partition which we're interested for. 455 00:39:30,640 --> 00:39:36,620 So uh 1 thing about this vacuum cleaner in particular this device is actually support 2 modes of uh reset. 456 00:39:36,620 --> 00:39:41,600 So the first thing is wifi reset which is which is a button which is called reset. 457 00:39:42,020 --> 00:39:46,360 Um and the second is like the uh factory reset. 458 00:39:46,480 --> 00:39:51,220 Um the wifi reset what it does is just deletes the wifi credentials but everything else remains there. 459 00:39:51,220 --> 00:39:59,280 And the factory reset needs a special procedure where you need to press multiple buttons to wait and then it resets uh the device in the factory. 460 00:39:59,340 --> 00:40:03,160 Um it's mentioned in the manual but I figured out that nearly no one knows about it. 461 00:40:03,160 --> 00:40:06,300 So probably the first thing what you do is like if you get the manual you just throw it away. 462 00:40:06,720 --> 00:40:07,960 And um yeah. 463 00:40:08,100 --> 00:40:15,920 What this factory reset actually is doing is it restores the um operation system from the recovery and the formats the data partition. 464 00:40:16,040 --> 00:40:19,640 But interestingly here is it doesn't wipe it really so there might be still some traces. 465 00:40:19,820 --> 00:40:25,880 Um the partition of the usage data is not erased so basically all the usage data is still there but not kind of the user data. 466 00:40:26,620 --> 00:40:36,720 So what I did is I just connected it then to the cloud and I figured out oh hey um all the data is still visible in the app so I could figure out like okay when when was the apartment cleaned of the person? 467 00:40:36,880 --> 00:40:38,380 What the apartment is looking like? 468 00:40:38,400 --> 00:40:44,620 And um so the assumption was that this device was only wifi resetted so they pressed only the reset button nothing more. 469 00:40:44,920 --> 00:40:51,880 Um and even though that I connected it to a totally different account uh this device was re-uploading all the data from the vacuum cleaner up in the cloud. 470 00:40:51,880 --> 00:40:53,440 So I had it as a new owner. 471 00:40:53,440 --> 00:40:54,820 I had all the previous data before. 472 00:40:55,140 --> 00:40:58,260 Also all the log files were still um locally available. 473 00:40:58,420 --> 00:41:01,240 And I was kind of curious what happens if I do a factory reset. 474 00:41:01,240 --> 00:41:03,560 So at the end of the day I did the factory reset. 475 00:41:03,560 --> 00:41:09,240 The good news is if you do like a real factory reset and press the real buttons then the data is at least not visible in the app anymore. 476 00:41:09,960 --> 00:41:13,760 Um I was looking at the log files and figured out hey I have two mega addresses. 477 00:41:14,100 --> 00:41:25,840 Um and actually the geo uh the Google geo RP have given me like some coordinates back and um I figured I mean I again censored it so it's like somewhere in the area but I knew the exact address. 478 00:41:26,200 --> 00:41:40,460 Um as soon as I knew the address I was looking at the at the street and I figured out that the Wi-Fi credentials have uh SSID had part of the street name in it and the street number because I don't know someone figured out it's maybe a good idea to use the street name and street number as a Wi-Fi SSID. 479 00:41:40,600 --> 00:41:44,360 And the password contains some uh personal information like probably the dog's name. 480 00:41:44,360 --> 00:41:44,800 I don't know. 481 00:41:44,800 --> 00:41:45,380 Not sure. 482 00:41:45,580 --> 00:41:49,700 Um however because this data is like stored in plain text in the device you can just read it out. 483 00:41:50,280 --> 00:42:11,240 Another magic trick is by the way um the device has a user ID of the user and if you use like the app you can share devices with other users and one thing which I did is basically I created like a fake account connected like a fake device and then I was just sharing this device with this user with the previous owner and had also the profile picture and the name so yeah. 484 00:42:12,180 --> 00:42:17,700 Yeah um so as a summary um for this particular device all the data was still there. 485 00:42:18,080 --> 00:42:20,240 The rest was not wiped. 486 00:42:20,680 --> 00:42:28,460 Um the reset button is very misleading like for many devices so reset is not doing actually reset. 487 00:42:28,740 --> 00:42:33,880 Um however in this case the correct procedure is actually documented in the menu but most of the people don't read that. 488 00:42:34,140 --> 00:42:46,180 Um again here I could track the owner um with the due to the log files and this kind of devices that create a lot of log files and there we are both so you have like a nice um nice idea what's going on there. 489 00:42:46,980 --> 00:42:51,900 Alright um some other example which I have here um are like this doorbelts. 490 00:42:51,900 --> 00:42:59,840 I figured out like I have like now I think 8 doorbelts and 7 of them are more or less from the same I think SDK. 491 00:43:00,100 --> 00:43:09,340 Um in terms of like um if you buy like 8 doorbelts from Amazon you have probably um internally 7 times the same hardware but different interior like exterior. 492 00:43:09,440 --> 00:43:11,740 Most of them are based on the high 3518 chip. 493 00:43:11,920 --> 00:43:15,040 Um they have like an SPI um nor flash in there. 494 00:43:15,040 --> 00:43:20,440 They use again JFS 2 and QBFS so you can happily um recover all the credentials. 495 00:43:20,900 --> 00:43:29,200 Um they have some log files so you might get one MAC address of the of the Wi-Fi access point so it's kind of like a little bit more difficult but actually you could track it down. 496 00:43:29,260 --> 00:43:37,580 The sad thing about this kind of devices is they have unfortunately like a SD card slot so they don't contain video data so it was like a little bit sad about that. 497 00:43:38,660 --> 00:43:49,980 Um not necessarily all IT devices are bad so I found actually one device which I didn't disclose yet um which was also a vacuum cleaner from a different company who used trust zone for key storage. 498 00:43:49,980 --> 00:43:52,380 They encrypted all the user partitions with looks. 499 00:43:52,780 --> 00:44:03,040 Um the um the keys were managed by this trusted execution engine and they're device specific and every time this thing boots up it checks like some states and then unlocks the partitions. 500 00:44:03,040 --> 00:44:13,420 Interesting thing here is if you do a factory reset it just throws away the keys and recreates the partitions so in this kind of case it would be kind of safe but this is like this is one example I've I saw so far so it's very very rare. 501 00:44:14,520 --> 00:44:22,860 Um as a conclusion um in general I had like a sample size of like 26 devices which I had found uh got or found like in like some swap fest. 502 00:44:23,140 --> 00:44:28,320 Um I figured out that apparently um secure or correct factory sets are very difficult to implement. 503 00:44:28,600 --> 00:44:34,360 Um especially if you use raw net uh flash it nearly defeats all the time like uh full vibes. 504 00:44:34,360 --> 00:44:39,800 And there's no real way to ensure that the device has actually waived uh waived uh wiped sorry. 505 00:44:40,060 --> 00:44:43,740 Um many also many of the vendors actually don't release all the user generated data. 506 00:44:43,740 --> 00:44:45,740 So you have like usage data which still remains there. 507 00:44:45,740 --> 00:44:46,900 Log files are not erased. 508 00:44:46,900 --> 00:44:50,380 Um the only thing that sometimes is erased is like the buffer confirmation files. 509 00:44:50,500 --> 00:44:54,300 Um but all the other information is more or less still like on this device. 510 00:44:54,600 --> 00:44:58,240 Um another problem what you have again is uh the missing knowledge of the user. 511 00:44:58,240 --> 00:45:04,940 So if the people don't know how to reset devices then in in the first place then we cannot even complain about the vendors because the user don't reset them. 512 00:45:05,640 --> 00:45:11,220 Um as a recommendation if you ever want to get rid of um devices uh don't sell them and throw them away . 513 00:45:11,740 --> 00:45:15,440 Um especially if you expect that they contain any sensitive information. 514 00:45:15,440 --> 00:45:20,580 So especially don't throw away like this media stuff uh the media players. 515 00:45:21,040 --> 00:45:27,020 Um and also don't throw away devices if you cannot verify that they have been uh done a full wiped. 516 00:45:27,020 --> 00:45:29,520 One example is destroy the physical memory. 517 00:45:29,860 --> 00:45:35,380 If it's a cheap device or just use this device to practice soldering that unsolder resolder things. 518 00:45:35,820 --> 00:45:45,120 Um in general it might be a good idea if you had to throw away devices maybe change your wi-fi credentials so at least that someone who has the credentials cannot break into your local network. 519 00:45:45,200 --> 00:45:52,340 Or the other thing is just put all your devices into a separate IOT wi-fi which kind of also limits the impact if someone gets the credentials. 520 00:45:53,160 --> 00:45:55,700 Alright um that's it. 521 00:45:55,700 --> 00:46:05,280 Uh for here I want to thank uh thank professor Nubir and uh professor uh John Manfidelli from uh the University and also the Zemo team from Darmstadt. 522 00:46:05,440 --> 00:46:12,660 And if you have any questions I'm happily here to answer them and I have also some devices if you want to take a look at this kind of weird adapters. 523 00:46:12,660 --> 00:46:14,360 I'm here for a while. 524 00:46:14,360 --> 00:46:15,120 Thank you.