1 of 44

By INIT_6

Hardware Hacking 101...

2 of 44

Introduction

INIT_6:

  • Generalist aka Hacks All The Things
  • Not really a hardware hacker
  • Run 0DayAllDay
  • Talk fairly regularly at DHA and DC214
  • Been hacking since I was just a young lad

3 of 44

Disclaimer….

Hack responsibly, Hack only things that belong to you or have written permission. Even then check if you are allowed to by your government. In addition, some companies are sue happy, so be careful.

Especially with hardware hacking always assume you are going to break it. If you can’t afford throwing it out of a window on 635 (don’t thats littering) don’t mess with it.

4 of 44

Goals

Introducing basic hacking techniques:

  • Hardware Interfaces
  • Tools of the trade
  • Soldering
  • Reverse Engineering
  • Debugging

5 of 44

UART - Universal Asynchronous Receiver-Transmitter

UART is a computer hardware device for asynchronous serial communication in which the data format and transmission speeds are configurable.

The electric signaling levels and methods are handled by a driver circuit external to the UART. A UART is usually an individual (or part of an) integrated circuit (IC) used for serial communications over a computer or peripheral device serial port.

One or more UART peripherals are commonly integrated in microcontroller chips.

6 of 44

UART Connection

7 of 44

UART Connection Settings -- 115200 8N1

  • Baud Rate (115200) specifies how fast data is sent over a serial line. It’s usually expressed in units of bits-per-second (bps).
  • Data bits (8)
  • Parity (N)
  • Stop bits (1)

8 of 44

JTAG - Joint Action Test Group

JTAG implements standards for on-chip instrumentation in electronic design automation as a complementary tool to digital simulation.

It specifies the use of a dedicated debug port implementing a serial communications interface for low-overhead access without requiring direct external access to the system address and data buses.

The interface connects to an on-chip test access port (TAP) that implements a stateful protocol to access a set of test registers that present chip logic levels and device capabilities of various parts.

9 of 44

JTAG Connection

TDI (Test Data In)

TDO (Test Data Out)

TCK (Test Clock)

TMS (Test Mode Select)

TRST (Test Reset) optional.

10 of 44

SPI - Serial Peripheral Interface

SPI is a synchronous serial communication interface specification used for short distance communication, primarily in embedded systems. Typical applications include Secure Digital cards and liquid crystal displays.

SPI devices communicate in full duplex mode using a master-slave architecture with a single master. The master device originates the frame for reading and writing. Multiple slave devices are supported through selection with individual slave select (SS) lines.

Sometimes SPI is called a four-wire serial bus, The SPI may be accurately described as a synchronous serial interface, but it is different from the Synchronous Serial Interface (SSI) protocol,

11 of 44

SPI Connection

SCLK: Serial Clock (output from master)

MOSI: Master Output Slave Input, or Master Out Slave In (data output from master)

MISO: Master Input Slave Output, or Master In Slave Out (data output from slave)

SS: Slave Select (often active low, output from master)

12 of 44

Firmware

Firmware is a specific class of computer software that provides the low-level control for the device's specific hardware. Firmware can either provide a standardized operating environment for the device's more complex software or, for less complex devices, act as the device's complete operating system, performing all control, monitoring and data manipulation functions.

Typical examples of devices containing firmware are embedded systems, consumer appliances, computers, computer peripherals, and others. Almost all electronic devices beyond the simplest contain some firmware.

13 of 44

Firmware - Why would you want it?

  • Users / Passwords
  • Keys
  • Connection Details
  • Add / Remove functions
  • Find vulnerabilities in the software running
  • Fuzz drivers (head start if you have the firmware)
  • System details (Chip info, memory info, etc)

14 of 44

Firmware - How To Obtain It

  • Download it from the Manufacturer's website.
  • Google search (See if someone else has gotten it for you)
  • MITM when the device is updating.
  • Dumping it from memory/flash/etc

15 of 44

Hardware

JTagulator - Bruteforce pins looking for possible jtag connections. $200

Buspirate - Supports SPI, UART, 1,2,3-Wire, etc. $30

SHIKRA - Supports SPI, JTAG, UART $45

OSEPP FTDI - Supports UART $15

Saleae - Logic Analyzer $400 - $1,000 ( up to $10,000)

Oscilloscope - Analyze signals $100 - $20,000

16 of 44

Hardware Extras

Caliper - For detailed measurements $40

Digital Multimeter - Read voltages, Continuity, etc $10 - $100+

Soldering iron $40 - $200 (Get one with replaceable tips and power control)

Jumper wires - Male-to-Male, Female-Male, Female-Female $10

breadboards, solder, flux, desoldering braid, tweezers, masking tape ~$20

Screwdriver - with security bits, torx, start, etc ~$50

17 of 44

Solder or Not to Solder

18 of 44

Connectors

SAM8116-ND - For AT&T Routers

SOIC clips - Clip onto chips directly

19 of 44

Bed Of Nails - “Pogo” pins

20 of 44

Bed Of Nails - “Pogo” pins

21 of 44

Software

OpenOCD - JTag software

minicom/screen - To connect to devices

Binwalk - Firmware Analysis Tool

Flashrom - a utility for identifying, reading, writing, verifying and erasing flash chips.

Cross-Compiler - For creating executables for your target system.

grep/xxd/hexedit/sed/awk/etc

22 of 44

Resources

23 of 44

Resources

  • https://www.datasheets.com/en/
  • DFW Hacking scene - almost everything you need can be found by asking. They will either let you borrow or more likely meetup with you and let you use whatever you are requesting.

24 of 44

Identifying Interfaces: External

  • Accessible to the outside world
    • Intended for engineers or manufacturers
    • Device programming or final system test
  • Usually hidden or protected
    • Underneath batteries
    • Behind stickers/covers
  • Dual purpose connectors
    • Headphone Jacks (Motorola Candy Bar Phones)
    • HDMI (Verizon Femtocell)
  • May be a proprietary/non-standard connector

25 of 44

Examples of External Interfaces

26 of 44

Examples of External Interfaces

27 of 44

Examples of External Interfaces

28 of 44

Identifying Interfaces: Internal

  • Test points or unpopulated pads
    • Silkscreen markings or notation
    • Easy-to-access locations
  • Familiar target or based on common pinout
    • Often single or double row footprint
    • JTAG: www.jtagtest.com/pinouts/
  • Can use PCB/Design heuristics
    • Traces of similar function are grouped together (bus)
    • Array of pull-up/pull-down resistors (To set static state of pins)
    • Test points usually placed on important/interesting signals
  • Might be covered by soldermask

29 of 44

Examples of Internal Interfaces

30 of 44

Examples of Internal Interfaces

31 of 44

Examples of Internal Interfaces

32 of 44

Examples of Internal Interfaces

33 of 44

Examples of Internal Interfaces

34 of 44

Examples of Internal Interfaces

35 of 44

Examples of Internal Interfaces

36 of 44

Hacking the AT&T router.

37 of 44

U-Boot

****************************************************************

****************************************************************

************************$

U-Boot 1.3.3(8.99.57.502881) (Aug 21 2014 - 02:40:44)

CPU: Broadcom BCM63268 v8.0 64 kB I-Cache 32 kB D-Cache

BOARD: Pace Broadcom BCM63168D0

DRAM: 256 MB

Clearing heap 4259840 bytes from 8fb84000 to 8ff94000

NAND: BCMNAND: Bootcfg=40000001 Cfg=15142200 CsAndNor=0 Base=0 Acc=f7001010 Id=ecf10095

BCMNAND: System strap=1fff5bf 2048,11,1

BCMNAND: NAND: AccControl=f7001010

BCMNAND: Nand Part Name: Samsung K9F1G08U0{A/M} LP

BCMNAND: size=128MB, block=128KB, page=2048B, spare=64

BCMNAND: Init done: 0

OOB[1/131072]ff ff cf 69 ff ff 99 a6 42 6f 6f 74 43 6f 64 65

OOB[2/262144]ff ff 96 ff ff ff 3 f 42 6f 6f 74 43 6f 64 65

OOB[3/393216]ff ff cf 0 ff ff f ff 42 6f 6f 74 43 6f 64 65

OOB[4/524288]ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

OOB scan: Found pattern mismatch at 4/524288

Fixed up MTD partition to mtdparts=mtd-0:524,288(loader),1,048,576(mtdoops),-(tlpart)

OpenTL: Going to add mtd partition tlpart

Creating 1 MTD partitions on "nand0":

Creating 1 MTD partitions on "nand0":

0x00180000-0x080 00 000 : "tlpart"

OPENTL: add_mtd for tlpart

nflaattach: pages per unit=64 shift=17 sectors_per_page=4

TL_debug: before mount mediasize=64768 size=64768 partiton 0 to 1012 spares=85

Adjusting virtual blocks 1012 to account for 30 bb blocks

Adjusting virtual blocks 982 to account for 1 stat blocks

resetting statsBlock statistics Num Used=1007 Num Free=5 Bad=0

TL_debug: after mount stat_blocks=1 virt=982 head_pages=1

geometry wasted 252 sectors

nand_geom: cap=251132 cyl=980 nhead=16 nsectors=16

OPENTL: Found new opentla

OpenTL: get_dev hook called

38 of 44

Ground out the Flash NAND Chip Data out

39 of 44

Dumping the Firmware

#!/bin/bash

i=0

while :

do

printf "nand dump %x\n" $i > /dev/ttyUSB0;

sleep 1;

i=$(($i+2048));

done

40 of 44

Sprinkle a little Magic

Lots of ‘sed’ commands cleaning up the minicom NAND dump.

Then a couple tries of using xxd to get the data to binary.

Then lots of binwalk magic. Then some dd manual extraction and back to binwalk then some openssl.

Of course lots of google searches

41 of 44

The LOOT!!!!

http://gateway.c01.sbcglobal.net/firmware/00D09E/10.7.0.530220-PROD/att-5268-10.7.0.530220_prod_lightspeed-install.pkgstream

root:$6$/z.UcPQG97QWFJsL$.T/mo4akJRnLYsSZGRaqm8zmpcmMOz55Ld48m5udtYUPZklSe8jq5E8WbryW6mDnF.D05FJxVf0nsAp0JsD8t1

root:$6$k1zVhu1pxS98iHZQ$79mbio8cbDg1hFPrSVicv3suoY2dQVDDAoyaBdytDsydySrr3KCpvSF8d7H9t71p7qTJiay/pA4kyXllr9UHf0

root:$1$5zGvtsff$OB4a1jpuQ9tSxAhrcN2tc1

root:$1$LXs4rDvW$l.YK/hPrC/.WbArp34kcZ0

root:$1$dfadif91$Q5FtHoUn91vcZWTIH7KRJ/

42 of 44

More Loot!!!

adm - base64:UdkvPYjKWN1hl2xhJMx3WA==

dslf-config - base64:o/2Qz2bEiJtpV7d3hjB8HA==

dslf-reset - base64:98x0toxtKqBthqmfl8tKig==

Several Certs - Known to be part of the EAP-TLS auth process

root_rsa Key1

root_rsa Key2

"acs_url">https://cwmp.c01.sbcglobal.net/cwmp/services/CWMP

"keycode">52HP-2374-2262-22AT-F2BQ

"bootstrapped_keycode">52HP-2374-2262-22AT-F2BQ

"connreq_port">3479

"connreq_username">00D09E-13151N005006

"connreq_passwd">Uh3xGGuQzTESPMrp

43 of 44

Credits….

44 of 44

Contact

Name: INIT_6

Twitter: @INIT_3

GitHub: https://github.com/initiate6

Blog: https://init6.me/

WhiskeyNeon