00:00:00.267 --> 00:00:04.037 So this is agenda we'll talk about- briefly about hypervisors 00:00:04.037 --> 00:00:07.374 (Inaudible) with protections against malicious software, 00:00:07.374 --> 00:00:12.346 malicious devices and so on or compromised devices. We'll talk 00:00:12.346 --> 00:00:16.350 about kind of this nasty thing that we call from (Inaudible) 00:00:16.350 --> 00:00:18.986 how hypervisors are good at protecting gates from 00:00:18.986 --> 00:00:22.356 (Inaudible). We'll also talk about how that we could convince 00:00:22.356 --> 00:00:25.492 (Inaudible) as well as the vulnerabilities that we use to 00:00:25.492 --> 00:00:28.328 install the firmware, cable ware to compromised hypervisor 00:00:28.328 --> 00:00:32.399 firmware within the virtual machines and we'll conclude with 00:00:32.399 --> 00:00:35.168 some of the mitigations available there; the tools that 00:00:35.168 --> 00:00:40.407 we'll be releasing soon, open source. So with that you know 00:00:40.407 --> 00:00:45.712 hypervisor based (Inaudible) it's good when it's done, when 00:00:45.712 --> 00:00:49.149 it's complete and with that I'm switching to Alex. He'll 00:00:49.149 --> 00:00:56.556 actually explain what it is. >> So usually hypervisor (Inaudible 00:00:56.556 --> 00:01:02.496 ) working with some- if we have malicious virtual machine it's 00:01:06.333 --> 00:01:14.174 infected by malware or compromised by something. Okay 00:01:14.174 --> 00:01:20.080 so good. If we have some compromised virtual machine by 00:01:20.080 --> 00:01:25.252 some malicious software or some exploit it's usually protected 00:01:25.252 --> 00:01:30.223 by hypervisor to (Inaudible) others virtual machines into 00:01:30.223 --> 00:01:36.229 cloud or some machine and also hypervisor protect from attacks 00:01:39.366 --> 00:01:47.140 from the malicious hardware. It's mean some (Inaudible) or 00:01:47.140 --> 00:01:54.247 something like option run something like that so... And 00:01:54.247 --> 00:01:58.986 usually hypervisor developers not directly thinking about 00:01:58.986 --> 00:02:04.591 firmware installation and we will show in our presentation 00:02:04.591 --> 00:02:10.597 how system firmware can effect a lot of different hypervisors. 00:02:13.600 --> 00:02:18.839 So-- and it's some description of different technologies based 00:02:18.839 --> 00:02:26.413 on hypervisor installation so usually the memory protects and 00:02:26.413 --> 00:02:33.653 the hypervisors dispatch access and is related direct hardware 00:02:33.653 --> 00:02:37.124 access for (Inaudible) audio permissions, bit maps and also 00:02:37.124 --> 00:02:43.130 memory protected by controllers from hypervisor level and it's 00:02:46.199 --> 00:02:52.205 software usually it's software based virtualization and also a 00:02:58.412 --> 00:03:04.351 lot of hypervisors have device level virtualization based on 00:03:13.326 --> 00:03:17.798 some interruption I think or IMMU for which are protected by 00:03:17.798 --> 00:03:23.070 G also for G- attacks but- so we will looking how from firmware 00:03:23.070 --> 00:03:26.339 it's looks indifferent-- different region. So it's a 00:03:26.339 --> 00:03:29.242 little bit description about how this technology for 00:03:29.242 --> 00:03:35.248 virtualization works. So usually all configuration about 00:03:37.250 --> 00:03:41.755 hypervisor, about virtual machine start in VM- control 00:03:41.755 --> 00:03:48.128 structure and VMCS and it's control all interrupt execution 00:03:48.128 --> 00:03:54.134 or instruction exceptions and also we have MSR bit maps which 00:03:58.605 --> 00:04:04.544 is a way to direct access to read write MSR's from guests or 00:04:06.613 --> 00:04:12.619 (Inaudible) which usually software based virtualization 00:04:15.222 --> 00:04:22.095 and IO bit maps which controlling direct IO access to 00:04:22.095 --> 00:04:28.101 the devices and the software is interact and we will show on the 00:04:32.572 --> 00:04:37.978 next slides how we can apply SMI handlers attack against 00:04:37.978 --> 00:04:42.849 hypervisors or compromises this protection and we will show how 00:04:42.849 --> 00:04:47.654 we can compromise (Inaudible) protection by script attack 00:04:47.654 --> 00:04:53.660 director. It's not new exploit but it's already show on 00:04:56.029 --> 00:05:01.968 communication in the last year-- in the last year by Corey and 00:05:04.638 --> 00:05:11.878 Jeff from (Inaudible) So- but we found some interesting way to 00:05:11.878 --> 00:05:17.884 compromise hypervisors by (Inaudible) it's not showing 00:05:20.687 --> 00:05:24.257 before just on last like that and system level virtualization 00:05:24.257 --> 00:05:26.626 is really important and if you control the system firmware you 00:05:26.626 --> 00:05:30.564 can access to direct to the physical memory and control 00:05:30.564 --> 00:05:34.634 everything in the system. It's not mean if you control the 00:05:34.634 --> 00:05:42.375 firmware on some device, it's mean if you control the bios you 00:05:42.375 --> 00:05:50.116 control the system and we will show how it's possibly to attack 00:05:50.116 --> 00:05:56.122 the mem with some specific root kit. You will continue with root 00:05:59.292 --> 00:06:05.232 kit. >> Yeah if I won't trip over this cable. So okay one of 00:06:09.669 --> 00:06:13.540 the first things before we go in to try to attack hypervisor from 00:06:13.540 --> 00:06:16.142 within the virtual machines using firmware, why would anyone 00:06:16.142 --> 00:06:20.180 do that? Again well one of the impacts is will it will slowly 00:06:20.180 --> 00:06:24.651 creep into the firmware and get persistence get, well what we 00:06:24.651 --> 00:06:28.588 think or what you might think after the presentation full 00:06:28.588 --> 00:06:32.058 control over the hypervisors and all the virtual machines but you 00:06:32.058 --> 00:06:35.161 know before we started that we kind of found that picture and 00:06:35.161 --> 00:06:38.999 what do you think were the kitties? Who's the kitty and 00:06:38.999 --> 00:06:44.871 who's the lion? No guess? Okay our guess was the kitty is the 00:06:44.871 --> 00:06:48.074 root kit and the hypervisor. So those kind of things that 00:06:48.074 --> 00:06:53.213 monstrous complicity and protecting everything from- 00:06:53.213 --> 00:06:57.751 including those kind of things like root kits. So let's hear 00:06:57.751 --> 00:07:02.355 how that goes. So what is firmware root kit? And really 00:07:02.355 --> 00:07:06.359 kind of a high level picture is just something effecting the 00:07:06.359 --> 00:07:11.164 system firmware either bios or you apply firmware and as my 00:07:11.164 --> 00:07:14.334 handler which is a runtime portion of the bios executing in 00:07:14.334 --> 00:07:18.004 parallel with the hypervisor OS or it could be something else 00:07:18.004 --> 00:07:21.374 like I don't know core boot or some other kind of a software 00:07:21.374 --> 00:07:27.113 extension of the firmware. So when -- and you can see the 00:07:27.113 --> 00:07:31.518 error on the left of the slide via the privileges of the 00:07:31.518 --> 00:07:37.123 exploit compromising each portion on the picture increases 00:07:37.123 --> 00:07:40.593 with going down the stack and it's pretty kind of a familiarly 00:07:40.593 --> 00:07:43.196 concept if you compromise something within the VM- you 00:07:43.196 --> 00:07:45.765 cannot compromise all the VM- short hypervising. If you 00:07:45.765 --> 00:07:49.102 compromise hypervising you can control the VM- but you cannot 00:07:49.102 --> 00:07:52.205 really compromise firmware and so on. But if you can compromise 00:07:52.205 --> 00:07:55.775 firmware you control hypervisor and everything in the software. 00:07:55.775 --> 00:08:00.113 So that's kind of a neat idea, this slide. However this is not 00:08:00.113 --> 00:08:03.550 how we've actually implemented that because the root kit here, 00:08:03.550 --> 00:08:08.388 one of the goals of the root kit is to stop the persistence that 00:08:08.388 --> 00:08:13.193 no body gets the -- out of the firmware and no body can detect 00:08:13.193 --> 00:08:18.264 it so we took a different strategy rather than you know 00:08:18.264 --> 00:08:21.234 root kit compromising hypervisor you know writing as code and so 00:08:21.234 --> 00:08:23.236 on and say it might be detectable and it's not that 00:08:23.236 --> 00:08:27.240 kind of a - it's more difficult because we don't know 00:08:27.240 --> 00:08:31.678 hypervisors, we don't know how to modify them right? So what we 00:08:31.678 --> 00:08:35.248 did instead assume there's an attacker VM-. They VM- the 00:08:35.248 --> 00:08:38.685 control by the attacker completely and somehow on that 00:08:38.685 --> 00:08:41.821 system, and we'll explain how but somehow on that system root 00:08:41.821 --> 00:08:45.158 kit got installed into the firmware. So instead of actually 00:08:45.158 --> 00:08:47.594 kind of overwriting hypervisor or installing your own 00:08:47.594 --> 00:08:54.167 hypervisor or anything like that we implemented the back door. We 00:08:54.167 --> 00:09:00.106 did a very small modification to the data structures. No 00:09:00.106 --> 00:09:03.209 modifications to the code. I'll explain how when modified data 00:09:03.209 --> 00:09:06.646 structures but kind of the ultimate is ultimately with-- we 00:09:06.646 --> 00:09:10.717 can implement multiple kind of strategies for the root kit and 00:09:10.717 --> 00:09:15.055 in fact one of the strategies is one bit modification. And that 00:09:15.055 --> 00:09:18.258 one bit modification basically gives attacker VM- full control 00:09:18.258 --> 00:09:21.094 over everything going on in the system including the hypervisor. 00:09:21.094 --> 00:09:25.665 So we'll have a demo, the demo uses a slightly different 00:09:25.665 --> 00:09:31.271 approach. So I'll explain in the next slide. So through the back 00:09:31.271 --> 00:09:35.241 door we don't modify anything, any code. We install that back 00:09:35.241 --> 00:09:38.578 door through a data structure and then that back door provides 00:09:38.578 --> 00:09:41.981 full access to one specific particular VM- to all other VMs 00:09:41.981 --> 00:09:47.086 including to the hypervisor itself. So how that particular 00:09:47.086 --> 00:09:52.325 backdoor works, when root kit is on the system every time the 00:09:52.325 --> 00:09:56.229 system boots it starts as part of the firmware, in fact we've 00:09:56.229 --> 00:09:59.265 been using a kind of a runtime part of the firmware which 00:09:59.265 --> 00:10:03.970 periodic with kinds of memory so the root kit scans memory, finds 00:10:03.970 --> 00:10:07.607 virtual kind of a virtual control blocks or virtual 00:10:07.607 --> 00:10:12.212 control structures for the virtual machines you know finds 00:10:12.212 --> 00:10:17.217 the one that belongs to your attacker VM- and then from that 00:10:17.217 --> 00:10:21.287 point on it finds the kind of the pointer to the hardware 00:10:21.287 --> 00:10:24.791 system cables that Alex talked about, the base tables that 00:10:24.791 --> 00:10:26.993 actually translate the guests physical addresses, the host 00:10:26.993 --> 00:10:31.431 physical addresses and modifies those base tables by just adding 00:10:31.431 --> 00:10:34.734 a few entries and those entries you can see them out over there. 00:10:34.734 --> 00:10:39.639 So they basically map out you know-- they map all of the DRM- 00:10:39.639 --> 00:10:41.641 starting from the arrow to the physical address, starting from 00:10:41.641 --> 00:10:46.312 256 gigabytes. So at 256 gigabytes boundary our attacker 00:10:46.312 --> 00:10:49.449 VM- will have full access to the DRM- to all of the other VMs, to 00:10:49.449 --> 00:10:51.451 the VMM himself, and everything else and basically that's- I had 00:10:51.451 --> 00:10:53.453 actually balloons describing what I just described, right. So 00:10:53.453 --> 00:10:55.455 the root kit added a page table-- page table entries to 00:10:55.455 --> 00:10:57.457 the page table and now the attacker VM- has access to all 00:10:57.457 --> 00:11:03.530 of the memory. So before we show you the demo how would one 00:11:03.530 --> 00:11:09.536 install the root kit in the firmware? First method calls 00:11:23.783 --> 00:11:29.856 word guard attack is basically when someone sticks something to 00:11:29.856 --> 00:11:35.028 your laptop when you leave it. Like for example this spy flash 00:11:35.028 --> 00:11:37.263 firmware and physically overrides the firmware on the 00:11:37.263 --> 00:11:41.768 spy flash. That's kind of nice but you know you can sometimes 00:11:41.768 --> 00:11:46.973 see that somebody broke your laptop apart. Sometimes you 00:11:46.973 --> 00:11:51.878 cannot. But you know the easiest mechanism would be if the 00:11:51.878 --> 00:11:54.781 firmware is not properly protected-- protecting itself on 00:11:54.781 --> 00:11:58.585 the spy flash on the RAM then you know booting into a 00:11:58.585 --> 00:12:03.323 malicious USB and basically running a code that will reflash 00:12:03.323 --> 00:12:08.194 your firmware that's an easier mechanism. You can use other 00:12:08.194 --> 00:12:11.965 ways with a physical access to infect the system in fact Tramle 00:12:11.965 --> 00:12:16.069 and Zena showed yesterday how to use you know the add on adapters 00:12:16.069 --> 00:12:22.075 to infect the firmware. So there are other mechanisms with the 00:12:27.013 --> 00:12:31.584 physical but firmware could be installed using software 00:12:31.584 --> 00:12:36.022 mechanisms right? If for example if the firmware is not added and 00:12:36.022 --> 00:12:39.359 protecting itself in flash memory you don't need physical 00:12:39.359 --> 00:12:44.697 at all you have to have kind of an attack, a software attack 00:12:44.697 --> 00:12:50.903 that can flash whatever it wants on the spyflash memory. It could 00:12:50.903 --> 00:12:54.273 be done from privileged guests for example ground zero or a 00:12:54.273 --> 00:12:58.511 root petition because all of them you know provide some 00:12:58.511 --> 00:13:00.446 direct access to the system firmware. And you know for that 00:13:00.446 --> 00:13:06.452 you would need either a direct to the privileged guest or you 00:13:09.889 --> 00:13:12.358 need privileged escalation from a normal guest to the privileged 00:13:12.358 --> 00:13:14.827 guest. It could from the host OS- and the hosted 00:13:14.827 --> 00:13:16.829 virtualization scenario you could you know--- one could 00:13:16.829 --> 00:13:19.299 install a root kit before the hypervisor is there or in 00:13:19.299 --> 00:13:23.069 parallel with a hypervisor or you know hypothetically could be 00:13:23.069 --> 00:13:26.906 done from a normal guest if the VMM provides direct access to 00:13:26.906 --> 00:13:30.543 one of the system firmware cases to the normal guest. Right? So 00:13:30.543 --> 00:13:34.881 there are software mechanisms to install a root kit. So and now 00:13:34.881 --> 00:13:38.518 let me just show you the demo of the root kit before we go into 00:13:38.518 --> 00:13:44.524 the explanation part. So we will -- we will use hyper-v. Can you 00:13:51.931 --> 00:13:55.802 see that? Okay. We will use hyper-v but this root kit is the 00:13:55.802 --> 00:13:59.305 diagnostic. It won't work against any VMI. So it's broken 00:13:59.305 --> 00:14:01.974 in two parts- the demo is broken in two parts. This is the first 00:14:01.974 --> 00:14:04.644 part where we install the root kit and we're using the fact 00:14:04.644 --> 00:14:07.480 that this system particularly doesn't properly protect it's 00:14:07.480 --> 00:14:09.515 own firmware so we're just bypassing the firmware 00:14:09.515 --> 00:14:12.151 protection and installing something on a flash. And this 00:14:12.151 --> 00:14:17.290 could be done like months before the rebooting the server can be 00:14:17.290 --> 00:14:19.892 done like I showed with the physical access or with a spot 00:14:19.892 --> 00:14:23.763 program or something like that. So it was the first part. Now 00:14:23.763 --> 00:14:29.769 we've rebooted that server. So we have three virtual machines 00:14:38.811 --> 00:14:43.950 here. Two of these are victim machines. One runs (Inaudible) 00:14:43.950 --> 00:14:46.953 the other one runs Windows and we have a third machine which is 00:14:46.953 --> 00:14:52.291 a tagger virtual machine, it runs Windows. So first we will 00:14:52.291 --> 00:14:59.398 open a virtual machine. It has a patch installed in it and so 00:14:59.398 --> 00:15:04.170 what we'll do is we'll actually generate a probably private 00:15:04.170 --> 00:15:10.743 keeper including the public surrogate for patching and 00:15:10.743 --> 00:15:17.383 that's what I will do in a second and bare with me because 00:15:17.383 --> 00:15:22.688 I was made to type this whole open in SSL command line you 00:15:22.688 --> 00:15:28.995 know not from history but like literally type it, three lines. 00:15:28.995 --> 00:15:33.933 Okay so we're generating X509 certificates and private key; I 00:15:33.933 --> 00:15:36.569 say private key for our patching. So the private part 00:15:36.569 --> 00:15:42.575 you can say ours say 2 --> 048 bits. So the private will be dumped 00:15:52.785 --> 00:15:58.791 into the SSL coil.p file and the public part will get written to 00:16:04.163 --> 00:16:10.036 an SSL server.Pdm. So we're issuing a certificate. We're 00:16:10.036 --> 00:16:14.373 requesting to issue a certificate for victim core 00:16:14.373 --> 00:16:20.379 registered in Las Vegas, Nevada with no emails. Now I'll just 00:16:27.854 --> 00:16:31.991 bring up the config file and you can see that those private and 00:16:31.991 --> 00:16:37.997 public keys are you know are used. Now let's restart. So the 00:16:42.735 --> 00:16:48.741 server is up, it's using those keys and its enabled to the web 00:16:55.915 --> 00:16:59.585 server. Now I'll just bring the private portion of the R-state 00:16:59.585 --> 00:17:05.525 key on the display. So this is all that the victim core did on 00:17:07.693 --> 00:17:12.531 that virtual machine. Now we'll open a virtual machine with 00:17:12.531 --> 00:17:18.537 windows and the only thing we'll do there, we have kind of a 00:17:26.178 --> 00:17:31.717 confidential documents over there on that virtual machine; 00:17:31.717 --> 00:17:35.621 two confidential documents. One is annual earnings of some 00:17:35.621 --> 00:17:39.892 corporation which is apparently confidential for I don't know 00:17:39.892 --> 00:17:46.532 what reason. The second document is product schedule of the same 00:17:46.532 --> 00:17:51.971 corporation and it's super top secret; a little bit more 00:17:51.971 --> 00:17:54.240 confidential. So the only thing we did is just view those 00:17:54.240 --> 00:17:59.779 documents and now we'll go to the attackers VM running 00:17:59.779 --> 00:18:04.817 windows. Remember this is to just couple minutes ago that 00:18:04.817 --> 00:18:07.853 system got root kit installed in the firmware. So root kit is now 00:18:07.853 --> 00:18:14.060 working, running, doing its thing, opening the backdoor to 00:18:14.060 --> 00:18:20.066 the attacker VM. So an attacker VM I'll tell you a secret now it 00:18:25.471 --> 00:18:29.909 has full access to all the memory so what we do is we just 00:18:29.909 --> 00:18:32.878 run a script that dumps and searches for you know some 00:18:32.878 --> 00:18:36.182 secret artifacts in that memory and we're searching for private 00:18:36.182 --> 00:18:43.789 keys, kind of documents, rtf documents and so on. So give it 00:18:43.789 --> 00:18:49.395 a minute. It found rtf documents in memory somewhere save it to 00:18:49.395 --> 00:18:55.401 your file. Found a very safe private key, ssh key, not ours. 00:19:05.244 --> 00:19:08.447 Some encrypted private keys and so on. It actually finds a whole 00:19:08.447 --> 00:19:13.653 bunch of stuff not even the ones that we just generated. So the 00:19:13.653 --> 00:19:19.725 script is done. It dumped the artifacts into folder now let's 00:19:19.725 --> 00:19:26.966 search for confidential. Files that have confidential. And here 00:19:26.966 --> 00:19:34.040 we go. So we've found blank document? We've found annual 00:19:34.040 --> 00:19:37.076 earnings confidential documents that somebody opened in a 00:19:37.076 --> 00:19:43.082 completely different VM-. [Applause] Thank you. You have 00:19:46.919 --> 00:19:51.624 to see at least until top secret. So we're now looking for 00:19:51.624 --> 00:19:55.861 super top secret and we found that super top secret document 00:19:55.861 --> 00:20:01.867 as well. And so finally we're looking for a private key log. 00:20:07.907 --> 00:20:13.412 There's quite a few private key blogs extracted from memory and 00:20:13.412 --> 00:20:19.418 one of them is basically our c-private key. And just to 00:20:31.530 --> 00:20:34.633 compare those you could compare those offline and the video will 00:20:34.633 --> 00:20:40.773 be available offline. So those will be two keys. So bottom line 00:20:40.773 --> 00:20:45.444 we had a completely persistent root kit completely stealthy and 00:20:45.444 --> 00:20:49.315 no one within the virtual machines including the 00:20:49.315 --> 00:20:54.153 administrative on the virtual machines is able to find it 00:20:54.153 --> 00:20:58.858 there. And the root kit is VM- diagnostics so if you install 00:20:58.858 --> 00:21:03.963 any VM- it will get the same results like even- it won't' 00:21:03.963 --> 00:21:07.099 even notice which VMM is installed because we're not even 00:21:07.099 --> 00:21:13.305 using any of the artifacts of any specific VMM. So now we're 00:21:13.305 --> 00:21:19.311 switching -- I'm switching to full screen. Bear with me a 00:21:21.347 --> 00:21:27.353 second. Yeah okay. So yeah, so we flash the root kit directly 00:21:35.227 --> 00:21:41.433 into the firmware image from within the position and this is 00:21:41.433 --> 00:21:43.969 because the system didn't properly protect the firmware. 00:21:43.969 --> 00:21:48.040 Before the system started protected-- doing those basic 00:21:48.040 --> 00:21:51.844 protections like when you enable the protection in the firmware 00:21:51.844 --> 00:21:55.414 or the spyflash. You can tell with that specific module 00:21:55.414 --> 00:22:00.386 common.Bias. (Inaudible) by the way you have chip sets on all 00:22:00.386 --> 00:22:04.890 the defcon cds thanks to the defcon team especially for that. 00:22:04.890 --> 00:22:08.694 So you can you know grab chipsack out of there and tell 00:22:08.694 --> 00:22:14.900 us if your system is refutable like that but what would the 00:22:14.900 --> 00:22:17.503 attacker do if the systems didn't properly protect their 00:22:17.503 --> 00:22:22.575 biases and you applied firmware? We'll we've explained a bunch of 00:22:22.575 --> 00:22:27.012 vulnerabilities in the previous presentation and recon that 00:22:27.012 --> 00:22:30.916 could be used for these purposes. So you could install a 00:22:30.916 --> 00:22:36.355 root kit using either those vulnerabilities as well and 00:22:36.355 --> 00:22:40.392 we'll discuss two of those but before we'll go to discuss two 00:22:40.392 --> 00:22:43.495 of those vulnerabilities, so a couple of words about what this 00:22:43.495 --> 00:22:48.467 root kit could do. In fact, it's you know the root kit has access 00:22:48.467 --> 00:22:51.337 to, it provides access to the attacker VM- tool to the memory 00:22:51.337 --> 00:22:54.673 and from that memory that attacker VM- can extract the 00:22:54.673 --> 00:22:57.876 structure pinch tables or page tables can instruct host page 00:22:57.876 --> 00:23:02.848 tables for the hypervisor. Guest page tables for each of the 00:23:02.848 --> 00:23:06.685 guests. It can extract all of the page tables for the units, 00:23:06.685 --> 00:23:13.392 for all the units for all the hardware. It can extract the 00:23:13.392 --> 00:23:16.428 memory map including VM- exit handler as well as it can 00:23:16.428 --> 00:23:20.065 extract full configuration of all the real hardware devices 00:23:20.065 --> 00:23:24.870 including PCI configurations. So this is one example. So we're 00:23:24.870 --> 00:23:29.541 basically extracting from just memory. We're extracting all the 00:23:29.541 --> 00:23:33.912 extended page tables which gives us all the memory map, the 00:23:33.912 --> 00:23:37.950 translation from the guest physical address to the host 00:23:37.950 --> 00:23:40.352 physical addresses. Now with that let's go to the section 00:23:40.352 --> 00:23:45.624 that explains how we would-- how the attacker would exploit 00:23:45.624 --> 00:23:48.560 hypervisors from within the virtual machines and all of 00:23:48.560 --> 00:23:55.467 those attacks that we'll describe here they are done from 00:23:55.467 --> 00:24:02.141 the privileged administrative position. So you know-- the kind 00:24:02.141 --> 00:24:04.877 of full version of the slides that are published right now it 00:24:04.877 --> 00:24:09.248 has a little bit more details including vulnerabilities from 00:24:09.248 --> 00:24:14.887 within the normal guest and so on. We've got to transition to 00:24:14.887 --> 00:24:20.893 Andrew, he'll walk you through the text. >>Okay that's better. 00:24:31.637 --> 00:24:36.508 So what you can do if you find that spyware is properly 00:24:36.508 --> 00:24:42.715 protected. So he can try-- there is a small piece of (Inaudible) 00:24:42.715 --> 00:24:46.518 that handles system management interrupts and so is a micaliber 00:24:46.518 --> 00:24:52.224 and so that sets the parameters in general purpose registers. 00:24:52.224 --> 00:24:58.230 They can be-- my handler reads and writes data uses pointers. 00:25:00.599 --> 00:25:06.605 So-- and if the pointer is not checked it can write or read 00:25:10.576 --> 00:25:14.780 from the server itself. So I think I can generate a 00:25:14.780 --> 00:25:20.285 summarized pointer into (Inaudible) so my handler will 00:25:20.285 --> 00:25:26.291 do write read. So that is privileged so if he or she can 00:25:31.730 --> 00:25:37.736 intercept from the zero it will go to a semi-handler which will 00:25:47.379 --> 00:25:53.385 rewrite to hypervisor memory like this. It can modify the 00:25:56.688 --> 00:26:01.627 codes, data like we mentioned. It can modify page table 00:26:01.627 --> 00:26:07.633 structures, open a back door or drop a piece of codes to 00:26:13.806 --> 00:26:19.812 override the spy flash for us. We have a demo. Its a hyper read 00:26:25.217 --> 00:26:31.223 as well. This we run the exploit from the repetition. >>Right now 00:26:53.545 --> 00:26:56.048 the exploit is compromising as my handler promo than the 00:26:56.048 --> 00:27:01.987 partition. >> Yup. >>We'll launch the second part of the 00:27:11.964 --> 00:27:14.099 exploit... >> I'm trying to find the compromised structures in 00:27:14.099 --> 00:27:16.101 hypervised memory. So we'll run the virtual analyzer and we'll 00:27:16.101 --> 00:27:18.103 find this-- control the three. So you can see it found three 00:27:18.103 --> 00:27:20.105 virtual machine to partition itself. So we have complete 00:27:20.105 --> 00:27:22.107 access to the hypervisor memory so we can do whatever we want 00:27:22.107 --> 00:27:28.113 with it. So how is this possible? The problem is that 00:27:30.716 --> 00:27:36.722 remember figures-- IO bit map, it allows a privileged guest to 00:28:02.814 --> 00:28:07.853 generate-- to access several ports and one of the open port 00:28:07.853 --> 00:28:12.224 is the port which we can use to generate the system management 00:28:12.224 --> 00:28:18.230 interrupt as you can see the IO map ports is the VM exit is red. 00:28:20.999 --> 00:28:24.036 So they exist only to this port. You would code by VMM or the 00:28:24.036 --> 00:28:30.042 access to other ports will not be seen by VMM. So the three can 00:28:38.550 --> 00:28:42.988 generate the management interrupt the hypervisor will 00:28:42.988 --> 00:28:48.994 not see it. So this firmware right, so the problem is that 00:28:51.697 --> 00:28:58.670 hypervisor doesn't change the point of the supply to-- oh, 00:28:58.670 --> 00:29:04.610 that doesn't change the point but what is semi-handler is 00:29:07.879 --> 00:29:12.651 implement correctly and check that the pointer is not in SMM 00:29:12.651 --> 00:29:18.657 because it can guess. It can -- he has no idea of the virtual-- 00:29:27.399 --> 00:29:34.806 of the hypervisor memory partition. There's hypervisor 00:29:34.806 --> 00:29:41.947 memory and there's virtual machine memory so that I can 00:29:41.947 --> 00:29:49.554 steal supply pointer in physical memory and this memory can be 00:29:49.554 --> 00:29:55.560 hypervisor memory. And SMI will steal-- will write data to this 00:29:58.196 --> 00:30:04.202 memory because it's outside of SMM so from the point of view 00:30:21.887 --> 00:30:29.294 from the handler its a completely legal operation. So 00:30:29.294 --> 00:30:32.397 this will be the view like this. SMI color view will compromise 00:30:32.397 --> 00:30:35.367 the hypervisor. SMI writes data or coding VMM and opens a back 00:30:35.367 --> 00:30:41.373 door. >> So this is Andrew. So basically that was the -- one of 00:30:48.814 --> 00:30:54.519 the attacks applicable to hyper-v because of the fact that 00:30:54.519 --> 00:30:58.890 root partition has access to the whole ports including the SMI 00:30:58.890 --> 00:31:02.561 port which is V2, so it could trigger vulnerability in the SMI 00:31:02.561 --> 00:31:07.065 handler and this way you know propagate the attack onto the 00:31:07.065 --> 00:31:10.702 hypervisor. Next we'll show a completely different issue which 00:31:10.702 --> 00:31:17.542 was discovered by multiple folks, teams including our team 00:31:17.542 --> 00:31:21.980 as well as (Inaudible) from Bromium and researchers from 00:31:21.980 --> 00:31:27.986 Legmacorp. This vulnerability is known as encryptical 00:31:30.355 --> 00:31:35.761 vulnerability and Treml and Zeno used it in thunder strike two 00:31:35.761 --> 00:31:39.831 attack as well on maximum yesterday. So we'll use that 00:31:39.831 --> 00:31:44.169 attack. So the first idea to explain a little bit of the 00:31:44.169 --> 00:31:50.175 background about what s3 is, you know most of the systems 00:31:52.210 --> 00:31:54.813 especially they support the sleep state or suspended realm 00:31:54.813 --> 00:31:59.885 where you put the system into sleep and it's resumed and that 00:31:59.885 --> 00:32:03.188 happens much faster than you put the system and that's the 00:32:03.188 --> 00:32:07.125 purpose. The contents in the memory are preserved when you're 00:32:07.125 --> 00:32:10.829 resuming the system from sleep and so what happens with the 00:32:10.829 --> 00:32:14.699 firmware? When firmware normally boots it executes a whole bunch 00:32:14.699 --> 00:32:18.503 of code if it's a unified specific firmware or base 00:32:18.503 --> 00:32:22.073 firmware. Then it's executing hundreds of so called firmware 00:32:22.073 --> 00:32:26.044 drivers. Each of them configures something within the hardware, 00:32:26.044 --> 00:32:30.615 some device or so like writing certain registers. So it's a lot 00:32:30.615 --> 00:32:35.554 of time and we need to you know conserve that time. Thank you. 00:32:35.554 --> 00:32:40.859 So the way it's done, these drivers record their actions in 00:32:40.859 --> 00:32:44.830 addition to now configuring hardware they record their 00:32:44.830 --> 00:32:49.801 actions into a structure called resumable script table and this 00:32:49.801 --> 00:32:55.207 structure is just in the memory. Well, on many systems. So when 00:32:55.207 --> 00:32:58.076 you put the system into sleep and resume from sleep the 00:32:58.076 --> 00:33:02.881 firmware doesn't execute all of that code, all of those drivers. 00:33:02.881 --> 00:33:06.585 In fact what it does, it loads a kind of the executable module, 00:33:06.585 --> 00:33:09.087 the firmware module that interprets the script table 00:33:09.087 --> 00:33:14.192 which reads those actions that have been previously recorded on 00:33:14.192 --> 00:33:18.363 a normal and interprets them and this way restores all of the 00:33:18.363 --> 00:33:21.066 hardware configuration on the system. That saves you a whole 00:33:21.066 --> 00:33:25.503 bunch of time. Now that is why we can resume like (Inaudible) 00:33:25.503 --> 00:33:31.176 and so on but a few words about what table is. It's just a 00:33:31.176 --> 00:33:34.913 sequence of drop codes. Each code can write specific register 00:33:34.913 --> 00:33:38.416 either PCI configuration or memory map, bio-register or 00:33:38.416 --> 00:33:42.554 memory location or IO port. So this particular screen shot it 00:33:42.554 --> 00:33:47.025 shows you that the up code is writing to memory. In fact 00:33:47.025 --> 00:33:51.897 judging this I'd say that's a kind of a memory mapped IO or 00:33:51.897 --> 00:33:54.432 memory mapped configuration register but there are other up 00:33:54.432 --> 00:33:57.802 codes because sometimes you get-- it's not sufficient to 00:33:57.802 --> 00:34:00.372 just write to the register. Sometimes firmware needs to do a 00:34:00.372 --> 00:34:03.608 little bit more, you know more complex action and for those who 00:34:03.608 --> 00:34:06.945 can attach the things there is a dispatch code that basically 00:34:06.945 --> 00:34:13.351 just invokes our code. So what could go wrong? First of all the 00:34:13.351 --> 00:34:17.722 vulnerabilities you know described in great details by -- 00:34:17.722 --> 00:34:21.893 in the white paper we referenced as well in the publications by 00:34:21.893 --> 00:34:25.463 Corey and Refall. So first how that applies to attacking 00:34:25.463 --> 00:34:31.903 hypervisors. So we will attack them from ground zero because 00:34:31.903 --> 00:34:36.875 then does not prevent ground zero access to the previous root 00:34:36.875 --> 00:34:42.314 table because VMM is not on the crypt table that's a firmware 00:34:42.314 --> 00:34:46.851 thing right? So the- assume there's an exploit within it. 00:34:46.851 --> 00:34:51.356 This exploit just goes and modifies the contents of memory. 00:34:51.356 --> 00:34:55.427 It modifies that previous crypt table, installs additional log 00:34:55.427 --> 00:35:00.298 codes, modifies existing up codes or something like that and 00:35:00.298 --> 00:35:03.535 you know then puts system into sleep and when system resumes 00:35:03.535 --> 00:35:09.307 from sleep, the firmware interprets the completely bogus 00:35:09.307 --> 00:35:14.112 attacker this crypt table including you know executing 00:35:14.112 --> 00:35:18.216 your code. This is done with a firmware cryptologist. There are 00:35:18.216 --> 00:35:23.688 four that the code can modify hypervisor as well. So basically 00:35:23.688 --> 00:35:27.759 you got them compromised here. So I'll show you the demo on 00:35:27.759 --> 00:35:33.765 exploiting them from ground zero using this vulnerability. You 00:35:39.037 --> 00:35:45.043 can see we're in ground zero using them. And we're going to 00:35:47.345 --> 00:35:54.819 guest, to virtual machine. So I'm launching a command that 00:35:54.819 --> 00:35:58.390 just you know searches memory for hypervisor structures. 00:35:58.390 --> 00:36:03.595 Structures, you saw the NCS, extended page tables and so on 00:36:03.595 --> 00:36:07.832 basically structures hypervisor wants to protect. They guarantee 00:36:07.832 --> 00:36:12.037 hypervisor protection. And the script couldn't find anything 00:36:12.037 --> 00:36:15.907 because you know you generally not as a guest have access to 00:36:15.907 --> 00:36:18.676 those critical structures including privileged guests like 00:36:18.676 --> 00:36:23.848 ground zero root petition. They cannot. So to kind of a solve 00:36:23.848 --> 00:36:27.886 that problem we're launching an exploit. We're launching an 00:36:27.886 --> 00:36:30.522 exploit by modifying the previous script table in memory 00:36:30.522 --> 00:36:34.993 which we have access to. We installed some up codes into 00:36:34.993 --> 00:36:38.329 that previous script table, then we're putting system into sleep 00:36:38.329 --> 00:36:42.233 with RTC wake and it will take us a couple of seconds to wake 00:36:42.233 --> 00:36:48.239 from sleep. So now we're awake. System is up and running again 00:36:53.511 --> 00:36:57.015 and we're launching the same script that looks for those 00:36:57.015 --> 00:37:00.218 critical structures of the hypervisor; the NCS structures 00:37:00.218 --> 00:37:08.026 and the page tables. And we found one. So basically we have 00:37:08.026 --> 00:37:13.565 full access to the structures controlling virtual machine for 00:37:13.565 --> 00:37:20.205 that guest. So okay that does look a little bit familiar for 00:37:20.205 --> 00:37:24.342 those of you who followed ITL- research a few years ago. They 00:37:24.342 --> 00:37:27.545 did explain that hey it's possible to pull the hypervisor 00:37:27.545 --> 00:37:31.082 through the bios right? Or through the MVR and pretty much 00:37:31.082 --> 00:37:35.220 those attacks give up to the point that yes you can 00:37:35.220 --> 00:37:38.123 compromise hypervisors completely using those 00:37:38.123 --> 00:37:42.427 vulnerabilities in the bios or in the firmware. But those 00:37:42.427 --> 00:37:44.429 vulnerabilities were from privileged guests like root 00:37:44.429 --> 00:37:48.299 partition and (Inaudible) which sort of limits the impacts in 00:37:48.299 --> 00:37:51.402 the minds of a lot of people and minus the privilege escalations 00:37:51.402 --> 00:37:56.608 from the normal guest to the privileged guest or directly 00:37:56.608 --> 00:38:00.445 exploiting into the root partition. So what about -- it 00:38:00.445 --> 00:38:05.950 keeps us that strictly want to separate guests from root 00:38:05.950 --> 00:38:10.588 partition and we heard a presentation by folks from 00:38:10.588 --> 00:38:14.259 Microsoft on the new virtualization security based 00:38:14.259 --> 00:38:18.196 model and the system which is basically that model. So right 00:38:18.196 --> 00:38:20.532 now we are working with Microsoft to make sure that 00:38:20.532 --> 00:38:27.505 those are not applicable to the Windows 10. So tools and 00:38:27.505 --> 00:38:31.709 mitigations that we have. First of all the first things first-- 00:38:31.709 --> 00:38:35.346 if you have vulnerabilities in the firmware you are in trouble. 00:38:35.346 --> 00:38:38.583 You can have thunder strike, you can have completely persistent 00:38:38.583 --> 00:38:42.253 stuff and it can compromise, it can attack full encryption based 00:38:42.253 --> 00:38:49.761 CPM. It can attack seeker boot. As we saw you can completely 00:38:49.761 --> 00:38:54.532 control the hypervisors and every secret. So we need to fix 00:38:54.532 --> 00:38:58.703 those vulnerabilities of course and there are tests in the open 00:38:58.703 --> 00:39:04.309 source. It can run and test for both issues we've explained. If 00:39:04.309 --> 00:39:07.645 your systems are vulnerable as well as you can test if the 00:39:07.645 --> 00:39:11.416 firmware is what protected on the spy flash but you can-- we 00:39:11.416 --> 00:39:14.085 will also need to test hypervisors and especially all 00:39:14.085 --> 00:39:17.188 of those hardware and firmware pieces that the hypervisor is 00:39:17.188 --> 00:39:20.091 exposed to the VMs. We'll be releasing the open source 00:39:20.091 --> 00:39:22.994 modules to the chipset that pretty much tells every hardware 00:39:22.994 --> 00:39:27.932 interface, I'm sorry emulation, I'm poor at emulation CPID 00:39:27.932 --> 00:39:32.570 emulation, MMOI emulation, and so on as well as we'll provide, 00:39:32.570 --> 00:39:37.175 we'll release some of the additional functionality that 00:39:37.175 --> 00:39:42.714 just allows you to see how VMMs are built and debugged and so 00:39:42.714 --> 00:39:47.051 on. So-- but how do we deal with you know the firmware attacks 00:39:47.051 --> 00:39:51.256 and the hypervisors? First a number of interfaces exist that 00:39:51.256 --> 00:39:55.593 could be used to attack firmware. Variable my handler 00:39:55.593 --> 00:40:00.899 says direct the spyflash raids and so on. Unfortunately 00:40:00.899 --> 00:40:04.435 firmware doesn't know what hypervisor wants to protect. It 00:40:04.435 --> 00:40:06.904 doesn't know all those pages that the hypervisor is 00:40:06.904 --> 00:40:10.908 protecting so the firmware cannot validate you know that 00:40:10.908 --> 00:40:14.912 the pointer I just got is really pointing to some obscure 00:40:14.912 --> 00:40:17.215 hypervisor memory. I cannot validate that, the firmware 00:40:17.215 --> 00:40:22.854 cannot validate that. So both firmware-- so that just you know 00:40:22.854 --> 00:40:27.558 demonstrates the point that it's not just the firmware problem. 00:40:27.558 --> 00:40:31.396 It is both firmware and hypervisor problem. Both VMM and 00:40:31.396 --> 00:40:34.599 the firmware have to be designed such that they are aware of each 00:40:34.599 --> 00:40:37.935 other which-- on a (Inaudible) and so on. So you know sometimes 00:40:37.935 --> 00:40:43.641 some of those are phases should not even be exposed like for 00:40:43.641 --> 00:40:47.679 example Zem doesn't expose directly SMI handlers to even 00:40:47.679 --> 00:40:51.849 ground zero. So some of those interfaces should not be even 00:40:51.849 --> 00:40:57.055 exposed but some interfaces you know may need to be trapped and 00:40:57.055 --> 00:41:01.492 emulated by the hypervisor. So the conclusions because we have 00:41:01.492 --> 00:41:05.563 a couple of minutes. First compromised firmware is 00:41:05.563 --> 00:41:10.568 definitely bad news for VMM and that lion and the kitty picture 00:41:10.568 --> 00:41:14.205 pretty much you -- we now know that the lion is the firmware 00:41:14.205 --> 00:41:17.842 root kit, it's not the hypervisor. So the firmware 00:41:17.842 --> 00:41:21.412 needs to be tested for issues. With Windows 10 there is a path 00:41:21.412 --> 00:41:24.949 to a direct update of the firmware through the Windows 00:41:24.949 --> 00:41:30.421 update which should streamline updates of the firmware with 00:41:30.421 --> 00:41:35.660 vulnerabilities with fixes for vulnerabilities. With new 00:41:35.660 --> 00:41:41.632 vulnerabilities as well of course. So make sure that your 00:41:41.632 --> 00:41:46.437 privileged guests are really secure and really hardened 00:41:46.437 --> 00:41:51.242 because privileges guests as we saw because of the exposed 00:41:51.242 --> 00:41:54.846 interfaces to the firmware they pretty much control the 00:41:54.846 --> 00:42:00.251 hypervisor on you know the majority of the systems. It's 00:42:00.251 --> 00:42:04.689 pretty much the hypervisor-- the root partition is pretty much 00:42:04.689 --> 00:42:07.959 the hypervisor because of those vulnerabilities. So the 00:42:07.959 --> 00:42:11.429 vulnerabilities in the device and CPM emulation are very 00:42:11.429 --> 00:42:15.333 common so we need to pause the interfaces for those and you 00:42:15.333 --> 00:42:18.503 know we've seen high profile vulnerabilities recently like 00:42:18.503 --> 00:42:24.609 earlier and our team found quite a few of those in the device 00:42:24.609 --> 00:42:27.512 emulation. So those are pretty common and pretty well 00:42:27.512 --> 00:42:33.084 understood but you know they -- the hypervisors need to be false 00:42:33.084 --> 00:42:37.355 for those vulnerabilities. Now the firmware interface may 00:42:37.355 --> 00:42:42.326 effect hypervisors if they are exposed to the guests. So both 00:42:42.326 --> 00:42:45.797 VMMs and firmware need to be designed such that they are 00:42:45.797 --> 00:42:48.599 aware of each other and you know you saw Andrew describing SMI 00:42:48.599 --> 00:42:54.605 handler attacks. The demo that we did it actually compromises 00:42:57.141 --> 00:43:01.746 SMI handler first. Basically it writes SMM firmware and then 00:43:01.746 --> 00:43:05.783 that malicious within the SMS compromises hypervisor. So this 00:43:05.783 --> 00:43:10.087 is a firmware problem but even if the firmware SMI handler 00:43:10.087 --> 00:43:13.357 validates that the pointer supplied to it doesn't apply to 00:43:13.357 --> 00:43:16.828 it's own memory, so you cannot really get SMI code execution 00:43:16.828 --> 00:43:20.398 through that vulnerability you can still tell the SMI handler, 00:43:20.398 --> 00:43:26.237 hey there's a pointer, it points inside a VMM page, writes to it 00:43:26.237 --> 00:43:30.007 something and it will write on your behalf. So basically you 00:43:30.007 --> 00:43:32.543 are using firmware as the computers deputy where as the 00:43:32.543 --> 00:43:37.315 proxy, you proxy the attack onto the hypervisor and it's a 00:43:37.315 --> 00:43:41.619 significant point because it proves that this is not just a 00:43:41.619 --> 00:43:46.090 firmware problem. It's also a hypervisor and both you know 00:43:46.090 --> 00:43:49.460 hypervisor and firmware problem. So with that we're basically 00:43:49.460 --> 00:43:53.197 concluding there are some references including details to 00:43:53.197 --> 00:43:57.235 white papers explaining all the technical information and the 00:43:57.235 --> 00:44:02.907 vulnerabilities that we've used and again I appreciate very much 00:44:02.907 --> 00:44:06.477 you staying until Sunday and until our talk. Thank you. 00:44:06.477 --> 00:44:10.181 [Applause]