Component Firmware http://outflux.net/slides/2014/lss/firmware.pdf - - PowerPoint PPT Presentation

component firmware
SMART_READER_LITE
LIVE PREVIEW

Component Firmware http://outflux.net/slides/2014/lss/firmware.pdf - - PowerPoint PPT Presentation

Component Firmware http://outflux.net/slides/2014/lss/firmware.pdf Linux Security Summit, Chicago 2014 Kees Cook <keescook@chromium.org> (pronounced Case) Overview Wait, which firmware? Threats Update methods


slide-1
SLIDE 1

Component Firmware

http://outflux.net/slides/2014/lss/firmware.pdf Linux Security Summit, Chicago 2014

Kees Cook <keescook@chromium.org> (pronounced “Case”)

slide-2
SLIDE 2

Component Firmware Linux Security Summit 2014 Aug 18, 2014 2/20

Overview

  • Wait, which firmware?
  • Threats
  • Update methods
  • request_firmware() hooking
  • Regression testing
  • Future work
slide-3
SLIDE 3

Component Firmware Linux Security Summit 2014 Aug 18, 2014 3/20

Wait, which firmware?

  • Not the BIOS, UEFI, or other boot firmware

– Though consider ME, SMM, TrustZone

  • “Component Firmware” in system:

– Network – Storage – Input – CPU – Other weird stuff

slide-4
SLIDE 4

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Threat: memory access

  • Attached via DMA?

– Example: network card

  • Access to physical memory!
  • Best protection is to configure IOMMU (when

available) to limit the scope of attack

http://esec-lab.sogeti.com/dotclear/public/publications/11-recon-nicreverse_slides.pdf

slide-5
SLIDE 5

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Threat: interception and spoofing

  • Attached to existing driver

– Example: Bluetooth keyboard, drives

  • On a similar bus? LPC devices can imitate

legacy keyboards

– Example: SuperIO and TPM are on LPC

https://online.tugraz.at/tug_online/voe_main2.getvolltext?pCurrPk=59565 http://spritesmods.com/?art=hddhack

slide-6
SLIDE 6

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Update methods

  • None: actual ROMs
  • Persistent?
  • Over kernel or userspace exposed bus?
  • Checksum?
  • Signature?
  • Documented?
  • Once per boot?
slide-7
SLIDE 7

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Read-only

  • Code is part of chip mask
  • Pros

– Cannot be replaced with malicious code

  • Cons

– Cannot be replaced with bug-fixed code without

physically replacing the chip

slide-8
SLIDE 8

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Direct programmed

  • Programmable chip but update mechanism

not wired to anything

  • Pros

– Cannot be replaced with malicious code

  • Cons

– Cannot be replaced with bug-fixed code without

physically attaching chip programmer

slide-9
SLIDE 9

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Vendor-defined Crypto

  • A chip has a vendor-supplied key loaded for

crypto verification of the incoming firmware

  • Pros

– Secure firmware updates

  • Cons

– System owner has no access to change firmware – Uncommon for component vendors to implement

slide-10
SLIDE 10

Component Firmware Linux Security Summit 2014 Aug 18, 2014

System-defined Crypto

  • A chip can have a key loaded for crypto

verification of the incoming firmware

  • Pros

– Secure firmware updates – Key chain defined by system owner

  • Cons

– Very unlikely for component vendors to implement

slide-11
SLIDE 11

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Per-power-on Toggle

  • A chip will come up allowing updates, but once a

flag is set, will reject further updates

  • Pros

– Secure firmware updates

  • Cons

– Only as secure as boot firmware – Updates must be applied during initial system boot – Boot firmware may need to re-flip bit across power

events (e.g. suspend)

slide-12
SLIDE 12

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Kernel-only bus

  • The bus for communicating updates is only

exposed to the kernel (e.g. reserved IO memory on PCI bus)

  • Pros

– Updates possible

  • Cons

– Only as secure as the kernel – Need kernel API to verify firmware origin

slide-13
SLIDE 13

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Userspace bus

  • The bus for communicating updates is exposed

to userspace (e.g. SCSI generic, i2c, etc)

  • Pros

– Updates possible

  • Cons

– Crosses the line between userspace and ring0 – May not be limited to root user (e.g. 3G modem

“AT” commands)

slide-14
SLIDE 14

Component Firmware Linux Security Summit 2014 Aug 18, 2014

request_firmware()

  • Kernel drivers use this to get firmware loaded

from userspace somewhere

  • Designed for non-persistent firmware, covers

a wide range of existing devices

  • Go look in /lib/firmware
slide-15
SLIDE 15

Component Firmware Linux Security Summit 2014 Aug 18, 2014

kernel_fw_from_file() LSM hook

/* * @kernel_fw_from_file: * Load firmware from userspace (not called for built-in firmware). * @file contains the file structure pointing to the file containing * the firmware to load. This argument will be NULL if the firmware * was loaded via the uevent-triggered blob-based interface exposed * by CONFIG_FW_LOADER_USER_HELPER. * @buf pointer to buffer containing firmware contents. * @size length of the firmware contents. * Return 0 if permission is granted. */

slide-16
SLIDE 16

Component Firmware Linux Security Summit 2014 Aug 18, 2014

request_firmware() validation

  • Check origin of fd (e.g. coming from expected

read-only filesystem?)

  • Check contents (e.g. against known signature)

https://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=lsm/modpin

slide-17
SLIDE 17

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Regression testing

  • CONFIG_TEST_FIRMWARE creates

test_firmware.ko that can be used to verify request_firmware calls

  • Echo desired firmware name into

/sys/devices/virtual/misc/test_firmware/trigger_ request

  • Check /dev/test_firmware for resulting

contents (or dmesg for errors)

slide-18
SLIDE 18

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Demo!

slide-19
SLIDE 19

Component Firmware Linux Security Summit 2014 Aug 18, 2014 19/20

Future work

  • What's the best way to intercept userspace

APIs that allow firmware updates?

  • How to convince vendors to implement once-

per-boot updates?

  • Can we modify existing component firmware

to implement once-per-boot updates?

slide-20
SLIDE 20

Component Firmware Linux Security Summit 2014 Aug 18, 2014

Questions?

http://outflux.net/slides/2014/lss/firmware.pdf keescook@chromium.org keescook@google.com kees@outflux.net