540 likes | 654 Views
Hardware Involved Software Attacks. App. App. OS. Jeff Forristal CanSecWest 2012. Hardware/Platform. ?. “Once you have root/admin,. what’s left to do?”. Question. Relevance. &. Attack surfaces. Attack patterns. Themes. X86-centric Other architectures may do it differently
E N D
Hardware Involved Software Attacks App App OS Jeff Forristal CanSecWest 2012 Hardware/Platform
? “Once you have root/admin, what’s left to do?” Question
& Attack surfaces Attack patterns Themes
X86-centricOther architectures may do it differently Not about hardware attacks* The final vulnerability lives in software Caveats
Follow the RASQ’ally rabbit… Attack Surfaces
App App Privilege OS Hardware The Stack
App App Privilege OS Hardware OS The Stack
App App Privilege OS Hardware OS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? The Stack
App App Privilege OS Hardware OS Driver Driver Driver Driver Driver Driver Driver Driver The Stack
App App Privilege OS Hardware OS Driver Driver Driver Driver Driver Driver Driver Driver The Stack
VM VM App App App App Privilege OS OS VMM/Hypervisor SMM/BIOS CPU Peripherals Memory Firmware Hardware Platform The Stack
VM VM App App App App Privilege OS OS VMM/Hypervisor BIOS & OS/VMM share access, but not trust SMM/BIOS CPU Peripherals Memory Firmware Hardware Platform The Stack
VM VM App App App App Privilege OS OS VMM/Hypervisor Hypervisor can grant VM direct HW access SMM/BIOS CPU Peripherals Memory Firmware Hardware Platform The Stack
VM VM App App App App Privilege OS OS VMM/Hypervisor SMM/BIOS CPU Peripherals Memory Firmware Hardware DMA Platform The Stack
Besides the obvious… • Direct capabilities to affect a critical system resource(e.g. DMA to system/software memory) • Indirect sideband access to a resource (e.g. PCI/e & ExpressCard access to SMBus) • Store executable code that is automatically invoked(e.g. HDD or USB drive; PCI/e device option ROM) • Proxy data from an untrusted external source*(e.g. NICs, Wifi radios) Hardware’s Involvement
Memory? X86 HW Access Methods
Mistakenly passed through by a higher privilege software layer • Explicitly passed through by a higher privilege software layer • Explicitly provided by hardware architectural intent • The attacker is already deemed to have access • The attacker is physically proximate to the system* Surface Transitions
Buckets to describe stuff…because people like to categorize things Attack Patterns
Originate in a lower-privileged software/layer or be remote/physically proximate Leverage or depend upon an operation of hardware* Achieve a vulnerability in a higher-privileged software/layer or a peer in current software/layer Commonality
This is a conversation about forests Let’s not get pedantic about the individual trees Only these slides are black & white… Ambiguity Image: http://lyricsdog.eu/
Categorization criteria isn’t always crisp (it’s like porn…) • Challenges on separating HW operation, TLP, and data • Bug DBs lack of consistent characterization of the problem, mention of hardware Challenges
Inappropriate General Access to Hardware • Straight-forward driver failure • (Semi) arbitrary access to general purpose HW access (e.g. IO, MMIO, PCI config, MSRs) • Debug purposes, laziness, bad foresight, simplicity OS Driver Driver Driver Driver Driver Driver Driver Driver Pattern #1
CVE-2005-0204Linux kernel on x64/em64t allows writing to IO ports via outs instruction CVE-2007-5633Speedfan (Windows) allows MSR reading/writing via IOCTLs CVE-2007-5761Nantsys (Windows) allows MSR reading/writing Pattern #1 Examples
Unexpected Consequences of Specific Hardware Function • Given access because functionality seems safe • Extra/hidden/unexpected/bug functionality leads to a problem Pattern #2
CVE-2011-1898DMA used to generate MSI interrupts, compromise of Xen hypervisor CVE-2011-1016Radeon Linux Gfx driver gives access to AA resolve registers, allows memory manipulation CVE-2011-2367WebGL in Firefox allows GPU memory reading, or crash Pattern #2 Examples Image: http://invisiblethingslab.com/
Hardware Reflected Injection Variants: • 2nd order injection through HW • Security-sensitive logic operation on HW value • Stored executable code blobs Pattern #3
Hardware Reflected Injection - 2nd order injection • Trigger a traditional vuln via malicious data value inserted/stored in hardware • Integer issues, buffer overflows, etc. Pattern #3 – Variant #1
AlexandreGazet – Recon 2011Update KBC FW, feed malicious value to SMM and cause a buffer overflow App App OS SMM/BIOS CPU KBC Memory Firmware Pattern #3 – Variant #1 Example
Hardware Reflected Injection - Security-sensitive logic operation on HW value • One-off logic operation, not a general purpose weakness • Thus very contextual, particularly to security-specific software Pattern #3 – Variant #2
CVE-2009-4419Malicious MCHBAR register value prevents proper VT-d policy application during TXT SENTER Hardware VT-d 00000001 FEC10000 SINIT ACM Memory Pattern #3 – Variant #2 Example Image: http://invisiblethingslab.com/
Hardware Reflected Injection - Stored executable code blobs • BIOS flash • Option ROMs • Boot device MBRs* Pattern #3 – Variant #3
Mebromi virusUpdated BIOS ISA ROM, which is executed upon system reboot Update CPU Reset BIOS OpROM MBR OS + Apps Flash PCIe Card Boot Dev Reboot Pattern #3 – Variant #3 Example
Mebromi virusUpdated BIOS ISA ROM, which is executed upon system reboot CPU Reset BIOS OpROM MBR VMM Flash PCIe Card Boot Dev IOMMU VM Update Pattern #3 – Variant #3 Example
Interference with Hardware Privilege Access Enforcement • Relevant to hypervisor & emulation • Hypervisor/emulator does operation with their (elevated) privilege, not requestors lower privilege • “Confused deputy” Pattern #4
CVE-2009-1542MS Virtual PC/Server instruction decoding doesn’t enforce CPU privilege level requirements CVE-2010-0298KVM x86 emulator doesn’t consider CPL & IOPL in guest hardware accesses Pattern #4 Examples
Access by a Parallel Executing Entity • Things running at the same time • One good, one bad • Sensitive use of shared resources • Programmable peripherals CPU Peripherals Memory Firmware Hardware Pattern #5
CVE-2010-0306SMP guest uses one thread to change instructions of another thread while being interpreted by hypervisor, allowing for arbitrary instruction execution CVE-2005-0109Malicious CPU thread monitors cache misses of another thread, recovery of cryptographic keys, etc. Pattern #5 Examples
Incorrect Hardware Use • Someone didn’t RTFM • In all fairness: • The manuals can be vague/cryptic • They tell you to do things without a reason for why • They say “should” instead of “must” Pattern #6
CVE-2006-1056Linux didn’t notice AMD FXSAVE/FXRSTOR different than Intel, lead to leaking of floating point data between processes (cryptographic secrets, etc.) CVE-2006-0744Linux improper handling of uncanonical return address on EM64T, allowing exception handler to run on user stack with wrong GS CVE-2010-2938Xen/RedHat/Linux accesses VMCS fields without first seeing if hardware supports those fields, leading to crash/DoS Pattern #6 Examples
External Control of a Hardware Device • The device (not the data it processes) is under malicious control • Variants: • Physically present/proximate • Reprogrammed Radios/comms? Pattern #7
CVE-2011-3215Firewire port allows DMA, access to host memory CVE-2009-2834Reprogramming keyboard firmware SMM/BIOS CPU 1394/FW Memory Firmware Pattern #7 Examples Image: http://www.karbosguide.com/
And it’s not a good offense… Defense
Watch your“under surface” ! Developers
Unused Devices Image: http://www.tomshardware.com/
You, too, can crash your system without trying Experimenting With Hardware
R/W Everything http://rweverything.myweb.hinet.net/ Windows
Open Hardware Monitor C# .NET http://openhardwaremonitor.org/ Windows + Linux Image: http://openhardwaremonitor.org/
LoLA – Low Level Access • Linux kernel module that provides IO, MSR, memory, & CPUID access • Programming API for access http://code.google.com/p/lola-linux/ Linux
LoLA – Low Level Access • Linux kernel module that provides IO, MSR, memory, & CPUID access • Programming API for access http://code.google.com/p/lola-linux/ Pause for irony Linux