7.1: Firmware Extraction and Analysis

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

Firmware

A combination of an OS and the application logic for the device.

2
New cards

Reasons for extracting Firmware

  • Finding vulnerabilities

  • Extract data (e.g. cryptographic keys)

  • Reverse engineering protocols or interfaces

  • Forensics

  • Failure analysis

  • Repurposing EOL devices (Archbook mentioned)

3
New cards

Extracting Firmware from Small Devices (With Force)

  • May have to take apart or completely destroy it to understand its internals

  • Access the circuit boards

4
New cards

Read-Out Protection

A protection chip manufacturers may use to prevent chips having their programming read.

5
New cards

Bypassing Read-Out Protection

Decapping it, removing the top with acids and heat - don’t try this at home!

  • Check it under a microscope

  • Fuses area often enforces read-out protection

  • Cover the whole chip except for the fuses and shine a strong UV light at it

  • Flip the fuse’s bit and disable ROP

<p>Decapping it, removing the top with acids and heat - don’t try this at home!</p><ul><li><p>Check it under a microscope</p></li><li><p>Fuses area often enforces read-out protection</p></li><li><p>Cover the whole chip except for the fuses and shine a strong UV light at it</p></li><li><p>Flip the fuse’s bit and disable ROP</p></li></ul><p></p>
6
New cards

Extracting Firmware from Small Devices (Without Force)

  • Might not have ROP turned on from the factory

  • Update blobs available on manufacturers’ websites

  • Race conditions and bugs in ROP firmware

  • Or you could just have a silly little screw that you can take out

7
New cards

Chip Readout Protection (CRP)

Protects a chip from being read out, different versions including CRP1 (quite relaxed), CRP2 (a bit stricter), CRP3 (disables the bootloader completely and prevents the chip from being read ever again).

8
New cards

Chip Memory Layout

  • Programming commands

  • Stack

  • Rest of RAM

  • CRP

<ul><li><p>Programming commands</p></li><li><p>Stack</p></li><li><p>Rest of RAM</p></li><li><p>CRP</p></li></ul><p></p>
9
New cards

CRP - Bypass

Use Return-Oriented Programming.

  • Call the write command with a payload overwriting the return address

  • That return address points inside the read command handler

  • Use some kind of gadget to prevent a crash

  • Dump chip contents

10
New cards

Extracting Firmware from Complex Devices

  • Updates or complex systems that can be reverse engineered

  • If a device is updated over-the-air, HTTPS is not used due to certificate stores getting old/nonfunctional/outdated

    • HTTP is used instead which can be easily eavesdropped on

11
New cards

UART Protocol

Universal asynchronous receiver/transmitter - used to exchange serial data between two devices.

12
New cards

UART Debugging

Use a serial debugger, of which a lot of devices have for manufacturers to test them.

  • Four pins connect to a small USB adapter

  • Create a terminal session over the UART debugger to interface with the device

  • Once root is accessed (usually via insecure passwords), can dump what you want

13
New cards

Dumping Firmware via Rebooting

  • Reboot and interrupt the boot sequence for the chance of accessing the BIOS or low-level bootloader

  • If using U-boot, can interrupt the boot process by entering the bootloader and using nand dump 0×0 to dump firmware

  • Can also upload your own bootloader if possible

14
New cards

JTAG

A protocol similar to UART that can test printed circuits after manufacturing.

15
New cards

Directly Attacking Storage

Interfacing directly with soldered chips on the board will often contain firmware.

16
New cards

eMMC (Embedded MMC)

Glorified embedded SD cards - used to store data.

17
New cards

Reading eMMC Chips

Connecting the chip to an SD card reader.

18
New cards

Analysing Firmware - Black-Box Techniques

  • Port scanning

  • Network traffic sniffing

  • Poking web vulnerabilities

19
New cards

Analysing Firmware - Grey-Box Techniques

Combining white-box (proper firmware analysis) and simplifying it (checking TCP connections directly may be easier than reversing the respective binary)

20
New cards

Analysing Firmware - White-Box Techniques

  • Convert and dump the firmware into an appropriate format

  • Identify the CPU architecture

  • Analyse the firmware structure

  • Decrypt and unpack the firmware

  • If it’s a bare-metal binary, load into IDA or Ghidra

  • Otherwise, mount the filesystem and load a forensics tool/automated analyser

  • Analyse files of interest