The PC enthusiast community is often on edge about the latest software security holes and how people exploit them. We read about how developers close those vulnerabilities, and it seems like it's a never-ending cycle. What if the deepest, most private parts of your PC's hardware had years-old vulnerabilities that hadn't been detected, though? That nightmare is real. At Black Hat last week, researcher Christopher Domas demonstrated that security measures built into the hardware of some older Intel CPUs can be bypassed with a carefully-crafted attack.
CPUs use different security levels, called rings, for code execution. Code running in a given ring can access data and processes in less-privileged modes, but those less-privileged areas cannot reach back into the more privileged rings. Ring 0 is where the operating system runs, and for a long time, this was the most privileged ring. When new processor features were introduced that needed to be invisible to the operating system, those features were added to even more privileged rings, which are known as negative rings.
According to Domas's paper, when hardware hypervisors (like Intel's VT-x or AMD's AMD-V) were introduced, the associated privilege level became known as "ring -1." The most privileged mode on modern CPUs is system management mode (SMM), which Domas refers to as "ring -2." SMM controls functions Domas says are "so important we don't want the kernel to screw them up," like cryptographically authenticated variables, firmware and SecureBoot signature verifications, and hardware locks.
The exploit works because of a compatibility feature in a component called the Local Advanced Programmable Interrupt Controller (or LAPIC). The LAPIC was integrated into Intel's processors starting with the P5 family, the original Pentium. To speed up sending interrupts to the CPU, the LAPIC's registers were mapped to system memory. According to Domas, the LAPIC is usually locked into a specific address range, but a compatibility feature introduced in later versions of x86 CPUs allows that memory range to be remapped.
Domas discovered a way to re-map the LAPIC's address space to overlap system management memory (SMRAM), which he calls the "memory sinkhole." In turn, he was able to inject a data structure that describes memory use (called a Global Descriptor Table) crafted specifically to cause less-privileged code to run in SMM mode. Because SMM is invisible to other rings, the existence of the malformed GDT is hidden from the operating system. The code loaded this way could then operate completely unchecked: Domas describes applications like "deeply persistent rootkits, hardware modifications, and system destruction" as potential attacks.
For what it's worth, Domas does say that "the vulnerability [is] extremely difficult, but not impossible, to apply in practice." According to Intel's security bulletin on the memory sinkhole, the vulnerability only affects processors prior to second-generation Core (Sandy Bridge). The company has posted patched BIOSes for its affected server boards based on the S5500 and S5520 chipsets, so if you have a system based on one of these boards, the company recommends that you update the firmware. Otherwise, it seems the only way to protect yourself is to replace affected PCs with systems based on chips from the Sandy Bridge family or later.