start	end	text
0	7780	Thank you, everyone, for coming. This is our penultimate talk of the day. This is Dennis.
7780	12640	He's going to be doing a talk on, you know, privacy leaks by dumpster diving, more or
12640	19160	less, correct? Yeah. So if you ever get, you know, cool technology at eBay or the Goodwill
19160	24720	store or in the dumpster, maybe there's some stuff that got left over even after like a
24720	28180	factory reset. So he's going to get into all that today. I think it's going to be pretty
28180	35320	cool. Can everyone in the back hear me okay? If I talk like this, would you really hear
35320	42500	me okay? Okay. So you have to talk as loud as that. Because he's going to start talking
42500	47420	and he's going to be like, can you hear me? It's pretty good talk, right, guys? See? Negative
47420	50800	thumbs. So you got to get real close. Are you ready?
50800	59660	All right. I try. Can you hear me in the back? Yes, maybe. Should I speak louder? Loud enough?
61080	69560	What about now? Yeah, okay. Great. All right. So welcome to my talk about privacy leaks
69560	73840	in smart devices. The introduction was mostly correct in terms of like dumpster diving.
73840	80280	What I do more is like shop on Amazon warehouse deals or like eBay. And the main idea of this
80280	86560	talk is to speak about the extraction of data of used smart home devices. So the outline
86560	90980	for this talk is the following. I start with the motivation. Then I will speak about how
90980	96260	data is stored or what kind of data is stored on IoT devices. Then how is it stored and what
96260	100840	kind of reset states you can imagine if you get like a used device. What kind of data is
100840	107200	maybe there or won't be there. In the next topic, I will talk about the data extraction
107200	111420	methods. So how you get the data off the device. And later on, I will have some example
111420	116280	devices where I will tell you how I got the data off and how I found, for example, like the
116280	120740	previous owner of that. So some information about me. I'm a PhD student at Northeastern
120740	125080	University and I'm working there with Professor Gibraltar Beer. So we're doing mostly wireless
125080	130060	security but I'm kind of into this IoT stuff. I'm also right now a grad student at DTU
130060	134180	Darmstadt in Germany. I'm working there with Matthias Horlich. And my main interest is
134180	139380	like reverse engineering with any kind of interesting devices. It can be nearly everything.
139420	144820	But at the moment it's more like IoT and smart locks. But I do also physical locks which is
144820	150180	kind of like the same thing. And so you find me also in the tool lockpicking village. Some
150180	154800	side notes about my talk. It's not a Xiaomi bashing talk. So maybe some of you know me from
154800	159680	last year where I was giving a lot of talks about Xiaomi. The problem is I have a lot of
159680	164100	these devices so basically I need to talk about them. Most of the methods I present are
164100	169300	already known and used for other things. There are some ethical and legal questions in this
169300	174380	presentation so I had to censor most of the data and like mock it up a little bit. If you use
174380	178220	any of the methods, for example if you want to do like BGA on soldering and you break it then
178220	184780	it's kind of on you. I'm not responsible for that. And a lot of technical aspects I totally
184780	189680	simplified. So basically NAND flash is way more complex but I did it for the sake of the
189680	194160	talk to simplify. And there's particular things which are out of the scope of this talk. For
194160	199920	example how to interpret NAND data or reassemble it or for example how to do device specific
199920	205380	routing. I mean there's a lot of manuals out there so I won't cover that. So let's start with
205380	211580	the motivation of this talk. Traditionally we had like nearly forever like the problem that
211580	216440	there's a lot of second hand devices which still contain data. This issue literally existed
216440	220980	forever since the hard drive exists. But I think it was increased as soon as people started to
220980	225960	buy or sell hard drives on eBay. And most of those hard drives on eBay they still contain
225960	232040	data like some personal information, emails, pictures or any other media. Sometimes even
232040	235740	sensitive documents if the government sold hard drives. And the awareness for this kind of
235740	240880	topic was raised like in the beginning of the 2000s. There was for example like a paper where
240880	244880	the researchers analyzed like what kind of data is still there and what you have to do to
244880	250680	basically get rid of all the data. Interestingly this not only affected like computers but it
250680	254700	also affected like multi-function printers or lab instruments. And the NIST kind of
254700	259400	recognized that in 2006 and they published a standard how to kind of wipe your devices to get
259400	263360	rid of the data. And some of the solution was for example like you need to wipe your device
263360	269640	and actually verify it or you sell devices without hard drive and destroy the hard drive like in
269640	274400	the one picture which is like the example there we just shredded. But there was still like a
274400	279540	big problem and the problem was that the lack of knowledge and awareness of the user. So for
279540	284080	example most of the people didn't know how to securely erase hard drives. They format their USB
284080	288360	stick and they thought like okay everything is fine. Some people didn't care. They said like
288360	292800	yeah I have nothing to hide. And there's one particular problem if you have a broken device. For
292800	297060	example a broken laptop. Most people don't know how to remove the hard drive and to format it.
298440	302520	For a long time I thought this problem was actually kind of solved but this year there has been
302520	307580	like a study where someone bought like 159 hard drives from Ebay and 66 of them still contain
307580	312220	data. So it's like still apparently like an issue. The whole problem become a little bit more
312220	316640	interesting with smartphones because smartphones also contain a lot of data. Sometimes even
316640	321880	more than your personal computer. Pictures. All kind of pictures. Messages, accounts,
321880	326300	credentials, call lists. And one thing which people didn't know for a long time is that the
326300	331360	phones are not encrypted by default. At least not up to 2014, 2015. So very long time the phones
331360	335800	were not encrypted. And this was, this was only introduced with iOS 8 for example by Apple in
335800	341720	2014. Or with Android 6 in 2015. There have been some researchers who didn't analyze on like
341720	347520	um how the devices uh do the um factory reset and they figured out that most devices actually
347520	351500	don't do it correctly but still there's a lot of data. And this was kind of addressed again by
351500	356480	NIST in 2014. They figured out okay smartphones is a big risk so um we should address that in
356480	363520	this new standard. So now the next topic comes with IOT. Um IOT in contrast to smartphones and
363520	369680	uh PCs has like a big difference. And um there's literally no a small or like no user
369680	375300	interface um available. So as a user you cannot really access directly the data which is on a
375300	380120	device. Like you go in the file browser or something and look at that. Um so you don't know
380120	384440	what kind of data is also collected by this device. So um you literally don't know anything
384440	388740	about your device. If you do a factory reset then you cannot really verify that this device is
388740	393120	really empty. Um the other thing is you kind of don't know what kind of implementation of the
393120	397600	factory reset was done by the vendor. So and this depends from vendor to vendor, from device to
397600	401080	device, and sometimes even from one version to another. So you could have a version which does
401080	405980	it correctly and then the next version may do something completely different. So the main
405980	410160	motivation for this talk is um when I was writing my master thesis uh at XAML and uh was
410160	414740	analyzing a lot of security uh the security of a lot of uh IOT devices. I had to do like a
414740	419020	lot of root access methods and had to factory reset them regularly. And I figured out every
419020	422940	time I do a factory reset with this device all the data is still there or there's still data
422940	427300	left. So I was kind of figuring out like hey maybe I should look into that. Um another
427300	431940	important thing is um not only we as kind of hackers are interested in the data but other
431940	435860	people are also uh interested in the data. And this is like an example from Germany where the
435860	440540	police figured out like hmm smart devices that might be interesting to look at like for
440540	446760	forensic to solve crimes. Um so more and more people come now on the idea to um actually do
446760	453020	forensics analysis of um IOT devices. Um so this kind of talk is about like if you get a
453020	456800	used device or if the cops bust your door and actually take your device so what kind of data
456800	463080	you can expect there. Alright, let's talk about the data on IOT devices. Um in general the
463080	466420	data that you find on a device is basically dependent on the device type. There's different
466420	470600	device types which contain more or less data. However there's one important thing which is
470600	474680	like the same for all IOT devices and this is basically we need to have Wi-Fi credentials.
474800	479480	Without Wi-Fi credentials it's not IOT because it cannot connect to the internet. Um the
479480	482880	other thing what you most of the time have is like some kind of cloud credentials because the
482880	487280	device needs to authenticate itself against the cloud to like upload data to download data
487280	492400	whatever. Um as a rule of thumb what I found is the more performance functions or storage
492500	497380	a device has the more data is on it or will be collected. So it is like a thing if you have a
497380	502060	very powerful device you can expect it to definitely collect something. So let's start with
502060	505880	the first kind of group of devices and this are the vacuum cleaning robots which most of the
505880	510360	time additional to create the credentials contain uh connection log files, maps, cleaning
510360	516100	logs, user IDs. And you see like an example for like um uh like a map um like there on the
516100	519840	screen. Um I did an analysis over a lot of vacuum cleaners. I have a lot of vacuum cleaners
519840	524760	you see like a small collection there but I have even more. So I had a lot of fun with them.
525140	529900	Um another second group is smart home gateways. Um this can be anything which controls any
529900	535300	functions in your home. Um they also connect uh contain um connection log files, sensor
535300	539120	actuators, binding bindings. So for example if you have like any sensors in your home they
539120	543400	know obviously what kind of sensors you have. Sometimes they collect also data in terms of
543400	547020	like if sensors are triggered like temperature sensors you have like log files about
547020	551620	temperatures in your home. Um depending on the device you might have also key material on it
551620	559460	or like user ID again. The next group, cameras. Um here again depending on what kind of
559460	564840	camera you have um it might contain uh cache snapshots or video clips, recorded video, event
564840	568880	logs. For example if you have this nice uh doorbell cameras and they detect if someone is
568880	572780	in front of it then most of the time this device is sometimes or sometimes this device is
572780	578840	locked that. Um it might contain again user IDs and for for cameras in particular they might
578840	583600	have a cloud storage credentials because we need to upload like uh video files to some kind
583600	589700	of space and um sometimes you can use the storage credentials to download data again so it's
589700	594860	like depends on the device. Another thing which is not directly smart home but uh which is
594860	600340	also important are routers. Um you can buy a lot of routers out of ebay by the way. So um
600340	605940	people update them on a regular base but what they forgot is forget actually is to erase them.
606080	610400	And interesting information for example is there a DCP leases so you see the MAC address to IP
610400	615400	binding, you see time stamps, you see like log files you can potentially track down like when
615400	619260	this person is home or not home because if you go home your smart phone is logging into your
619260	623880	wifi so this kind of stuff is still stored in your device. Firewall configurations if you have
623880	629440	any interesting service behind um like your firewall. Media files where it's like very
629440	635300	powerful like media routers um which contain also like media files and all kind of other log
635300	640040	files. Connections, DNS, some people activate actually DNS logging on their router and sell
640040	644320	it later which is maybe not the best idea because you see all the DNS requests and especially
644320	648740	parents are a little bit paranoid and set like um children like you know parenting filters
648740	654100	and other things, other stuff. And also other credentials so some people put whatever in
654100	659880	their router. Another interesting example, media players. Um this is a kind of a critical
659880	666380	thing for me. Um so they contain again um connection logs, sometimes uh or most of the
666380	672120	time media libraries, playlists, caches, um some people are using this kind of devices also
672120	676200	for in their home to browse on a TV so basically we have Firefox or some other browser
676200	680720	installed, we have e-mails installed and so on and they contain also um credentials like for
680720	684800	Google Play Store or for network shares so people are using them for network shares. Um
684800	689540	there's one important thing which I have to change in my presentation um and it's basically
689540	695340	for ethical reasons I need to skip this device because uh this device contains um interesting
695340	700780	information or interesting pictures let's say so. Um with a very interesting taste. Um I
700780	705140	heard from someone else that um this is not that uncommon that someone bought a
705140	710100	PlayStation 3 and it contained also like a lot of adult movies and whatever. Um another
710100	714740	thing which I added also um are toys. Um most of the people don't know that toys can also
714740	719640	record a lot of data. For example I have this nice drone. Um and this device can also like
719640	724580	record uh audio and video data and if you crash it you have no way to reset it and most of
724580	730040	the time like this device you cannot reset it anyway in the first place so yeah. Right. Um
730040	733660	this is like a little bit more technical now, the storage of um IOT devices but this is
733660	737860	like a little bit um this is actually important to understand why you kind of screwed up in
737860	743400	particular situations. Um if you talk about storage on IOT devices you have um more or less
743400	748900	2 kinds of flash types which you use. You use the raw flash um and the block devices. Um for
748900	754980	raw flash the typical things which most of you probably know or see in IOT devices is SPI
754980	760180	flash uh which can come in 2 flavors NAND and NOR. For this presentation we just stick to
760180	765360	NAND and uh the parallel uh NAND flash. Parallel NAND flash is in the green box more or
765360	769720	less space also like different flavors of that. Uh the other group are the block devices which
769720	775880	are EMMC, EMCP which is like in your smartphone or SD cards. And depending what kind of uh
775880	781760	storage type you have chosen it affects more or less the um the selection of file systems
781760	785540	which you can use for your IOT device and this becomes more or less later uh this becomes
785540	791040	important later for the forensic analysis. Um let's start first with the with the raw NAND
791040	795760	flash. Um if you have SPI flash for example most of the time it's like smaller than 64
795760	801140	megabyte and you see it like in small packages like um let's see like in this kind of uh like
801140	807480	8 pin package. If you have bigger uh sized uh NAND flash then um it's most of the time like
807480	813100	parallel NAND flash. It's a raw NAND and um this can vary from 128 megabyte to 4 gigabyte and
813100	818740	it can come in all kind of different like uh packages like BGA or TSOP or whatever. Um the
818740	824340	reason why vendors are liking or love this kind of flash is because it's cheap and fast. Um but
824340	827840	the problem with that is that it has uh that it produces a lot of bit errors which you need to
827840	832320	correct. And you see on the right how the access is going so basically we have the raw NAND flash
832900	836980	and um this is connected to the host processor and the host processor in this case need to take
836980	841940	care of their leveling, the ECC correction, and the bad block management. If you work with
841940	846360	Linux this is usually done by the memory technology devices subsystem which takes care of
846360	850400	that and it's basically converts the character device into a block device and it kind of takes
850400	856420	care of all the things for you. Um if you take a closer look like to the properties of NAND
856420	860740	flash um then what you see at some point is that it's organized in blocks which are then
860740	867060	organized uh like in blocks and pages and a block contains multiple pages. The problem with
867060	871640	NAND flash is if you want to erase data you need to erase a whole block which contains a lot
871640	877640	of pages. Um and erasing of a block means basically you set all the things to one. Um the
877640	882960	typical size of these blocks are between 16 and 512 kilobyte so if you want to erase like one
882960	888340	particular small area of memory then you need to erase like 512 kilobytes and you need to copy
888340	893320	them somewhere. Interestingly the programming works on page level so the programming you can
893320	899080	do it on uh on 2 kilobyte but if you want to erase it you need to erase a big block. Um the
899080	904900	other thing in addition to the data um space there's also like an out of band data um space
905420	911620	which is uh for management and for ECC reasons. Um because NAND flash is so unstable a lot of
911620	916980	vendors are adding a lot of some like 2% of uh additional blocks for spare so if um if you
916980	921160	have like a lot of bad blocks then basically they are used for that. And again like I said the
921160	925960	ECC is computed by the host CPU and the problem here at some point is that depending on what
925960	930560	kind of host CPU you use or NAND controller it can do particular computations differently so
930560	937260	you you cannot really swap one flash to another maybe like and read it out. So let's talk
937260	941720	about rare leveling of raw flash. Um and the problem of uh raw flash is basically that
941720	946280	individuals flash cells have very limited uh uh lifetimes and writes. So you can write on
946280	952600	one cell only 1000 times. And file systems like X2, X3, X4 are not uh rare leveling aware. So
952600	958900	basically if you run an X2 or X3 system uh file system on a NAND flash uh without any other
958900	962920	layer in between it will just destroy it with like multiple writes as soon as you write too
962920	966560	much. And the solution for that is basically that you have flash aware file systems or
966560	971020	additional layer. So on the right side you see like one example you might have like a um
971840	975700	JFFS2 for example is like a file system which is like flash aware which works on a partition
975700	980420	layer. A level. And um the other thing which you can do is like you can add an additional
980420	984600	level between the flash and the file system. And this is um an example for that is like
984600	990860	UBI or UBF- UBFS. And this works on the whole level. There's a particular pro and cons for
990860	993740	the decision but this is like more or less depends on the vendor what they want to do. This
993740	997760	is not that important for now. But uh the thing here is that the support for the bad block
997760	1001620	management and rare leveling is again done in the operation system. And the main idea of
1001620	1006960	that is um of this rare leveling in particular. Um deleted blocks are not erased because that
1006960	1012720	would cause again like many rights. Instead they are just marked as dirty or deleted. And
1012720	1017440	uh the actual change information is copied into a new block. And at some point if necessary
1017440	1020940	the garbage collector will take care of like the old data. But if you don't need to take
1020940	1027320	care of it then it stays there. I did the graph for that. Um so this is again simplified.
1027320	1032480	So um bear with me. It's like uh not totally correct in terms of like terms. Um but imagine
1032480	1036940	we have like a data block. This one which we want to change. And it's assigned to the
1036940	1042000	um use block um the physical use block there. And now what happens is if you want to change
1042000	1046940	it the original the old use block is red. Then the information with the modified information
1046940	1053220	is written to a new free block. Um the link is more or less um set to the new block. And
1053220	1057840	the old block is just marked as dirty. And the important thing here is the data is still
1057840	1062560	present. The data is not erased. It's still there. Um the interesting thing in particular
1062560	1066980	for IOT is if you if you change a particular file more often then you have more more and
1066980	1073820	more copies of that. So uh the thing is you have multiple copies on flash. Um and this
1073820	1077280	data is also not erased as long as this whole block is not erased. And if you have some
1077280	1081900	data in there which is never touched then it's probably never erased. Um the interesting
1081900	1086220	thing for us is uh to reverse engineer or like to extract data is basically that the
1086220	1090660	copies have like a size bigger than 2 kilobytes. So you can put like a text file, credentials
1090660	1095320	file, whatever into that. And the more data gets changed, for example log files or
1095320	1100120	wi-fi credentials or pictures, uh the more copies you have in NAND flash. So basically it's
1100120	1105920	like kind of like a backup just without being a backup. Um so this was super simplified. If
1105920	1110640	you are more interested in that there's a great talk uh from the back at USA 2014 about
1110640	1114680	reverse engineering flash memory for fun of fun and benefit from Matt O. And you have
1114680	1118340	given like an introduction into the communication protocol of NAND. Um the soldering
1118740	1124040	of NAND flash and how to reverse engineer the um NAND formats. Uh another interesting talk
1124040	1130120	is also like from uh or it's a block entry actually uh from NAND chips to files. Um from uh
1130120	1135920	John Michael Picotte. And uh there's also like a recommended thing. As a side note, by the
1135920	1140900	way, even vendors of devices are not aware of particular features of their file systems. For
1140900	1145400	example, this is like from uh this is an example from my talk last year at DEF CON. Um where
1145400	1150880	developers leaked actually like a key um where developer keys in the JFFS2 file system. So
1150880	1154780	they basically deleted the file and just imaged the whole file system and put it on millions of
1154780	1158820	devices. And all the millions of devices still had like somewhere the fragments of the key. So
1158820	1166020	even vendors are not safe from that. Let's talk about block devices. Um so block devices are
1166020	1172180	in general known as managed NAND. Um they have multiple standards uh uh EMMC4, EMMC5. The
1172180	1176740	higher the standard, the more difficult it gets for us as reverse engineers or like forensics. Um
1176740	1182000	the classical thing that most people know is like EMMC. And uh EMMC in tech- technically
1182000	1186760	speaking is a flash with integrated controllers. So basically the controller is like on the chip.
1186760	1190320	So it's not necessary anymore that you have- that you do the bare leveling or the other things
1190760	1197680	in like in uh like on the operation system. Um another flavor of um of this kind of uh memory
1197680	1202220	is EMCP. And this is typical things which you find on your smartphone. Um because it's
1202220	1207200	basically EMMC with an additional DRAM on one chip. And the advantage is you- for the vendor
1207200	1211080	for supply chain basically you have only one chip. It contains DRAM and flash at the same
1211080	1215460	time. You see it gets a little bit more complicated with the pins down there. Um under
1215460	1220240	Linux, this devices are kind of seen as normal block storage devices like an SD card. And so
1220240	1226240	they support all file systems X2, X3, X4. Um and the advantage of them kind of is like for
1226240	1231060	complexity reasons that um the bare leveling, the ECC and bad block management is already
1231060	1235780	integrated in them. So you don't have to take care of that. Now if you want to access
1235780	1239560	deleted data then it gets a little bit more complicated because the EMMC controller doesn't
1239560	1246340	really allow us to get raw access on the- on the- on the device like with a raw NAND. Um so
1246850	1251220	but the thing is that the- this kind of chips they're using a raw NAND internally. And
1251220	1255180	they're like possibilities where you can just um bypass the EMMC controller and directly
1255180	1260100	attach to the NAND internally and just bypass all the security things. Um the challenge is
1260100	1263420	just that some EMMC controllers are doing some kind of weird format so you need to figure
1263420	1267980	out what- what we do internally. Again recommended talk here is uh the EMMC chips data
1267980	1272220	recovery beyond the controller. Uh by a company who is doing like a lot of um recovery
1272220	1276880	things. Resolute I think. And the summary is basically even if you delete all the data from
1276880	1282340	the EMMC, all the data is still in there in the- in the- in the chip. So you can extract it.
1282340	1288600	Uh but this is a little bit out of scope for this talk. Alright um let's talk about reset states
1288600	1292840	which you can find if you buy like a used device or if you do dumpster diving or if your
1292840	1297880	neighbor gives you some broken device. So the reset states most of the time depend on the
1297880	1302040	previous owner. So some previous owner think like yeah I have nothing to hide so for example
1302040	1307160	for this media box um for the critical one um I don't need to- to reset it at all so
1307160	1312100	basically this device contains still all the data, all the configurations. Um and one of
1312100	1316340	the reasons why it might be the case is that the knowledge is just missing so the people
1316340	1321600	don't know how to reset this thing. Another level which can be uh the Wi-Fi configuration
1321600	1327160	reset. So this device might still contain all the data or most of the data but it's like in
1327160	1330740	an unprovisioned state. That means if you power it on it won't connect to any Wi-Fi. It
1330740	1336580	expects more or less you to provision it again to a new Wi-Fi. And um interestingly many
1336580	1340380	devices only offer this Wi-Fi reset. Uh so basically if you see a reset button on your
1340380	1344020	device then most of the time it's a Wi-Fi reset it's not the device wipe which is the next
1344020	1349960	thing. Um device wipes in contrast to that they just delete all the data uh put the device
1349960	1355320	back in a factory state and um but even in this case there might be still traces of data
1355320	1359320	there. Um interestingly not all the devices support that because it's basically from
1359320	1364180	technical reasons if they built a device incorrectly then they can't just wipe the device.
1365680	1371740	So in comparison both so some devices actually support both features. Um so Wi-Fi reset is
1371740	1375420	usually marked by a special button if you have a reset button you click it um it's basically
1375420	1381060	doing a Wi-Fi reset. Um device wipe um is usually available over the app if you have an app or
1381060	1385740	you need to press like multiple keys. And now the idea of this Wi-Fi reset is like a very
1385740	1390840	logical one. So basically you don't want to erase the whole device every time you do want to
1390840	1395840	change the Wi-Fi. So basically this device can be reconnected quickly to a new Wi-Fi. So you
1395840	1400460	don't have to wait like for 5 minutes or 10 minutes until the flash gets erased so you want
1400460	1406040	to just move the thing. In contrast to that I mean with the device wipe you want to erase all
1406040	1409880	the data and you want to get rid of everything and get bring it back in a factory mode. But
1409880	1414040	this is like these things are like not necessarily the same in terms of like um what people
1414040	1417700	understand under reset you know. So it's basically for people think they reset the device
1417700	1424380	most of the time it's a Wi-Fi reset. Alright let's talk about data extraction methods. Um for
1424380	1429460	me the idea is extract all available data. Everything which I can get from this device. And
1429460	1433900	there are multiple methods to do that. For example if I somehow can get root access on a
1433900	1439260	device then I can extract it by software. Um sometimes I can dump the flash contents without
1439260	1443120	actually disordering anything. In the worst case I need to disorder like the flash for
1443120	1449000	example. So this is like typically the chip off method. So if you talk about software methods
1449000	1455000	for many IOT devices especially for the cheap ones where like some public methods are
1455000	1460060	available where people tell you how to access like the file system. How to root a device. How
1460060	1465380	to do like whatever. Um and most devices support also like installation of custom firmware
1465380	1472260	or access over USB. For example ADB or UART. Um for some devices especially for cameras
1472260	1476160	there's like some special modes where you can boot a system from the uh SD card for
1476160	1480740	example. And if you have no root shell at some point what you, the thing what you want to do
1480740	1486760	is like basically dump all the flash contents via DD. Um the advantage for DD is basically DD
1486760	1492740	is not flash aware. So it doesn't know anything about out of uh out of um data blocks, out of
1492740	1498180	band blocks or ECC. So it just dumps everything. Um which is very helpful for us. Usually you
1498180	1503000	shouldn't use DD by the way if you ever do backups of NAND flashes because you can't
1503000	1508300	restore them again without breaking a system. Um you extract the data usually by external
1508300	1513580	media SSH or Netcat. Netcat is probably the most easiest thing to do. Uh this method of
1513580	1518320	software works especially good for uh file systems if it's like JFFS2 or UBFS. The
1518320	1522280	disadvantage here is you can only do things with the kernels allowing you. So basically
1522280	1525560	sometimes the kernel is not allowing you low level access on the flash. So you might be a
1525560	1531380	little bit limited there. Um the other thing which you can do is like um you can dump flash
1531380	1537460	without disordering. And it works mainly very good for SPI flash or EMMC. Um some of the
1537460	1541900	devices if you get them they allow in system programming. And how it works basically you
1541900	1545520	take your uh flash reader and you attach it to particular test pins and then you can
1545520	1550320	directly access the memory. The problem is um the processor shouldn't interfere with this
1550320	1553460	process. So you need to kind of make sure that the processor or the sock is kind of like
1553460	1558380	not working. And you can do that um sometimes by pulling like the reset pin or you just
1558380	1563980	ground the uh clock, the crystal so that it doesn't do anything. The advantage of this
1563980	1568280	thing is well you have a reduced risk of destroying your hardware. If you're not very good
1568280	1573320	in BGA re-soldering or like um un-soldering then you probably break your device. The
1573320	1577800	disadvantage is you need to fight the test pins first or you get the traces. And some
1577800	1582700	vendors do um the four layer PCBs they do so that they hide things like in the middle
1582700	1589240	layers and it's kind of nasty. Um the last method of re-sort is more or less dumping the
1589240	1593960	flash by de-soldering. So this works literally for all the flash methods uh for all the flash
1593960	1611420	chips. Um I'm confused. Well ok so how does ok um how this works is usually that um the
1611420	1616200	recommended thing is you heat up the PCB um before you do any soldering because if you don't
1616200	1620600	heat up the PCB then um at some point you might accidentally pull pins because you have like a
1620600	1627000	ground pin. Um if you have accessible pins for like for TSOP um one one trick which you can
1627000	1630760	do is like basically create like a low temperature alloy and a low temperature alloy you
1630760	1636560	just take like a um like an alloy like a soldering alloy which is like 120 137 uh degrees
1636560	1640840	Celsius and then you just mix it with the existing alloy and you can do that uh with a normal
1640840	1644840	soldering iron so you don't need too much special tools. For BGA chips it gets a little bit
1644840	1649740	more complicated. Um you most of the time need like some hot air station, infrared or a
1649740	1655320	flow oven or a flow soldering station. Some people use also a pizza oven but I might not
1655320	1661680	recommend that. Um in general the disadvantage of BGA chips is um if you want to reuse the
1661680	1667100	device later you need to um re-bore the chip and um to re-solder it and this might be
1667100	1674760	complicated and might be might require a lot of um patience. Um especially one one thing
1674760	1679040	about NAND devices is that you might need um a special adapter to use them because of the
1679040	1683200	high pin count. Alright let's start with the tools which you need to do uh which you which you
1683200	1687860	can use for particular things. Um if you want to access SPI flash um you can literally take
1687860	1692480	any device which can bit ba- do bit banging on GPIOs. You can use a Raspberry Pi, you can use
1692480	1697200	Adrenos, you can use Bus Pirates. Um for Raspberry Pi you have the software FlashROM which can
1697200	1702280	natively speak to most of the um flash chips. So that's kind of easy. My favorite tool
1702280	1706180	because I use it also for other things is FlashCat USB which is I don't know a couple like
1706180	1713060	30-40 bucks or so. Um this is also for that purpose. Um if you if you want to access EMMC
1713060	1717740	flash um the advantage of EMMC flash is it speaks the same protocol like SD card so you can
1717740	1722160	use potentially like SD card readers. Um here the important thing is you want to double
1722160	1726660	check the data sheet of the EMMC flash because some of them are low voltage. So it's like 1.8
1726660	1731280	volt if you connect it with 3.3 then you have a very hard time and you need to buy new
1731280	1738120	devices. Um one very cheap method is here um there's a like an um expert tiers uh EMMC adapter
1738120	1742300	for 10 bucks which you can get. You can just connect it into a SD card reader. You sort of
1742300	1749620	the um um the cables uh um to to the chip and you can can read it out. The disadvantage of
1749620	1755800	that is um the chips are very small and um so you might have good eyes to do that or you need a
1755800	1760240	microscope or something. Um and uh the disadvantage of this particular method is also
1760240	1764620	that you might not be able to access all the partitions which might be which is actually not a
1765080	1768820	real problem for us in this our use case of getting data from those devices but if you do
1768820	1772260	more reverse engineering you also want to access the special partitions like the boot
1772260	1777720	partitions but this doesn't matter here. Um another method um by the way for EMMC flash is
1777720	1782400	if you get some cheap stuff from China like this uh BGA adapters where you can just put your
1782400	1787840	BGA chip in there and j-jiggle a little bit around and then get a very good connection. Um
1787840	1793380	the advantage of this is that they support dual volag- uh dual voltage chips. So uh you
1793380	1798300	should be good to go with that. Disadvantages with that by the way um you need to find the
1798300	1802700	correct position of the uh of the chip so you need to try a little bit. And I wouldn't
1802700	1805880	recommend to use the original software because it's detected as malware and the typical
1805880	1810020	recommendation of the developers of the software is yeah it's fine just disable your
1810020	1819800	antivirus and uh doesn't sound very um trustworthy. Alright um if you want to access uh raw
1819800	1823200	NAND this gets a little bit more complicated because the pin count gets higher so you need
1823200	1831580	like at least um uh I think 16 pins uh which you need to connect um to the chip. Um and this
1831580	1835600	requires some kind of NAND controller. You can again look into the uh talk about the
1835600	1838780	reverse engineering flash memory for fun and benefit. They have like very very cheap
1838780	1843560	method to do that. But again here there's like more or less professional um devices
1843560	1848740	available where you can just um use like a socket to put the chip in and read it out um and
1848740	1852760	dump all the data. The problem with that kind of devices is um most of the time that they
1852760	1859800	cannot interpret uh the ECC or the band data so it might be a hit or miss. Um another method
1859800	1863700	if you have access to that, evaluation boards. So just take a look at the processor which
1863700	1867880	is used in your device. So I did a lot of vacuum cleaners. I have some development boards
1867880	1873420	which I have exactly the same chip. So I can just solder the chip onto this evaluation board
1873420	1878920	and can just use the processor like it is to read and dump all the information. And can also
1878920	1883080	use it to write information to that without thinking on how to calculate the ECC and how to
1883080	1886960	do other things. Um the disadvantage of this method is obviously you need to get this board
1886960	1890800	somehow and sometimes they're not available or if they're available they're extremely
1890800	1897180	expensive. So it's kind of yeah, difficult. Um at the moment we extracted the data. There's
1897180	1900800	like a lot of um there's a whole zoo of tools which you can use. Um the typical thing that
1900800	1905720	most people just do is like bin walk. Um if you just extract if you just want to extract some
1905720	1910340	data like credentials then you can just use a hex editor. Um at some point if you want to
1910340	1915200	interpret uh NAND flash dumps um there's like some tools like the dump flash tool or uh
1915200	1919480	NAND's dump tool. The problem with this particular tool is um even though that they're
1919480	1927080	open source um they don't handle exotic out of band data sizes correctly sometimes or also
1927080	1931080	the ECC data is kind of like uh difficult. So it depends more or less on the sock which was
1931080	1937340	used. If you at some point have like a UB image you can just dump the whole content of that. Um
1937340	1941880	JFFS images uh it's also easy but it's like also tools for that. So basically for most of the
1941880	1946560	things you have open source tools available. Um you should be good to go with that. Alright
1946560	1952540	let's start with the device analysis. Um so some of the methods which I use um where
1952540	1957580	basically disassemble the device, um unsolder the flash, dump the flash, put the flash on
1957580	1962100	again, then power the device on again and um maybe try to root it. Sometimes it works
1962100	1967440	sometimes it doesn't work. Um the one thing which I try to do is I basically try to connect
1967440	1973380	the device also to the app. So as a new user kind of I connect to um the device to the app and
1973380	1978560	hope that I still get some old information. Um the other thing is like as a kind of test I
1978560	1983860	do um I use the devices for example uh I ran vacuum cleaners in my uh in my lab and then I
1983860	1987180	reset them and then I just compare the data which I had before and after that. So to get an
1987180	1991880	idea of what kind of how good the factory set is. So the first device where I would start is
1991880	1997100	uh the Echovox D-Bot 900. I think it's mostly it's very popular in Europe. I'm not sure how
1997100	2002260	popular it is in America. I got this device in 2019 and the previous owner told me that he
2002260	2007460	erased it. So I was kind of curious about that. This thing runs Linux. Um it has this weird
2007460	2014160	rock chip, a sock. And we use a 128 megabyte of uh NAND flash in TSOP um 48 format. So you
2014160	2018720	see like this green thing on the on the left. Um the approach that I use is basically I dump
2018720	2022220	the NAND flash and then I connect to the UI to get some additional information uh to figure
2022220	2029080	out what's going on. After I unsoldered the flash, I wanted to verify um that this device was
2029080	2033600	actually factory resetted because otherwise it's kind of like a little bit unfair. And the
2033600	2039180	thing is what I found is actually that um I found a log file which is where it says that this
2039180	2044460	device was erased before I got it. So basically it was it was new for sure but this device was
2044460	2049180	erased. The next thing what I found there is like lots lots of fragments of log files, keys,
2049180	2053500	maps, bifurc credentials. The only problem with what I had with this particular device is that I
2053500	2058260	didn't know how to how to uh how to read uh the out of band data to reassign all the blocks
2058260	2063220	correctly. So this is like still something which I'm working on. Um the next step what I did is
2063220	2067640	I connected over UART and was hoping that I can get some shell to extract the data very easy.
2067640	2073680	But unfortunately they did um protect that by making the uh like UART read only. But I found
2073680	2077240	some information about it. So the one information I could figure out is that the rock chip is
2077240	2081760	using this very specific like driver to communicate with the uh with the flash and they do a
2081760	2085920	variable link by themselves. And the other thing what I knew is um that the root partition is
2085920	2091260	squashfs and that the data partition x4 is x4. So um basically I could expect that I find
2091260	2097600	more more traces. So this is like the example with the credentials. So basically um this
2097600	2100660	device um at some point you need obviously to have files which store the credentials. And what
2100660	2104600	you can see here from the from the top to the bottom uh this was the original file which was
2104600	2109080	created in the factory. So you still see the factory credentials of the SDSSID and the Wi-Fi
2109080	2112960	password for the factory somewhere in Changshan or wherever this vacuum cleaner was
2112960	2118100	designed. And over the time when the previous owner was adding Wi-Fi's or was connecting this
2118100	2123540	device to the Wi-Fi, you see that more and more Wi-Fi's were like added to this. Um the
2123540	2128020	other, I had to censor things. So the blue things are censored. Um the other thing what you
2128020	2132000	see out of the log files is every time uh when the vacuum cleaner was connected to the Wi-Fi
2132000	2137320	or when the original point where the owner was provisioning this device first time to the
2137320	2142040	Wi-Fi. So in this case I knew that this the person had like a Galaxy phone because you can
2142040	2147640	see it in the in the log files that the Galaxy phone was connected to this. So now we have
2147640	2152100	some of the information so what about locating the former owner? And um there's like a very
2152100	2157820	useful uh API for that, the Google geolocation API. And what it does is you give it uh two
2157820	2161820	MAC addresses and the signal strength and it gives you back the coordinates and the
2161820	2166420	accuracy rating. Um the problem with this particular device was um unfortunately it had
2166420	2171440	only one MAC address so I couldn't use this API to find the original position of that. Um
2171440	2175420	but there's another website where you can just enter the SSID and then you can just look
2175420	2179400	around the world where this SSID is coming from. And the thing about this particular SSID
2179400	2185600	is that it was like a provider modem which had like a random random number SSID so I found
2185600	2191600	exactly only one um position where this SSID was used. At the second SSID from the same
2191600	2195300	owner, I checked, double checked it and figured out it's somewhere in the middle of Germany
2195300	2204360	so I have also the exact address but I didn't have it here. Um right, so as a summary for
2204360	2207780	this particular device, uh most of the user data was still existing on this device even
2207780	2213120	though it was swiped. Um I could see the XMMP log files um this device is using XMMP for
2213120	2218080	the communication with the cloud. Um I could see the maps, the credentials. Um because the
2218080	2222060	maps are using some kind of weird format I couldn't really reassemble them but I might at
2222060	2226900	some point. Um I also tried to reset this device 3 times in a row and still could get all the
2226900	2232080	fragments so factory resetting is not very effective there. Um one interesting aspect is I
2232080	2237320	also found the factory locks so where the sensors and all the other stuff was tested and I
2237320	2241060	think these files are actually not existing anymore in the logical space but they're still
2241060	2247300	on this thing. Um again I could uh track the previous owner of this device. However there's
2247300	2252920	one small good news. Um if you connect this vacuum cleaner now to the to the um wifi and to
2252920	2257080	your uh account then basically the app doesn't leak previous information so it's kind of
2257080	2262220	this is kind of okay so the data is apparently not there anymore in the form that everyone
2262220	2266920	can see it. Um interesting thing is I found the similar results also for other vacuum
2266920	2272300	cleaners. I'm not sure if I mean everyone who's using um this kind of raw NAND chips is
2272300	2279080	kind of like want to save money so a lot of devices have exactly the same issue. Right um the
2279080	2283720	second device which I analyzed um because I do many research on Xiaomi so I bought random
2283720	2289040	used devices and broken devices out of ebay. Um this is a device which I got in 2018. Um I
2289040	2293020	didn't really know what kind of condition it had because it was broken. Um in general the
2293020	2298540	Xiaomi devices they have uh they run an Ubuntu 14.4 uh with a quad core um and they have a
2298540	2303420	4 gigabyte of EMMC. And here the approach was that I connect over uh UART and dump the
2303420	2308760	partitions um over UART and then later on I tried to connect it again to the cloud. Um the
2308760	2312600	good thing about the Xiaomi vacuum cleaners is that routing methods exist. Um I found them
2312600	2317680	I think 2 years ago and presented them. Um you can get root shell over UART or you just can
2317680	2321180	push your custom firmware onto that. The good thing with pushing custom firmware is it
2321180	2325920	doesn't destroy the data so the data is still there so which is kind of good. Um and later on
2325920	2330760	you can exfiltrate all the data via SSH. Um the alternative method is if this device is
2330760	2337240	totally broken um you can still remove and dump the flash content but still works. Um to
2337240	2342880	give you like an idea of for what to look for um this system this is like the EMMC layout um
2342880	2347260	how it looks like. So you see that it has like 3 copies of the operation system. Uh then on
2347260	2352040	the um pre last line there's the reserve partition which contains all the usage data so how
2352040	2357940	much how often this device was used. Um what is the status of like all the sensors, the uh
2357940	2362180	HEPA filter and so on. And then there's a user partition which is the udisk partition which
2362180	2369040	contains all the logs uh maps, wifi configuration and user ID. Um and this is like the
2369040	2373820	partition which we're interested for. So uh 1 thing about this vacuum cleaner in particular
2373820	2378880	this device is actually support 2 modes of uh reset. So the first thing is wifi reset which
2378880	2386960	is which is a button which is called reset. Um and the second is like the uh factory reset. Um
2386960	2390820	the wifi reset what it does is just deletes the wifi credentials but everything else remains
2390820	2395100	there. And the factory reset needs a special procedure where you need to press multiple
2395100	2400300	buttons to wait and then it resets uh the device in the factory. Um it's mentioned in the
2400300	2404020	manual but I figured out that nearly no one knows about it. So probably the first thing
2404020	2408620	what you do is like if you get the manual you just throw it away. And um yeah. What this
2408620	2414160	factory reset actually is doing is it restores the um operation system from the recovery and
2414160	2418340	the formats the data partition. But interestingly here is it doesn't wipe it really so there
2418340	2422980	might be still some traces. Um the partition of the usage data is not erased so basically all
2422980	2428620	the usage data is still there but not kind of the user data. So what I did is I just
2428620	2432920	connected it then to the cloud and I figured out oh hey um all the data is still visible in
2432920	2436720	the app so I could figure out like okay when when was the apartment cleaned of the person?
2436880	2440740	What the apartment is looking like? And um so the assumption was that this device was only
2440740	2446220	wifi resetted so they pressed only the reset button nothing more. Um and even though that I
2446220	2450520	connected it to a totally different account uh this device was re-uploading all the data from
2450520	2454320	the vacuum cleaner up in the cloud. So I had it as a new owner. I had all the previous data
2454320	2459980	before. Also all the log files were still um locally available. And I was kind of curious what
2459980	2463880	happens if I do a factory reset. So at the end of the day I did the factory reset. The good
2463880	2467760	news is if you do like a real factory reset and press the real buttons then the data is at
2467760	2472540	least not visible in the app anymore. Um I was looking at the log files and figured out hey I
2472540	2479320	have two mega addresses. Um and actually the geo uh the Google geo RP have given me like some
2479320	2484060	coordinates back and um I figured I mean I again censored it so it's like somewhere in the
2484060	2488640	area but I knew the exact address. Um as soon as I knew the address I was looking at the at the
2488640	2493040	street and I figured out that the Wi-Fi credentials have uh SSID had part of the street name
2493040	2497280	in it and the street number because I don't know someone figured out it's maybe a good idea to
2497280	2502160	use the street name and street number as a Wi-Fi SSID. And the password contains some uh
2502160	2506560	personal information like probably the dog's name. I don't know. Not sure. Um however because
2506560	2510920	this data is like stored in plain text in the device you can just read it out. Another magic
2510920	2516080	trick is by the way um the device has a user ID of the user and if you use like the app you can
2516080	2520280	share devices with other users and one thing which I did is basically I created like a fake
2520280	2526300	account connected like a fake device and then I was just sharing this device with this user
2526300	2534300	with the previous owner and had also the profile picture and the name so yeah. Yeah um so as a
2534300	2540740	summary um for this particular device all the data was still there. The rest was not wiped. Um
2540920	2548460	the reset button is very misleading like for many devices so reset is not doing actually reset.
2548740	2552620	Um however in this case the correct procedure is actually documented in the menu but most of
2552620	2558340	the people don't read that. Um again here I could track the owner um with the due to the log
2558340	2563380	files and this kind of devices that create a lot of log files and there we are both so you have
2563380	2569180	like a nice um nice idea what's going on there. Alright um some other example which I have
2569180	2575920	here um are like this doorbelts. I figured out like I have like now I think 8 doorbelts and 7
2575920	2581980	of them are more or less from the same I think SDK. Um in terms of like um if you buy like
2581980	2587380	8 doorbelts from Amazon you have probably um internally 7 times the same hardware but
2587380	2592680	different interior like exterior. Most of them are based on the high 3518 chip. Um they have
2592680	2598960	like an SPI um nor flash in there. They use again JFS 2 and QBFS so you can happily um
2598960	2604800	recover all the credentials. Um they have some log files so you might get one MAC address of
2604800	2607420	the of the Wi-Fi access point so it's kind of like a little bit more difficult but
2607940	2611180	actually you could track it down. The sad thing about this kind of devices is they have
2611180	2616500	unfortunately like a SD card slot so they don't contain video data so it was like a little bit
2616500	2623360	sad about that. Um not necessarily all IT devices are bad so I found actually one device
2623360	2627840	which I didn't disclose yet um which was also a vacuum cleaner from a different company who
2627840	2633880	used trust zone for key storage. They encrypted all the user partitions with looks. Um the um
2633880	2639760	the keys were managed by this trusted execution engine and they're device specific and every
2639760	2643040	time this thing boots up it checks like some states and then unlocks the partitions.
2643040	2646480	Interesting thing here is if you do a factory reset it just throws away the keys and
2646480	2649780	recreates the partitions so in this kind of case it would be kind of safe but this is like
2649780	2656240	this is one example I've I saw so far so it's very very rare. Um as a conclusion um in
2656240	2661180	general I had like a sample size of like 26 devices which I had found uh got or found like
2661180	2666840	in like some swap fest. Um I figured out that apparently um secure or correct factory sets
2666840	2672420	are very difficult to implement. Um especially if you use raw net uh flash it nearly defeats
2672420	2676800	all the time like uh full vibes. And there's no real way to ensure that the device has
2676800	2682180	actually waived uh waived uh wiped sorry. Um many also many of the vendors actually
2682180	2685300	don't release all the user generated data. So you have like usage data which still remains
2685300	2688960	there. Log files are not erased. Um the only thing that sometimes is erased is like the
2688960	2693460	buffer confirmation files. Um but all the other information is more or less still like on
2693460	2697820	this device. Um another problem what you have again is uh the missing knowledge of the
2697820	2702120	user. So if the people don't know how to reset devices then in in the first place then we
2702120	2706420	cannot even complain about the vendors because the user don't reset them. Um as a
2706420	2710940	recommendation if you ever want to get rid of um devices uh don't sell them and throw them
2710940	2715800	away. Um especially if you expect that they contain any sensitive information. So
2716580	2723040	especially don't throw away like this media stuff uh the media players. Um and also don't
2723040	2727620	throw away devices if you cannot verify that they have been uh done a full wiped. One
2727620	2732000	example is destroy the physical memory. If it's a cheap device or just use this device
2732000	2737460	to practice soldering that unsolder resolder things. Um in general it might be a good idea
2737460	2741160	if you had to throw away devices maybe change your wi-fi credentials so at least that
2741160	2746000	someone who has the credentials cannot break into your local network. Or the other thing is
2746000	2750780	just put all your devices into a separate IOT wi-fi which kind of also limits the impact
2750780	2758080	if someone gets the credentials. Alright um that's it. Uh for here I want to thank uh thank
2758080	2763460	professor Nubir and uh professor uh John Manfidelli from uh the University and also the
2763460	2769300	Zemo team from Darmstadt. And if you have any questions I'm happily here to answer them
2769300	2772960	and I have also some devices if you want to take a look at this kind of weird adapters. I'm
2772960	2775120	here for a while. Thank you.
