Skip to main content
Be Bitwise

Hardware Interfaces

Hardware Hacking · Embedded Systems & Firmware track

5 min read

In this module

Finding the Door In

Every embedded device sprouts hardware interfaces. Some are intentional (USB ports, network jacks). Others are vestigial — UART consoles, JTAG headers a developer forgot to depopulate. For a hardware security researcher, those are the way in. Identifying and accessing them is step one of any hardware assessment.

UART Identification

UART is the most common debug interface on embedded devices — used during development, and routinely left accessible in production. Finding it means pinning down four pads: VCC, GND, TX, and RX.

Step 1: Visual inspection. Look for a row of 3-4 holes, pads, or a pin header on the PCB. Common locations: near the main processor, along the board edge, or near labelled test points.

Step 2: Identify GND. Use a multimeter in continuity mode. Touch one probe to a known ground point (like a metal shield or the USB connector shell) and probe each pad. GND shows continuity (near zero ohms).

Step 3: Identify VCC. With the device powered on, measure voltage between GND and each remaining pad. VCC reads steady 3.3V or 5V (some newer boards use 1.8V). You'll leave it unconnected: the device powers itself, and tying its supply to your adapter's can damage one or the other.

Step 4: Identify TX. During boot, the device transmits boot messages on TX. Connect an oscilloscope or logic analyser to the remaining pads and power cycle the device. TX shows rapid voltage transitions during boot. The idle state is high (3.3V).

Steps 2 to 4 are a process of elimination, and the order matters. TX idles high, so a quick voltmeter reading on a booted, quiet board can mistake it for VCC. Measure while the device is booting and the two come apart.

Elimination order for an unlabelled four-pad header

Step 5: Determine baud rate. The logic analyser can auto-detect the baud rate from the captured signal, or try common rates: 115200, 9600, 57600, 38400.

bash
# Connect to UART
screen /dev/ttyUSB0 115200
# Power cycle the device - boot messages should appear
Level Shifting

MCU UART operates at 3.3V or 1.8V logic levels. Your USB-to-UART adapter must match. Connecting a 5V adapter to a 1.8V UART can damage the device. Always check the voltage level before connecting. Use a logic level converter if the levels do not match.

JTAG/SWD Discovery

JTAG uses up to 5 signals: TCK (clock), TMS (mode select), TDI (data in), TDO (data out), and optional TRST (reset). SWD (Serial Wire Debug) uses only 2: SWDIO (data) and SWCLK (clock).

JTAGulator: A hardware tool that brute-forces JTAG pinouts by trying every possible pin combination and watching for valid JTAG responses. Hook its channels up to the suspected pins and let it work.

Manual identification: Look for standard JTAG headers (20-pin ARM, 10-pin Cortex Debug). Check the MCU datasheet for JTAG/SWD pin assignments, then trace PCB signals from the MCU's debug pins out to accessible pads.

Bus Protocols and Sniffing

Logic analysers (like the Saleae Logic or cheap USB analysers) capture digital signals and decode protocols:

text
# Capture and decode SPI traffic:
Connect logic analyzer probes to MOSI, MISO, SCK, CS pins
Configure decoder: SPI, MSB first, CPOL=0, CPHA=0
Trigger capture and observe the device communicating with SPI flash
# Capture and decode I2C traffic:
Connect probes to SDA and SCL
Configure decoder: I2C
Observe device addresses and data transfers

Here's what one decoded transaction looks like when the MCU reads its SPI NOR flash using the standard READ command (0x03). Chip select goes low, the MCU clocks out the command byte and a 24-bit address on MOSI, then keeps clocking while the flash streams data back on MISO until CS goes high again. The address below is illustrative.

SPI flash READ (0x03) as a logic analyser decodes it

Spot the 0x03 and you know exactly which flash offset the firmware just touched. Sniff a few boots and you can map which regions hold the bootloader, the config and any keys.

Bus sniffing reveals what data the device shuttles to and from its external chips. For security work, that can expose:

  • Encryption keys read from an EEPROM
  • Configuration data pulled out of SPI flash
  • Sensor data that might be spoofable
  • Communication patterns between the main MCU and a secure element

Protocol Decoders

Modern logic analyzers ship with decoders for dozens of protocols: UART, SPI, I2C, CAN, USB, SDIO, JTAG, and on. They turn raw captures into meaningful frames, addresses, and commands.

When the protocol is proprietary, you write your own decoder. Sigrok (open-source signal analysis) takes Python decoder plugins.

Passive vs Active Analysis

Passive analysis (sniffing) only observes traffic without modifying it. Active analysis involves injecting signals - sending commands on an I2C bus, transmitting data on SPI, or driving JTAG signals. Passive analysis is non-destructive and very hard for the device to notice, though a probe still loads the line slightly and can upset fast or marginal signals. Active analysis can interact with the device but risks causing unexpected behaviour. Always start passive.