[00:00.000 --> 00:00.980] All right. [00:00.980 --> 00:03.120] This is a talk about bare metal, though. [00:03.120 --> 00:04.840] And for cloud providers. [00:04.920 --> 00:06.620] So metal as a disservice. [00:07.120 --> 00:10.840] And here is Bill Demirkepper. [00:15.740 --> 00:19.800] Thank you so much, everyone, for coming out again for another one of my talks. [00:19.800 --> 00:22.600] I'm really excited to be back here at DEF CON. [00:23.000 --> 00:32.600] And, yeah, today I'm going to be talking to you about a wave of systemic vulnerabilities in these new cloud providers that have a machine learning focus. [00:33.700 --> 00:43.220] So for some background, my name is Bill Demirkepper and I'm a security researcher with a background in hardware and software as well as the web and cloud. [00:43.400 --> 00:48.920] I'm really passionate about security research that I can have an impact at scale. [00:48.920 --> 00:56.480] And recently I've been working on automating vulnerability discovery with advancements and foundation models for code reasoning. [00:58.620 --> 01:03.140] Today we're going to be going through a little bit of background to set the scene. [01:03.140 --> 01:12.640] What are bare metal servers and what is the rise, what do I mean by the rise in providers that are intended to support machine learning workflows? [01:12.820 --> 01:22.280] We're going to go through the attack surfaces that bare metal servers are subject to as well as a few case studies before wrapping it up with a review of our lessons learned. [01:24.960 --> 01:33.200] So for some background, there is a lot of large providers out there like AWS, Azure and Google Cloud you're likely aware of. [01:33.260 --> 01:36.320] And in terms of volume, their market share is massive. [01:36.320 --> 01:39.640] It's not even comparable to a lot of these smaller providers. [01:40.280 --> 01:53.500] But what we started to see in the past few years as interest in machine learning has grown, is the rise of these new or rebranded providers that offer competitive pricing for GPUs. [01:54.040 --> 01:58.000] Again, in terms of volume, they're nothing compared to these large providers. [01:58.260 --> 02:06.720] But if you're working in this space, you may be familiar with some of the names on the right because they offer competitive pricing sometimes at a tenth of the cost. [02:09.330 --> 02:14.630] Now, what is a bare metal server compared to a regular VM? [02:15.010 --> 02:18.070] Well, we can separate it into three categories. [02:18.190 --> 02:21.270] Bare metal means you're running directly on the host. [02:21.730 --> 02:23.370] You, you're running on metal. [02:23.370 --> 02:26.330] There's no layer between you and the host. [02:26.330 --> 02:32.330] Whereas, for example, with virtual machines, there's a hypervisor between you and the host itself. [02:32.330 --> 02:41.030] And while that can provide some security guarantees, in the case of machine learning workloads, that can also sometimes impact performance with PCI devices. [02:41.610 --> 02:43.650] Another version is containers. [02:43.650 --> 02:52.730] Think Docker, where you still run on the host OS, but you're in, inside of a little container where you can't really do anything except interact with the GPU. [02:53.310 --> 02:56.270] We're going to be focusing on the left, bare metal. [02:59.750 --> 03:05.450] Now, one of the big selling points of bare metal is supposedly greater security. [03:05.630 --> 03:14.430] If you take a look, I have a few vendors here who claim that, you know, bare metal cloud servers are physically isolated from other servers. [03:14.690 --> 03:20.010] Um, there's discussions about performance, better control and improved security. [03:20.150 --> 03:28.690] And while this may be true in theory, what we're going to explore today is how in practice, you're really at the mercy of your provider. [03:32.120 --> 03:38.700] So, there's been a lot of research in the past decade into boot security as well as hardware security. [03:38.700 --> 03:45.140] But in large, a lot of that focuses on either client devices or individual servers. [03:45.400 --> 03:51.580] What I've found is that there's limited bare metal cloud research, particularly against these modern providers. [03:51.720 --> 03:58.780] You know, established monoliths like the AWS's of the world have invested over a decade into their hardware security story. [03:58.980 --> 04:10.560] When I was first getting into machine learning a few months ago, before I started renting out GPUs, I was curious to make sure that the security story was at least somewhat okay. [04:11.140 --> 04:14.880] And that's exactly what I did, um, in spring when I had this need. [04:14.880 --> 04:20.460] I decided to start renting GPUs and taking a look at these environments that I had access to. [04:21.380 --> 04:25.080] So let's go through the attack surface problem with bare metal servers. [04:26.060 --> 04:28.540] By design, you have root access. [04:28.540 --> 04:32.440] Now, that's, we've seen that with regular VMs as well as containers. [04:32.440 --> 04:35.980] But the difference is, is that this is one of the main selling points. [04:36.060 --> 04:38.980] You have root access to the actual hardware. [04:40.240 --> 04:44.180] And unfortunately, this can expose significant attack surfaces. [04:45.700 --> 04:51.420] So for example, we have the Eufion BIOS, you know, boot time attack surfaces from the, uh, motherboard firmware. [04:51.420 --> 04:58.400] Any vulnerabilities in your firmware, such as during network boot, could be exploited by an attacker on the local network. [04:59.080 --> 05:04.500] We have onboard devices that offer a point for persistence. [05:04.660 --> 05:14.840] You know, a NIC or GPU are examples of privileged components where if compromised, they can access your host machine even after you've released the server to another customer. [05:16.020 --> 05:21.660] We also have firmware of motherboard and onboard devices for being backdoored. [05:21.660 --> 05:23.920] And again, for persistent access. [05:23.920 --> 05:34.860] If the provider doesn't do a great job of resetting the machine between customers, there's a possibility that an attacker can actually infect the host and maintain persistence for long to come. [05:35.920 --> 05:40.080] There's also the baseband management controller, the BMC. [05:40.080 --> 05:42.700] This is what enables out of band server access. [05:42.700 --> 05:45.960] It's how providers actually manage your server. [05:46.700 --> 05:50.520] It's responsible for cleaning environments between tenancy changes. [05:50.520 --> 05:53.300] But if this is compromised, you're out of luck. [05:53.300 --> 05:58.360] Because at the end of the day, the BMC has nearly full control over the host machine. [05:59.300 --> 06:01.900] And finally, we also have the network. [06:02.380 --> 06:07.500] You may be exposed to other customer servers if there's improper isolation. [06:07.860 --> 06:17.240] And as a result, this can expose critical flows like provisioning, which may allow an attacker to gain code execution while your server is being set up. [06:17.840 --> 06:25.540] What we're seeing here is that we are pretty much dealing with a traditional firmware and hardware security attack surface with any device. [06:25.540 --> 06:29.820] But it can have way worse consequences because it's in a shared environment. [06:30.000 --> 06:35.420] Remember, you're borrowing someone else's server in a data center with hundreds of other servers. [06:36.080 --> 06:39.620] A lot of firmware and hardware attacks depend on physical access. [06:39.620 --> 06:42.820] But with bare metal cloud, that's actually not the case. [06:42.820 --> 06:45.560] Because you have root access by design. [06:47.340 --> 06:51.380] Now, how do bare metal cloud providers actually manage these servers? [06:51.620 --> 06:56.600] One of the most popular implementations I've seen is canonical's metal as a service. [06:57.260 --> 07:00.320] The BMC allows management of a single server. [07:00.440 --> 07:18.720] But in order to provision hundreds of servers in a data center automatically, where you're not dealing with VMs or a hypervisor, mass allows you to automate a lot of the process for provisioning, you know, up deploying a custom operating system, as well as deploying any specific customer specific scripts or configurations . [07:19.960 --> 07:31.600] Now, what's really interesting about mass, when I was first reading about it, is that it relies on nearly two decade old protocols, such as Pixyboot, in order to provision devices. [07:32.840 --> 07:36.300] Keep this in mind as we continue through this presentation. [07:36.880 --> 07:45.100] From a high level, mass starts by booting into an environment for provisioning using Pixyboot. [07:45.100 --> 08:02.340] Pixyboot is a way of booting from the network where your device makes a DHCP request and the DHCP server, in this case, the mass management server, responds with a specific boot image in order to load scripts that will retrieve your customer data, deploy any custom scripts, [08:02.340 --> 08:03.760] and so forth. [08:04.900 --> 08:19.480] The high level flow looks like new, commissioning, ready, and at this point, when it reaches the ready stage, this is where the BMC is configured, and at this point, it can be deployed to the customer. [08:20.660 --> 08:24.820] Users can use mass API in order to control the device. [08:24.820 --> 08:31.400] So, the provider might have a web UI and mass is really what's controlling all these servers and providing metrics under the hood. [08:31.820 --> 08:34.800] Let's dive into these attack surfaces. [08:36.080 --> 08:45.240] So, starting with the boot environment, bare metal servers often lack basic defenses like secure boot because, again , the point is customer control. [08:45.360 --> 08:53.200] It's not that secure boot was very secure anyways, but it effectively makes it even easier to hijack the boot process. [08:53.740 --> 08:58.100] So, remember how mass was using Pixy or network boot. [08:58.120 --> 09:00.120] Well, let's take a look at what that looks like. [09:00.120 --> 09:03.040] On the right, I have two boot options. [09:03.040 --> 09:05.320] The top one is for booting from a hard drive. [09:05.320 --> 09:07.040] This is an NV RAM variable. [09:07.040 --> 09:10.860] And the bottom one is a second boot option for booting from the network. [09:12.240 --> 09:15.480] This provides an interesting opportunity to corrupt the boot chain. [09:16.440 --> 09:27.840] Remember, the way that mass works is by when the device starts, it will go request a mass server, hey, give me a Pixy boot image and this is the point in which provisioning scripts are deployed to the server. [09:28.800 --> 09:38.120] So, one really interesting way I found of persisting on servers without touching disk is by creating a malicious boot option. [09:38.880 --> 09:43.860] Pixy boot requires a local DHCP server, generally speaking. [09:43.860 --> 09:53.140] But if firmware also supports modern network boot, we can specify a remote server in the boot option through something called HTTP boot. [09:53.480 --> 09:55.420] You can see on the right a device path. [09:55.420 --> 09:58.040] That is what your boot option would look like. [09:58.040 --> 10:14.980] And what you can effectively do is specify that on the default boot path is that you need to make first get an IP address over DHCP, but instead of requesting Pixy boot, you instead request a remote server, EFI image from your attacker server. [10:15.620 --> 10:24.020] And this has been in the EDK2 open reference code for firmware, UEFI firmware for over a decade. [10:24.020 --> 10:29.820] And if you have Pixy boot, chances are that HTTP boot is supported as well. [10:31.300 --> 10:39.480] And one really cool primitive around this that I found was that we can weaponize UEFI security features to protect our persistence. [10:40.020 --> 10:45.060] So UEFI allows you to create something called authenticated variables. [10:45.400 --> 10:51.860] This is typically used to secure policy variables like the signature database as well as a platform key. [10:52.060 --> 10:58.000] But a lesser known feature about UEFI is that you can create private authenticated variables. [10:58.600 --> 11:05.280] So what an attacker can do is that they can create a boot option that is protected with their key. [11:05.920 --> 11:14.840] If you don't have direct firmware access, in order to remove that boot option, you would need or otherwise modify it, you would need to sign a payload with that key. [11:15.620 --> 11:26.880] As a result, an attacker can make it really annoying to change the boot order back to normal or reset configuration, even if they don't have direct access to the device during decommissioning. [11:30.710 --> 11:48.210] And if you want to change BIOS options but you don't have console access, another trick you can do is that AMI and other independent BIOS vendors, so these are the vendors that basically create a base framework that UEFI firmware is built on top of. [11:48.930 --> 11:56.870] What they allow you to do is there's automatic open source tools to parse BIOS options in hidden UEFI variable structures. [11:56.970 --> 12:02.430] Now these are undocumented but these tools will effectively tell you this BIOS option is at this offset. [12:02.890 --> 12:18.670] And as a result, if there's any time you run into an issue where you can't access the BIOS but you want to change maybe a security feature, you can use these tools to discover the offsets to these undocumented structures in order to downgrade the security of the environment even further. [12:19.890 --> 12:33.730] While these variables that contain the setup options are often no runtime access and what that means is after you exit boot and you go into the operating system, the operating system cannot directly modify these variables. [12:33.890 --> 12:49.230] There's a lot of other opportunities you can use such as booting from a custom EFI image on next boot just by changing the boot order and writing a simple nearly hello world EFI application in order to directly set these variables and the offsets that you're interested in. [12:49.650 --> 12:58.790] If you're interested in more, learning more about BIOS hacking, there's great forums out there like WinRaid and Bad Caps that have a lot of discussion on this exact topic. [13:00.990 --> 13:02.910] Moving on to the BIOS. [13:03.670 --> 13:11.450] What I've noticed is that there's a lack of user friendly tools to inspect the end to end boot security story. [13:12.270 --> 13:16.690] We'll go over some of the utilities out there that solve part of the problem. [13:16.690 --> 13:22.150] But what I've consistently discovered is that there is nothing that covers the entire thing holistically. [13:23.370 --> 13:31.490] So starting with basic enumeration, just some simple Linux commands, you can install DMID code which is going to dump some BIOS data. [13:31.490 --> 13:35.690] This is useful for understanding just details about your environment. [13:35.690 --> 13:37.250] What type of server are you running on? [13:37.250 --> 13:39.150] What type of motherboard are you running on? [13:39.150 --> 13:40.750] What is the BIOS version? [13:41.510 --> 13:49.090] There's also the boot EFI path which has the default EFI partition and this contains your boot loaders and any configuration files. [13:49.430 --> 13:56.950] What I mentioned about modifying BIOS options with your own EFI image, this is where you would put your EFI image and then you just have to change your boot order. [13:57.570 --> 14:02.870] There's also the sys firmware path which allows you to interact with various firmware information and settings. [14:03.270 --> 14:11.460] And this is honestly this, one of the first things I do whenever I get onto a new bare metal cloud provider is just this basic enumeration to figure out what I'm dealing with. [14:12.240 --> 14:19.740] Another really useful utility is Chipsack and Chipsack is effectively a framework for analyzing platform security. [14:20.580 --> 14:28.720] Once you compile and run it, it'll give you a bunch of detailed information about common vulnerabilities found in bare metal environments . [14:29.800 --> 14:41.360] It's not comprehensive in the sense of it still has little gaps here and there but it's one of the best utilities for just getting a quick picture about how, about the posture of your platform. [14:42.280 --> 14:54.320] You can see on the right some of the things it checks for is Intel's manufacturing mode, it'll check if the BIOS is writable, is it protected and it also explicitly tells you when there's something wrong. [14:54.320 --> 14:58.980] Like when there's a vulnerability, it'll tell you why it's critical and how you can actually exploit. [15:00.280 --> 15:06.920] Now, one of the defenses against tampering with the BIOS is called Intel Boot Cart and this is specific to Intel machines. [15:07.560 --> 15:13.820] This is a security feature that effectively establishes a route of trust from Intel to OEM firmware. [15:14.340 --> 15:20.200] If you're considering modifying firmware on a bare metal server, this might be one of the things you have to look after. [15:21.040 --> 15:30.440] Now, if it's applied incorrectly or often not at all, it may allow an attacker to modify your firmware and actually put an implant for backdoor persistence. [15:31.260 --> 15:45.960] And if specifically manufacturing mode is left enabled or the end of manufacturing is not reached, which effectively means the OEM keys have not been fused into the chipset, this likely means you can disable Intel Boot Cart. [15:47.640 --> 15:49.220] How do you know if it's enabled? [15:49.220 --> 16:00.140] Well, if you dump firmware using a couple different routes, one of them is through Intel's CSME utilities, think flash programming tool, it can be hard to find the right version for your chipset. [16:00.340 --> 16:06.880] There's also IBV specific tools, like if you're running an AMI motherboard, there's AFU Linux for Linux. [16:06.940 --> 16:12.380] And chipset also, for example, has a built in ROM, SPI ROM dumping capability. [16:12.600 --> 16:17.360] Once you have your firmware, you can open it up in a utility called UFI tool. [16:17.360 --> 16:25.660] And if you see these colored regions here on the left, yellow means it's partially protected, and then red means it's definitely protected. [16:25.900 --> 16:33.420] This can be a quick way for you to explore what parts of your firmware are going to be under scrutiny, under being checked for their integrity. [16:33.820 --> 16:40.180] It's, it might be worth actually exploring some of the unprotected volumes for opportunities to inject code. [16:41.000 --> 16:44.840] On the AMD side, there's something called AMD ROM armor. [16:45.220 --> 16:52.660] This is a near equivalent to Intel Boot Guard, and like Intel Boot Guard, it provides integrity of the SPI flash firmware. [16:53.320 --> 16:57.400] I'm going to be honest though, empirically, it's rarely secure in practice. [16:58.940 --> 17:00.240] How do you know if it's secure? [17:00.240 --> 17:05.200] Well, there's this great open source utility just like Chipset called PlatBox from IOActive. [17:05.900 --> 17:12.980] This allows you to do basic audits of your environment, and it has a few features that are quite capable with AMD devices. [17:13.640 --> 17:20.600] Nearly every machine I've tested with AMD and PlatBox, usually has one or two big problems in them. [17:21.200 --> 17:26.440] And one of the other cool parts about PlatBox is it also enables flash access, including read and write. [17:27.360 --> 17:38.340] So, let's say that you do have flash access, and you can write to firmware, you don't, you're not dealing with signature verification, or maybe the module that you're replacing is not in a protected region. [17:38.460 --> 17:40.360] What does that actually look like? [17:40.640 --> 17:49.840] Well, the UEFI tool, specifically version 0.28, allows you to actually replace parts of the UEFI firmware with your own image. [17:50.660 --> 17:59.780] Now, there's some tutorials on BIOS modding forms in order to, for example, like change modules or remove certain modules to unlock certain capabilities. [17:59.880 --> 18:07.700] But personally, my favorite has been game, the game hacking community recently has published some really cool work around, for example, backdooring SMM. [18:07.780 --> 18:11.040] And there's open source projects that have full tutorials. [18:11.040 --> 18:19.300] If you're interested in learning more about how to actually backdoor a UEFI firmware image, this project SMM Infect is a great place to start. [18:20.640 --> 18:32.130] For example, we can replace an unutilized SMM image with a malicious EFI driver that allows us to maintain persistence after we've released our bare metal server to another customer. [18:33.570 --> 18:42.570] So, you know, we've discussed firmware persistence by modifying boot options and executable code, but how do you actually defend against this? [18:42.570 --> 18:50.070] Well, the real key is that you need to make sure to re-flash nearly every part of your device whenever you're provisioning between customers. [18:50.070 --> 18:57.590] When I let go of my customer server and if I had bare metal access, you should go ahead and reset the BIOS to a stock image. [18:58.270 --> 19:00.870] Now, the how actually depends on your hardware. [19:00.870 --> 19:04.510] And this is one of the tricky parts about being a bare metal cloud provider. [19:04.810 --> 19:16.670] So, some of the larger providers like AWS, et cetera, they have these platform resiliency chips that can not only reset firmware as needed, but can even detect tampering as it happens. [19:17.150 --> 19:21.710] Some BMCs also have similar capabilities, but it's really up to the provider to use them. [19:22.270 --> 19:29.350] For example, BMC Redfish interfaces are a way for you to access the BMC through a programmatic manner. [19:29.350 --> 19:46.930] But even if they offer the firmware reset or update capability, if you don't use it and if the provider doesn't use it, then there's nothing stopping an attacker from backdooring your firmware, releasing the server, and then letting another customer unknowingly use a compromised server. [19:47.670 --> 19:56.810] OpenStack Ironic, a mass equivalent, does offer the capability to reset firmware automatically as part of the cleanup flow. [19:56.810 --> 20:05.930] But as far as I'm aware, mass itself, which I've seen in several bare metal cloud providers, does not have a default automated cleanup flow for firmware. [20:08.620 --> 20:15.160] One of my favorite primitives for exposing vulnerabilities in protected code is downgrading to an older version. [20:15.280 --> 20:24.700] Let's say that you're dealing with an environment where you just can't figure out Intel boot guard, AMD ROMer, ROM armor, or whatever it may be, but you want privileged access to firmware. [20:24.800 --> 20:36.980] What you can do is that you can use traditional flashing techniques, but instead of using a firmware with your malicious module, you first downgrade the BIOS to an old version that has vulnerabilities. [20:37.360 --> 20:40.640] This is a technique I've seen work time and time again. [20:40.940 --> 20:48.000] It's extremely effective and it's a great way to escalate your privileges from, for example, the operating system to the boot environment. [20:48.160 --> 20:53.760] And it still passes Intel boot guard and AMD ROM armor because the code is still signed. [20:53.760 --> 20:55.500] You're executing legitimate code. [20:55.500 --> 20:56.720] It's just vulnerable. [20:57.200 --> 21:01.100] Now these features do technically have anti-rollback capabilities. [21:01.100 --> 21:04.720] For example, Intel has something called secure version numbers. [21:04.720 --> 21:08.220] But empirically, no OEM uses them in practice. [21:08.220 --> 21:17.900] You know, what they should do is when a new vulnerability is discovered and there's an update released, they bump the secure version number and this prevents downgrading to an older version with the vulnerability. [21:17.960 --> 21:22.920] But again, it's, it's very inconsistent, rarely used in practice by major OEMs. [21:24.960 --> 21:30.800] Now, moving on, another risk to bare metal servers is PCI devices. [21:31.280 --> 21:36.860] Let's say you do a great job of resetting the BIOS after a server has been decommissioned. [21:37.020 --> 21:43.040] Well, one of the other things you have to worry about is the devices that are attached to your host. [21:43.300 --> 21:49.200] This includes your GPUs, your CPU config devices, the BMC, network adapters and so on. [21:49.780 --> 21:52.360] Again, this is pretty easy to enumerate on Linux. [21:52.360 --> 21:58.360] You know, there's LSPCI, the SysPCI path and dev to see what sort of devices you have access to. [21:58.620 --> 22:10.000] And just to give you an example here, on the right we can see that this bare metal server I was testing has two broad, uh, broad com controllers and they're controlled by this BNextEN driver. [22:11.080 --> 22:22.480] The reason this is really useful is because if you go over to the Linux source code and take a look at the driver, you can often find remnants of critical functionality like the ability to flash the adapter. [22:23.200 --> 22:38.080] So, for example, if you were interested in backdooring a PCI device such as a NIC, you can go ahead and look at the driver and often it'll include functionality to flash the NVRAM and that's a great place to start if there aren't open source utilities already available. [22:38.400 --> 22:45.800] In this case, broad com, uh, adapters that use this driver can actually be dumped using Ftool. [22:48.220 --> 22:54.520] A real critical problem with these PCI devices is that they can come with something called an option ROM. [22:54.780 --> 23:00.520] So these are EFI drivers that enable interoperability between the PCI device and the host. [23:01.040 --> 23:06.560] It's part of the device's flash and if there's no root of trust, it is prime for a backdoor. [23:06.560 --> 23:13.260] The reason is, instead of just replacing, for example, the NIC's firmware, the option ROM is loaded into the host. [23:13.460 --> 23:15.860] Just like any other EFI driver. [23:15.960 --> 23:26.620] So, if you can replace it, it offers a really convenient way for you to maintain persistence and without having to do any firmware hacks to take over the host by other means, such as DMA. [23:27.680 --> 23:33.380] Now, de, decommission flows like OpenStack Ironic may reset the BIOS. [23:33.380 --> 23:38.640] But resetting the firmware of these onboard devices is rare outside of large providers. [23:39.420 --> 23:43.540] There is some silver lining there, like some OEMs like Dell and HP. [23:43.540 --> 23:48.420] They have at least a basic root of trust for components that come with the server. [23:48.880 --> 23:56.800] But outside of that, it's really rare to see providers, especially the ones that are starting out, to do any of these secure practices. [23:57.020 --> 24:02.400] Just to give you an example of what this looks like and what option ROM backdoors may look like. [24:02.400 --> 24:06.780] There's this great project from a decade ago called Thundergate. [24:06.780 --> 24:18.240] And one of the really cool parts about it is that the scripts allow you to replace Broadcom's firmware with not only your own firmware, but also an option ROM that is loaded into the UEFI environment. [24:18.380 --> 24:24.660] If you're interested in tampering with Broadcom adapters and specifically option ROMs, this is a very great place to start. [24:24.660 --> 24:26.940] And it's something that I use throughout my research. [24:30.070 --> 24:34.150] Now, GPU firmware is a little bit of an interesting special case. [24:34.650 --> 24:40.050] NVIDIA GPUs embed several microprocessors based on a custom architecture known as Falcon. [24:40.330 --> 24:46.350] Starting with the Maxwell architecture, Falcon microprocessors enforce a root of trust. [24:46.350 --> 24:49.110] This means that GPUs need to be signed. [24:49.870 --> 25:01.270] Now, GPU modding forms have made some progress in tampering with the firmware, including cross flashing firmware from, for example, a GTX 1070 and porting that over to a 2070. [25:01.290 --> 25:04.290] But it still requires a valid signature. [25:04.750 --> 25:12.270] Unfortunately, in terms of tampering with the GPU, if you're using NVIDIA, um, your backdoor opportunity is limited to a supply chain. [25:12.270 --> 25:16.070] So if you were selling a GPU to a data center, there may be an opportunity there. [25:16.070 --> 25:24.270] But in terms of backdooring a bare metal server's GPU, it's going to be difficult unless you can get around this firmware signature verification system. [25:25.350 --> 25:29.750] Now, most of the attack surfaces we covered require specialized tooling. [25:29.750 --> 25:31.850] But where do you actually find them? [25:32.010 --> 25:35.090] Well, you can look at the target vendors, public utilities. [25:35.130 --> 25:44.390] But nowadays, a lot of vendors, I don't know, like Supermicro, what they'll do is that their tools will enforce signature verification, even if technically it's not required at all. [25:44.490 --> 25:50.450] There are some leaks on BIOS modding forums like WinRaid and BadCaps, and you can look on virus scanning platforms as well. [25:51.090 --> 25:56.070] And on the right, you can see an example of looking for open directories with specific Intel utilities. [25:56.070 --> 26:00.530] But my favorite has been scraping OEM driver packages. [26:00.710 --> 26:04.370] So, for example, let's say you want to go get a Dell driver. [26:04.370 --> 26:11.070] Instead of just stopping at that driver, write a script that will download every single Dell driver ever released. [26:11.230 --> 26:19.990] Extract those zip files, and I guarantee you, you will find very interesting leaked utilities just left in some driver packages on accident. [26:20.590 --> 26:30.790] For example, below is a script that just vibe coded for Supermicro that allows me to enumerate every public utility and actually download the zip files. [26:30.790 --> 26:42.490] And this is how I was able to get certain tools that allowed me to flash the BMC without actually needing to run into the firmware verification problem that the new equivalent tools had. [26:44.550 --> 26:49.150] Moving on to the BMCs, so this is again the heart of your data center server. [26:49.150 --> 26:55.610] It enables remote management and monitoring, and it's going to be independent of the operating system and the CPU. [26:56.170 --> 26:59.750] You can see a diagram below from CloudFlare that kind of discusses what this looks like. [26:59.750 --> 27:04.730] But effectively, it's a chip on your server that allows the server to be managed remotely. [27:04.750 --> 27:14.270] And even if the actual host is powered off, if the BMC is turned on, because it's kind of like a tiny PC inside of your server, it allows full management. [27:14.270 --> 27:16.770] For example, you can access your KVM console, etc. [27:17.130 --> 27:23.910] And what I found is that this is actually a prime target for finding vulnerabilities in order to backdoor your device. [27:24.490 --> 27:32.290] It requires significant time investment, but if you're willing to put in the time, almost always there is some issue that allows you to backdoor the firmware. [27:33.290 --> 27:41.410] So, for example, if the BMC exposes itself to the host, in order to enumerate it, you can use utilities like IPMI config and IPMI tool. [27:41.630 --> 27:47.590] On the right, you can see a command where I dumped the BMC config for one of the servers that I was granted access to. [27:48.110 --> 27:56.130] And if you want to find easy, low-hanging fruit, look for proprietary customizations on top of the base code. [27:56.130 --> 27:59.390] So, think, for example, Asus. [27:59.390 --> 28:07.110] Asus may use Megarax as a base, but Asus will add a bunch of customizations on top of this base BMC firmware. [28:07.210 --> 28:17.570] And that code, because it's specific to Asus, is far more likely to contain vulnerabilities, whereas the BMC underlying code does still contain vulnerabilities, but it's going to be looked at far more. [28:18.230 --> 28:27.050] Just to give you an example of interesting features that I've discovered is there's proprietary undocumented commands to reset a BMC to stand stock. [28:27.050 --> 28:31.070] And if you can do that, well, you can just take over it because it has default credentials. [28:31.210 --> 28:47.970] And you really have to go to Google and look into the documentation for these, but I found multiple instances whereby sending a undocumented IPMI tool command, you can just reset it to stock and at that point you have admin access through the default credentials and you can reset the BMC firmware to largely whatever you want, [28:47.970 --> 28:50.150] depending on the firmware verification present. [28:51.530 --> 29:00.670] So, depending on the configuration, the BMC may also allow host or out of band control through something called the keyboard controller style or serial over LAN. [29:00.670 --> 29:04.110] These are known as KCS and SOL channels. [29:04.490 --> 29:06.450] Some tools offer greater access at boot. [29:06.450 --> 29:14.790] So, if you execute a Eufy shell and you run some of these tools, it'll allow you to interface with the BMC with greater capabilities than the OS tools allow you to. [29:14.930 --> 29:23.190] And similar to the whole modifying BIOS options trick from earlier, you can write a startup script for a Eufy shell to run commands and exit. [29:23.730 --> 29:29.470] A diagram below shows kind of all the complexities and different ways that you can interface with the BMC. [29:29.730 --> 29:35.450] And each one of these are a great opportunity to look into by default, does it allow access? [29:35.450 --> 29:38.170] And if so, what is the privilege level of that access? [29:39.210 --> 29:48.530] Another really important point is that just because the official tool from a vendor says that you can't modify firmware, that doesn't mean you can't modify firmware. [29:48.770 --> 30:01.630] In this example, I was dealing with a server where the official tool, the Gigaflash X64, told me that my modified and backdoored BMC firmware did not match the BMC firmware signature verification mechanism. [30:01.830 --> 30:17.810] But when I found another vendor's tool for the same BMC chip, the AST25000, what I found was that I was, I could easily flash the target chip because at the end of the day, the signature verification I was seeing was just client side. [30:17.990 --> 30:25.390] So again, target vendor may enforce restrictions in their flash tool, but another vendor's equivalent for the same chip may not. [30:26.910 --> 30:29.710] And not all BMC firmware is created equally. [30:29.750 --> 30:41.070] For example, what I mentioned earlier around whether your BMC has signature verification, well, for one of the servers I was dealing with, which was an X11 super micro server, I found something interesting. [30:41.070 --> 30:45.170] Where the firmware was signed, but technically it wasn't really enforced. [30:45.490 --> 30:57.070] So here, super micro's documentation says that for these X11 and H11 generation systems, super micro has added the capability to cryptographically sign the software. [30:57.290 --> 31:04.310] But you keep reading and you realize, wait a minute, because of backwards compatibility, it's not enabled by default. [31:04.310 --> 31:05.930] It's not actually stock at all. [31:05.930 --> 31:13.110] And it's just an example of just because you see firmware signature verification doesn't mean that it's actually there in the first place. [31:13.110 --> 31:19.590] In this case, what you could do is you can downgrade it to an older version of the BMC firmware that has a vulnerability. [31:19.710 --> 31:27.310] Or you could also largely use these other vendor tools to take over the flash without having to worry about signature verification in the first place. [31:28.630 --> 31:32.910] So again, firmware assigned, flash with a valid but vulnerable version. [31:32.910 --> 31:36.550] And look for vulnerabilities in other vendors who use the same BMC chip. [31:36.750 --> 31:43.790] Just as a few examples, binarily has found several vulnerabilities inside of super micro's BMC software. [31:44.130 --> 31:59.630] So for example, even if you are dealing with a super micro environment that has signature signed firmware, you can downgrade it to an older version before 2024 and you may be able to actually abuse these vulnerabilities in order to flash it again with your own image. [32:01.350 --> 32:08.350] Moving on, another serious risk to these bare metal environments and one of my most favorite turned out to be the network. [32:08.910 --> 32:13.690] Bare metal servers are subject to a similar threat model to that of any data center server. [32:13.830 --> 32:16.010] Except it's way easier to get access. [32:16.110 --> 32:21.930] You don't need to phish anyone, you don't need to compromise an employee and then pivot onto the data center network, whatever it may be. [32:21.930 --> 32:24.790] This is by design root access to data centers. [32:25.430 --> 32:30.590] And network is critical to everything from provisioning, management and potential cross tenant access. [32:30.590 --> 32:34.150] So any issues in the network layer are bound to have a critical impact. [32:34.610 --> 32:45.110] Just to give an example, I was pretty shocked to see that trivial wire shark and promiscuous mode would capture traffic from other client servers even though I wasn't doing anything fancy. [32:46.090 --> 32:51.250] This showed that there wasn't even a basic segmentation or isolation. [32:51.470 --> 33:02.470] But moving on, even if there was some basic isolation of network traffic, because let's say that the switch remembers what MAC address is associated with what port, et cetera. [33:02.570 --> 33:05.010] Well, what about traditional ARP soothing? [33:05.090 --> 33:07.830] It turns out it actually works extremely well. [33:07.830 --> 33:14.830] I was again, just very dumbfounded by the networking security that I was dealing with, with these bare metal cloud providers. [33:14.830 --> 33:19.510] Again, these are the top providers in the machine learning space that offer the most competitive pricing. [33:19.550 --> 33:29.030] Most of them were unfortunately actually vulnerable to basic network vulnerabilities that reminds me of like two decades ago, Cain and Abel style attacks. [33:29.230 --> 33:36.250] We'll see specifics in the case studies, but this was a really interesting find that opens the door to a few interesting attacks. [33:36.790 --> 33:40.170] Again, another classic simple pen test red team trick. [33:40.170 --> 33:42.510] You know, you can scan the internal data center network. [33:42.510 --> 33:44.370] Look for a low hanging fruit. [33:44.410 --> 33:57.170] And sometimes you're behind a VLAN, but if this is enforced at the bare metal host that you have root access to, which in the cases I saw VLANs was, then it doesn't really matter because you can easily bypass it. [33:57.750 --> 34:02.650] Besides the data center's infrastructure, you can also scan other customer servers. [34:02.650 --> 34:06.470] So let's say that you apply firewall rules at the gateway. [34:06.470 --> 34:13.890] So in your, let's say provider's firewall web UI, you block all ports except, you know, 22 or whatever it may be. [34:13.890 --> 34:25.730] Well, if I'm on your internal network, what I actually found was I was able to access significantly more surfaces than the customers had intended to expose based on the internal network access compared to the external network public IP. [34:26.250 --> 34:40.550] Just to give you an example, the screenshot below is from an NMAP scan of an internal data center network where I found a lot of low hanging fruit like, you know , a decade old vulnerable SSH, um, daemons as well as IPMI access and so forth. [34:40.550 --> 34:49.630] Again, if you're dealing with a bare metal data center network, it's really worth checking the local network whether you can hit other servers as well as the data center's internal infrastructure. [34:51.010 --> 35:07.310] Now, one really, really cool attack that I found was when I was renting this bare metal Mac mini to test its inferencing capability, I noticed this Wi-Fi symbol at the top bar and I found that not only could I enable Wi-Fi, but the data center had an open network for visitors. [35:08.150 --> 35:12.730] So this wasn't visible when I was renting a Mac mini from, for example, AWS. [35:12.930 --> 35:19.570] Um, for what I understood, AWS actually appears to have disconnected the Wi-Fi PCI device, um, in hardware. [35:20.190 --> 35:26.590] Uh, but what I found was in this case, not only was it just as simple as clicking the toggle, but they had an open network. [35:26.770 --> 35:34.230] And it was really, really cool to find that Mac OS, their Wi-Fi, uh, NICs actually allow for something called monitor mode by default. [35:34.230 --> 35:42.190] So this allows you to not only intercept a traffic, for example, on your open network, but it allows you to see what's going through the air. [35:42.270 --> 35:43.790] And these are the raw frames. [35:43.790 --> 35:55.550] So for instance, the previously, these locked networks you see down below, the, I saw multiple authentication like EAPOL, if you're familiar with WA2, WPA2 cracking, et cetera. [35:55.550 --> 36:03.190] This was a really interesting way of going from like, you know, a, a remote attack scenario to a physical data center attack surface. [36:03.390 --> 36:13.610] Um, and the reason I didn't include this in the case study sections is because once I hit the open network, I was a little too scared to continue on exploiting devices there because the data center wasn't owned by the provider. [36:13.610 --> 36:15.830] They were just reselling that data center's network. [36:15.970 --> 36:19.930] Um, and I did try cracking the WPA2 EAPOL handshakes. [36:19.930 --> 36:31.410] Fortunately, it wasn't anything in any normal dictionary, but I still found this just as a really unique, uh, attack vector that bare metal servers can introduce to your data center, uh, that I haven't seen discussed before. [36:32.550 --> 36:37.330] So going to mass again, remember how it uses those decade old protocols? [36:37.330 --> 36:42.350] Well, again, pixie boot over DHCP and HTTP for their provisioning API. [36:42.350 --> 36:48.670] It's a great opportunity for you to go from an insecure network environment to cross tenant RCE. [36:49.070 --> 36:52.910] So what we're discussing here is not technically a mass vulnerability. [36:52.910 --> 36:58.610] This would require your data center or your provider to have insecure network segmentation and isolation. [36:58.790 --> 37:05.850] But mass does make it pretty easy for you to take advantage of these provider weaknesses as we'll soon see. [37:06.570 --> 37:13.350] Another interesting fact I found about these mass servers is that they expose a squid HTTP proxy by default. [37:13.510 --> 37:17.710] So this is used for like caching, for example, APT packages, et cetera. [37:17.790 --> 37:32.470] But as an indirect result, even if you were isolated from other servers on your network, but you were exposed to the mass server because your server needs to be able to provision and get config, yada, yada, you can actually tunnel through the mass servers HTTP proxy in order to, [37:32.470 --> 37:34.730] for example, hit other servers on your network. [37:34.730 --> 37:43.750] Like I, I wrote a very simple Python tool that use this HTTP proxy to try to do a port scan of the local network just by like HTTP connect style. [37:45.450 --> 37:49.270] And to make requests to the mass API, you need these provisioning keys. [37:49.270 --> 37:53.750] Um, and this is basically when a service first starts, it'll send its Mac address to mass. [37:53.890 --> 37:57.570] And if the Mac address is recognized by masses, Hey, I'm provisioning the server. [37:57.570 --> 37:59.570] That's where you get these provisioning keys. [37:59.570 --> 38:09.230] But if you're already on an environment where you want to look at the mass API, what you can do is you can take a look at the local var lib cloud folder and look for this object pickle file. [38:09.350 --> 38:11.090] It's the secret for it. [38:11.090 --> 38:19.310] Mass is not typically stored elsewhere, but in these pickle files, you'll find them in plain text and you can extract them in order to attack the mass API itself. [38:19.670 --> 38:37.110] And it's another interesting primitive that I found was that if you need a Mac address of another server on your network being provisioned, there's actually a race condition where you can go ahead and race the registration process where you claim to be this Mac address and you receive the provisioning keys instead of the real server. [38:37.570 --> 38:47.470] In practice, what this means is that if a customer had, for example, specified custom credentials, let's say a password, or maybe they had their own scripts that runs at initialization. [38:47.830 --> 38:56.890] What this would allow you to do is access those customer config and scripts otherwise and, for example, get access to customer specific API credentials. [38:59.860 --> 39:01.980] Let's move on to a few case studies. [39:04.660 --> 39:11.680] So, again, one of the most simple vulnerabilities that I discovered was just promiscuous mode on bare metal servers. [39:12.000 --> 39:19.920] In this case, this vendor, I was seeing traffic from other servers without actually having to do anything special like ARP spoofing or anything like that. [39:20.120 --> 39:27.620] You know, one of the really interesting things I saw on the network was these DHCP offers from the gateway when servers were being provisioned. [39:28.000 --> 39:44.640] You can take a look on the right as one of these packets, but what it allows us to really do is because we can see the DHCP offer as well as the request on the network, when we detect one of these DHCP discover requests, we can respond with a malicious pixie, [39:44.640 --> 39:51.300] malicious pixie URL and server and feed the server our own EFI image to execute at boot. [39:51.320 --> 39:56.880] This is a way for you to go from, again, a network vulnerability and to remote code execution. [39:57.600 --> 40:05.040] Another attack here is when you detect that DHCP discover, you register on that server's behalf and get access to customer config. [40:05.040 --> 40:14.360] If you see DHCP traffic on your bare metal provider's network without doing ARP spoofing, this is a great attack to go from, again, the network to RCE and information disclosure. [40:19.280 --> 40:31.300] So, moving on to ARP spoofing, there is another vendor where I wasn't actually able to detect much traffic besides miscellaneous broadcast through just promiscuous mode alone. [40:31.300 --> 40:36.660] But, by ARP spoofing the mass gateway, I suddenly started to see this massive flood of traffic. [40:37.180 --> 40:55.720] An attack you can do at this point, if you're, if the other servers believe you are the mass gateway, well, you can hijack EFI images that are requested from the mass server, instead of spoofing a DHCP response or an offer or whatever it may be, you instead just man in the middle of the actual mass server and, [40:55.720 --> 41:09.780] again, since mass uses these two decade old unencrypted protocols, they allow you to take advantage of this network and security, and instead of, for example, serving the real boot x64 EFI image, you serve your own backdoored image that allows you to get code execution. [41:11.400 --> 41:15.760] Now, one of the really special cases I found was with RunPod. [41:15.900 --> 41:19.840] Now, they're a new, fairly new provider, but they're still pretty popular in this space. [41:20.120 --> 41:26.460] They don't offer bare metal hourly rentals, but rather containers, so Docker containers with GPU access. [41:26.460 --> 41:32.980] You know, they have this community cloud for random people running servers, but I was taking a look at their secure cloud of vetted data centers. [41:33.240 --> 41:41.880] So what I found was that by trace routing from their servers, I found that they were reselling, likely through a bulk contract, through a provider known as Mass Compute. [41:41.880 --> 41:45.620] And what would you know, Mass Compute allows you to do hourly rentals. [41:46.540 --> 41:53.600] As a result, I found that, uh, I could do the ARP spoofing, again, get access to the DHCP traffic. [41:54.000 --> 42:04.620] Um, but one of the really cool things that I found was that by doing this DHCP spoofing and ARP spoofing, um, I found traffic for, related to RunPod's customers. [42:04.620 --> 42:15.980] So again, I compromised Mass Compute, but as a result , because RunPod, a container environment, uses Mass Compute, they're inherently exposed to their providers' providers' vulnerabilities. [42:16.180 --> 42:23.780] On the left, you can see an unencrypted traffic between nodes for Caltech's machine learning training runs. [42:24.080 --> 42:31.460] On the right is other unencrypted traffic related to logs from Mass, uh, RunPod's managed inference service. [42:31.460 --> 42:36.380] And you can see their Docker containers and, and Docker, uh, container names, et cetera. [42:36.380 --> 42:42.980] And, and just, again, this is a really special vulnerability because it's, RunPod itself wasn't offering bare metal in the first place. [42:43.660 --> 42:52.660] Now, the reason I called out RunPod is because they were also one of the only providers to actually address the vulnerabilities in time for this talk and, um, I want to give them credit for that. [42:52.660 --> 42:59.620] They did respond extremely quickly and as far as I'm aware, they've isolated customer networks from Mass Compute's other customers. [43:02.020 --> 43:05.860] So, to take, so review for a few takeaways here, shy level. [43:06.100 --> 43:13.360] What we need to do, eh, from large providers or takeaway from large providers is that you need to reflash all devices, not just your BIOS firmware. [43:13.360 --> 43:16.820] You need to physically disconnect unnecessary PCI devices. [43:16.820 --> 43:19.280] Think that Wi-Fi adapter on the Mac minis. [43:19.300 --> 43:21.060] You need to isolate the network. [43:21.060 --> 43:23.640] That is one of the most critical things you can do. [43:23.780 --> 43:29.460] Because at the end of the day, if your network is compromised, it's the easiest path to cross tenant compromise. [43:29.620 --> 43:37.200] For example, I discussed a few attacks that I tried with BMC backdoors and NIC backdoors, but those all require significant time investment. [43:37.260 --> 43:42.220] The network was really one of the most simple attacks I'd done for an insane impact. [43:42.680 --> 43:48.340] Now, you can also look into custom firmware and attack surface reduction, but getting the fundamentals is even more important. [43:49.060 --> 43:51.400] And at the end of the day, don't use legacy BMCs. [43:51.400 --> 43:54.340] Use the ones that have firmware verification, et cetera, built in. [43:54.400 --> 43:57.660] Um, and even then realize that you're not going to be completely protected. [43:58.680 --> 44:04.680] So, lessons learned here, bare metal just has a number of impossible to deal with attack surfaces. [44:04.680 --> 44:10.740] These large providers have spent nearly a decade investing into the hardware and boot security story. [44:12.820 --> 44:26.300] Virtualize may be actually better than bare metal in terms of security, because yes, bare metal may be more secure if implemented properly, but what we've seen here is that bare metal wasn't implemented properly throughout the board, especially with these new providers. [44:26.300 --> 44:29.800] And as a result, the security story is far worse than if you just use a VM. [44:32.430 --> 44:34.550] So, what do you do to protect your organization? [44:34.730 --> 44:38.310] Well, first of all, don't believe in confidential compute. [44:38.310 --> 44:41.010] That's one of the things I've recognized in the last few months. [44:41.010 --> 44:45.270] It is just complete BS, at best a deterrent. [44:45.350 --> 44:49.410] No matter how many times these large providers try to sell you on it, don't listen to them. [44:50.390 --> 44:55.050] You, honestly, what you should recognize is that we're not important enough to be targeted by some of these attacks. [44:55.050 --> 45:02.430] And so, it's probably okay to actually use these hourly rentals, even from potentially vulnerable providers, because are we really going to be targeted? [45:02.430 --> 45:03.930] Well, maybe, maybe not. [45:03.930 --> 45:05.570] Is our workload really that important? [45:05.670 --> 45:06.570] Probably not. [45:06.770 --> 45:13.130] You know, one thing you can do if you have a spare kidney or two, is you can go ahead and buy, you know, eight GPUs of your own and build your own server. [45:13.130 --> 45:14.450] That's what I decided to do. [45:14.450 --> 45:24.150] But I actually did it largely because I wanted to be able to experiment really quickly and not because of, for example, security reasons, even though that is a side benefit. [45:24.970 --> 45:29.890] For future research opportunities, I'd love to see more research into GPU PCI access. [45:29.890 --> 45:33.550] You know, what can you do in a container with GPU PCI access? [45:33.750 --> 45:35.990] What about network vulnerabilities in virtualized environments? [45:35.990 --> 45:42.490] Are there any opportunities like some of the attacks we saw today for inside of containers or other virtualized VMs? [45:42.570 --> 45:46.810] And finally, can we automate the discovery of these systemic vulnerabilities? [45:46.810 --> 45:52.430] A lot of this had to be hand done and really frustrating, but I'd love to see more automation around it. [45:52.530 --> 45:55.370] Anyways, thanks so much for coming out. [45:55.490 --> 45:59.870] We're out of time for questions, but you can find me outside in the hall right after if you have any. [46:00.090 --> 46:04.510] And yeah, if you miss me, feel free to DM me on Twitter with any questions as well. [46:04.510 --> 46:05.510] Thank you so much.