I'm glad to see a good turnout. How many of you are really, really want to get Intel Management Engine off your system? All right. Motivated crowd. That's what I want to see. So let me give you a little bit about my motivation. I don't know about the rest of you but I'm very paranoid about my own personal system. I'm the kind of person that spends like a week fine tuning the SE Linux policies. And I first found out about the Management Engine, I don't know, six, eight years ago and it just planted this little seed of doubt in my mind. You know, as I'm there working away securing the OS layer and wondering like, well, what about this back door at the hardware layer that I can't touch and I can't get rid of? So I followed all the research and finally when there was a way to disable the Management Engine, I jumped on it right away. I bricked my laptop twice, not once but twice in the process. And I decided I wanted to put together a talk to help all of you to streamline it so you don't have to make the same mistakes that I did. So my name is Brian Milliron. I'm a freelance penetration tester. My company is ECR Security. I've been doing penetration testing for about eight years, primarily in the energy generation field. Prior to that, I spent about ten years as a security engineer and network architect. So I'm a security engineer. So when information about the Intel ME first started coming out, they called it a chip within a chip because it's a completely autonomous subsystem. It is not actually inside the CPU as they first thought. It's located on the PCH hub. It is completely closed source. It includes a number of modules, one of which is the AMT for remote administration. It works just like ILO for completely hardware level remote administration. It runs the Minix 3.0. It's a 3D OS. It is included in all the Intel chipsets since 2008. And some of the limited subset of chipsets earlier than that going back to 2006. It runs on an Intel Quark 32-bit microprocessor. It has its own separate file system which is stored in SPI flash. Some of the other modules included in the management engine are boot guard, TPM, the DRM module, and quite a few others. So I'm a security engineer. I've been working on this for a long time. So some of the capabilities for the management engine. It's active even in the power off S3 state. As long as the main power is connected, it can be activated. It has its own complete separate network and TCP IP stack which is completely independent of the operating system. It communicates out of band. And the OS cannot see or modify those packets at all. You might think, well, I have a network appliance. I don't have a network appliance. I don't have a network appliance. I have SEIM. I have got, you know, Wireshark running on a separate system. But does that system, does that network appliance also have an Intel ME chip in it? The ME has full read write access to all areas of the system main memory. It has full access to the system bus. It operates in SMM or protected system management mode. So the OS cannot see or interfere with any of its operations. It has a network interface. This is basically a God mode. It can read and write to anything on the system. If it receives a magic packet over the network interface, the AMT can be activated remotely to power on the system, change settings in the OS, change BIOS settings, view video output, do anything that a user could do sitting at the local terminal. Because it's intended for remote management. You might hope that the system would be very well locked down and hardened in security. That is unfortunately not the case. All the way back in 2009, Invisible Things Lab developed a root kit which lives inside the management engine in the system management mode, which can hide from the operating system any malware preventive software that you have on the operating system. It was completely persistent, could survive being, you know, the hard drive being wiped. Back in 2010, Vasilios Ververdes developed a certificate based authentication bypass to remotely enable, deploy and provision AMT even if it was disabled in the BIOS previously. And then here recently, just last year, 2017, the Silent Bob is Silent Vulnerability, remotely exploitable authentication bypass. You just send a null field to the, to the password, to the AMT and you get full remote management capabilities. The AMT must be enabled, however, for this to work. This does affect not only PCs. This affects servers, firewalls, HSM, security appliances, anything on your network that has an Intel chip is vulnerable to this. Again, also in 2017, buffer overflow leading to remote code execution. So unfortunately this thing is full of holes. This is just what we've discovered so far. It's closed source and it's very difficult to audit. And unfortunately, Intel makes it very difficult to get rid of. We all wish that there was just a simple check box in the BIOS where you could just say, turn it off. I'm not using this. I'm not even an enterprise user. But they want to make it as difficult as possible. The management engine firmware is located in a region of the SPI flash memory that is inaccessible to the BIOS and the OS. The core modules are RSA signed. And then you've got the RSA signature. If the signature verification fails, it will fail to boot. They're also using LCMA and Huffman compression as a form of obfuscation. They're using a hidden directory to make it very difficult for reverse engineers to figure out what this thing is actually doing. Additionally, there's an extra IME verification module which runs every 30 minutes to check to see that RSA signature. And so if you overwrite it on boot, you're going to see that it's going to check and find out that the RSA signature check fails and it's going to shut your system down. So Intel has gone to great lengths to make it very difficult to disable this. So there has been some people that have speculated that maybe this is an intentional backdoor. NSA has a history of these kind of things. I think it's useful to play a little game of what if. So if I was the NSA and I was designing a backdoor that I wanted to be loaded on every server and network appliance in the world, I would have to do a couple of things. I would want it to be completely independent of the main operating system. I would want it to be something that you cannot shut down, that can't be powered on any time even if the system is turned off. I would want it to be not just stealthy but completely invisible to anything on the OS. I would want it to have full access to everything on the system. And I would want it to have out of band communications for data exfiltration. So I would want it to be completely independent. Until ME does all of that. What else would I want if I was the NSA? And I want to have this backdoor on every system. I would want to have plausible deniability. I wouldn't want any evidence pointing to the NSA. I would want to have a single rogue engineer who is going to overlook a buffer overflow. Who is going to overlook a remote authentication bypass. That way there's nothing tying it back to us. So what are some capabilities for intelligence that are going to be used for intelligence gathering that such a backdoor might have? It could scrape RAM to pull encryption keys directly out of RAM. It could be used to exfiltrate data off of an air gap system by enabling a wireless module, even if the wireless was disabled in the BIOS and not configured. It could be re-enabled and used to exfiltrate data that way. It could also be used to infect a USB drive that was plugged in and then that USB drive is carried to a different air gap system to infect that system and create a two-derivative system that is going to be able to connect to an inter-directional communications channel back out to the wider world. So how do we disable the Intel management engine? The easy way, you can actually buy systems that are pre-configured with the management engine disabled. Purism laptops, system 76 systems, that's an option when you make your purchase, you can have it disabled for you. Dell, if you're a government customer, again, some of their systems, you can ask for the management engine to be disabled at time of purchase. So that's one of the things you can do. Okay. This is DEF CON. You want to do it yourself. You want to hack it yourself. So a little bit of history. Igor Skuchinsky is a reverse engineer with hex rays. He's kind of the one that started all of this by he reverse engineered a large portion of the management engine and for the first time the rest of the world was able to see what is this thing actually doing. 2016 Trammell Hudson discovered that he could actually overwrite part of the management engine without invalidating the signature checks. It turns out Intel was not properly implementing the integrity verification in the firmware checksums. Nicola Corna followed up on this research and created a script that would delete most of the management engine components. You actually can delete all of the management engine modules except the ROMP and the BUP module. 2017, positive technologies discovered an additional way. There's an undocumented mode called HAP or high assurance platform that was put in at the request of the company. It's called the high assurance platform, called the NSA. Which disables the management engine after boot. So it boots up, it does its signature check and then it disables itself. It's kind of funny the NSA thinks the management engine is a security vulnerability. Who would have figured? Using both techniques together you can disable the management engine after boot up and then overwrite it so that it can not be reactivated. However, since the management engine is built into the BIOS, you can also build it from the very start so basically it is a going to need a new BIOS with the disabled management engine built into it. So how many of you know about Coreboot? A few, good. So it is an open source BIOS UEFI firmware. It is supported by Google and a lot of the Google engineers contribute code. It has very bare bones functionality. It initializes hardware and passes control to the OS. That's it. It does support Secure Boot using the VBoot module. However, it does have limited hardware support. Most Chromebooks it will work on because Google wants it to work on their hardware. Some of the other supported hardware is mostly older modules, Intel Ivy Bridge and Sandy Bridge or the AMD Athlon. It works on some older MacBooks, ThinkBads and Elitebooks as well. You might be thinking, I don't want to be stuck with older hardware, but I've found for my purposes that a four or five year old Elite Book or ThinkPad does the job. If you really have some high performance applications that you need to use this on, the Intel Pixel has some very, very high level specs. So you should be able to find a system that will be able to suit your needs. How much is it going to cost? You should be able to build this for under $100. If you just have a regular 8-pin chip, all you need is a Raspberry Pi and an SOIC 8-pin Pomona clip. If you have a one of the 1.8 low volt chips, you're going to need a few extra components here. You need a logic level converter, breadboard, a capacitor and a linear power supply. But it still is pretty cheap. So the first thing you would want to do is prepare the Cortbu ROM. You're going to want to build from source. Check out all the sub-modules. And you're going to need to download and build a payload. You can either use CBIAS or legacy BIAS to build a payload. Or you can use CBIAS or TIANOCORE for the UEFI depending on what you want. And it uses a menu config. It is specific to each type of hardware. That's one of the reasons that there's limited hardware support. And you're going to need to include all the proprietary binary blobs for that specific main board. So you're going to need your video driver, your LAN, and the management engine as well as a few other things. It is very important to make sure that you have the correct PC. You're going to want to have the correct PC address for the video BIOS or you're going to end up with a blank screen when you try to reboot. This is something that happened to me. You always want to use the address that's listed in LSPCI on the running system. So binary blobs. I know we all hate them, but until they're all reverse engineered and open sourced, we have to live with them. I found this personally to be the most confusing part of the process because the documentation on the Cortboot website is kind of limited in this area. So you're going to want to use the address that's listed in LSPCI. So they say you need these binary blobs, but they don't go into a lot of detail as to where do you get them from. What you're going to need is you're going to need the flash descriptor, the video BIOS, the clean Intel management engine, PCH reference code, and the memory reference code. And depending on your main board, you might also need an Intel firmware support package. So where do you get this stuff? You're going to get it out of the existing BIOS. You're going to want to go to the manufacturer's website, download the latest BIOS, and you're going to extract it from that binary. You can get it out of the existing BIOS. You can get it from the system itself just by doing a read on the BIOS chip. However, there's always a possibility that you get a bad read and you would end up with some corrupted code. Cortboot comes with some helper scripts. The extractblobs.sh is supposed to do all of the extraction for you. However, it didn't work for me. It's a little out of date. It hasn't been maintained in a while. They also include some tools, the CBFS tool and the IDF tool, which are going to do it. And I'm going to show you how to do this manually. So this command here, the CBFS tool BIOS print, is going to show you what's in your current BIOS. And it will look like this. This is kind of a typical BIOS structure. It tells you the offset and the binaries that are located in each offset. So here are some commands that you will use to extract the binary blobs. I've got all the commands here for the reference code, the machine reference code, the video reference code, the management engine. So you don't need to worry about taking binary that you extracted in the previous step. And it's going to basically overwrite everything that can be overwritten. And it will also set the half disabled bit for you. Once you have the cleaned management engine binary, you're ready to build the final core boot ROM. Do a final check of your config file. Make sure that the core boot knows the path for all of the binary blobs, including the management engine and the CBIAS payload. Verify, again, that your PCI address for your VGA is correct. And make sure that your main board model and vendor are correct. Core boot is going to pre-populate a lot of default values based on that. There's hundreds of different settings in the menu. And all of the defaults are good as long as you get the main board model and vendor correct. Although you can tweak it as needed as well. And once you've got all that, go ahead and build it. And next you're going to want to set up the flash ROM on your Raspberry Pi. You do want to check the flash ROM site to make sure that your hardware is supported. They do support most of the major vendors, so you should be okay. And all of the major distributions also have it built into their package management system, so you don't have to build it from source unless you have a very new chip and you have to build from source. And you're also going to want to RASP config to enable the SPI. And next you're going to want to find out physically where is the BIOS chip on your main board. Most likely it's going to be 8 pins. It'll look a lot like this. It'll be located near the CMOS battery. And the two biggest manufacturers are Gigabyte and Winbond, and they will have a large G or a large W on the chip. And that will help you identify it. Here's another image of a BIOS chip on the main board. You can see there's not really very many 8-pin chips, you might have a couple. One of them is going to be your BIOS probably. If you're confused, you can just Google the model number that's on the chip itself and that will tell you if it's a BIOS chip or not and which model it is. Once you've identified it, or once you locate it, then you need to identify it. You need to figure out exactly which model number it is. And then you've got your BIOS chip on the main board, so you can number so you can get the specs. The model number will be printed on the chip. I've got an example here for what the model number actually indicates for this wind bond chip. The 25 tells you what family it is. The X tells you it's dual SPI. The 80 tells you it's an 8 megabyte chip. And the VAIZ tells you it's an SOIC 8 pin 208 mil chip. Once you have the model number, you're going to need to look up on the Internet the data sheet for that specific BIOS chip. You're going to need the pin out and you're going to need the voltage at the very least. So the voltage is either going to be a 3.3 volt or it's going to be a 1.8 volt. However, on this data sheet, it's not going to say 3.3 or 1.8. It's going to give you a range. It'll say something like 2.7 to 3.6 volts. That's because voltages are very rarely exact. This is an example of a pin out diagram. Notice the little dot next to the 1. So pin 1 is going to be marked physically on the chip. You're going to need a little indentation on the chip. That'll be pin 1 right there. Some of the manufacturers label the pins differently. Some of them call pin 2 SO. Some of them call pin 2 DO. Some of them call pin 5 SI. Some of them call it DI or SIO or DIO. The clock may be called S clock. The write protect may be called ACC. If you read the data sheet, it's going to tell you what the function is for each pin and that should tell you which is which. CS is going to be chip select. DO is data output. WP is write protect. GND is ground. DIO or DI is data input. CLK is clock. Hold is hold. VCC is for power. Here's a pin out showing you which pins for the Raspberry Pi is going to go to which pins on your SOIC Pomona clip. You'll notice that three of the pins on the Pomona clip are actually going to go to a single pin on the Raspberry Pi. So you're going to need to splice three wires together or you're going to need to use a bread board to make a bridge between them. This is an example of what it looks like all hooked up. Now, if you do have a 1.8 volt chip that's called a low voltage chip, you're going to need to make a step down circuit. Otherwise, you'll fry your bias chip if you connect it directly to the 3.3 volt output on the Raspberry Pi. I have here a diagram, a wiring diagram for how to connect the Raspberry Pi to the logic level converter and the power supply and the Pomona clip. You are going to want to have probably a 10 nanofarad capacitor in between the output on the logic level converter and the input on the Pomona clip. This is going to remove some voltage fluctuations that could get in the way of the power supply and the Pomona clip. This could create noise in your data signal and it could cause you to get a bad read or a bad write. This is an example of a completed step down circuit here. You can see I've got the logic level converter mounted on a bread board and that thing at the top is the power supply. Now, what to do if your bias chip is actually one of those super rare 16 pin chips? You're still only going to be using 8 of the pins and they're all going to be the same as on a regular 8 pin chip. However, you're going to have 8 pins that are extra and you're going to want to either just leave them floating loose or you can connect them to the ground or to the power pin. And which of those three it is is going to depend on the documentation. So read the documentation, that should tell you. Okay, so after you've got everything wired up, you're going to need to test the connection. Before you physically connect the Pomona clip to the bias chip, make sure the power is disconnected from the laptop. Power supply disconnected, battery disconnected. The Raspberry Pi itself should be the only source of power unless you're using a step down circuit with a separate power supply. And here is the command to read the bias from flash ROM. I recommend that you do a read three times and do a hash checksum of each of the reads to make sure they're all the same to make sure that you're actually getting a good read. If there's any variation there, the hashes don't come back the same, you're going to want to disconnect and reconnect the clip, you're going to want to check all your connections and make sure that they're firm. You've got to have a good electrical connection before you do any write here. Once you get three sequential reads that are all good, then you're ready to write. Here's the command to do a write. You're going to write your previously prepared core boot ROM into the bias chip. And if there's not any errors, everything works out well. You're going to see the CBIOS, you're going to see the CBIOS, splash boot screen, it's going to look like this. So what happens if it doesn't work? Just because the screen is blank doesn't mean that you've bricked the system. It could be that you have entered incorrectly the PCI address for the video ROM, so the video is outputting to the wrong address. If you wait a few seconds, core boot will pass on the control to the Linux kernel or whatever you're using, and the Linux kernel is going to have its own VGA driver that will take over at that point. If it is truly bricked, you're going to need to re-flash it. You can either try and re-flash your core boot ROM or you can re-flash your original ROM and get it back to specs and just double check everything. Check all the settings in your config file. Check that all your wiring connections are solid. Use a multimeter to make sure that everything is connected well. If flash ROM cannot detect your chip, you can specify manually using the M flag. However, you should be able to detect your chip if it is supported. Usually that means there's a poor electrical connection. It should be able to automatically detect your chip if it's supported. The flash ROM developers can be reached for support questions on the flash ROM channel on freenode.net, and the core boot support mailing list is here. And here are some, a lot of really useful resources that I found useful when I was researching this. I'm going to go ahead and show you a few of them. And there we have it. Here's my contact info. If you want to get in touch with me, you have some comments or feedback, or you want to work together, collaborate on some research with me, or if you want to hire me, here's my website. I've got all the information about the services I provide on the website.