1 00:00:00,000 --> 00:00:05,920 Hello everyone, welcome. I'm Tom Doinger from the Google TV Hacker. We're going to be talking about 2 00:00:05,920 --> 00:00:11,680 hacking the Google TV today. It should be interesting and a lot of fun, so let's get this 3 00:00:11,680 --> 00:00:22,300 started. First off, why do we do it? For science, as you can see. Moving on, so basically the Google 4 00:00:22,300 --> 00:00:29,020 TV Hacker team is consisted of six hackers. We kind of all met up on RAC and got together and 5 00:00:29,020 --> 00:00:35,240 started hacking the Google TV. Our primary goal was to bypass the hardware and the software to 6 00:00:35,240 --> 00:00:41,720 allow for unsigned kernels and give us more open to the system. To date, we have found multiple 7 00:00:41,720 --> 00:00:46,680 methods to accomplish this, so we're pretty happy with that. We're going to be dropping some of 8 00:00:46,680 --> 00:00:52,540 those today, so you guys should see some new stuff that you haven't seen yet from us. Our first 9 00:00:52,540 --> 00:00:59,000 accomplishment was on the Revu, which we got a $500 bounty to gain root. We're going to be 10 00:00:59,020 --> 00:01:05,340 working on that, and Amir is going to be talking about how we managed to do that. So just kind of 11 00:01:05,340 --> 00:01:10,460 basically going over our members today. We've got Agent HH, who's out in the audience up here in the 12 00:01:10,460 --> 00:01:18,460 front. He's not afraid to wear a pink shirt. We've got CJ, the destroyer of the words. Ginophage, 13 00:01:18,520 --> 00:01:27,860 a monster. He's, I don't know if he's here or not. There we go. That's our first time meeting him. 14 00:01:30,140 --> 00:01:37,560 It's kind of a mystery to us. We've got MBM, who couldn't be here today. Oh, he's on the 15 00:01:37,560 --> 00:01:48,100 cardboard over there. He's known for founding the open WRT and tossing 251 children in a well. Then 16 00:01:48,100 --> 00:01:53,180 we've got T-Dwang. That's me. I'm a software developer turned superhero. And then we have 17 00:01:53,180 --> 00:01:58,120 Amir, which is not very good at creating bios, so we don't know what he really does. 18 00:01:59,500 --> 00:02:07,780 And then we also have a special guest, Bliss, also known as Dan Rosenberg. He's a vulnerability 19 00:02:07,780 --> 00:02:12,960 researcher who takes on sick pleasure and exploiting anything with the CPU, and he once 20 00:02:12,960 --> 00:02:20,480 punched an android in the face. Moving on. So basically I'll go over just the basics of what 21 00:02:20,480 --> 00:02:29,000 the Google TV is. It's a system, a platform that bridges between the TV and the android device. It's a 22 00:02:29,000 --> 00:02:34,600 kind of creates an overlay instead of having to switch your source on your TV, so it's a direct 23 00:02:34,600 --> 00:02:39,800 input into your TV that you don't have to switch, which is kind of nice, because then you don't 24 00:02:39,800 --> 00:02:48,880 have to do that. It comes out of the box with, you know, Chrome, and then it also has an IR 25 00:02:48,880 --> 00:02:54,780 transmitter that talks to your TV so you can change channels and other fun stuff that you can do 26 00:02:54,780 --> 00:02:58,980 with a remote, but you can do with little keyboards and stuff that they give you. So it's a 27 00:02:58,980 --> 00:03:05,860 pretty good system. The system receives the over-the-air updates from the OEM manufacturer, so 28 00:03:05,860 --> 00:03:13,380 they're pretty slow about it, as we have found out. They say it's coming soon, and soon is six 29 00:03:13,380 --> 00:03:21,680 months. The platform contains Chrome, as I stated. It's basically a forked version of what you 30 00:03:21,680 --> 00:03:27,200 have on your computer. It works pretty well. It contains flash, but the plug-ins and extensions 31 00:03:27,200 --> 00:03:28,960 are disabled at the moment. So it's a pretty good system. It's a pretty good system. It's a pretty 32 00:03:28,980 --> 00:03:32,480 good system. We're currently looking into that, see if we can get it on there, which would be 33 00:03:32,480 --> 00:03:41,860 nice. So basically comparing the Android versus the Google TV, there's many differences. Google TV 34 00:03:41,860 --> 00:03:47,960 has a Chrome browser box right out of the box with it, so you can browse the web, and it's a nice 35 00:03:47,960 --> 00:03:56,060 Chrome browser, as most people probably prefer, like me. The Gen 1 devices all use x86 processors, 36 00:03:56,320 --> 00:03:58,960 so that was kind of different. It's kind of, you know, it's a little bit different than the 37 00:03:58,980 --> 00:04:04,100 first time I've seen anything with the Android that had x86, which causes all sorts of problems 38 00:04:04,100 --> 00:04:09,980 with Android market and games and stuff not being able to run. The initial release didn't have the 39 00:04:09,980 --> 00:04:14,300 Android market, which was a big letdown, because there was no apps that we could install or do 40 00:04:14,300 --> 00:04:20,200 anything when they first came out. Eventually that came out, and they're still lagging on apps, 41 00:04:20,280 --> 00:04:28,300 but we're hoping more and more come out in the next few months or so. Unlike most devices, the 42 00:04:28,980 --> 00:04:37,520 ADB is used over Ethernet instead of a USB, so basically there is only one whitelisted IP address 43 00:04:37,520 --> 00:04:42,900 that you can connect to the box at any given time. So if you have multiple computers like me, you 44 00:04:42,900 --> 00:04:49,020 have to use the same one to do any hacking or anything on it, which is kind of a pain, but most 45 00:04:49,020 --> 00:04:54,940 people probably only use one PC. Just kind of basically to go over the differences between the 46 00:04:54,940 --> 00:04:58,960 x86 and the ARM, most companies are using the x86, and most people are using the x86 on the 47 00:04:58,980 --> 00:05:03,900 TV. The most commonly deployed boxes that we have for the Google TV at the moment are x86. The 48 00:05:03,900 --> 00:05:08,500 newest devices are all ARM-based, and from our understanding, everything going forward is going 49 00:05:08,500 --> 00:05:14,300 to be ARM-based, so we expect to see a lot more apps and stuff that actually functions on these 50 00:05:14,300 --> 00:05:21,520 boxes, which would make it more useful. So the devices that we currently have out are the Sony 51 00:05:22,020 --> 00:05:28,820 boxes, which is a Blu-ray player and the TVs. We've got the LG TVs, the Vizio, which is coming 52 00:05:28,980 --> 00:05:36,840 soon, and the Logitech Revu. But we'll talk more on the ARM devices a little bit later in the talk 53 00:05:36,840 --> 00:05:44,900 here. I'll go over what's out there and let you guys know what's coming up. The big issue with the 54 00:05:44,900 --> 00:05:52,220 Google TV that we found is the content providers. So basically what they do is when you log into 55 00:05:52,220 --> 00:05:58,040 your open up Chrome and you go to content provider, they're checking the user agent and the flash 56 00:05:58,040 --> 00:05:58,960 version. So they're checking the content provider and they're checking the user agent and the flash 57 00:05:58,960 --> 00:06:02,580 version. They're basically looking in, see what you're on, so they're blocking all that to you, 58 00:06:03,500 --> 00:06:09,540 which is kind of the big downside at the moment. But we've bypassed that on numerous systems, so 59 00:06:09,540 --> 00:06:16,620 and future ones we plan on doing the same. So the content providers basically don't want us to do 60 00:06:16,620 --> 00:06:25,980 anything with that. So basically just to briefly go over the Gen 1 boxes, the x86 ones, they have 61 00:06:25,980 --> 00:06:28,940 the Intel CE4100. They have the Intel CE4100. They have the Intel 6400. They have the Intel 6400. 62 00:06:28,940 --> 00:06:29,300 They have the Intel 6410. They have the Intel 6419. They have the Intel 6419. They have the Intel 6420. 63 00:06:29,300 --> 00:06:33,360 The Intel 6420 is a high-end processor in it, which is an atom processor running at 1.2 gigahertz 64 00:06:33,360 --> 00:06:41,520 with an SOC on it. So basically they can create a chain of trust, which I'll be talking here shortly 65 00:06:41,520 --> 00:06:50,640 about, of how they lock down the boxes. The review is running a slightly slower processor, which is 66 00:06:50,640 --> 00:06:57,320 the CE4100. And the Sony TV and the Blu-ray player are running the 4150, which is slightly faster. 67 00:06:59,380 --> 00:07:03,780 Just kind of to go over the boot loader, we have a signed boot 68 00:07:04,540 --> 00:07:10,540 loader which was created using the Intel CFDK or also known as 69 00:07:10,540 --> 00:07:14,440 the Consumer Electronics Firmware Development Kit. The 70 00:07:14,440 --> 00:07:17,460 boot loader, as I mentioned before, it's signed with a 71 00:07:17,460 --> 00:07:21,480 signature and they use a chain of trust to prevent you from 72 00:07:21,880 --> 00:07:24,960 loading anything basically onto the device other than their 73 00:07:24,960 --> 00:07:30,660 signed software. Intel supplies a stage one and a stage two for 74 00:07:30,660 --> 00:07:34,940 their boot loader in the SDK that they have. Logitech 75 00:07:35,480 --> 00:07:39,320 utilizes both of these. The Sony, however, only uses the 76 00:07:39,320 --> 00:07:43,980 stage one and then uses their own prepared NBL for stage two. 77 00:07:45,580 --> 00:07:48,980 Just to go over the chain of trust here, we, this kind of 78 00:07:49,610 --> 00:07:52,480 breaks it down for you guys on how the chain of trust works on 79 00:07:52,480 --> 00:07:54,940 the Sony boxes and then Logitech uses their own 80 00:07:54,960 --> 00:07:59,460 Logitech box. So the first step of it is the SOC, which 81 00:07:59,460 --> 00:08:05,820 decrypts, verifies the signature of stage one of the CFDK, which 82 00:08:05,820 --> 00:08:10,020 then, once the CFDK boots, it moves on to check the signature 83 00:08:10,020 --> 00:08:14,580 and decrypts stage two. Once we reach stage two, that boots into 84 00:08:14,580 --> 00:08:18,040 the kernel and verifies the signature on that as well. So 85 00:08:18,040 --> 00:08:21,040 we, it's not as simple as rewriting that so we can run any 86 00:08:21,040 --> 00:08:24,940 new kernels. Once the kernel takes over, all of our 87 00:08:24,960 --> 00:08:27,680 files, at least on the Sony boxes, what it will do is it 88 00:08:27,680 --> 00:08:36,240 checks the SHA1 hash checks files and verifies all of them so 89 00:08:36,240 --> 00:08:42,560 we can't just go in and replace them to hack the boot order on 90 00:08:42,560 --> 00:08:46,700 that. And then after it does that, it checks the RSA 91 00:08:46,700 --> 00:08:54,140 verification on the niche.rc and then the niche.eagle.rc based 92 00:08:54,140 --> 00:08:54,940 on, which, I don't know if you've heard of it, but it checks the 93 00:08:54,960 --> 00:08:59,620 hash device you have. Just to briefly go over the kernel 94 00:08:59,620 --> 00:09:04,200 security, the kernel requires modules to be properly signed. 95 00:09:04,860 --> 00:09:09,340 So it's, we, so you can't just create a new module and insert 96 00:09:09,340 --> 00:09:13,740 into the kernel. So that's something that we've found a 97 00:09:13,740 --> 00:09:17,580 way to overcome and we'll be talking about that as well. All 98 00:09:17,580 --> 00:09:21,100 partitions, except for data and cache, are read only so that 99 00:09:21,100 --> 00:09:24,420 prevents us from changing anything in the system, which 100 00:09:24,420 --> 00:09:30,640 would be useful if we could. The ADB shell only allows you to 101 00:09:30,640 --> 00:09:34,000 read write to folders with the shell permission, which is your 102 00:09:34,000 --> 00:09:39,560 basic read write of pretty much nothing on the box. There's 103 00:09:39,560 --> 00:09:42,940 also an access dev slash mem, which is restricted to the 104 00:09:42,940 --> 00:09:46,680 normal shell user, so you can't just go into memory and mess 105 00:09:46,680 --> 00:09:51,700 with stuff either. And we also tried using all the current 106 00:09:51,700 --> 00:09:54,400 known Android vulnerabilities. So, you can't just go into the 107 00:09:54,420 --> 00:09:56,360 get the latest technologies on this bot, on the Sony and the 108 00:09:56,360 --> 00:09:59,720 logitech review with no avail. They're pretty good about 109 00:09:59,720 --> 00:10:02,120 patching everything and they're pretty quick once we release 110 00:10:02,120 --> 00:10:05,940 anything. So, hopefully, we release something here today 111 00:10:05,940 --> 00:10:10,140 that people can get on it before it gets patched in the next week 112 00:10:10,140 --> 00:10:13,480 or so, as we've seen. So, basically, I'm going to pass 113 00:10:13,480 --> 00:10:16,020 this off to Amir, who's going to talk about the current devices 114 00:10:16,020 --> 00:10:24,400 that we've got. All right. Hi, everyone. My name's Amir. I'm 115 00:10:24,420 --> 00:10:24,980 the head of the Logitech software and software development 116 00:10:24,980 --> 00:10:28,020 have. So, we're going to get started with the Logitech review. 117 00:10:28,320 --> 00:10:32,400 It was released in October 2010 and has a full-size keyboard 118 00:10:32,400 --> 00:10:36,360 with built-in touchpad. It was originally priced at about 249, 119 00:10:36,620 --> 00:10:40,160 was later reduced to 199, and was later discontinued and 120 00:10:40,160 --> 00:10:45,520 priced at around 99 to, I mean, I've seen it around 82. The big 121 00:10:45,520 --> 00:10:49,760 thing is that even though it's cheap and it's discontinued, 122 00:10:49,760 --> 00:10:52,200 it's probably one of our favorite devices. The full-size 123 00:10:52,200 --> 00:10:55,820 keyboard is really nice and it has all the same functionality as 124 00:10:55,820 --> 00:11:00,320 all the rest of the boxes. So, if you are looking to get into 125 00:11:00,320 --> 00:11:02,440 Google TV and you're looking for a cheap device to get you 126 00:11:02,440 --> 00:11:06,540 started, it's really nice. This is the Logitech review 127 00:11:06,540 --> 00:11:10,800 motherboard. We did our best to take a multimeter and label the 128 00:11:10,800 --> 00:11:13,640 pinouts the best we could. There are still a few that we didn't 129 00:11:13,640 --> 00:11:18,720 get, like the unused switch, NJ 24, which is an unknown header on 130 00:11:18,720 --> 00:11:22,180 the board. But it also has a UART pinout. It's a nice little 131 00:11:22,180 --> 00:11:24,920 thing. It doesn't have pins already soldered into it, but it's 132 00:11:24,920 --> 00:11:30,080 fairly easy to get to. It's not VIAs or whatnot. There's also an 133 00:11:30,080 --> 00:11:33,520 Intel XDP debug header, which requires some proprietary 134 00:11:33,520 --> 00:11:38,280 software to interface with. And there's an unpopulated SATA 135 00:11:38,280 --> 00:11:42,080 header, which we haven't had very much luck with. The review 136 00:11:42,080 --> 00:11:45,020 recovery is a standard Android 2e recovery. It gives you 137 00:11:45,020 --> 00:11:47,780 basically four things you can do. Reboot, apply update from 138 00:11:47,780 --> 00:11:51,480 USB, wipe data, factory reset, and wipe cache partition. 139 00:11:52,620 --> 00:11:56,160 All update files provided are RSA verified before the box even 140 00:11:56,160 --> 00:12:00,200 attempts an installation. So our first hack was UART on the 141 00:12:00,200 --> 00:12:02,980 review. We managed to get this done about two months after the 142 00:12:02,980 --> 00:12:07,620 box was released. And essentially it was just that you 143 00:12:07,620 --> 00:12:12,420 take a, well, first of all, the box does a mandatory update when 144 00:12:12,420 --> 00:12:14,380 you first plug it in. It makes you update to the latest 145 00:12:15,480 --> 00:12:19,400 version, and it basically kills this hack. So the reason we 146 00:12:19,400 --> 00:12:22,060 found it was we actually got lucky and plugged the box in 147 00:12:22,180 --> 00:12:26,800 before even trying an update and noticed that in recovery you get 148 00:12:26,800 --> 00:12:32,080 a console shell. So, you know, really easy to mistake. They 149 00:12:32,080 --> 00:12:34,120 pushed it out. They didn't think anyone was going to plug 150 00:12:34,120 --> 00:12:37,640 it in, plug a UART header into it and give it a shot. But they 151 00:12:37,640 --> 00:12:40,500 didn't know that we were going to buy, you know, five boxes at 152 00:12:40,500 --> 00:12:47,980 250 bucks. So, yeah, we're not the brightest. So it required a 153 00:12:47,980 --> 00:12:50,800 virgin review. It still works on newly purchased reviews since 154 00:12:50,800 --> 00:12:52,160 it was pushed out from the main system. So, you know, it's a 155 00:12:52,180 --> 00:12:55,580 great manufacturer with this problem. And as mentioned 156 00:12:55,580 --> 00:12:58,420 earlier, it requires soldering to four pads on the board, which 157 00:12:58,420 --> 00:13:03,520 are really easy to do other than ground. And it allowed us to 158 00:13:03,520 --> 00:13:06,600 rewrite the file system, which was great because the kernel has 159 00:13:06,600 --> 00:13:10,520 some built in functionality that disables us to be able to write 160 00:13:10,520 --> 00:13:15,760 to, which we can talk about later. So this is essentially my 161 00:13:15,760 --> 00:13:18,700 recursive keyboard setup. As you can see, I have way too many 162 00:13:18,700 --> 00:13:22,100 keyboards plugged in. And that's in my kitchen. My wife is 163 00:13:22,180 --> 00:13:26,760 very, very patient. That was up there for, like, two months and 164 00:13:26,760 --> 00:13:31,980 she tolerated and didn't kick me out. So it's nice. What we did 165 00:13:31,980 --> 00:13:34,700 was we created a manual update process that didn't check any of 166 00:13:34,700 --> 00:13:38,120 the signatures. Since we had that old UART hack or the hack 167 00:13:38,120 --> 00:13:41,460 that we found, the downside was that it only worked on the 168 00:13:41,460 --> 00:13:44,280 unupdated version. So what we had to do is we wanted people to 169 00:13:44,280 --> 00:13:47,940 have the most recent version with the same vulnerability. So 170 00:13:47,940 --> 00:13:49,980 we created the manual update process, which didn't do any 171 00:13:49,980 --> 00:13:52,160 checks on signatures or anything along those lines. So, 172 00:13:52,180 --> 00:13:52,960 we created the manual update process, but still mirrored the 173 00:13:52,960 --> 00:13:56,120 exact same update process. We continued to release the 174 00:13:56,120 --> 00:13:59,820 modified updates until they started encrypting them, and 175 00:13:59,820 --> 00:14:02,800 then we had to jump through some hurdles. Plus, at one point, 176 00:14:02,820 --> 00:14:05,520 they jumped to 3.2, and we decided to start looking for 177 00:14:05,520 --> 00:14:08,960 other vulnerabilities. This was also our first content provider 178 00:14:08,960 --> 00:14:11,320 bypass because that's what people really wanted with this. 179 00:14:11,440 --> 00:14:14,640 They were tired of the Hulu and content provider battle with 180 00:14:14,640 --> 00:14:19,440 Google, and we really wanted a way to stream, you know, TV 181 00:14:19,440 --> 00:14:22,160 shows and stuff to get us away from work. So we created a 182 00:14:22,860 --> 00:14:24,940 content provider bypass. So the content provider bypass was 183 00:14:24,940 --> 00:14:29,420 extremely simple. What it was was essentially we take the flash 184 00:14:29,420 --> 00:14:34,680 version and we manipulate it by changing one byte. Literally we 185 00:14:34,680 --> 00:14:37,620 could change an A to an F or whatever, and they will just 186 00:14:37,620 --> 00:14:41,720 allow it because they strictly have a blacklist type setup. As 187 00:14:41,720 --> 00:14:45,440 you can see in the picture, we have GTV switched to ATV, and 188 00:14:46,920 --> 00:14:50,260 just doing that and changing the user agent in Chrome, which you 189 00:14:50,260 --> 00:14:52,160 can do just by going to settings, and you can change the 190 00:14:52,180 --> 00:14:55,380 text, and typing in anything you want will get you the content 191 00:14:55,380 --> 00:14:59,580 provider bypass. So with that, we released that, and we got a 192 00:14:59,580 --> 00:15:02,800 surprise message from Logitech. They essentially removed the 193 00:15:02,800 --> 00:15:05,540 recovery menu that I mentioned, the Android 2e recovery menu, 194 00:15:05,740 --> 00:15:09,920 and they put our names as the menu items and a rot 13 195 00:15:10,740 --> 00:15:15,420 ciphered message. They removed all the functionality to 196 00:15:15,420 --> 00:15:19,480 install manual updates, and so they crippled the ability for 197 00:15:19,480 --> 00:15:22,160 users to recover their boxes unless they received the 198 00:15:22,180 --> 00:15:26,900 OTA update, which it was a really bad move because even on 199 00:15:26,900 --> 00:15:29,420 the forms, the Logitech forms, which we troll all the time, I 200 00:15:29,420 --> 00:15:34,840 assume they troll ours, there were multiple users who probably 201 00:15:34,840 --> 00:15:38,200 could have fixed their box if they still had access to this 202 00:15:38,200 --> 00:15:42,200 manual USB update mode. Each of the current GTV hackers members 203 00:15:42,200 --> 00:15:45,340 names at the time, which it's changed since then, but at the 204 00:15:45,340 --> 00:15:48,740 time were listed in there, which was a little eerie. You know 205 00:15:49,200 --> 00:15:51,740 they're watching you, but you don't want your name listed in the 206 00:15:52,180 --> 00:15:57,220 firmware. So yeah, if anyone's here, thanks, but we never got 207 00:15:57,220 --> 00:16:00,860 our message back, whatever. And this is essentially what it 208 00:16:00,860 --> 00:16:03,620 looks like. We had to do some jerry rigging to get this to show 209 00:16:03,620 --> 00:16:07,620 up like it did, but the message reads, A, at GTV hackers, 210 00:16:08,080 --> 00:16:10,600 congratulations, if you're reading this, please post a note 211 00:16:10,600 --> 00:16:17,560 on your form to let me know. Winky smiley face. So, I don't 212 00:16:17,560 --> 00:16:20,080 know, is this a good enough message? We posted it on the 213 00:16:20,080 --> 00:16:22,160 forums. If anyone here is from Logitech, please post a note on 214 00:16:22,180 --> 00:16:24,260 Logitech or Google or something. Please respond back. 215 00:16:24,380 --> 00:16:29,460 It's been a year and a half. So then we got started and we 216 00:16:29,460 --> 00:16:31,540 started working on hardware hacks, just different other 217 00:16:31,540 --> 00:16:34,800 things that we could do. We got to the flash sabotage. It's just 218 00:16:34,800 --> 00:16:37,140 a name we coined. I don't know if there's an actual real name 219 00:16:37,140 --> 00:16:41,040 for this, but what happened was since they removed the update 220 00:16:41,040 --> 00:16:43,620 functionality from manual updates, we still wanted a way so 221 00:16:43,620 --> 00:16:47,940 that we could update the box if we could get just any update zip 222 00:16:47,940 --> 00:16:52,160 file. So we found out that when a, you know, if you have a 223 00:16:52,180 --> 00:16:54,740 file, an update is done, an intent file is placed in slash 224 00:16:54,740 --> 00:16:57,820 cache slash recovery slash command. When the box is 225 00:16:57,820 --> 00:17:00,660 booting, it checks this intent file and it will know where the 226 00:17:00,660 --> 00:17:03,720 update is and what to do. But if only we had a way to write 227 00:17:03,720 --> 00:17:06,980 cache. That's where the flash sabotage comes in. Essentially, 228 00:17:07,260 --> 00:17:10,020 cache and Chrome are ext partitions stored on NAND 229 00:17:10,020 --> 00:17:13,220 flash and it's actually connected, the NAND flash is 230 00:17:13,220 --> 00:17:16,980 connected to a USB controller which essentially just makes it 231 00:17:16,980 --> 00:17:21,560 show up as a flash drive on the device. By simply cutting that 232 00:17:21,560 --> 00:17:26,140 line out and adding a USB header to it, we could input our own 233 00:17:26,720 --> 00:17:30,180 flash drive and take over cache and Chrome. So then we had our 234 00:17:30,180 --> 00:17:35,660 way to send updates. It allowed us to fix soft bricks and it, 235 00:17:36,280 --> 00:17:39,520 most of the time, if a brick happened and we were able to fix 236 00:17:39,520 --> 00:17:41,720 it with this, it was because they had corrupted the boot 237 00:17:41,720 --> 00:17:46,280 image. It also allowed us, like I said, to push OTA updates, but 238 00:17:46,280 --> 00:17:50,000 it didn't help us fix anything where we really screwed up. So 239 00:17:50,580 --> 00:17:51,540 we had to go and fix it. We had to go and fix it. We had to go 240 00:17:51,560 --> 00:17:54,980 another route and CJ was brave enough to solder a NAND 241 00:17:54,980 --> 00:18:01,080 programmer to his board. As you can see, you have to be really 242 00:18:01,080 --> 00:18:05,500 brave and have a lot of tape. We have some alternative points 243 00:18:05,500 --> 00:18:07,600 if anyone wants to give it a shot that we can pass out, but 244 00:18:07,600 --> 00:18:12,100 this was an early picture. It allowed us to essentially test 245 00:18:12,100 --> 00:18:14,840 all the stuff we wanted to, you know, to verify the bootloader 246 00:18:14,840 --> 00:18:18,340 was actually signed, flash a modified one to see if we could 247 00:18:18,340 --> 00:18:21,460 get it to boot. And just give anything a shot that we were 248 00:18:21,460 --> 00:18:24,280 really, really wanted to without a risk of having to go 249 00:18:24,280 --> 00:18:30,520 buy another expensive, crappy device. But yeah, so we had to 250 00:18:30,520 --> 00:18:33,700 add that picture. So we wanted a software route on honeycomb 251 00:18:33,700 --> 00:18:36,160 builds. No unpatched publicly known vulnerabilities worked, 252 00:18:36,220 --> 00:18:39,800 as Tom had mentioned. And there were no trivial symbolic links. 253 00:18:39,940 --> 00:18:47,360 Oh, shit. Okay. My bad. This goes to Bliss. Sorry. Hey, I'm 254 00:18:47,360 --> 00:18:51,440 Dan. He was trying to steal my thunder. So yeah. I'm Dan. I'm 255 00:18:51,440 --> 00:18:53,760 a software hack. Yeah. And then, as you were saying, we 256 00:18:53,760 --> 00:18:56,740 wanted a way of providing a software route for the honeycomb. 257 00:18:56,960 --> 00:18:59,680 These guys reached out to me. They had previously done the 258 00:18:59,680 --> 00:19:02,660 UART hack and gotten route that way. But that got fixed. And 259 00:19:02,660 --> 00:19:05,080 pretty much users were left without a way of having route 260 00:19:05,080 --> 00:19:08,540 access on their own devices. So they reached out to me because I 261 00:19:08,540 --> 00:19:12,800 like beating up Android. And I took a look. As we said before, 262 00:19:13,040 --> 00:19:16,060 they're pretty good about patching. They have this device 263 00:19:16,060 --> 00:19:19,520 had no unpatched publicly known vulnerabilities on it when I 264 00:19:19,520 --> 00:19:21,420 looked at it. And additionally, they had no unpapped vulnerabilities 265 00:19:21,440 --> 00:19:24,880 didn't have any of the sort of trivial vulnerabilities that 266 00:19:24,880 --> 00:19:28,680 tend to plague a lot of the OEMs that have to do with simple bugs 267 00:19:28,680 --> 00:19:31,560 with world writable directories and playing games with symbolic 268 00:19:31,560 --> 00:19:34,560 links to write files you shouldn't. None of that was 269 00:19:34,560 --> 00:19:37,580 there on inspection. But I looked a little bit deeper and 270 00:19:37,580 --> 00:19:41,260 found that there are some very suspicious looking world 271 00:19:41,260 --> 00:19:46,780 accessible character devices in slash dev. So just a little 272 00:19:46,780 --> 00:19:50,440 background. Traditionally Linux supports a file called slash 273 00:19:50,440 --> 00:19:54,260 dev slash mem that originally allowed users to map physical 274 00:19:54,260 --> 00:19:59,120 memory into a processes user address space. Since people 275 00:19:59,120 --> 00:20:03,940 realized this was fairly dangerous, you could make root 276 00:20:03,940 --> 00:20:06,640 kits this way, things like that, there's a configuration option 277 00:20:06,640 --> 00:20:10,320 called config strict dev mem that prevents even root from 278 00:20:10,320 --> 00:20:15,340 mapping most of RAM using this mechanism. So it's reserved for 279 00:20:15,340 --> 00:20:19,720 some, I think it's some IO related thing now. It's the X 280 00:20:19,720 --> 00:20:20,320 server, exactly. 281 00:20:21,560 --> 00:20:24,620 So, you know, this wasn't a viable vector for us, but I 282 00:20:24,620 --> 00:20:29,000 noticed that on the review there was a similar device that Intel 283 00:20:29,000 --> 00:20:34,280 was so kind to include called slash dev slash dev mem. And I 284 00:20:34,280 --> 00:20:37,640 was like, what the hell is this? So this device is world 285 00:20:37,640 --> 00:20:42,160 accessible, so we can interact with it, and on inspection it 286 00:20:42,160 --> 00:20:46,000 behaves the same as the original dev mem, but it doesn't allow 287 00:20:46,000 --> 00:20:49,180 mapping addresses lower than the last page frame of physical 288 00:20:49,180 --> 00:20:49,520 RAM. 289 00:20:50,440 --> 00:20:53,800 So what does that mean? So we are not allowed to map kernel 290 00:20:53,800 --> 00:20:58,100 memory as an unprivileged user using this device file. But on 291 00:20:58,100 --> 00:21:03,240 X86 Linux supports memory mapped IO, so accessing addresses 292 00:21:03,240 --> 00:21:06,660 higher than physical RAM actually results in interacting 293 00:21:06,660 --> 00:21:09,260 with hardware registers corresponding to device 294 00:21:09,260 --> 00:21:13,320 peripherals. So this means that this device is giving us the 295 00:21:13,320 --> 00:21:17,160 ability to poke and prod the hardware of the device directly, 296 00:21:17,820 --> 00:21:18,840 which is a brilliant idea. 297 00:21:20,520 --> 00:21:24,260 So this seems like something that we can use to somehow 298 00:21:24,260 --> 00:21:27,860 escalate our privileges. So there were several options 299 00:21:27,860 --> 00:21:30,460 available. You know, we have access to the PCI buses, we 300 00:21:30,460 --> 00:21:32,920 have access to the interrupt controllers, maybe we can 301 00:21:32,920 --> 00:21:36,920 reprogram them to do something crazy. We had access to the 302 00:21:36,920 --> 00:21:41,020 E1000 Ethernet controller, which, you know, maybe we could 303 00:21:41,020 --> 00:21:43,840 do things with DMA with that. But after weighing all these 304 00:21:43,840 --> 00:21:48,500 options, I ended up choosing the Intel CE NAND flash controller as 305 00:21:48,500 --> 00:21:50,420 the device that I would leverage. So, you know, it's a 306 00:21:50,440 --> 00:21:53,380 great device to gain root privileges. The first reason 307 00:21:53,380 --> 00:21:57,160 being it supports DMA, direct memory access, which is a 308 00:21:57,160 --> 00:22:00,800 mechanism by which hardware can write directly to physical RAM 309 00:22:00,800 --> 00:22:04,140 without intervention from the operating system. And secondly, 310 00:22:04,260 --> 00:22:07,880 because it had an open source driver, which really helps in 311 00:22:07,880 --> 00:22:09,940 that I didn't have to do any sort of hardware reverse 312 00:22:09,940 --> 00:22:12,980 engineering or any risky guess work where I basically just 313 00:22:12,980 --> 00:22:15,720 tried plugging things into random hardware registers and 314 00:22:15,720 --> 00:22:20,420 hope I didn't turn the device into a brick. So, you know, I 315 00:22:20,440 --> 00:22:23,260 thought, what can we do with this device now that we can play 316 00:22:23,260 --> 00:22:28,660 with it? So by using this dev dev mem file to map and write to 317 00:22:28,660 --> 00:22:31,520 flash controller hardware registers, we can actually cause 318 00:22:31,520 --> 00:22:35,000 this controller to DMA directly on top of kernel memory in a 319 00:22:35,660 --> 00:22:40,800 page length increments of 4096 bytes. So fortunately for us, 320 00:22:40,860 --> 00:22:44,200 the address of kernel memory that we can clobber doesn't have 321 00:22:44,200 --> 00:22:47,160 to be aligned to a page boundary, which could have been a 322 00:22:47,160 --> 00:22:50,420 restraint. But, you know, this device actually supports that. 323 00:22:51,180 --> 00:22:55,420 Unfortunately, the data that we're scribbling over using DMA 324 00:22:55,880 --> 00:22:59,440 isn't really controllable by us. Because it's just sort of raw 325 00:22:59,440 --> 00:23:02,620 NAND data that's living below the file system layer. You know, 326 00:23:02,640 --> 00:23:05,560 you don't even really have a hope of getting file fragments or 327 00:23:05,560 --> 00:23:08,260 anything like that because of where leveling and all that. So 328 00:23:08,260 --> 00:23:11,580 it's basically just garbage that we can, you know, clobber a page 329 00:23:11,580 --> 00:23:15,520 of kernel memory with. So the question becomes, what do we 330 00:23:15,520 --> 00:23:19,300 clobber? Like, how do we leverage this capability? So we 331 00:23:19,300 --> 00:23:20,420 need a target in kernel memory. So we need a target in kernel 332 00:23:20,440 --> 00:23:24,380 memory where it's okay to wipe out an entire full page with 333 00:23:24,380 --> 00:23:28,080 random garbage. So that, you know, what I would normally go 334 00:23:28,080 --> 00:23:31,480 after would be some sort of function pointer or an entry of 335 00:23:31,480 --> 00:23:34,300 the system call table where we can somehow trigger invocation 336 00:23:34,300 --> 00:23:37,520 of that and it would point into, you know, our payload and 337 00:23:37,520 --> 00:23:40,500 then we could run things with kernel privileges. But the 338 00:23:40,500 --> 00:23:44,820 problem was all of the targets that I'm aware of, we couldn't 339 00:23:44,820 --> 00:23:47,720 do it this way because clobbering an entire page of 340 00:23:47,720 --> 00:23:50,420 memory from that point on tended to break the kernel. So, you 341 00:23:50,440 --> 00:23:51,700 know, that was a big problem. And the device immediately 342 00:23:51,700 --> 00:23:56,780 crashed. Then I tried to be clever and go after something 343 00:23:56,780 --> 00:24:00,220 specific to Android, which is the Android properties page. So 344 00:24:00,220 --> 00:24:05,100 Android has this shared page of memory that represents sort of 345 00:24:05,100 --> 00:24:07,780 global system settings. And if you overwrite certain 346 00:24:07,780 --> 00:24:10,300 properties, the Android debugging daemon will actually 347 00:24:10,300 --> 00:24:13,740 run as root and give you a root shell. And I actually got this 348 00:24:13,740 --> 00:24:18,120 working and then I found out that on this particular device, 349 00:24:18,340 --> 00:24:20,420 they modified the ADB daemon to not be able to run a root shell. 350 00:24:20,440 --> 00:24:24,600 They never run as root, which really sucked. So I was a bit 351 00:24:24,600 --> 00:24:28,940 stuck for a little bit. And then I remembered that I actually had 352 00:24:28,940 --> 00:24:33,140 already solved this problem in a different context. So the 353 00:24:33,140 --> 00:24:36,100 technique that I'm using here, I actually talked about with John 354 00:24:36,100 --> 00:24:39,140 Oberheide like a year and a half ago. And it's a technique 355 00:24:39,140 --> 00:24:41,800 that we called stack jacking, which we thought was a really 356 00:24:41,800 --> 00:24:46,780 funny name. So in this case, a process's kernel stack is a great 357 00:24:46,780 --> 00:24:50,000 target. On Linux, by default, these kernel stacks are eight 358 00:24:50,000 --> 00:24:52,780 kilobytes big. So there's plenty of room. And most of it 359 00:24:52,780 --> 00:24:56,180 is generally unused. So you can wipe out a full page of memory 360 00:24:56,180 --> 00:24:58,960 there and it's not going to break anything. And the next 361 00:24:58,960 --> 00:25:01,960 thing is, at the base of a process's kernel stack on Linux, 362 00:25:02,120 --> 00:25:04,520 there's a structure called thread info. And this has stuff 363 00:25:04,520 --> 00:25:07,760 that's particularly useful for us to overwrite using this DMA. 364 00:25:09,180 --> 00:25:12,160 And in particular, there's one variable called the adder limit 365 00:25:12,160 --> 00:25:16,640 that I chose to go after. So the adder limit is basically, it 366 00:25:16,640 --> 00:25:19,860 represents the boundary between user and kernel memory. 367 00:25:20,000 --> 00:25:23,300 So on Linux, by default, the first three gigabytes of an 368 00:25:23,300 --> 00:25:26,140 address space are user memory. And the top one gigabyte is 369 00:25:26,140 --> 00:25:29,380 kernel memory. On the review, it's actually two gigabytes and 370 00:25:29,380 --> 00:25:31,380 two gigabytes. And I haven't figured out why they did that. 371 00:25:33,420 --> 00:25:36,920 And whenever the kernel is copying data from a supposed 372 00:25:36,920 --> 00:25:40,660 user land address to a kernel address, it checks, is this user 373 00:25:40,660 --> 00:25:43,780 land address actually below this limit? Otherwise, you know, you 374 00:25:43,780 --> 00:25:46,200 could read from a file descriptor right into a kernel 375 00:25:46,200 --> 00:25:49,980 buffer. So if we can overwrite this particular variable, it 376 00:25:50,000 --> 00:25:53,520 is at the base of the kernel stack with a high value, then 377 00:25:53,520 --> 00:25:56,160 that will allow our process to read and write to arbitrary 378 00:25:56,160 --> 00:25:58,960 kernel memory because all of these sort of access checks will 379 00:25:58,960 --> 00:26:03,380 pass. The way we actually find out where the process's kernel 380 00:26:03,380 --> 00:26:08,240 stack is is a little bit complicated. The gist of it is 381 00:26:08,240 --> 00:26:11,980 I leverage another vulnerability to leak some uninitialized bytes 382 00:26:11,980 --> 00:26:15,160 from the process's kernel stack and then do some fancy 383 00:26:15,160 --> 00:26:19,340 statistical hand waving and, you know, resolve the address. 384 00:26:20,060 --> 00:26:22,820 You can just believe me that it works and the code will be 385 00:26:22,820 --> 00:26:25,760 public. And this is all implemented in a library that I 386 00:26:25,760 --> 00:26:29,900 published like a year ago called libk stack. So here's that 387 00:26:29,900 --> 00:26:32,540 thread info structure which lives at the base of the kernel 388 00:26:32,540 --> 00:26:36,440 stack that we're going to clobber using DMA. You'll notice 389 00:26:36,440 --> 00:26:39,780 that, I don't know if you can, no, there's no mouse. Yeah, you 390 00:26:39,780 --> 00:26:44,300 can see that adder limit variable. And it clobbers, we're 391 00:26:44,300 --> 00:26:47,620 going to clobber everything from that point on. So we're also 392 00:26:47,620 --> 00:26:49,980 going to overwrite the restart block function pointer. We're 393 00:26:50,000 --> 00:26:50,260 also going to overwrite the return function pointer, which 394 00:26:50,260 --> 00:26:54,220 is, it actually gets invoked when system calls have to be 395 00:26:54,220 --> 00:26:57,580 restarted for certain reasons. And you can manually invoke it 396 00:26:57,580 --> 00:27:00,820 as well. And then we're also going to clobber this CIS enter 397 00:27:00,820 --> 00:27:03,380 return function pointer, which is a real pain in the ass. 398 00:27:03,800 --> 00:27:07,920 Because this is actually a pointer to a user land address 399 00:27:07,920 --> 00:27:12,160 where the kernel will return execution to the process when it 400 00:27:12,160 --> 00:27:15,140 is returning from a system call that was invoked using the CIS 401 00:27:15,140 --> 00:27:18,240 enter mechanism. The other CIS call mechanism being interrupt 402 00:27:18,240 --> 00:27:19,980 OX80. So we're going to do that. And then we're going to do a 403 00:27:20,000 --> 00:27:21,860 couple of things. So by clobbering this, we can no 404 00:27:21,860 --> 00:27:25,700 longer use like G lib C library functions, because they all use 405 00:27:25,700 --> 00:27:29,360 CIS enter by default and when those functions return, it will 406 00:27:29,360 --> 00:27:31,680 go to this random address that we've written there instead of 407 00:27:31,680 --> 00:27:35,300 where it's supposed to go. So we had to fix that up, too. So 408 00:27:35,300 --> 00:27:37,880 here's what the whole exploit looks like, just summarizing all 409 00:27:37,880 --> 00:27:43,800 that into one page. So we use this dev dev mem file to map 410 00:27:43,800 --> 00:27:46,280 the NAND flash controllers, hardware registers into our 411 00:27:46,280 --> 00:27:49,620 address space. We leverage this kernel info leak and do some 412 00:27:49,620 --> 00:27:54,000 magic to resolve the address of the current process's kernel 413 00:27:54,000 --> 00:27:56,660 stack. And now we know that there's that thread info 414 00:27:56,660 --> 00:27:59,920 structure at the base of it. We write to specific hardware 415 00:27:59,920 --> 00:28:02,640 registers that we sort of learned about by reading the 416 00:28:03,350 --> 00:28:09,240 Intel NAND driver to trigger this DMA on top of that offset 417 00:28:09,240 --> 00:28:12,120 corresponding to that outer limit variable from the base of 418 00:28:12,120 --> 00:28:15,460 the kernel stack. And then we pray that the random garbage that 419 00:28:15,460 --> 00:28:19,020 we wrote there happens to make this outer limit variable high, 420 00:28:19,620 --> 00:28:22,620 enough so that we can read and write to arbitrary kernel memory. 421 00:28:22,960 --> 00:28:26,260 And using that new capability, we fix up that CIS enter return 422 00:28:26,260 --> 00:28:29,940 thing. You know, we manually invoke all of our system calls 423 00:28:29,940 --> 00:28:34,080 using int 80 from then on. Fix the CIS enter return function 424 00:28:34,080 --> 00:28:37,520 pointer. Overwrite the restart block function pointer to point 425 00:28:37,520 --> 00:28:40,160 to our payload that will escalate privileges and then 426 00:28:40,160 --> 00:28:43,860 trigger it. Our payload gets executed. We escalate our 427 00:28:43,860 --> 00:28:48,180 privileges and we win. Some caveats about this exploit. It 428 00:28:48,180 --> 00:28:49,600 really sucks. We have a lot of problems with this exploit. We 429 00:28:50,360 --> 00:28:51,740 just don't have the tool that we need. So the jist of it is 430 00:28:52,520 --> 00:28:56,020 poking and prodding hardware registers like this is never a 431 00:28:56,020 --> 00:28:59,020 good idea. And in this particular case, it conflicts 432 00:28:59,020 --> 00:29:04,680 with what the driver's usage of this hardware. So when you 433 00:29:04,680 --> 00:29:09,000 trigger the DMA, the hardware sends off an IRQ saying, oh, I'm 434 00:29:09,000 --> 00:29:12,080 done doing DMA and the driver receives it and goes, why did 435 00:29:12,080 --> 00:29:16,000 you just tell me that I didn't ask you to do that? So and then 436 00:29:16,000 --> 00:29:19,600 on Linux, the default response to a spurious IRQ is that it's a 437 00:29:19,620 --> 00:29:24,260 is to ignore that from then on. So at that point your NAND flash 438 00:29:24,260 --> 00:29:26,920 controller can no longer perform DMA and your primary storage 439 00:29:26,920 --> 00:29:32,400 goes down and the box is totally useless until you reboot. So I 440 00:29:32,400 --> 00:29:38,040 have to that was a weird phone sound. So you have to I toggle 441 00:29:38,040 --> 00:29:42,060 an IRQ bit on the actual in the appropriate hardware register to 442 00:29:42,640 --> 00:29:45,640 prevent it from firing that off when the DMA is complete. But 443 00:29:45,640 --> 00:29:48,700 it's essentially a race condition and you know that 444 00:29:48,700 --> 00:29:51,900 really lowers the reliability of the exploit. The other problem 445 00:29:51,900 --> 00:29:55,280 is when we're doing our DMA we basically have to pray that the 446 00:29:55,280 --> 00:29:58,020 random data that overwrites this variable is something favorable 447 00:29:58,020 --> 00:30:02,080 to us. This only works like I don't know 20% of the time if 448 00:30:02,080 --> 00:30:04,720 that. But it's good enough for home brew and it will get 449 00:30:05,260 --> 00:30:12,140 people's devices rooted. So lastly as these guys mentioned 450 00:30:12,140 --> 00:30:18,500 the review, review, review, review. The review is a 451 00:30:30,760 --> 00:30:46,740 third thing. Unrestricted 452 00:30:48,680 --> 00:30:53,920 device would. So we just mapped the RSA verify function which I 453 00:30:53,920 --> 00:30:56,280 actually just guessed, it seemed like it was probably important 454 00:30:56,980 --> 00:31:02,040 and replaced the first bytes of that function with an XOR EAX 455 00:31:02,040 --> 00:31:04,900 EAX return which is just a return zero. So now the 456 00:31:04,900 --> 00:31:07,560 verification function will always return success and you 457 00:31:07,560 --> 00:31:13,220 can load arbitrary kernel modules. So next CJ is going to 458 00:31:13,220 --> 00:31:26,020 talk about Sony. So hello everyone. There we go. I'm CJ 459 00:31:26,020 --> 00:31:27,940 here. I'm going to talk to you about the Sony Google TV 460 00:31:27,940 --> 00:31:31,420 devices. My first question, anyone from Google or Sony around 461 00:31:31,420 --> 00:31:36,680 here? Audience? If so, I'm sorry about getting busy next week. So 462 00:31:37,260 --> 00:31:41,120 the generation one Sony Google TV devices include a Blu-ray 463 00:31:41,120 --> 00:31:43,200 player which is the GT one on the left. The other one is the 464 00:31:43,220 --> 00:31:46,780 Sony. And the televisions including a 24, 32, 40 and 46 465 00:31:46,780 --> 00:31:51,780 inch GT one on the right. So that should be a GX one. The 466 00:31:51,780 --> 00:31:55,620 hardware is identical apart from the obvious differences of the 467 00:31:55,620 --> 00:31:59,060 fact that one is a TV, one is a Blu-ray player. You can tell by 468 00:31:59,060 --> 00:32:01,980 the GT one's motherboard that it is considerably bulkier than 469 00:32:01,980 --> 00:32:05,080 that of the Logitech review. But it is built like a Sony. I 470 00:32:05,080 --> 00:32:08,560 mean it's very heavy and it's populated with debug ports which 471 00:32:08,560 --> 00:32:11,820 is very great. There are at least three UARTs on board and 472 00:32:11,820 --> 00:32:13,200 it contains a CE4. So it's very heavy and it's populated with 473 00:32:13,220 --> 00:32:13,860 debug ports. So it's very heavy and it's populated with debug 474 00:32:13,860 --> 00:32:19,020 processor at 1.7 gigahertz. Now, our very first attempt was 475 00:32:19,020 --> 00:32:23,700 S8A sabotage. We noticed that the box had an internal SSD. It 476 00:32:23,700 --> 00:32:27,800 was connected over an S8A bus, used the TDK GB driver RS2. 477 00:32:28,140 --> 00:32:32,220 However, that featured AES encryption on the flash. So we 478 00:32:32,220 --> 00:32:34,420 couldn't just pull the flash, dump it, modify it, stick it 479 00:32:34,420 --> 00:32:38,600 back. Instead, we just tapped into the S8A bus. Our very first 480 00:32:38,600 --> 00:32:41,860 attempt was to tap into the bus, hook it into a computer, but we 481 00:32:41,860 --> 00:32:43,200 got nowhere since there was an ATA. So this is the S8A bus. It's 482 00:32:43,220 --> 00:32:43,480 a little bit sturdier than the S8A bus. The first attempt was to 483 00:32:43,480 --> 00:32:51,340 lock on the SSD. And since the cable was kind of I guess cheaply 484 00:32:51,340 --> 00:32:57,140 sorted in by myself, it wasn't very sturdy. So instead of doing 485 00:32:57,140 --> 00:33:00,520 that, I sort of new cable in, hooked it up to an external hard 486 00:33:00,520 --> 00:33:04,640 drive which allowed us to access the entire file system, read to 487 00:33:04,640 --> 00:33:08,060 it, write to it and also downgrade. Since the cache partition 488 00:33:08,060 --> 00:33:13,200 still had a flag on the box. That kept track of what version of the 489 00:33:13,200 --> 00:33:16,220 software should be at. So we used that to look for flaws. We 490 00:33:16,220 --> 00:33:19,260 initially downgraded to the very first version and started 491 00:33:19,260 --> 00:33:24,420 looking there. So the recovery system of the Google TV is far 492 00:33:24,420 --> 00:33:27,040 more interesting than that of the Logitech review. But like 493 00:33:27,040 --> 00:33:30,420 the review, it also has the update from USB features and it 494 00:33:30,420 --> 00:33:33,540 also has a few more other interesting features such as 495 00:33:33,540 --> 00:33:37,960 service mode that lets you set certain IDs for ACS and what 496 00:33:37,960 --> 00:33:42,380 not. However, the entire series of the recovery script is done 497 00:33:42,380 --> 00:33:46,040 through pretty much a large script. Runs a shell script, 498 00:33:46,240 --> 00:33:48,440 probably not the safest thing to do. We'll get to that in a 499 00:33:48,440 --> 00:33:52,140 moment. And it outputs logging to the UART, which we will use 500 00:33:52,140 --> 00:33:55,500 in a moment. And it's worth mentioning that Sony updates are 501 00:33:55,500 --> 00:34:04,020 RC4 encrypted. It's an RC4 and they are also RSA signed. So we 502 00:34:04,020 --> 00:34:07,080 saw this in the logs, the first line. Can anybody see the 503 00:34:07,080 --> 00:34:12,360 obvious problem? If nobody gets it, we're going to have to 504 00:34:12,380 --> 00:34:13,160 try and fix it. So we're going to go to the local command 505 00:34:13,160 --> 00:34:14,880 execution, which I'm sure some people do, but they're being 506 00:34:14,880 --> 00:34:18,340 quiet. The very first thing returns a wild card that's 507 00:34:18,340 --> 00:34:21,440 directly passed to another shell script. It's a big flaw. 508 00:34:21,620 --> 00:34:27,840 It was never validated. So using that, we could craft, yes, a 509 00:34:27,840 --> 00:34:31,840 package name. If as long as we had, we put some semicolons in, 510 00:34:31,960 --> 00:34:35,500 it matched the wild card, passed it to the SH, and we're able to 511 00:34:35,500 --> 00:34:39,140 get local command execution, which is pretty awesome since 512 00:34:39,140 --> 00:34:42,120 they never checked it. We initially started with a script 513 00:34:42,380 --> 00:34:45,700 called t.sh, which would pretty much spawn a shell over the UART 514 00:34:45,700 --> 00:34:48,300 and also telnet, and from there we were able to dump out the 515 00:34:48,300 --> 00:34:50,780 entire recovery file system and really examine it for more 516 00:34:50,780 --> 00:34:54,940 flaws. However, this exploit was patched in the 7-2011 517 00:34:54,940 --> 00:34:59,100 update. We were checking around with it, patched. We still had 518 00:34:59,100 --> 00:35:02,020 the hardware exploit that we talked about, but to quote the 519 00:35:02,020 --> 00:35:05,760 tech blog Engadget, they stated about our review exploit, it's 520 00:35:05,760 --> 00:35:08,420 not exactly what we call an easy jailbreak, seeing as how it 521 00:35:08,420 --> 00:35:10,900 requires a soldering iron, an info procedure, and a logitech 522 00:35:10,900 --> 00:35:12,360 review that's never been powered on. So we're going to 523 00:35:12,380 --> 00:35:13,800 get into that in a minute. But it looks like it's possible to 524 00:35:13,800 --> 00:35:16,840 route a Google TV after a run. That was four rather large pads. 525 00:35:17,120 --> 00:35:20,220 The Sony would have to remove four surface mount capacitors 526 00:35:20,690 --> 00:35:23,720 and solder them in. I'm sure some of you could do it. Most 527 00:35:23,720 --> 00:35:27,220 people couldn't. So that was not a viable option to release to the 528 00:35:27,220 --> 00:35:31,020 public. Getting back to the UART, there was an active UART 529 00:35:31,020 --> 00:35:34,360 line, output only for logging, and after our initial hack with 530 00:35:34,360 --> 00:35:38,180 the replacement of the SSD, we were able to achieve a root 531 00:35:38,180 --> 00:35:42,360 console in Linux. And using that root console, we took a few 532 00:35:42,380 --> 00:35:44,260 steps to dump out the system memory, which showed the 533 00:35:44,260 --> 00:35:48,100 existence of NBL, which was Sony's second stage boot loader 534 00:35:48,100 --> 00:35:52,080 that Tom talked about earlier. And looking through it a bit, we 535 00:35:52,080 --> 00:35:56,540 saw that there was the existence of a shell, and after some 536 00:35:56,540 --> 00:36:00,700 memory reversing, we found out that if we hit the escape key, 537 00:36:00,820 --> 00:36:04,160 repeatedly when the box boots up, actually NBM did, but he's 538 00:36:04,160 --> 00:36:08,260 not here, it would bring us to a password prompt. And after more 539 00:36:08,260 --> 00:36:11,720 reversing on his part, the magic password to bring up a shell was 540 00:36:11,720 --> 00:36:12,360 console. And that's what we found out. And we found out that 541 00:36:17,740 --> 00:36:21,420 the NBL had options including loading files into memory and 542 00:36:21,420 --> 00:36:25,740 executing from internal flash or network via TFTP. That would be 543 00:36:25,740 --> 00:36:27,960 great but we couldn't just stick an unsigned kernel and have it 544 00:36:27,960 --> 00:36:30,620 boot. The kernels were, of course, signed. And the 545 00:36:30,620 --> 00:36:33,080 insecure booting features were disabled on production units. 546 00:36:33,680 --> 00:36:38,840 And since NBL used signature and hash checks, we couldn't do 547 00:36:38,840 --> 00:36:41,800 anything. But I do happen to remember that recovery version I 548 00:36:41,800 --> 00:36:46,380 spoke about that was patched in 7 2011, we could reload it. So 549 00:36:46,380 --> 00:36:49,880 this picture shows the initial boot up, shows us entering a 550 00:36:49,880 --> 00:36:54,140 password and then we boot over the network to a TFTP server, 551 00:36:54,320 --> 00:36:58,660 the exploitable recovery version and initial RAM disk. Takes a 552 00:36:58,660 --> 00:37:01,640 few minutes but then it will drop us to a root shell, which 553 00:37:01,640 --> 00:37:04,940 is perfect for what we needed. And it gets even better since 554 00:37:04,940 --> 00:37:09,780 the system, when you boot via TFTP, the system doesn't unlock 555 00:37:09,780 --> 00:37:14,120 the SSD on board, the kernel panics and drops to a shell. We 556 00:37:14,120 --> 00:37:18,720 don't even have to do anything past that, which is awesome. So 557 00:37:18,720 --> 00:37:21,880 in the exploitable recovery, the system boot binaries are stored 558 00:37:21,880 --> 00:37:25,100 not on the SSD but on a separate flash located at DevGlobe 559 00:37:25,100 --> 00:37:28,680 underscore Spectra A2. And since I mentioned the ATA was locked 560 00:37:28,680 --> 00:37:32,140 but the flash wasn't, we could write to it. So we replaced the 561 00:37:32,140 --> 00:37:35,440 new recovery version that was signed with our old exploitable 562 00:37:35,440 --> 00:37:38,400 but signed recovery version. Since now we have an exploitable 563 00:37:38,400 --> 00:37:39,760 recovery, there was no need to replace it with the old 564 00:37:39,760 --> 00:37:43,780 one. There was no need for UART and our thought was we could 565 00:37:43,780 --> 00:37:47,800 either wait until the rumored 3.2 release to release the 566 00:37:47,800 --> 00:37:51,940 exploit last September 2011. Google and Sony took until 567 00:37:51,940 --> 00:37:58,180 December, unfortunately. So come the 3.2 release in 568 00:37:58,180 --> 00:38:00,420 December, we didn't really want to give up our boot loader 569 00:38:00,420 --> 00:38:04,280 password being found. It was great fixing boxes and it was a 570 00:38:04,280 --> 00:38:07,280 pretty cool exploit. So we spent about two weeks looking for 571 00:38:07,280 --> 00:38:09,560 bugs. We found plenty of bugs in 572 00:38:09,760 --> 00:38:13,720 there, including leveraging sim links and zips and unzips and 573 00:38:13,720 --> 00:38:16,020 creating files and removing files but we could never get one 574 00:38:16,020 --> 00:38:20,160 to execute. But we really got to know the update process. So the 575 00:38:20,160 --> 00:38:23,760 next one shows the update process. Pretty much recovery 576 00:38:23,760 --> 00:38:27,800 mounts USB to temp mount disk B1. It looks for the package 577 00:38:27,800 --> 00:38:32,440 list wildcard. Then it passes it to package updated.sh which 578 00:38:32,440 --> 00:38:35,400 then copies the file to cache. And then the package update 579 00:38:35,400 --> 00:38:38,180 unzips the build.prop and displays it to the user. Before 580 00:38:38,180 --> 00:38:39,740 verification, mind you. And then we got to the update process. 581 00:38:39,760 --> 00:38:42,920 If the update's accepted, it's copied again to cache, then it's 582 00:38:42,920 --> 00:38:46,520 verified. But when they copied it to cache, they never checked if 583 00:38:46,520 --> 00:38:50,440 there was already an existing file in cache. So this is 584 00:38:50,440 --> 00:38:53,960 essentially what we did. Since the Sony recovery mounted EXT2 585 00:38:53,960 --> 00:38:57,160 and EXT3 partitions with no mount parameters, we could use a 586 00:38:57,160 --> 00:39:01,540 block device on a USB drive to write to a device node as root. 587 00:39:01,960 --> 00:39:05,800 So we started with three flash drives. USB 1, USB 2, USB 3. 588 00:39:05,960 --> 00:39:09,140 USB 1 just had a build.prop. It didn't have to be signed. It 589 00:39:09,140 --> 00:39:13,540 just prompted the user 1 to switch. USB 2 contained the block 590 00:39:13,540 --> 00:39:17,860 device that we would write to the box. And USB 3 contained a 591 00:39:17,860 --> 00:39:22,640 full image of the flash stored on the system. So what we'd 592 00:39:22,640 --> 00:39:26,120 first do, we'd insert USB 1. It'd prompt us if we wanted to 593 00:39:26,120 --> 00:39:28,680 update. This was before the verification but after the 594 00:39:28,680 --> 00:39:32,100 initial copy. I'm sorry. I take that back. It was before the 595 00:39:32,100 --> 00:39:35,060 verification and before the initial copy. So we'd swap it 596 00:39:35,060 --> 00:39:38,740 out with USB 2 which held our block device that we labeled 597 00:39:39,140 --> 00:39:44,400 package-list-gtv-hacker.zip. We'd hit okay. It would copy 598 00:39:44,400 --> 00:39:48,680 package-list-gtv-hacker.zip as a block device to the cache 599 00:39:48,680 --> 00:39:51,400 partition. Then it would error out since it wasn't validated. 600 00:39:51,660 --> 00:39:55,020 But that's perfect. That's what we wanted. Then instead of 601 00:39:55,020 --> 00:39:58,040 rebooting or deleting the files, it would drop us back to the 602 00:39:58,040 --> 00:40:01,000 main menu. From the main menu, we repeat the process, insert 603 00:40:01,000 --> 00:40:05,060 USB 1, which would get us past that first prompt, and then we'd 604 00:40:05,060 --> 00:40:08,420 swap it out with USB 3, which contained our image of the flash 605 00:40:09,140 --> 00:40:12,100 file system. When we hit okay, it copied our new modified image 606 00:40:12,100 --> 00:40:16,060 with an exploitable recovery of the flash file system right over 607 00:40:16,060 --> 00:40:21,000 to the block device. And doing that, we were able to rewrite 608 00:40:21,000 --> 00:40:25,180 the internal flash only using software, which was great. 609 00:40:29,080 --> 00:40:36,600 Thank you. So now assuming all that went correctly, 610 00:40:36,800 --> 00:40:39,080 which every now and then if somebody copied a file or 611 00:40:39,140 --> 00:40:41,700 did something wrong, it could go poor, but then you could use 612 00:40:41,700 --> 00:40:45,120 the boot loader to fix it. Assuming that went correctly, we 613 00:40:45,120 --> 00:40:51,020 used the local executable. Not executable. Local code 614 00:40:51,020 --> 00:40:54,240 execution recovery exploit. In our exploit, we had a large 615 00:40:54,240 --> 00:40:56,880 script that when ran would repartition the internal SSD 616 00:40:57,340 --> 00:40:59,920 because we needed a little more room. It would copy boot to a 617 00:40:59,920 --> 00:41:03,760 new partition. It'd edit the initial boot to include K exec 618 00:41:03,760 --> 00:41:08,960 files and hijack the initial boot process to call K exec. Now, 619 00:41:08,960 --> 00:41:09,120 we're going to go back to the main menu and we're going to go 620 00:41:09,120 --> 00:41:10,100 going to go back to the main menu. And now, if anybody doesn't 621 00:41:10,100 --> 00:41:13,680 know, according to Wikipedia, K exec is a mechanism of a 622 00:41:13,680 --> 00:41:17,960 Linux kernel that allows live booting of a new kernel over 623 00:41:17,960 --> 00:41:20,900 the currently running kernel. Now, K exec can be built into 624 00:41:20,900 --> 00:41:24,060 the kernel, but most people don't, especially not if you 625 00:41:24,060 --> 00:41:27,040 don't want people running unsigned kernels. It wasn't, so 626 00:41:27,040 --> 00:41:29,460 we built it as a kernel module. Took a little bit, but we got it 627 00:41:29,460 --> 00:41:32,460 in there. K exec allowed us to boot the system, have it kick 628 00:41:32,460 --> 00:41:34,840 over in less than one second and load our new unsigned kernel. 629 00:41:35,100 --> 00:41:38,480 But as Tom mentioned, the Sony box, after checking the 630 00:41:39,120 --> 00:41:42,400 boot loader, checking the signing of the kernel, the 631 00:41:42,400 --> 00:41:47,620 kernel's, the kernel arguments also had a hash, an SHA1 hash on 632 00:41:47,620 --> 00:41:52,520 the init. And the init RSA verified the init scripts. So we 633 00:41:52,520 --> 00:41:55,980 had to find a place to jam something in there. The chain 634 00:41:55,980 --> 00:41:59,460 of trust needed to be broken. And we could break it a little 635 00:41:59,460 --> 00:42:02,500 further in the process, but the issue was the platform security 636 00:42:02,500 --> 00:42:05,860 firmware would kick in and panic the kernel. So we couldn't do 637 00:42:05,860 --> 00:42:09,560 that. So we looked for an attack vector and we found E2FSCK. 638 00:42:10,140 --> 00:42:12,880 Now, if anybody doesn't know, it does a file system check. It's 639 00:42:12,880 --> 00:42:15,840 one of the first things ran before anything is mounted. So 640 00:42:15,840 --> 00:42:20,300 we were able to attack that, and that was stored in E2FSCK, 641 00:42:20,460 --> 00:42:24,300 which is mounted from dev SD A1 on the SSD that we can now 642 00:42:24,300 --> 00:42:29,040 write to in our exploitable recovery. So we replaced E2FSCK 643 00:42:29,040 --> 00:42:32,220 with a script that mounted system, inserted our K exec 644 00:42:32,220 --> 00:42:35,740 modules, and K exec loaded our new kernel. Our new kernel, 645 00:42:35,860 --> 00:42:39,280 apart from having no hashes, no signatures, had a few other 646 00:42:39,280 --> 00:42:43,220 tweaks, including not signing the init.rc, the init.eagle or 647 00:42:43,220 --> 00:42:46,780 server.rc. It also modified the init.rc to read write 648 00:42:46,780 --> 00:42:50,820 everything, set our secure to zero, our debug to one, and we 649 00:42:50,820 --> 00:42:55,460 had a script that would mutate the flash plug-in totally 650 00:42:55,460 --> 00:42:59,720 randomly. So no two boxes would have the same flash plug-in and 651 00:42:59,720 --> 00:43:02,140 it also wouldn't randomly mutate it to GTV, which would 652 00:43:02,140 --> 00:43:05,760 defeat the point. Make sure to check for that. So you could 653 00:43:05,860 --> 00:43:08,860 watch Hulu or whatever else was blocked on the Sony Google TV. 654 00:43:09,780 --> 00:43:12,860 So now I'm going to pass it back off to Omeya to talk a little 655 00:43:12,860 --> 00:43:24,200 off topic about the Boxee. All right. So this is a little off 656 00:43:24,200 --> 00:43:27,140 topic portion, but what happened was that we were 657 00:43:27,140 --> 00:43:33,360 looking to port the Boxee to the Google TV devices. Now Boxee 658 00:43:33,360 --> 00:43:35,840 runs a C4100 just like the Google TV, but it's a little 659 00:43:35,860 --> 00:43:36,580 bit more expensive than the Google TV. So we thought it would 660 00:43:36,580 --> 00:43:39,880 be fairly easy and we actually did get it working. Downside was 661 00:43:39,880 --> 00:43:42,860 we were lacking certificates and what not to get Netflix working 662 00:43:42,860 --> 00:43:45,840 to get the box to where everyone would want it. We also 663 00:43:45,840 --> 00:43:48,900 discovered that we hate the Boxee because it is 664 00:43:49,860 --> 00:43:53,160 counterintuitive to everything you'd want it to do. If you 665 00:43:53,160 --> 00:43:56,420 have a Boxee, we have a route for it. We're about to drop, so 666 00:43:56,420 --> 00:44:02,200 enjoy. Yeah, and the Boxee hacking community wasn't very 667 00:44:02,200 --> 00:44:05,840 friendly to us, as it's mentioned at the bottom. So we 668 00:44:05,840 --> 00:44:07,440 decided to make this a little bit more complicated. So this is 669 00:44:07,440 --> 00:44:10,200 about Google TV, so we're going to make this pretty quick. 670 00:44:11,220 --> 00:44:14,380 Essentially, there's a software local command execution exploit 671 00:44:14,840 --> 00:44:18,620 that's as simple as dropping a semicolon into a certain field 672 00:44:18,620 --> 00:44:21,300 in the settings menu and throwing whatever command you 673 00:44:21,300 --> 00:44:31,980 want afterwards and owning the box. It's perfect. I don't know 674 00:44:31,980 --> 00:44:34,720 how it was missed. I don't know why there's still people looking 675 00:44:34,720 --> 00:44:35,820 for this route. They don't know how to use it. They don't know 676 00:44:35,840 --> 00:44:37,180 how to use it. We've been talking with them about it for 677 00:44:37,180 --> 00:44:41,320 like two or three months. But it was incredibly easy to find. I 678 00:44:41,320 --> 00:44:43,840 literally just went through and put semicolon reboot in every 679 00:44:43,840 --> 00:44:48,920 field. There's also a hardware exploit, which is a little more 680 00:44:48,920 --> 00:44:51,820 difficult, which involves there's two vials on the board 681 00:44:51,820 --> 00:44:54,460 that are kind of hidden. You scrape away at them a little bit 682 00:44:54,460 --> 00:44:57,720 but if you solder a UART adapter to it, it will just drop you 683 00:44:57,720 --> 00:45:01,060 into a route shell, which they also didn't fix. Between those 684 00:45:01,060 --> 00:45:05,400 two, you can route a Boxee very simply in two different methods. 685 00:45:06,800 --> 00:45:09,040 Essentially, at the bottom we have this example, which is 686 00:45:09,040 --> 00:45:14,120 semicolon SH, mount label custom.SH, so you can run more 687 00:45:14,120 --> 00:45:23,820 than one script. We're going to make this just real quick because 688 00:45:23,820 --> 00:45:27,620 we're running low on time. Essentially, we go to menu. 689 00:45:30,780 --> 00:45:35,820 Showing that it's up to date. I'm going to go back to the 690 00:45:38,440 --> 00:45:45,040 server. Go to network. SMB client, which is our service, 691 00:45:45,140 --> 00:45:49,440 which is the settings menu. And I, in this example, I entered in 692 00:45:50,440 --> 00:45:53,280 semicolon reboot in the share password, which is a required 693 00:45:53,280 --> 00:45:56,140 field. I just felt like throwing it in there. But the actual 694 00:45:56,140 --> 00:46:03,320 affected field is share work group, which there's semicolon 695 00:46:03,320 --> 00:46:05,820 reboot, semicolon. And then I'm going to go back to the server. 696 00:46:21,280 --> 00:46:23,560 So the sound works exactly as its樂hter went for.莉 697 00:46:23,560 --> 00:46:24,100 S.F.: . 698 00:46:24,100 --> 00:46:24,640 When Sir para was first Todump the age when ever 699 00:46:24,640 --> 00:46:26,980 you got theke button on. So then you take a tick. Then they 700 00:46:26,980 --> 00:46:27,980 have to get it right if you click theFAQ show and go. But 701 00:46:27,980 --> 00:46:28,600 it's God gave me a perfect reason to boot buddy first. 702 00:46:35,820 --> 00:46:38,800 Unreleased is their Blu-ray player that's coming out we 703 00:46:38,800 --> 00:46:41,720 think in what October or something. We're not quite sure 704 00:46:41,720 --> 00:46:45,240 yet. They've got the Vizio that's on preorder. You guys can 705 00:46:45,240 --> 00:46:47,940 go get it if you want. It's only 99 bucks. We highly recommend 706 00:46:47,940 --> 00:46:52,720 that. It's pretty cheap. There's LG TV that we don't have. Too 707 00:46:52,720 --> 00:46:56,780 expensive for us. This slide just kind of goes over the 708 00:46:57,460 --> 00:47:02,920 basically the specs on all the new devices. This just tells you 709 00:47:02,920 --> 00:47:06,480 more about the Vizio specs and what's kind of out there. 710 00:47:07,140 --> 00:47:09,760 Supposed to be a Blu-ray player by them coming out in the 711 00:47:09,760 --> 00:47:16,420 future. This is kind of a brief overview of the LG TVs. Like I 712 00:47:16,420 --> 00:47:18,860 said, we don't have these. We don't have $1,200 lying around 713 00:47:18,860 --> 00:47:24,240 just to mess with the TV to break it. So Amir is going to 714 00:47:24,240 --> 00:47:28,980 talk about the timeline now. Actually, I'm going to skip the 715 00:47:28,980 --> 00:47:31,880 timeline because we're running low on time. So yeah, look at 716 00:47:31,880 --> 00:47:32,900 it. Everyone good? Cool. 717 00:47:32,920 --> 00:47:38,560 Good. Next one. Okay. So now we're going to talk about the 718 00:47:38,560 --> 00:47:42,060 Sony NSCGS7, which is the newest line of Google TV devices and 719 00:47:42,060 --> 00:47:45,040 the first released device. It was released this month. We have 720 00:47:45,040 --> 00:47:47,440 the tear down posted at GTV hacker and there's a CN2000 721 00:47:47,440 --> 00:47:51,100 adapter on it which is the same that's in the NSCGT1. You can 722 00:47:51,100 --> 00:47:54,780 buy it at Micro RC cars websites. We'll have a link posted 723 00:47:54,780 --> 00:47:57,260 on our website before you can get it. It costs about $2 and it 724 00:47:57,260 --> 00:48:02,900 can help you have a solder-free solution to root the NSCGT1 725 00:48:02,920 --> 00:48:08,140 but unfortunately not this device yet. Yeah. Timeline, we 726 00:48:08,140 --> 00:48:11,020 rooted it the next day. We were pretty proud of that because we 727 00:48:11,020 --> 00:48:13,440 got it from a few guys at Google IO. They went, they got the box. 728 00:48:14,240 --> 00:48:18,840 One guy met up with CJ here in Boston and sold it to him for 729 00:48:20,820 --> 00:48:23,460 $200, which was awesome. And another guy from roots wiki 730 00:48:23,460 --> 00:48:26,760 donated a box to myself. Unsigned kernel is still a work 731 00:48:26,760 --> 00:48:29,040 in progress and we're here so we didn't have a whole lot of 732 00:48:29,040 --> 00:48:31,520 time to try to finish that. Hopefully soon we'll have it. 733 00:48:31,580 --> 00:48:32,900 We're not going to release this one yet until we get it out of 734 00:48:32,920 --> 00:48:35,500 the market. We want the best for the community. Let's go to the 735 00:48:35,500 --> 00:48:47,520 demo. Essentially to not give away exactly what we did, this 736 00:48:47,520 --> 00:48:51,140 is just showing the fact that it is rooted and we have ADB set 737 00:48:51,140 --> 00:48:56,580 up right there. We dropped a sue binary on the system, gave it 738 00:48:56,580 --> 00:48:59,880 the correct permissions so we could just sue up and install 739 00:48:59,880 --> 00:49:02,900 super user.apk and this is what we have. We're going to show you 740 00:49:03,980 --> 00:49:11,060 the build number. Has his laptop open. He's going. Logs in 741 00:49:11,060 --> 00:49:13,880 through ADB. Types ID. So you can just see that we're still 742 00:49:13,880 --> 00:49:25,220 shell. You can see the super user APK just prompted the device 743 00:49:25,220 --> 00:49:28,920 to say that we had root and we're all done. So. 744 00:49:30,360 --> 00:49:30,840 . 745 00:49:32,420 --> 00:49:32,900 .