• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    C
  • License
    MIT License
  • Created about 2 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

STM32F0x Protected Firmware Dumper with Raspberry Pi Pico

STM32F0x Protected Firmware Reader with Pi Pico

This is a proof of concept protected firmware extractor which uses a bus race-condition in SWD readouts. For exploiting it you need to avoid "talking too much" with the MCU (like the SWD Probes do) and just get direct to the point. Then it's possible to extract a single 32 bit DWORD from the firmware before the protection mechanism triggers. The proof of concept needs to control both reset and power for the target device, since the read out protection on SWD requires a power-cycle to be reset.

There are several PoC over the internet for this debug mode exploit, but most of them use STM32 with the MBED SDK which makes necessary a ton of stuff to compile. I like simple stuff so I choose platform.io which makes everything to you. I also ported over Raspberry Pi Pico (RP2040) which is more accessible nowadays.

This will only work for Level 1 Readout Protection, since it requires SWD active and Level 2 Readout Protection totally blocks it. It might work with other STM32 variants but haven't been tested (if you test a different series than STM32F0x let me know!)

Building it

For building it you need platform.io installed:

pip install platformio

Or check it out specifics for different platforms at https://platformio.org/

To build you just run:

pio run

The firmware will be at .pio/pico/firmware.uf2.

You can also use platform.io vscode plugin which allows you do to everything in a GUI environment.

Usage

The pinouts are defined at include/main.h by default as:

#define TARGET_RESET_Pin 27
#define TARGET_PWR_Pin 26
#define SWDIO_Pin 14
#define SWCLK_Pin 15

The pico should be able to completely turn off the device by using the TARGET_PWR_Pin, if your target board is just the STM32 or it has few stuff on it, you can just use the TARGET_PWR_Pin directly as 3.3V power supply for the board. Keep in mind that the current sink of the pico is very low, but should be enough for the attack. If you're unsure, you can use a relay/mosfet to power on/off the target power supply.

If your STM32 target has different than 32KB flash memory, you should also edit in main.cpp the parameter size.

After powering everything up, the pico will repeat the message Send anything to start... on the serial port, that means it is ready. Press up any key and it will start dumping the content:

Send anything to start...
Starting
0x08000000: deadbeef
0x08000004: deadbeef
0x08000008: deadbeef
0x0800000C: deadbeef
0x08000010: deadbeef
0x08000014: deadbeef
0x08000018: deadbeef

You can also use the dump.py script to dump to a file.

Disclaimer

This work is heavily based on Johanes Obermaier paper Shedding too much Light on a Microcontroller's Firmware Protection. I also used portions of its Proof of Concept to migrate this to a Raspberry Pi Pico and Platform.IO so I released in the same license as the original PoC: MIT.

More Repositories

1

riskow

Learning how to make a RISC-V
Verilog
118
star
2

picohome

Raspberry Pi Pico Home Automation using CAN Bus
73
star
3

asm2web

CΓ³digo usado na live de Assembly for Noobs!
Assembly
57
star
4

segdsp

Pure GoLang DSP Library with native SIMD
Go
53
star
5

SquarePhP

Servidor de Minecraft em PHP (WTF) - Nome por Yuhtin
PHP
47
star
6

riscv-emulator

Golang RISC-V emulator that can play DOOM
Go
45
star
7

goboy

Playing GameBoy Emulation in GoLang (ported from https://github.com/racerxdl/GameBoyEmulator)
Go
40
star
8

LVDS-7-to-1-Serializer

An Verilog implementation of 7-to-1 LVDS Serializer. Which can be used for comunicating FPGAs with LVDS TFT Screens.
Verilog
38
star
9

piuio_clone

A AVR clone of Pump It Up USB IO Board - Fully compatible with the original machines.
Assembly
30
star
10

open-satellite-project

A Open Satellite Receiver Project (who knows in the future maybe a Transmitter as well? :) )
30
star
11

sat4noobs

Satellite 4 Noobs - Powered by He4rt Devs
SCSS
26
star
12

riscv-online-asm

RISC-V Online Assembler using Emscripten, Gnu Binutils
JavaScript
24
star
13

esp32-hub-panel

A ESP32 clock / display using 64x32 HUB75 panels.
C++
24
star
14

esp32-rjtag

ESP32 Remote JTAG Host for programming FPGAs
C
23
star
15

tangnano-yosys-hello

Sipeed Tang Nano Fully Opensource Toolchain Ledblink
Makefile
20
star
16

piuvisual

HTML5 Canvas and WebGL Pump It Up Visualizer!
JavaScript
19
star
17

minecrowdcontrol

Minecraft Crowd Control Plugin
Java
19
star
18

biggateboy

WIP Big FPGA Gameboy
Verilog
18
star
19

go-switch-examples

Examples using TinyGo for Nintendo Switch
Go
18
star
20

usbprinter

Android USB Printer Test
Java
18
star
21

go-cqrs-example

CQRS Example with GoLang, MQTT, gRPC and GraphQL
Go
15
star
22

gonx

libnx wrapper for tinygo
Go
14
star
23

CGO

Yuneec CGO3 Camera Hacking
13
star
24

DOS

D Operating System - Just because HUEBR
D
13
star
25

piho

Raspberry Pi Pico Home Automation Firmware
C++
13
star
26

CLReproject

OpenCL Spherical to Linear Reprojection for GOES 16 HRIT Images
C#
12
star
27

pokemon-gopher

GraphQL with Golang Example
Go
12
star
28

cursed-transistors

Cursed Transistors NFT Project and Storage
TypeScript
11
star
29

linux-iobridge

Linux Modules for IO Loopback
C
11
star
30

wimatrix-emulator

Wimatrix Emulator in Golang
C++
11
star
31

pcieledblink

Stratix V PCIe Ledblink (for usage in Microsoft Storey Peak boards)
SystemVerilog
11
star
32

segdsp-sample

SegDSP Sample Application
Go
10
star
33

asm4noobs

Assembly Tutorial for Noobs!
SCSS
10
star
34

radioserver

SegDSP Based SDR Server
Go
9
star
35

spectrumpaint

Golang / SegDSP Spectrum Paint Generator
Go
9
star
36

gotoyrender

ShaderToy like Go-Lang Render
Go
9
star
37

lms_tcp

LimeSDR rtl_tcp equivalent
Go
8
star
38

twitchled

Wimatrix Twitch TV Integration
Go
8
star
39

tmccncboard

TMC2209 GRBL-ESP32 CNC Board
8
star
40

go-subscription-handler

Golang Simple GraphQL Subscriptions Handler
Go
8
star
41

protocrypt

Protobuf Transparent Encryption
Go
8
star
42

GameBoyEmulator

C# Gameboy Emulator - Did for fun and learning :)
C#
7
star
43

AppServer

.NET Application Server Prototype
C#
7
star
44

memestash

My Meme Stash
7
star
45

spacelabview

SpaceLab View API
JavaScript
7
star
46

fpga-serial-hello

FPGA Verilog Serial Hello World + Led Blink
Verilog
6
star
47

huephone

An ESP32 Phone
Python
6
star
48

air105-uploader

AIR105 MCU program uploader
Python
6
star
49

goprocorrect

GoPro Lens Correction Profiles
6
star
50

se-image-web

Space Engineers LCD Image Generator using ReactJS
TypeScript
6
star
51

limedrv

LimeSuite Wrapper on Go (Driver for LimeSDR Devices)
Go
5
star
52

pyepiphany

Epiphany E-HAL Wrapper to Python
Python
5
star
53

goes-satellite-hunt

5
star
54

webprime

Remake of Pump It Up Prime for Web
JavaScript
5
star
55

go-mcp23017

GoLang MCP23017 driver that uses Linux I2C calls
Go
5
star
56

spy2go

Spyserver Go Library
Go
5
star
57

NXAEdit

NX2 / NXA Save Game Editor
C#
5
star
58

h2hc-rfvillage

H2HC 2022 - Radio Frequency Village
Python
5
star
59

bedhock

Bedrock Server Hooking Tool
C++
5
star
60

wimatrix

WiFi LED Matrix
C
5
star
61

qo100-dedrift

TypeScript
4
star
62

twitch-doom

Twitch DOOM bot for playing through chat. Shitty code warning
Go
4
star
63

letshackit

Let's Hack It - Webpage
JavaScript
4
star
64

kitten-stats-api

Kitten Stats API using Cloudflare Workers :D
TypeScript
4
star
65

wtc801

Arduino WTC801 Library
C++
4
star
66

platformio-air105

AIR105 MH1903 for Platform.io (WIP)
Python
4
star
67

minecraft-server

Dockerized Minecraft Server
Dockerfile
4
star
68

ircredirect

IRC Redirect to MQTT
Go
3
star
69

hekate

Nintendo Switch Something
C
3
star
70

esp32-shift

ESP32 + 74HC595 Shift Register controlled by Serial Port
Python
3
star
71

kissdvb

Keep It Simple and Stupid DVB-S Receiver / Player with Golang and SegDSP
Go
3
star
72

FakeJNI

Golang FakeJNI for calling JNI Libraries from golang (with android support)
Go
3
star
73

NuclearType

Nuclear Reaction for Javascript - Decorations for auto-generation of GraphQL and Sequelize models
JavaScript
3
star
74

OpenHamStation

OpenSource Ham Radio Station
JavaScript
2
star
75

craftclient

Minecraft Bedrock C++ Prototype client
C
2
star
76

esp32-rotracker

WIP ESP32 Rotor Tracker using stepper motors. Optimized for https://github.com/racerxdl/tmccncboard
C++
2
star
77

RTLSharp

Inspired on SDRSharp
C#
2
star
78

mqtttelegram

MQTT to Telegram Broker
Go
2
star
79

riskow-cores

Riskow Cores using Fusesoc (WIP)
Verilog
2
star
80

teske-status

Teske's Lab Website Status
Markdown
2
star
81

fpga-spi

SPI Controller for FPGA
Verilog
1
star
82

kicad-board-collection

Kicad Board Collection for use in 3D Projects
1
star
83

gocross

Golang with CGO cross compiling images
1
star
84

rf-calculators

JavaScript
1
star
85

colorlight-picorv32

Colorlight Boards (i5, hub75) with ECP5 picorv32 example
Verilog
1
star
86

gorduino-led

Golang + Arduino + WS2812 LED Controller Service (WIP)
Go
1
star
87

fastconvert

Golang Fast Byte Array to Type Array converters (replacement for binary.Read that does not use reflection)
Go
1
star
88

fpgaserialterminal

Verilog
1
star
89

anatel

Anatel Scrapper / Manager (focused on HAM stuff)
Go
1
star
90

openquadlog

Open Datalogger Project for Quadcopters (Multirotors)
C++
1
star
91

opentracker

1
star
92

cgo-tag

Yuneec CGO3 Web GPS Tagging using Telemetry
JavaScript
1
star
93

wasmvm

Wagon Experiment Simulating GOOS=js
Go
1
star
94

energylabs-static

Static Version of my old website - EnergyLabs Brasil
HTML
1
star
95

f2rank

Fiesta 2 Unnoficial Ranking Page Source Code
JavaScript
1
star
96

quadlight

A Light Control for multirotors.
Arduino
1
star
97

wsgame

Three.js and WebSocket based WebGame Example
JavaScript
1
star
98

odroid-io

Odroid C2 I/O Plugin for Jonnhy-Five based on linux-io
JavaScript
1
star
99

minelab-bot

Minecraft Bot used in Minelab Lives
Go
1
star
100

racerxdl

ACHIEVEMENT UNLOCKED
1
star