Skip to content

Lesson 1 of 14 · 15m

UART: The Console That Bypasses Everything

Find the serial pads, connect a USB-TTL adapter, and get the shell the firmware never asked your permission to give.

Pull the cover off almost any Linux-based embedded device — a router, a camera, a smart plug — and somewhere near the SoC there are three or four unlabeled through-hole pads. Those pads are a UART: the device's serial console. Whatever the web UI wants you to believe about authentication, the serial console is a different trust domain. The kernel doesn't know you plugged in a cable. If the firmware was built to drop a shell on ttyS0, you get that shell. No packet crosses a network. The firewall you paid for is not involved.

Finding the pads

UART needs four lines: GND, TX, RX, and (usually unused) VCC. On the PCB they show up as a row of three or four pads, sometimes labeled J1 or CON1, often unlabeled entirely.

Identify them with a multimeter. GND beeps in continuity mode against the RF shield or any large ground pour. VCC reads the rail voltage — 3.3 V on most gear, 1.8 V on newer low-power SoCs. TX is the giveaway: it idles high and spits boot text the instant power lands, so a logic analyzer or oscilloscope on the candidate pads during power-up finds it in seconds. RX is whatever's left.

Voltage is not negotiable. A 3.3 V adapter driving TX into a 1.8 V RX pin is how pins die. Measure the rail first; buy the right adapter.

Wiring and talking

Any USB-to-TTL adapter works — CP2102, FT232RL, CH340, a few dollars each. Cross the lines: adapter TX to board RX, adapter RX to board TX, GND to GND. Do not wire VCC to the board's rail unless you intend to power the board through it — and you usually don't; let the board power itself and only share ground.

Then open the port:

picocom -b 115200 /dev/ttyUSB0
# or
screen /dev/ttyUSB0 115200

115200 8N1 covers most of the field. If you get scrolling garbage, the baud is wrong — try 57600, 38400, 9600. A UART decoder in PulseView/sigrok will guess the baud from a captured burst if you'd rather not iterate.

What the console gives you

Power on the board with the port open and you watch the whole boot: the bootloader banner, kernel decompression, init. Two consoles matter.

The bootloader console. Most of these devices run U-Boot, and U-Boot prints Hit any key to stop autoboot: with a countdown. Press a key and you're in a shell that predates Linux entirely: printenv dumps the environment (bootcmd, bootargs, addresses of every MTD region), setenv edits it, tftpboot pulls an image over TFTP into RAM, sf write or nand write burns it to flash. From U-Boot you can boot with init=/bin/sh, remount root read-write, or flash a different firmware image entirely. The device doesn't ask who you are.

The kernel console. Once Linux is up, getty runs on ttyS0 and you get a login: prompt — or, on an embarrassing amount of shipped hardware, a bare #. Consumer routers and IP cameras have been dropping root shells on UART for as long as they've shipped. There's a reason one of the best-known firmware-research blogs is literally named /dev/ttyS0.

The wrong model this kills

The mental model people carry is that device management happens through the authenticated web UI, and everything else is "hacking." That model has it backwards. UART isn't an attack the software performs; it's a console the software exposes. If getty runs a login that accepts root with the compiled-in password, or init just execs a shell, the "login page" is a courtesy, not a boundary. Every software control — web auth, rate limits, admin lockouts — lives inside the firmware, and UART walks under it.

That's also why UART is the first thing an auditor checks: one cheap adapter answers "does this device hand a root shell to anyone with a soldering iron" in five minutes, before you've read a byte of firmware.

What to do with access

On your own hardware or in an audit: capture the full boot log, interrupt autoboot, printenv, then boot normally and inventory the running system — cat /proc/mtd for the flash layout, ps for listeners, cat /etc/passwd for accounts. UART access is also the extraction path for firmware: once you have a shell, dd the mtdblock devices into files and carry them off over nc, scp, or tftp.

Note: some production devices kill the console — silent UART, or a login: that never accepts. That's not a dead end; it's a data point that says the vendor did the next lessons' work. The debug pins may still be live.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.