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
Acquiring Firmware
Official Sources
Official Sources
- 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
Network Interception
Network Interception
- Intercept OTA update traffic via MitM
- Sniff update requests within device communication
- Identify and use hardcoded update endpoints
Hardware Extraction
Hardware Extraction
- Extract via UART, JTAG, or PICit debug interfaces
- Dump from the bootloader
- Remove and read the storage chip directly with appropriate hardware tools
Cloud & App Sources
Cloud & App Sources
- 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/shadowandetc/passwd— user credentialsetc/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
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
Obtain Older Signed Image
- Download from vendor portal or CDN
- Extract from companion mobile app APK (
assets/firmware/) - Retrieve from VirusTotal, Internet archives, forums
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.
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:- Extract with firmware-mod-kit (FMK)
- Identify target architecture and endianness
- Build a cross compiler (e.g., Buildroot) and compile a backdoor
- Copy backdoor to
usr/bin/in extracted rootfs - Repackage with FMK
- 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