Docsity

Firmware Analysis of Embedded Systems, Study notes of Computer Networks

Partial preview of the text

Download Firmware Analysis of Embedded Systems and more Study notes Computer Networks in PDF only on Docsity!

Firmware Analysis of Embedded Systems

Dimitrios-Georgios Akestoridis

Carnegie Mellon University

14-829 / 18-638: Mobile and IoT Security (Fall 2018)

Reminders

  • (^) University Policies: https://www.cmu.edu/policies/index.html
  • Course Policies: http://mews.sv.cmu.edu/teaching/14829/f18/policy.html
  • (^) Be aware of potential ethical and legal implications of your actions
  • (^) Use isolated networks for your assignments and research

How do embedded systems work?

  • The special-purpose computer software that controls an embedded system is often referred to as fi rmware and it is stored in non-volatile memory

How do embedded systems work?

  • The special-purpose computer software that controls an embedded system is often referred to as fi rmware and it is stored in non-volatile memory
  • Many vendors use flash memory in their devices to store their firmware, which enables them to later: - Improve the system’s functionality - (^) Fix security vulnerabilities

What does a fi rmware image look like?

  • (^) Possible methods for obtaining the firmware image of a device:
    • (^) Downloading it from the vendor’s website
    • Capturing it during the device’s firmware update process
    • (^) Extracting it from the hardware

What does a fi rmware image look like?

  • (^) Possible methods for obtaining the firmware image of a device:
    • (^) Downloading it from the vendor’s website
    • Capturing it during the device’s firmware update process
    • (^) Extracting it from the hardware
  • (^) For illustration purposes, we will use a firmware image from the OpenWrt project: - https://downloads.openwrt.org/releases/18.06.0/targets/ar71xx/generic/ - (^) https://git.openwrt.org/openwrt/openwrt.git/

$ strings

  • (^) We can inspect sequences of printable characters in the firmware image with the strings command

$ hexdump

  • (^) We can examine the bytes of the firmware image with the hexdump command

$ hexdump

  • (^) 0x48445230 (HDR0) corresponds to the magic number of the TRX header:
    • https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=package/ system/mtd/src/trx.c;hb=HEAD

$ hexdump

  • (^) 0x27051956 corresponds to the magic number of the uImage header:
    • https://git.denx.de/?p=u-boot.git;a=blob_plain;f=include/image.h;hb=HEAD

$ hexdump

  • (^) If the -v option is not provided, hexdump replaces repeating lines with a single asterisk (*)

$ hexdump

  • (^) 0x68737173 (hsqs) corresponds to the magic number of the little-endian SquashFS filesystem: - https://sourceforge.net/ p/squashfs/code/ci/ master/tree/ squashfs-tools/ squashfs_fs.h

$ binwalk

  • (^) We can use binwalk to scan for known signatures
  • (^) Custom signatures can easily be incorporated
  • (^) Wide variety of analysis options available
  • https://github.com/ ReFirmLabs/binwalk

$ binwalk

  • Regions that contain compressed or encrypted data tend to have high values of entropy
  • (^) Useful for the inspection of regions that contain data in an unknown format