Skip to main content
Firmware is essential software that enables devices to operate by managing communication between hardware and software. Examining and potentially modifying firmware is a critical step in identifying security vulnerabilities in IoT devices, routers, and embedded systems.

Gathering Information

Before acquiring firmware, collect:
  • CPU architecture and operating system
  • Bootloader specifics
  • Hardware layout and datasheets
  • External libraries and license types
  • Update histories and regulatory certifications
  • Security assessments and known CVEs
Use OSINT tools and analyze any available open-source components. Static analysis tools like Coverity Scan can help find issues in open-source components.

Acquiring Firmware

  • Download from the manufacturer’s official support site
  • Obtain directly from developers or manufacturers
  • Build from provided source instructions
  • Use Google dork queries to find hosted firmware files
  • Intercept OTA update traffic via MitM
  • Sniff update requests within device communication
  • Identify and use hardcoded update endpoints
  • Extract via UART, JTAG, or PICit debug interfaces
  • Dump from the bootloader
  • Remove and read the storage chip directly with appropriate hardware tools
  • Access cloud storage directly (e.g., S3 buckets via S3Scanner)
  • Extract from companion mobile apps (firmware often bundled in APK assets)

Analyzing Firmware

Initial Inspection

Extracting the Filesystem

Filesystem Analysis

Once extracted, examine key locations:

Credential Files

  • etc/shadow and etc/passwd — user credentials
  • etc/ssl/ — SSL certificates and private keys
  • Config files with hardcoded API keys or passwords

Code & Binaries

  • Startup scripts (etc/init.d/, etc/rc.d/)
  • Web server configs and CGI scripts
  • Compiled binaries for offline analysis
Recommended tools:

Security Checks on Compiled Binaries

IoT Cloud Credential Harvesting

Many IoT hubs fetch per-device configuration from cloud endpoints using tokens derived from a hardcoded secret:

Firmware Downgrade Attacks

Even when vendors implement cryptographic signature checks, version rollback protection is frequently omitted. If the bootloader only verifies the signature but not the version number, older vulnerable firmware with valid signatures can be re-flashed.

Attack Workflow

1

Obtain Older Signed Image

  • Download from vendor portal or CDN
  • Extract from companion mobile app APK (assets/firmware/)
  • Retrieve from VirusTotal, Internet archives, forums
2

Upload to Device

Via any exposed update channel: Web UI, mobile-app API, USB, TFTP, MQTT. Many consumer IoT devices accept unauthenticated HTTP POST requests with firmware blobs.
3

Exploit Patched Vulnerability

After downgrade, exploit the vulnerability that was patched in the newer version.

Update Logic Assessment Checklist

  • Is the update endpoint protected with TLS + authentication?
  • Does the device compare version numbers or a monotonic anti-rollback counter?
  • Is the image verified inside a secure boot chain?
  • Does userland code perform additional sanity checks (model number, partition map)?
  • Do partial/backup update flows reuse the same validation logic?

Emulation for Dynamic Analysis

Firmware Integrity & Backdooring

If integrity or signature verification flaws exist in the update process, a modified firmware can be uploaded. The general workflow:
  1. Extract with firmware-mod-kit (FMK)
  2. Identify target architecture and endianness
  3. Build a cross compiler (e.g., Buildroot) and compile a backdoor
  4. Copy backdoor to usr/bin/ in extracted rootfs
  5. Repackage with FMK
  6. Upload via the update mechanism and test connectivity via netcat

Practice Targets

OWASP IoTGoat

Intentionally vulnerable IoT firmware for practice: github.com/OWASP/IoTGoat

DVRF

Damn Vulnerable Router Firmware: github.com/praetorian-code/DVRF

DVID

Damn Vulnerable IoT Device: github.com/Vulcainreo/DVID

AttifyOS

Pre-configured OS with firmware analysis tools: github.com/adi0x90/attifyos

References