[00:00.000 --> 00:04.000] So good morning and welcome. I know this is kind of early Sunday morning, so I really [00:04.000 --> 00:07.760] appreciate you guys all being here. Today we're going to be talking about hacking and [00:07.760 --> 00:14.160] implanting a drop cam. So we both work at the R&D team at Cinec. Cinec does crowdsource [00:14.160 --> 00:19.020] vulnerability discovery with vetted security researchers. My name is Patrick Wardle. I've [00:19.020 --> 00:24.640] worked at various acronymed places, but currently I'm the director of research at Cinec. [00:25.380 --> 00:29.980] And I'm Colby Moore. I formerly worked at VRL and currently work at Cinec as a security [00:29.980 --> 00:36.540] research engineer. More like a security ninja, I think. All right. So what are we going to [00:36.540 --> 00:42.600] talk about today? First, a brief overview of drop cam. Then how we got a root shell on the [00:42.600 --> 00:47.700] device. Following that, we're going to talk about some vulnerabilities that we found. And [00:47.700 --> 00:55.340] then finally, we want to present a persistent implant that we designed for drop cam. So first [00:55.340 --> 00:58.780] let's talk a little bit, give a little bit of an overview, talk about some background [00:58.780 --> 01:04.920] information, talk about what drop cam is. Before jumping in, though, I always think it's a [01:04.920 --> 01:09.800] good idea to concisely define any possible ambiguous terms, especially since we're in [01:09.800 --> 01:14.500] Vegas, so there could be some confusion. So in the talk, when we talk about implants, we're [01:14.500 --> 01:21.380] talking about persistent code that is malicious. Hooking means intercepting function calls, [01:21.380 --> 01:28.400] usually by installing a hook or a detour. A Trojan is a malicious piece of software that [01:28.400 --> 01:33.600] pretends to be something legitimate. Injection is all about getting code into a remote [01:33.600 --> 01:40.740] process. And finally, a backdoor is some code that provides, you know, undetected remote [01:40.740 --> 01:43.940] control of the device. Now, it's a little sad when I hear these terms. I actually now think [01:43.940 --> 01:48.860] of the computer term first. But my wife likes that, so I guess that's the silver lining [01:48.860 --> 01:55.280] there. So what is a drop cam? Well, as you can see from their definition, it's a cloud-based [01:55.280 --> 02:00.500] video Wi-Fi solution. And at the core of it is the camera, the actual drop cam device. So [02:00.500 --> 02:04.360] besides an incredible simple set-up process, it's got some cool features, such as cloud [02:04.360 --> 02:11.660] recording, night vision, two-way talk and intelligent alerts. Now, one of the main appeals [02:11.660 --> 02:16.460] of drop cam is its trivial set-up process. Really all the camera needs to get set up is the [02:16.460 --> 02:21.940] name or SSID and password of your wireless network. Now, there's two ways to do this. This [02:21.940 --> 02:26.980] configuration can be done by either plugging the camera into the computer via USB or with a [02:26.980 --> 02:31.240] smartphone that has Bluetooth. Now, once the set-up is complete, the camera will be [02:31.240 --> 02:35.520] connected to the Wi-Fi network. From then on, it's pretty much fully autonomous. You really [02:35.520 --> 02:39.300] don't have to worry about it anymore. It's going to stream audio and video to the cloud and [02:39.300 --> 02:46.240] beacon to the drop cam servers for updates on a regular basis. So there's a lot of IP-based [02:46.240 --> 02:49.200] video solutions out there. So what's special about drop cam? Why did we choose to go after [02:49.200 --> 02:55.120] it? Well, now drop cam is owned by Google. And Google has indicated it will become the core of [02:55.120 --> 02:58.460] their push into the connected home. So in other words, soon there's going to be drop cams [02:58.460 --> 03:03.060] everywhere. Now, when we started this research, we didn't know that Google would buy drop cam. [03:03.060 --> 03:06.900] If we had, we probably would have tried to get hired there, get some equity. But it was still a [03:06.900 --> 03:11.620] pretty appealing target. For one, it's really popular. You see all over the Bay Area, it's a [03:11.620 --> 03:16.060] best-selling device on Amazon. Secondly, it shows up in interesting places like homes and [03:16.060 --> 03:20.200] offices. Again, the Bay Area, all the start-ups pretty much use drop cams for their security [03:20.200 --> 03:25.820] solutions. So good target in that point of view. And finally, it's kind of a juicy target [03:25.820 --> 03:29.080] because it has some really cool capabilities that, you know, we thought were pretty [03:29.080 --> 03:33.900] powerful and were just begging to be abused. Now Colby is going to talk about routing a [03:33.900 --> 03:39.860] drop cam. So based on the network footprint, we figured taking a hardware approach would be [03:39.860 --> 03:45.440] best. So naturally the first thing to do was crack the camera open. Conveniently, drop cam [03:45.440 --> 03:52.180] left us this mysterious header right here. Probing around revealed what looked like a 3.3 [03:52.180 --> 03:58.100] volt UART on there. So we hooked it up to the FTDI to serial to USB connector that you guys [03:58.100 --> 04:03.400] are all familiar with. And here's a little photo showing our ground connection and [04:03.400 --> 04:09.520] transmit and receive on pins 3 and 4, respectively, if you guys want to try this at home. So [04:09.520 --> 04:14.120] after a quick reboot, we have a serial console and major credit to drop cam for the sweet [04:14.120 --> 04:19.800] ASCII art right there. We wrote a serial brute forcer to try admin, admin, admin password, [04:19.800 --> 04:25.300] all the standards, but really no luck. So at this point we should probably mention the [04:25.300 --> 04:29.420] drop cam is running essentially just Linux. It's a miniature computer. It's running a Linux [04:29.420 --> 04:35.220] system on chip from a company called Ambarella based in the Santa Clara Bay area. And so, [04:35.220 --> 04:41.300] you know, we figured we'd take more of a Linux approach to maybe getting root in this box. So [04:41.300 --> 04:46.140] we decided to go after the boot loader. So if you hold enter on power on or you short the [04:46.140 --> 04:50.620] transmit and receive lines and power on the device, it should drop you to the boot loader. [04:50.620 --> 04:57.340] Now, this is Ambarella's custom boot loader. Now, looking at the boot loader, we got a [04:57.340 --> 05:01.960] couple options here. The set EMV one looked pretty promising. And it looks like there's an [05:01.960 --> 05:06.700] option to change the boot parameters. So we went ahead and just like, you know, root in a [05:06.700 --> 05:10.000] standard Linux box that you have physical access to, we went ahead and changed the parameter [05:10.000 --> 05:20.480] to slash bin slash SH and hope it drops us to a root shell. And yeah, that worked. So now we [05:20.480 --> 05:24.740] got to get rid of that password so we can get on the system, right? So we checked out [05:24.740 --> 05:29.820] Etsy shadow and it wouldn't open. So it looks like it was SIM linked to mount drop cam [05:29.820 --> 05:34.980] shadow. So we checked out Etsy F stab and it gave us the necessary information we needed to [05:34.980 --> 05:39.980] mount up that share. So we went ahead and mounted it up and now we have access to the [05:39.980 --> 05:45.180] shadow file. I went ahead and just knocked out that hash and saved. Went ahead and [05:45.180 --> 05:50.480] rebooted and reset the boot parameters in the boot loader and rebooted, boom, we have a [05:50.480 --> 05:56.000] full-featured root shell on the device. So there's some other research done [05:57.020 --> 06:00.820] previously and they really didn't find any vulnerabilities in the drop cam but we tend to [06:00.900 --> 06:05.060] have a little bit of a different opinion. So we're going to talk a little bit about the [06:05.060 --> 06:09.560] vulnerabilities that we found. So first let's talk about the environment. Since we have a [06:09.560 --> 06:14.700] root shell we can now poke around and explore. The drop cam is running ARM 32 bit Linux [06:14.700 --> 06:19.840] custom distribution and the heart of the drop cam is this connect executable. We're going to [06:19.840 --> 06:24.840] talk about that a lot later. They also left all sorts of goodies on the device for us, you [06:24.840 --> 06:34.400] know, drop bear, FTP, Telnet, GDB server, you know, thanks guys. So overall the drop cam is [06:34.400 --> 06:38.940] decently secure. There were no open ports or exposed network services. All [06:38.940 --> 06:44.440] communications were SSLed properly. And the drop cam employs device specific [06:44.440 --> 06:48.120] provisioning from the factory. That's likely why we couldn't crack the root password [06:48.120 --> 06:53.140] because each device has its own unique password. It also employs automatic updates. It [06:53.140 --> 06:56.080] beacons out regularly and checks drop cam for updates and they're pushed down and the [06:56.080 --> 07:02.340] whole device is reflashed. So it's pretty robust in that sense. But let's take a look at the [07:02.340 --> 07:08.280] first bug. The camera is using open SSL for comms to drop cam servers. But it's running an [07:08.280 --> 07:14.020] old version of open SSL so it's vulnerable to heart bleed. So what can we do with that? [07:15.540 --> 07:20.180] Drop cam says our cameras won't communicate with anyone on the Internet, only drop cam's [07:20.180 --> 07:24.920] cloud servers. But that's not really true. If we spoof DNS responses and trigger a client [07:24.920 --> 07:28.840] side heart bleed attack, we're able to download the camera's private and public SSL keys [07:28.840 --> 07:34.860] among other system information. So realistically now that we have these keys, what can we [07:34.860 --> 07:40.400] do? Normally the drop cam talks to the cloud via SSL and then you use your devices to view [07:40.400 --> 07:44.480] the video from the cloud. But you should note that it authenticates using the very same [07:44.480 --> 07:50.280] certificates that we stole. So a hacker with these certs could spoof a drop cam video feed [07:50.840 --> 07:55.840] providing false video to the cloud DVR. So should a user really trust what they're seeing? [07:56.720 --> 08:00.280] For the record, we notified drop cam of this heart bleed bug and they patched it fairly [08:00.280 --> 08:04.780] recently. However, they haven't rotated the camera's certificates so if anybody happened [08:04.780 --> 08:10.480] to have a bucket full of these certificates, we don't. There's nothing the consumer can [08:10.480 --> 08:17.540] really do at this point. So then for most of its functionality, drop cam runs busy box. But [08:17.540 --> 08:22.700] unfortunately the version is outdated and vulnerable. Basically it's an old bug that [08:22.700 --> 08:28.080] allows command injection via malicious DFCP response. So a user is able to inject commands [08:28.080 --> 08:33.340] via the host name parameter and they get propagated into the system host name. This is [08:33.340 --> 08:39.340] really only triggered if the host name is used by another utility. But we checked out the [08:40.140 --> 08:43.420] vulnerable source code and compared it to the disassembly from drop cam and it [08:43.420 --> 08:48.340] definitely matches. So we weren't able to trigger this bug right now because drop cam isn't [08:48.340 --> 08:51.560] using the host name in a way that would trigger this, but it could come back to bite them [08:51.560 --> 08:58.380] later. So all those bugs are pretty cool, but we had to open up the camera. So wouldn't it be [08:58.380 --> 09:03.600] nice if we could implant the device without opening it up? Luckily there's an app for that. [09:05.080 --> 09:09.160] It's called direct USB and we found a copy somewhere in the dark corners of the internet, [09:09.160 --> 09:14.380] specifically Russia. If you hold down the button on the back of the camera, the button that [09:14.380 --> 09:18.960] drop cam swears does nothing according to official docs, and you hold it down while you're [09:18.960 --> 09:22.820] powering the camera on, it enters a firmware update mode. And we believe this is how the [09:22.820 --> 09:27.200] devices are provisioned at the factory. When we questioned drop cam about this, they didn't [09:27.200 --> 09:31.460] deny it. Ultimately we were able to read and write unsigned data to the camera. So [09:31.460 --> 09:35.000] realistically an attacker could walk into the home, plug into a drop cam, reflash with [09:35.000 --> 09:42.060] malicious software in minutes. And back to Patrick. So there's more to drop cam than just [09:42.060 --> 09:45.680] the software that runs on the camera. So recall that a user may use their computer to [09:45.680 --> 09:50.800] initially configure the device. So to do this, the camera is plugged into the computer and [09:50.800 --> 09:55.100] then it mounts part of the camera as a share, which contains the setup utility. This [09:55.100 --> 09:59.960] utility, which requests root privileges to run, gets the SSID and password of the Wi-Fi [09:59.960 --> 10:03.940] network and then propagates that back to the camera. The end result is a connected and [10:03.940 --> 10:09.820] configured camera. Unfortunately, this application which runs at root is world [10:09.820 --> 10:14.980] writable. So in a proof of concept, a non-privileged host-based attacker can wait until [10:14.980 --> 10:21.200] any drop cam is plugged in. They can then inject a malicious payload into the mounted drop [10:21.200 --> 10:27.120] cam setup utility. Now when the application is run and elevated, so is the attacker's code. [10:27.960 --> 10:32.780] Now the Windows installer setup configuration utility has a similar privilege escalation [10:32.780 --> 10:36.700] vulnerability as well. Drop cam is still patching that so we can't go into details at this [10:36.700 --> 10:42.320] time. Now as Colby mentioned, the CEO of drop cam said that their cameras only talk to [10:42.320 --> 10:46.860] drop cam servers, which discounting things like Heartbleed is pretty much true. However, [10:46.860 --> 10:52.520] the same cannot be said for their iOS application. Now SSL pinning is an extra layer of [10:52.520 --> 10:56.360] security that ensures the client will only communicate with a well-defined set of [10:56.360 --> 11:01.800] servers. Now since the drop cam iOS application does not use SSL pinning, a man in the [11:01.800 --> 11:08.020] middle attack can occur. So if an attacker has a compromised root certificate or can coerce [11:08.020 --> 11:12.480] the user to install a certificate, for example, sending them an email, the connection can be [11:12.480 --> 11:18.260] man in the middle. So here we have a burp capture showing a man in the middle attack in [11:18.260 --> 11:22.220] action actually against my own phone, which is non-jailbroken. It reveals a username and [11:22.220 --> 11:27.160] password for a drop cam account. Now since drop cam does not use dual factor [11:27.160 --> 11:31.920] authentication or any shared or duplicate session alerts, an attacker with these [11:31.920 --> 11:36.900] credentials can persistently and surreptitiously spy on the user at any time. Now this is [11:36.900 --> 11:45.550] really good for the bad guys, not good for the rest of us. So now that we have a good [11:45.550 --> 11:49.950] way to implant the camera, let's have some fun. Introducing our full featured implant, [11:49.950 --> 11:58.430] cuckoo's egg. For those who are unaware, the cuckoo lays its egg in other nests. See how many [11:58.430 --> 12:02.890] you guys get it. Given the robust capability of the drop cam, our malicious software [12:02.890 --> 12:08.510] should. C, we want to be able to intercept video. Here, we want to hot mic a room. [12:09.170 --> 12:12.490] Propagate, we want to infect other hosts when they connect to the drop cam or it's plugged [12:12.490 --> 12:16.570] in. We want to be able to geolocate the drop cam, so if we send a bunch out in the wild, we [12:16.570 --> 12:20.090] know where they ended up. We want to be able to infill and exfil files in case we need to [12:20.090 --> 12:24.050] upload our new exploit or tool so we can pivot into the network. We want to be able to [12:24.050 --> 12:28.150] drop to a command shell to use our tools. And we want to be able to connect a basic network [12:28.150 --> 12:33.810] survey and a device survey. So conceptually the drop cam will sit on a corporate network [12:33.810 --> 12:39.990] and talk out to the drop cam's cloud. But with our implant, it will also talk out to us. We [12:39.990 --> 12:45.430] also need a method for other devices on the drop cam's network. We also need a method, [12:45.430 --> 12:58.470] sorry. What? Okay. Well, anyway. So our implant even comes with its own slogan. He sees you [12:58.470 --> 13:02.530] when you're sleeping, he knows when you're awake, he knows if you've been bad or good, just [13:02.530 --> 13:11.820] like the NSA JK. So in a real world scenario, how do we install our malicious software? We [13:11.840 --> 13:15.980] don't have remote code execution but there's a lot of options. We can intercept the package [13:15.980 --> 13:21.560] in transit, we could maybe gift a drop cam to somebody that's already been implanted or we [13:21.560 --> 13:29.620] could break and enter and modify it in the house. Realistically that stuff never happens, [13:29.620 --> 13:35.380] right? No further comment. We approached drop cam about this and they were convinced the [13:35.380 --> 13:39.240] adversary wouldn't be able to reshrink the drop cam as nicely as it was done to the factory. [13:39.240 --> 13:50.050] And that alone would be an appropriate anti tamper mechanism. What do you guys think? Now [13:50.050 --> 13:54.370] what about sending one as a gift? Recently a friend's incubator space was broken into. Is it [13:54.370 --> 13:57.910] too far-fetched to think that management might send them security cameras to implement? [13:58.210 --> 14:04.930] Probably not. Is a break in entering scenario really plausible? Maybe. Drop cam's argument [14:04.930 --> 14:08.870] was that you would see an attacker coming. However, only one third of users sign up for drop [14:08.870 --> 14:13.030] cam's cloud recording. Even then, if you just showed up with a Wi-Fi jammer, the camera [14:13.030 --> 14:17.730] doesn't cache any video locally so the video wouldn't get sent to the server. Now what makes [14:17.730 --> 14:23.510] drop cam a good target? The drop cam CEO said all software products are susceptible to jail [14:23.510 --> 14:26.910] breaking. And that's true. We tend to agree with that. But the drop cam really is the low [14:26.910 --> 14:34.720] hanging fruit. Here are the other options. Someone could go after a computer that often has [14:34.720 --> 14:39.140] full disk crypto, boot password and there's no forensic tools. They could go after a printer [14:39.140 --> 14:43.180] but it runs a proprietary operating system. You've got to crack it open. A printer can't see, [14:43.180 --> 14:47.180] can't hear. There's a lot of things it can't do. They could go after a gaming console but [14:47.180 --> 14:51.600] again, it runs sign code and has DRM protection. You've got to crack it open and it's [14:51.600 --> 14:55.580] generally turned off. Or they could go after a mobile phone but it's normally pass locked, [14:55.580 --> 15:01.520] again, runs sign code and it's really off person. So the drop cam, you don't need to open it [15:01.520 --> 15:07.160] up, no boot password, no disk crypto, no sign code, the operating system is open source, [15:07.160 --> 15:11.400] it's always on, has tons of capabilities and who's going to suspect that the security [15:11.400 --> 15:22.750] camera is spying on you. So in order to create an advanced implant, we needed to fully [15:22.750 --> 15:28.050] understand how the drop cam worked. In other words, we had to answer questions such as how [15:28.050 --> 15:33.670] does it hear, see or think? Where is its core logic, the main module of the brain? And [15:33.670 --> 15:40.130] finally, can this be manipulated or rewired? The drop cam has many hardware and software [15:40.130 --> 15:44.030] components. However, these all kind of come together in the connect binary, which I'll be [15:44.030 --> 15:48.310] talking about a lot. This binary is really the brain of the camera as it contains most of the [15:48.310 --> 15:53.550] drop cam specific operations such as talking to the audio and video devices, streaming [15:53.550 --> 15:57.490] content to the cloud and then also handling or executing commands that are received from [15:57.490 --> 16:05.110] drop cam servers. Unfortunately, the connect binary is packed with UPX, which is not [16:05.110 --> 16:10.530] normally a problem. Unfortunately, when we tried to unpack it, it failed. Now, since we [16:10.530 --> 16:15.530] wanted a full unpack, that would make everything easier from debugging to static [16:15.530 --> 16:21.170] analysis, we decided to look into this a little more. Now, the unpacker stub matched the [16:21.170 --> 16:26.670] UPX source code, indicating it wasn't a custom version of UPX. So we figured perhaps the [16:26.670 --> 16:32.490] binary was perhaps modified after the fact in some way to prevent unpacking. Now, I single [16:32.490 --> 16:36.610] stepped through the unpacking stub's instructions and followed along in the UPX source code, [16:36.610 --> 16:42.390] which was not fun. But this revealed exactly where the unpacking exception occurred. The [16:42.390 --> 16:47.610] code was checking a value within the binary's ELF header and then branching into a code path [16:47.610 --> 16:54.270] for unpacking shared library. That unfortunately then errored out. Now, connect is a normal [16:54.270 --> 16:58.270] ELF executable. It's not a shared library. So I was a little confused why I was taking this [16:58.270 --> 17:03.630] code path. So we decided to write a small Python script that simply unset the value in the [17:03.630 --> 17:08.310] ELF header that the UPX unpacking code was looking at. Once we did this, we then [17:08.310 --> 17:13.250] re-invoked UPX to attempt to unpack the binary and that worked. Connect was fully unpacked [17:13.250 --> 17:17.610] and even fully runnable, which is really nice. And actually using the inverse of this [17:17.610 --> 17:21.050] technique, so setting that member in the ELF header, we were actually able to create [17:21.050 --> 17:28.910] unpackable binaries as well. So I guess thanks to Dropcam for that. So now that we've talked [17:28.910 --> 17:32.290] about all these cool capabilities, let's talk about the core of our implant. We wanted to [17:32.290 --> 17:36.130] create something simple, portable to other devices and have the ability to leverage [17:36.130 --> 17:41.570] third-party libraries. So since we don't have to be too stealthy, Python seemed like a [17:41.570 --> 17:47.650] natural choice. We cross-compiled and stripped down Python to reduce the disk footprint. And [17:47.650 --> 17:51.710] then Python is then extracted to RAM disk on boot and our implant is kicked off all through [17:51.710 --> 18:01.420] an energy script. It's great that we have an implanted camera and all, but how is it going [18:01.420 --> 18:06.800] to talk to us? All comms are done over HTTPS and call out through the secure networks [18:06.800 --> 18:11.760] firewall. Our command and control and streaming data are sent over separate channels and [18:11.760 --> 18:16.840] our CNC server is set up on Amazon AWS infrastructure, the same as Dropcam's. Given the [18:16.840 --> 18:21.680] nature of our comms and by putting our CNC server on AWS, it really wouldn't be that easy to [18:21.680 --> 18:26.640] tell the difference between our regular Dropcam traffic and our implant by looking at network [18:26.640 --> 18:35.240] traffic or even to create appropriate IDS rules. Which connection is legit? What about if we [18:35.240 --> 18:39.280] wanted to ship a ton of these cameras out in the wild? How will we know where they end up? [18:40.160 --> 18:45.260] Cuckoo's egg runs a camera side Wi-Fi survey and ships it back to the CNC server. The CNC [18:45.260 --> 18:50.560] server then sends the survey back to Google's geolocation APIs and returns the device [18:50.560 --> 19:01.440] location. Thanks, Google. We also wanted our implant to autonomously propagate to Windows [19:01.440 --> 19:06.820] or Mac-based computers. Since we control the camera, we actually control the set-up [19:06.820 --> 19:12.480] application as well. So we simply replace it with a malicious implant installer. Now, [19:12.480 --> 19:16.940] whenever the user runs the implant or the set-up application, they're actually running the [19:16.940 --> 19:22.200] implant installer first. And that's executed with root privileges. We also use a homograph [19:22.200 --> 19:26.000] attack so that it's really difficult to actually tell which binary is the malicious one by [19:26.000 --> 19:30.740] simply looking at their names. We also made sure to disable the Bluetooth set-up feature [19:30.740 --> 19:36.040] so that the user was forced to plug the camera into the computer in order to configure it, [19:36.040 --> 19:41.980] which for us ensured that they would then infect their PC or Mac-based computer. So Apple [19:41.980 --> 19:46.260] loves to tout their many anti-malware mitigations. However, some of these are trivially [19:46.260 --> 19:51.840] bypassed while others can be avoided altogether, which allows our implant to execute freely. [19:51.840 --> 19:55.400] It's not detected at all. So if you want some more information, we gave a talk about the [19:55.400 --> 20:00.120] stuff at ShakaCon and also released an open source tool that can detect persistent OSX [20:00.120 --> 20:06.120] malware, which would also detect our implant on OSX. This talk describes bypasses for [20:06.120 --> 20:13.520] XProtect, which is Apple's antivirus product, Gatekeeper, the OSX sandbox, and even signed [20:13.520 --> 20:18.560] coding requirements. For example, it's able to load unsigned kernel module into the kernel. So [20:18.560 --> 20:26.420] sorry, Apple. Now a major component of our implant is the ability to grab and manipulate audio [20:26.420 --> 20:31.780] and video. Now I mentioned the Kinect binary talks to both the audio and video cards that [20:31.780 --> 20:36.340] reside in kernel mode. Data is read from these devices and then is streamed to the [20:36.340 --> 20:41.980] DropCam's cloud servers where it is consumed by the user. So first I'm going to talk about [20:41.980 --> 20:47.600] how our implant is able to hot mic the camera in order to listen in to everything. Since the [20:47.600 --> 20:52.440] Kinect binary exclusively opens the audio card, we have to inject a module into the Kinect [20:52.440 --> 20:58.160] process. So here are the various relevant components. The Kinect binary is continually [20:58.160 --> 21:04.700] reading the audio stream. But our injected module can then install a hook and gain access to [21:04.700 --> 21:12.740] the audio stream and then exfil it to our command and control servers. Now DropCam uses a [21:12.740 --> 21:17.200] standard Linux framework to read audio, which is kind of cool. So to get the audio, it [21:17.200 --> 21:22.820] invokes the send PCM read end function, which retrieves audio frames containing audio [21:22.820 --> 21:28.700] buffers. This is where the implant installs its audio hook. Again, the goal was to clone the [21:28.700 --> 21:33.100] audio and stream it to the cuckoo's egg server while letting it stream in parallel up to [21:33.100 --> 21:38.600] DropCam so the user wouldn't notice anything was amiss. So here is the code that is inserted [21:38.600 --> 21:45.560] as an audio hook. This code gets a pointer to the original send PCM read function, invokes [21:45.560 --> 21:49.860] it, and then simply exfiltrates any data or audio that's captured. So pretty [21:49.860 --> 21:56.840] straightforward. All right. Now on to video. So by disassembling the Kinect binary, we were [21:56.840 --> 22:02.760] able to uncover how the camera accesses and streams video to the cloud. In the [22:02.760 --> 22:08.280] disassembly, you can see it opening the video device, which is slash dev slash IAV. Now this [22:08.280 --> 22:13.960] device is backed by an umbrella chip that does all the video processing and H264 encoding in [22:13.960 --> 22:19.280] hardware, obviously for performance reasons. The second disassembly snippet shows the [22:19.280 --> 22:25.160] Kinect binary talking to this video device to get the actual video via an eye octal. The [22:25.160 --> 22:29.860] eye octals are all undocumented and many take undocumented structures. Luckily, there were [22:29.860 --> 22:35.220] some comments or error messages in the disassembly so we could maybe kind of get the name of [22:35.220 --> 22:41.140] the eye octal, which gave us some insight into perhaps what it was doing. So I mentioned we [22:41.140 --> 22:46.560] wanted to clone the video and stream it to the implant servers. Now, undocumented eye octals [22:46.560 --> 22:51.720] and structures result in a ton of reverse engineering and a ton of seg faults. However, we [22:51.720 --> 22:56.980] eventually got it all figured out and we wanted to describe that here. So first you open the [22:56.980 --> 23:03.080] slash dev slash IAV device. Then you get the H264 encoding parameter so that the stream you [23:03.080 --> 23:09.900] exfil can be decoded. You then map the bit stream buffer memory and the digital signal [23:09.900 --> 23:15.080] processor memory. Now, after you check that the video is actually being recorded, the video [23:15.080 --> 23:21.800] stream can finally be read with the IAV IOC read bit stream, yeah, bit stream EX eye octal. [23:22.200 --> 23:26.640] Now, besides this being really useful for an implant, this actually allows you to stream the [23:26.640 --> 23:31.720] video to a server or DVR of a choice. So this saves you money because you don't have to pay [23:31.720 --> 23:36.820] DropCam $30 a month to store your video and it also prevents Google from seeing what's going [23:36.820 --> 23:40.040] on, say, inside your house. So that's kind of a cool feature. I don't want Google seeing what [23:40.040 --> 23:47.180] I'm up to. So now we could clone the video feed, send it to an implant server while it was [23:47.180 --> 23:51.480] also streaming in parallel to DropCam. But we thought we wanted to take this a step farther [23:51.480 --> 23:56.300] and actually manipulate the live video stream on the device to do cool things like in the [23:56.300 --> 24:02.300] movies, for example, making an attacker invisible. So again, here are the various relevant [24:02.300 --> 24:08.580] components. The video card is going to generate frames which will, in this example, show the [24:08.580 --> 24:13.680] attacker, you know, breaking in or doing his bad things. So we really don't want that. However, [24:13.680 --> 24:19.880] the injected module will intercept these frames and inject other frames. These injected [24:19.880 --> 24:24.160] frames will then be streamed to the cloud instead and ultimately back to the user which will [24:24.160 --> 24:31.780] hide the attacker. So take a little bit of a closer look. Here's the video device and the [24:31.780 --> 24:37.820] connect binary which is reading frames. The injected module installs another hook. This [24:37.820 --> 24:46.480] time it's an IOCTL hook and watches for the IOC read bit streams EX IOCTL. Now when this [24:46.480 --> 24:51.420] IOCTL is called, it populates a structure with various values. Through reverse [24:51.420 --> 24:56.100] engineering, we were able to determine what these values were. Some of the relevant ones [24:56.100 --> 25:04.680] include the frame number, the address to the frame's raw H264 encoded data, the frame type, [25:04.680 --> 25:10.100] and finally the frame size. Now the easiest way to manipulate the video stream is just to [25:10.100 --> 25:15.200] wait for a frame type of JPEG full. Then moving forward, you can either just replay this [25:15.200 --> 25:20.640] frame to lock or freeze the video frame or actually inject other full frames as well. The [25:20.640 --> 25:25.800] other frames are not ideal because H26 encoding pretty much just encodes deltas. So if [25:25.800 --> 25:29.260] you're trying to intercept and manipulate a frame, a lot of times you don't actually have [25:29.260 --> 25:33.540] the full frame. These JPEG full frames happen every second so it's pretty easy to wait for [25:33.540 --> 25:39.880] them and then use them moving forward. All right. So video demo time. I wanted to show you [25:39.880 --> 25:44.680] how we can transparently lock the video stream. If you look at the top left is the drop cam [25:44.680 --> 25:49.080] feed. So this is what the user is going to see and this is what we are manipulating. The top [25:49.080 --> 25:53.980] right is a shot from an external camera. Bottom left is the sys log output and bottom right is [25:53.980 --> 26:01.860] the attacker's console. All right. So you see a mom coming to tuck her kid in. If you look at [26:01.860 --> 26:08.940] the attacker's window, they're going to then run the enable cam to activate the video lock. We [26:08.940 --> 26:18.000] then see... an attacker that somehow looks like Colby. Got to work on your disguises. The [26:18.000 --> 26:22.380] video now is locked to frame. It's injecting these JPEG full frames in so the video is [26:22.380 --> 26:27.220] frozen. But you can see the camera is still counting up so the user is not going to notice. [26:27.600 --> 26:32.860] Then we run the disable command which tells the camera feed to resync and then it's going to [26:32.860 --> 26:37.880] flip back to the baby. Now, I'm sure the mom is going to accept this child as one of their [26:37.880 --> 26:59.650] own. Well... apparently not. All right. Back to Colby. All right. So we built this awesome [26:59.650 --> 27:11.270] implant that does everything an attacker could dream of. But how do we control it? So [27:11.270 --> 27:16.230] naturally a sleek web control panel is needed. On the main screen all the cameras call back [27:16.230 --> 27:21.430] with their name and location so targeting is super easy. From there it's easy to select a [27:21.430 --> 27:25.610] target and a job to be sent down to the drop cam. We support all the commands we talked [27:25.610 --> 27:32.190] about previously. The camera calls home to the server at a standard interval to report job [27:32.190 --> 27:39.210] results and retrieve new jobs from the queue. We have a series of completed and unsent [27:39.210 --> 27:43.650] jobs. Queued up is an execute and execute task whereas there are several completed [27:43.650 --> 27:50.450] surveys. Results are reported in a convenient JSON format. For this next part we need a bit [27:50.450 --> 27:55.070] of disclaimer. The stuff we're about to do is theoretically possible on any device, not [27:55.070 --> 28:00.070] just drop cam. However, we were just kind of curious how far we could take things. Since [28:00.070 --> 28:04.370] physical access is easy enough and there's lots of free space inside the drop cam, it's [28:04.370 --> 28:09.390] conceivable to think that someone could add some extra hardware. Could someone turn this [28:09.390 --> 28:14.590] network device into a true cyber weapon? Most embedded systems contain what are called [28:14.590 --> 28:19.810] general purpose input and output, GPIO for short. What if we use this camera's GPIO pins to [28:19.810 --> 28:23.630] control something external? However, since we don't have a device schematic and toggling [28:23.630 --> 28:29.310] random pins is generally kind of frowned upon, we wanted to use a known quantity. In [28:29.310 --> 28:33.870] this case we decided to interface with the drop cam status LED seen circled up above. The [28:33.870 --> 28:38.510] status LED is really just tied to one of the drop cam's GPIO pins. But we needed a way to do [28:38.510 --> 28:42.110] this intelligently because the light comes on randomly and we didn't really want to be [28:42.110 --> 28:47.790] setting off whatever we're doing intermittently. So here's some pseudocode to show what we [28:47.790 --> 28:51.890] did. We figured out how to toggle the status LED at a set frequency, just in a loop up [28:51.890 --> 28:56.110] there. Then we installed a microcontroller to listen for the square wave that we're [28:56.110 --> 29:01.230] generating on the LED. So it's listening for that specific frequency. And then when the [29:01.230 --> 29:05.130] microcontroller gets the frequency it's looking for, something amazing happens. If your [29:05.130 --> 29:12.410] camera starts blinking, get out of the way. So here's one possible scenario. Please note [29:12.410 --> 29:15.610] that the following was performed in compliance with all local laws and you should not try [29:15.610 --> 29:16.510] this at home. [30:32.430 --> 30:45.810] Oh, that's tragic. Well, that's a wrap. You probably heard that the Internet of things is [30:45.810 --> 30:51.270] blowing up. So remember you saw it first here at DEF CON 22. Again, I'm Patrick and this is [30:51.270 --> 30:55.970] my coworker Colby. Feel free to contact us. We probably won't plug in any devices you send [30:55.970 --> 31:13.800] us. Any questions now? We have a few extra minutes. Yes, in the front. Great. So the [31:13.800 --> 31:16.760] question was, you know, while we're hooking the video and audio stream, did we see any [31:17.220 --> 31:21.190] degradation in the performance of the device? Since we were hooking pretty low level, [31:21.940 --> 31:26.180] where the IOPTLs are coming in, we're pretty much just mem copying them off and then putting [31:26.180 --> 31:30.860] that in a shared buffer where exfiltrate code would just pick it up and do that. So in our [31:30.860 --> 31:35.120] testing, we didn't see any specific degradation or anything. And sometimes the video [31:35.120 --> 31:46.420] stream goes in and out anyway. So independent of us. Any other questions? Awesome. Well, [31:46.420 --> 31:49.480] thanks again. Remember, don't trust cameras from strangers.