Home
VAPT Web Application PentestAPI PentestMobile App PentestInfrastructure PentestAI & LLM PentestOT / ICS PentestIoT PentestPenetration TestingAll VAPT services
Red Team Red Team EngagementAdversary SimulationAssumed BreachPurple TeamingSocial Engineering
Sectors Banking & Financial ServicesGovernment & Public SectorHealthcareOil, Gas & EnergyAviation & LogisticsRetail & E-commerceManufacturing & IndustryTelecommunicationsTechnology & SaaS
CompanyResourcesBlogFree Consultation

Reading the flash: firmware extraction that exposes hardcoded keys

A UART port or SPI flash clip gives a tester direct access to device firmware. Here is how that read leads to hardcoded credentials and fleet-wide access.

Joel Aviad OssiJoel Aviad OssiRed Team Lead, RedTeam Security
8 min read
An isometric left-to-right row of objects: a small IoT circuit board with a clip programmer attached, then a filesystem folder icon, then a lock with a key, then a cloud server cluster, joined by glowing red flow lines.

Key takeaways

  • UART consoles and SPI flash interfaces are present on most IoT PCBs and are rarely disabled in production firmware.
  • A CH341A programmer and a SOIC-8 clip read the entire firmware image from a device without disassembling its software.
  • Binwalk extracts squashfs and cramfs filesystems from firmware blobs, making the root filesystem browsable in minutes.
  • A hardcoded API key found in one device's firmware authenticates to the vendor cloud on behalf of every unit running the same image.
  • Secure boot, hardware-fused debug-port disabling, and per-device provisioning each break a different step in the extraction chain.

What debug interfaces on the PCB expose

Most IoT devices ship with hardware debug interfaces added during development and never removed before production. The two most useful are UART and SPI flash. UART gives a live serial console, often with a root shell, at baud rates from 9600 to 115200. SPI flash is the chip that holds the firmware itself.

Locating them on a board takes a logic analyser and a voltage probe, or sometimes only a datasheet search on the main SoC. UART pads appear as clusters of four test points (TX, RX, GND, VCC) near the processor. SPI flash is usually an 8-pin SOIC or WSON package, identified by its marking against a flash chip database. Finding either one is the starting point for an IoT pentest.

JTAG is a third interface worth considering. It provides deep hardware access, including memory reading and instruction stepping, but SPI flash is faster for firmware extraction because it reads storage directly without needing a debug agent. When a UART console opens to a root shell, there is no need to go lower: the filesystem is already accessible from software. The broader methodology is covered in how an IoT pentest is run.

Connecting to a UART console at 115200 baud
# After identifying TX/RX/GND pads with a logic analyser
screen /dev/ttyUSB0 115200

# If the baud rate is unknown, baudrate.py probes common values
python3 baudrate.py -p /dev/ttyUSB0

# A successful connection often drops directly to a root shell:
# BusyBox v1.31.1 built-in shell (ash)
# / #
The three phases of firmware extraction, from physical board access to fleet-wide authentication.

Dumping the firmware over SPI

When the UART console requires a password or is locked, the SPI flash chip is the alternative path. A CH341A USB programmer costs under $10, and a SOIC-8 test clip attaches to the chip without soldering. The chip does not need to be removed from the board. The clip connects the programmer to the chip's data lines, power and ground, and flashrom handles the protocol.

Before reading, flashrom queries the chip's JEDEC ID to identify the manufacturer and model. This confirms the right timing and voltage. A full read on a 16 MB chip takes under a minute. The resulting binary is the complete firmware image: bootloader, kernel, root filesystem, and sometimes a data partition with device-specific configuration.

Some boards use eMMC rather than raw SPI flash. eMMC requires a different approach: either desolder the chip and use a BGA reader, or boot the device into a UART shell and stream the contents over serial. Both are described in the engagement methodology; what matters for this technique is that the output is the same either way: a raw binary image that can be unpacked offline.

Identifying and reading a SPI flash chip with flashrom
# Probe the chip before reading to confirm identification
flashrom -p ch341a_spi

# Output:
# Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ch341a_spi.

# Read the full firmware image
flashrom -p ch341a_spi -r firmware.bin
# Reading flash... done.
# Verifying flash... VERIFIED.

# Confirm the read completed cleanly
md5sum firmware.bin
# a3f8c2d1e9b04756c8a21f933b2d0184  firmware.bin

Extracting the filesystem with binwalk

A raw firmware binary contains multiple sections concatenated together. Binwalk scans the binary for known file signatures: uImage headers, squashfs or cramfs filesystem magic bytes, compressed kernel images, certificate stores, and configuration blobs. The -e flag tells it to extract each recognised segment into a local directory.

Squashfs is by far the most common IoT root filesystem. It is read-only, compressed, and mounts directly on the device at boot. After binwalk identifies it, unsquashfs produces a full directory tree that mirrors what the device sees at runtime. Cramfs is older and less common; fsck.cramfs extracts it in the same way. Once the extraction completes, everything the device reads at runtime is readable offline.

The extracted directory is the filesystem the device runs. Init scripts that start at boot, configuration files with device-specific parameters, binary executables, and any secrets embedded at build time are all present. How to document what that filesystem gives up, and what evidence format UAE regulators and auditors expect, is covered in what an IoT pentest report must contain.

Binwalk scan and squashfs extraction
binwalk -e firmware.bin

# Output (truncated):
# DECIMAL       HEXADECIMAL     DESCRIPTION
# -------------------------------------------------------
# 0             0x0             uImage header, header size: 64 bytes
# 2097152       0x200000        Squashfs filesystem, little endian, v4.0,
#                               size: 8388608 bytes, 1247 inodes,
#                               blocksize: 131072 bytes

# Extract the squashfs manually if binwalk leaves it packed
unsquashfs -d squashfs-root \
  _firmware.bin.extracted/200000.squashfs

# Navigate the extracted root filesystem
ls squashfs-root/
# bin  dev  etc  lib  mnt  proc  sbin  sys  tmp  usr  var
Three-actor attack sequence. The attacker attaches a SPI clip to the IoT device. The device has an unprotected debug interface in production, marked as the vulnerability. The attacker unpacks the squashfs filesystem locally and searches it for secrets.
From physical clip to cloud access: the five steps that turn one device into a credential for the whole fleet.

What the filesystem gives up

The search begins in the locations where IoT firmware developers most often leave credentials. Init scripts under /etc/init.d/ or /etc/rc.d/ frequently pass API keys and passwords as environment variables or command-line arguments to background processes. Configuration files in /etc/ store device registration tokens and service credentials in plain text. Shell scripts in /usr/bin/ or /usr/sbin/ wrap cloud API calls with hard-coded authentication headers.

Beyond startup scripts, private keys appear in /etc/ssl/private/ or as embedded PEM blocks in binary executables, readable with strings. The /etc/shadow file, if present without root-only permissions, yields password hashes. The OWASP IoT Top 10 places hard-coded or guessable passwords at the top of its list for this reason: the weakness is structural and affects every unit of the product at once.

What makes this class of finding severe is scope. A credential baked into firmware is identical across every device shipped with that firmware version. Finding it on one device means every other device shares it. CWE-798 documents the hard-coded credential weakness and CWE-321 covers hard-coded cryptographic keys, which appear as embedded certificates and symmetric encryption keys used for firmware update verification.

The monitoring perspective on this technique is covered in what your monitoring should catch during an IoT pentest, which lists the cloud API calls that look anomalous when a credential is used from outside the expected device context.

Searching the extracted filesystem for credential patterns
# Broad search for credential patterns in all text files
grep -rli 'password\|passwd\|api_key\|api-key\|secret\|token\|Bearer' \
     squashfs-root/

# Common finds:
# squashfs-root/etc/init.d/cloud-agent
# squashfs-root/usr/bin/update.sh

# Inspect the cloud agent startup script
cat squashfs-root/etc/init.d/cloud-agent

# Output:
# #!/bin/sh
# CLOUD_API_KEY="d3a4f8b2c1e09f761234abcd5678ef90"
# /usr/bin/cloud-daemon --key "$CLOUD_API_KEY" \
#   --endpoint https://manage.vendor-iot.example/api/v1
Common types of hardcoded secret found in IoT firmware, their locations in the extracted filesystem, and their typical impact
Secret typeCommon filesystem locationTypical impact
Cloud API key/etc/init.d/ startup scripts, /usr/bin/ wrappersFleet management access on the vendor platform
Device registration token/etc/config/, /etc/persistent/Enrolment of attacker-controlled devices in the fleet
Private TLS key/etc/ssl/private/, PEM block embedded in binaryTraffic decryption, impersonation of the device
MQTT credentials/etc/mqtt.conf, environment variables in init scriptsMessage broker access across all devices
Firmware signing keyEmbedded in update daemon binarySilent deployment of attacker-modified firmware
Default admin password hash/etc/shadow with weak permissionsLocal or web interface access across the fleet

Using the extracted credentials against the cloud backend

A hard-coded API key found in one device's firmware is a credential for every device the vendor manages at that endpoint. The key typically authenticates to a device management platform that lists enrolled devices, reads their telemetry, and in some cases issues firmware updates or configuration changes. The scope of access depends on the platform. Fleet-wide read is the minimum; remote code execution via a firmware push is the maximum.

The MITRE ATT&CK technique T1552.001 covers credentials in files and applies directly here. The key was placed in the filesystem deliberately by the developer, which is what distinguishes this from a credential left in a debug log: it was designed to be there, it ships in every unit, and there is no rotation mechanism because the device cannot fetch a new one without breaking the cloud registration.

Before calling the management API, the tester confirms the endpoint from the firmware image itself. The cloud agent binary, the init script, or a configuration file will name it. The same binary often contains the API version and the expected request format. See how to buy an IoT pentest for how the scope document should capture which cloud endpoints are in scope before testing begins.

HTTP request using the extracted API key
GET /api/v1/devices HTTP/1.1
Host: manage.vendor-iot.example
X-API-Key: d3a4f8b2c1e09f761234abcd5678ef90
Accept: application/json
Response showing fleet-wide device inventory
HTTP/1.1 200 OK
Content-Type: application/json

{
  "total": 4821,
  "devices": [
    { "id": "DEV-00001", "model": "SG-200", "firmware": "2.4.1",
      "location": "building-a",
      "last_seen": "2026-11-25T07:14:00Z" },
    { "id": "DEV-00002", "model": "SG-200", "firmware": "2.4.1",
      "location": "building-b",
      "last_seen": "2026-11-25T07:13:58Z" },
    ...
  ]
}

What stops this class of attack

The chain has four steps that can each be broken independently. Physical access to the debug interface is first. JTAG and UART consoles should be hardware-fused off in production builds, not merely disabled in software. A fused-off interface cannot be re-enabled without destroying the chip. SPI flash can be encrypted with a hardware key stored in a secure element, so a raw dump of the chip yields ciphertext rather than a readable filesystem.

Hardcoded credentials are the second step and the most significant. Each device should receive a unique credential at manufacturing time, stored in a hardware security module or secure element, and the cloud platform should validate the device-specific credential rather than a fleet-wide one. This is the control that limits the blast radius: when each device has its own key, compromising one device yields access to that device alone.

Firmware signing breaks the update path. If the device verifies a signature on every firmware update against a public key stored in a read-only memory region, an attacker who extracts the firmware but not the signing key cannot push modified images to the fleet. Certificate pinning at the cloud API layer breaks the final step: if the device validates the server's certificate against a pinned value, a credential alone is not enough to impersonate the management platform.

The NIST SP 800-115 testing guide describes how each of these controls should be verified during an assessment. The evidence those tests produce, and what format UAE regulators expect it in, is documented in IoT testing evidence UAE regulators read.

Firmware extraction and the UAE connected device landscape

Connected devices are deployed across Dubai and Abu Dhabi at scale: smart building controllers, industrial meters, healthcare monitoring equipment, and access control hardware all run embedded firmware. Each represents a physical asset a tester can reach during an authorised engagement, and each carries the same risk of an accessible debug interface and a filesystem holding credentials shared across the product line.

In Dubai, the DESC information security standard applies to Dubai government entities and their technology suppliers. An IoT device procured by a government department falls within that supplier's security obligations, which include assurance that embedded credentials are unique per device and that debug interfaces are disabled before deployment.

Abu Dhabi's ADHICS framework covers healthcare IoT specifically, requiring that medical devices connected to clinical networks meet security controls that include firmware integrity and no default or shared credentials. A device shipped with a fleet-wide API key into an Abu Dhabi clinical network is a finding under ADHICS, not only an engineering concern.

At the federal level, the UAE Information Assurance Standard published by TDRA names physical security of devices alongside network controls, recognising that an interface on a PCB is a security boundary. CBUAE guidance for financial institutions extends to the IoT devices banks deploy in branches and ATMs, where a compromised device credential could reach a backend that also holds transaction data. An IoT pentest that includes firmware extraction produces evidence relevant to all four of these regimes: it documents whether debug interfaces were disabled, whether credentials are device-unique, and whether the cloud backend enforces the controls it asks the device to trust.

Frequently asked questions

What is firmware extraction in IoT security testing?

Firmware extraction is the process of reading the software stored on an IoT device's flash memory chip. A tester connects to the chip using a hardware programmer or a debug interface such as UART, reads the raw binary image, and unpacks it to examine the filesystem, configuration files, and credentials it contains. The extracted image reflects exactly what the device runs.

What is a hardcoded credential in IoT firmware?

A hardcoded credential is a password, API key, or cryptographic key that a developer embedded directly in the firmware image at build time. Because it is part of the firmware binary, it is identical across every device shipped with that firmware version and cannot be changed without pushing a firmware update to the entire fleet.

How does binwalk extract IoT firmware?

Binwalk scans a firmware binary for known file signatures such as squashfs or cramfs filesystem headers, uImage markers, and compressed archive magic bytes. When it finds a recognised format, it extracts the contents into a local directory. The resulting directory mirrors the root filesystem the device runs at boot, browsable with standard Linux tools.

What is a SPI flash reader and how is it used in IoT testing?

A SPI flash reader is a USB programmer that communicates with SPI flash chips, the most common storage component in embedded devices. A SOIC-8 test clip attaches to the chip on the PCB without soldering or desoldering it. Flashrom software handles the read protocol. The result is a full copy of the firmware image stored on the device, produced in under a minute for most consumer-grade chips.

How does a hardcoded API key compromise a full device fleet?

If a vendor uses the same API key across all units of a product, that key authenticates to the cloud management platform on behalf of every enrolled device. A tester who extracts it from one unit can query or control every other unit the platform manages, including devices at other sites. The scope of that access is determined by the platform, not by the individual device.

How does firmware extraction differ from a network vulnerability scan?

A network vulnerability scan tests interfaces from the network, seeing only what the device exposes over TCP or UDP. Firmware extraction reads the device's storage directly, offline, without sending a single packet. It reveals what is in the image: credentials, cryptographic keys, configuration, and binary code that would not be visible to any network-facing scanner.

What CWEs apply to hardcoded IoT credentials?

CWE-798 covers use of hard-coded credentials, including passwords and API keys embedded in code or configuration files. CWE-321 covers hard-coded cryptographic keys, such as symmetric keys used for firmware encryption or private keys used for TLS. Both are classified as severe because they affect every device sharing the firmware version.

Can a UART console give root access to an IoT device?

Many IoT UART consoles open directly to a root shell with no authentication required. Others present a login prompt, but the credentials are either default, hardcoded in the firmware, or absent entirely. A UART console that requires a password is a weaker control than a hardware-fused-off interface, because the password may be recoverable from the same firmware image.

What is the OWASP IoT Top 10 and where do hardcoded passwords appear in it?

The OWASP IoT Top 10 is a list of the most significant security risks in IoT products. Hard-coded or guessable passwords occupy the first position, reflecting how commonly they appear in production devices and how directly they enable device and fleet compromise. The list covers weak update mechanisms, insecure interfaces, and inadequate physical security alongside credential issues.

What is the difference between firmware extraction and a software pentest of the same device?

A software pentest interacts with the device through its published interfaces: a web UI, an API, a mobile app. Firmware extraction reads the device's storage directly and reveals what all those interfaces are built on. The two are complementary: a software pentest finds how the exposed surface behaves, and firmware extraction finds what the firmware author built into the image that no published interface was meant to expose.

The engagements this applies to

IoT Pentest

Firmware, radio, hardware interfaces and the cloud side

Joel Aviad Ossi, Red Team Lead at RedTeam Security
Joel Aviad OssiRed Team Lead, RedTeam Security

Joel Aviad Ossi is Red Team Lead at RedTeam Security, the Dubai-licensed trading brand of WebSec FZCO. He scopes and runs objective-based engagements across the UAE.

Let's talk about your security

Tell us the objective you want tested. We will come back with a scope, a timeline and a quote, under NDA from the first conversation.

Email [email protected]
IFZA Business Park, Building A2
Nadd Hessa, Dubai Silicon Oasis
Dubai, United Arab Emirates