hacking the extensible hacking the extensible firmware
play

Hacking the Extensible Hacking the Extensible Firmware Interface - PowerPoint PPT Presentation

Hacking the Extensible Hacking the Extensible Firmware Interface Firmware Interface John Heasman, Director of Research John Heasman, Director of Research Agenda The role of the BIOS The role of the BIOS Attacking a


  1. Hacking the Extensible Hacking the Extensible Firmware Interface Firmware Interface John Heasman, Director of Research John Heasman, Director of Research

  2. Agenda � � The role of the BIOS The role of the BIOS � � Attacking a legacy BIOS Attacking a legacy BIOS � � Limitations of the legacy BIOS Limitations of the legacy BIOS � � Introduction to the EFI environment Introduction to the EFI environment � � Attacking the EFI environment Attacking the EFI environment � � UEFI, summary and conclusions UEFI, summary and conclusions

  3. Some Caveats… � � This talk is about rootkit persistence This talk is about rootkit persistence - i.e. how to deploy a rootkit from the BIOS/EFI - i.e. how to deploy a rootkit from the BIOS/EFI � � This talk is not about Trusted Computing This talk is not about Trusted Computing � � Some attacks may require physical access Some attacks may require physical access - And most require root access And most require root access - - Could be deployed as a blended attack Could be deployed as a blended attack - - e.g. browser bug e.g. browser bug - -> escalation to kernel > escalation to kernel - -> > - deploy rootkit deploy rootkit � � Parts of this research are still work in progress… … Parts of this research are still work in progress

  4. The Role of the BIOS � � Test and initialise the hardware Test and initialise the hardware - Configure Northbridge and Southbridge Configure Northbridge and Southbridge - � � Locate and execute options ROMs Locate and execute options ROMs - Scan PCI buses Scan PCI buses - - Copy option ROMs to RAM Copy option ROMs to RAM - - Scan RAM for options ROMs and execute Scan RAM for options ROMs and execute - � � Provide means of user configuration Provide means of user configuration - User can select boot device priority and configure hw User can select boot device priority and configure hw - - Persists settings to CMOS Persists settings to CMOS - � � Launch bootloader bootloader Launch

  5. Attacking a Legacy BIOS � � #1 - - Modify BIOS code and Modify BIOS code and reflash reflash firmware firmware #1 � � #2 - - Modify PCI Option ROM and Modify PCI Option ROM and reflash reflash device device #2 � � #3 - - Modify ACPI tables and Modify ACPI tables and reflash reflash firmware firmware #3 � � #4 - - Non Non- -persistent warm reboot attacks persistent warm reboot attacks #4

  6. 1. Patching the BIOS � � Many places that we can insert code Many places that we can insert code - Ultimately we want to subvert the - Ultimately we want to subvert the bootloader bootloader - The The bootloader bootloader relies on the Interrupt Vector Table relies on the Interrupt Vector Table - - The IVT is created dynamically The IVT is created dynamically - � � BIOS calls int int 19h ( 19h (“ “the bootstrap loader the bootstrap loader” ” vector) vector) BIOS calls - Append code before this call after IVT is built Append code before this call after IVT is built - - Rewrite IVT to hook desired interrupt Rewrite IVT to hook desired interrupt - � � Caveats: Caveats: - May require physical access (write protect jumper) - May require physical access (write protect jumper) - Secure Flash may prevent unsigned updates Secure Flash may prevent unsigned updates -

  7. 2. PCI Option ROMs � � ROM on PCI card holding initialisation code ROM on PCI card holding initialisation code � � Can be for any platform but typically holds x86 code Can be for any platform but typically holds x86 code � � Copied to RAM and executed by BIOS Copied to RAM and executed by BIOS � � Stored in EPROM or EEPROM Stored in EPROM or EEPROM � � Example: EEPROM on your PCIe graphics card: Example: EEPROM on your PCIe graphics card: - Hooks Hooks int int 10h in real mode IVT 10h in real mode IVT - - Implements VGA/VBE BIOS functions Implements VGA/VBE BIOS functions -

  8. Attacking Option ROMs � � Obtain option ROM and flash tool Obtain option ROM and flash tool � � Patch option ROM Patch option ROM - Add code to hook interrupt of choice Add code to hook interrupt of choice - - Gain control when - Gain control when bootloader bootloader calls interrupt calls interrupt - Patch kernel itself or kernel modules Patch kernel itself or kernel modules - � � Which interrupt to hook? Which interrupt to hook? - eEye eEye’ ’s s BootRoot BootRoot hooked hooked int int 13h (disk) 13h (disk) - - Can also hook Can also hook int int 10h (video) on Windows 10h (video) on Windows - - There are likely other candidates There are likely other candidates -

  9. Pros and Cons of Option ROM Attacks � � Typically no jumper on PCI card Typically no jumper on PCI card - Flashing is easy - Flashing is easy – – typically just I/O to the card typically just I/O to the card - Almost all standalone graphics card can be flashed Almost all standalone graphics card can be flashed - - Network cards with PXE are useful Network cards with PXE are useful - � � Space is typically limited to a few kilobytes Space is typically limited to a few kilobytes - Could distribute over multiple PCI devices Could distribute over multiple PCI devices - � � Detection is fairly easy Detection is fairly easy - Dump ROM from card and analyse Dump ROM from card and analyse - - Give Give aways aways e.g. presence of protected mode code e.g. presence of protected mode code - - Detection process could be subverted though Detection process could be subverted though -

  10. 3. Typical ACPI Implementation Applications Kernel OSPM System Code ACPI Drivers/ Device Driver AML Interpreter ACPI Registers ACPI BIOS ACPI Tables BIOS Hardware

  11. ACPI BIOS Rootkits � � BIOS holds tables containing AML instructions BIOS holds tables containing AML instructions � � ACPI device driver contains AML interpreter ACPI device driver contains AML interpreter � � AML instruction set allows us to modify system memory AML instruction set allows us to modify system memory � � Re- -flash BIOS to contain patched ACPI tables flash BIOS to contain patched ACPI tables Re � � AML methods now deploy rootkit from BIOS AML methods now deploy rootkit from BIOS

  12. Benefits of ACPI Rootkits � � Independent of OS! Independent of OS! - AML is platform and OS independent - AML is platform and OS independent � � ASL is a high level language ASL is a high level language - Easy to disassemble AML to ASL and recompile - Easy to disassemble AML to ASL and recompile � � Kernel is already loaded when AML is interpreted Kernel is already loaded when AML is interpreted - Modify kernel data structures directly Modify kernel data structures directly - � � Make “ “smart smart” ” decisions before deploying rootkit decisions before deploying rootkit Make - Future Future- -proof rootkit against service packs/ proof rootkit against service packs/hotfixes hotfixes -

  13. Limitations of ACPI Rootkits � � Must be able to update system BIOS Must be able to update system BIOS - Signed updates prevent attack (Secure Flash) Signed updates prevent attack (Secure Flash) - � � OS must have ACPI device driver OS must have ACPI device driver - Stop it loading for cross Stop it loading for cross- -view detection view detection - � � OS must not sandbox AML interpreter OS must not sandbox AML interpreter - Prevent mapping of kernel address space Prevent mapping of kernel address space -

  14. 4. Warm Reboot Attacks � � Previous attacks make persistent modifications Previous attacks make persistent modifications - Makes detection easier Makes detection easier - - Systems with Systems with SLAs SLAs are not cold booted regularly are not cold booted regularly - - But might be warm rebooted (to install updates) - But might be warm rebooted (to install updates) � � Persist across reboot by modifying code at reset vector Persist across reboot by modifying code at reset vector - This is copied to shadow RAM during cold boot This is copied to shadow RAM during cold boot - - We must remove write protection then modify We must remove write protection then modify - � � Removing write protection is chipset specific Removing write protection is chipset specific - Intel: Programmable Attribute Map Registers ( Intel: Programmable Attribute Map Registers (PAMs PAMs) ) - - AMD: Memory Type Range Registers ( AMD: Memory Type Range Registers (MTRRs MTRRs) ) -

  15. Legacy BIOS Limitations � � BIOS typically written in Assembler BIOS typically written in Assembler - Who writes 16 Who writes 16- -bit real mode assembler? bit real mode assembler? - - Rooted in x86 Interrupt model - Rooted in x86 Interrupt model � � Few cleanly defined interfaces exposed by vendors Few cleanly defined interfaces exposed by vendors - int int 15h is the 15h is the “ “miscellaneous miscellaneous” ” interrupt interrupt - - Subfunctions Subfunctions vary from vendor to vendor vary from vendor to vendor - - Interfaces that are defined are clunky Interfaces that are defined are clunky - e.g. the Post Memory Manager (PMM) spec: e.g. the Post Memory Manager (PMM) spec:

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend