• Stars
    star
    378
  • Rank 112,617 (Top 3 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 7 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

BootStomp: a bootloader vulnerability finder

BootStomp

License

BootStomp is a boot-loader bug finder. It looks for two different class of bugs: memory corruption and state storage vulnerabilities. For more info please refer to the BootStomp paper at https://seclab.cs.ucsb.edu/academic/publishing/#bootstomp-security-bootloaders-mobile-devices-2017

To run BootStomp's analyses, please read the following instructions. Note that BootStomp works with boot-loaders compiled for ARM architectures (32 and 64 bits both) and that results might slightly vary depending on angr and Z3's versions. This is because of the time angr takes to analyze basic blocks and to Z3's expression concretization results.


Directory structure

  • analysis: Contains analysis results (Ex: IDA idbs etc) of boot images of different devices.
  • tools: Contains tools that can be used to work with various images.

Pre-requisites

$ pip install angr

How to run it

Run BootStomp using docker

The easiest way to use BootStomp is to run it in a docker container. The folder docker contains an appropriate Dockerfile. These are the commands to use it.

cd docker
# build the docker image
docker build -t bootstomp .
# run the docker image (if you need, use proper options to have persistent changes or shared files)
docker run -it bootstomp

# now you are inside a docker container
cd BootStomp
# run BootStomp's taint analysis on one of the examples
# this will take about 30 minutes
python taint_analysis/bootloadertaint.py config/config.huawei
# the last line of the output will be something like:
# INFO    | 2017-10-14 01:54:10,617 | _CoreTaint | Results in /tmp/BootloaderTaint_fastboot.img_.out

# you can then "pretty print" the results using:
python taint_analysis/result_pretty_print.py /tmp/BootloaderTaint_fastboot.img_.out

The output should be something like this:

...
17)
===================== Start Info path =====================
Dereference address at: 0x5319cL
Reason: at location 0x5319cL a tainted variable is dereferenced and used as address.
...
Tainted Path 
----------------
0x52f3cL -> 0x52f78L -> 0x52f8cL -> 0x52fb8L -> 0x52fc8L -> 0x52fecL -> 0x53000L -> 0x53014L -> 0x5301cL -> 0x53030L -> 0x53044L -> 0x53050L -> 0x5305cL -> 0x53068L
===================== End Info path =====================
# Total sinks related alerts: 5
# Total loop related alerts: 8
# Total dereference related alerts: 4

Run BootStomp manually

Automatic detection of taint sources and sinks

  1. Load the boot-loader binary in IDA (we used v6.95). Depending on the CPU architecture of the phone it has been extracted from, 32 bit or 64 bit IDA is needed.
  2. From the menu-bar, run File => Script file => find_taint.py
  3. Output will appear in the file taint_source_sink.txt under the same directory as the boot-loader itself.

Configuration file

Create a JSON configuration file for the boot-loader binary (see examples in config/), where:

  • bootloader: boot-loader file path
  • info_path: boot-loader source/sink info file path (i.e., taint_source_sink.txt )
  • arch: architecture's number of bits (available options are 32 and 64)
  • enable_thumb: consider thumb mode (when needed) during the analysis
  • start_with_thumb: starts the analysis with thumb mode enabled
  • exit_on_dec_error: stop the analysis if some instructions cannot be decoded
  • unlock_addr: unlocking function address. This field is necessary only for finding insecure state storage vulnerabilities.

Finding memory corruption vulnerabilities

Run

python bootloadertaint.py config-file-path

Results will be stored in /tmp/BootloaderTaint_[boot-loader].out, where [boot-loader] is the name of the analyzed boot-loader. Note that paths involving loops might appear more than once.

Finding insecure state storage vulnerability

Run

python unlock_checker.py config-file-path

Results will be stored in /tmp/UnlockChecker_[boot-loader].out, where [boot-loader] is the name of the analyzed boot-loader. Note that paths involving loops might appear more than once.

Checking results

To check BootStomp results, use the script result_pretty_print.py, as follows:

python result_pretty_print.py results_file

Exploit for CVE-2017-2729

Other references

More Repositories

1

karonte

Karonte is a static analysis tool to detect multi-binary vulnerabilities in embedded firmware
Python
383
star
2

difuze

Fuzzer for Linux Kernel Drivers
C++
365
star
3

dr_checker

DR.CHECKER : A Soundy Vulnerability Detection Tool for Linux Kernel Drivers
C++
329
star
4

leakless

Function redirection via ELF tricks.
Python
156
star
5

hal-fuzz

Source code of HAL-fuzz
137
star
6

baredroid

Python
90
star
7

packware

Effects of packers on machine-learning-based malware classifiers that use only static analysis
Python
82
star
8

pretender

Automatic modeling of hardware to enable the rehosting of embedded firmware
C
80
star
9

greed

A symbolic execution engine for EVM smart contract binaries.
Python
73
star
10

agrigento

Agrigento is a tool to identify privacy leaks in Android apps by performing black-box differential analysis on the network traffic.
Python
69
star
11

monolithic-firmware-collection

Repository for monolithic firmware blobs
Python
68
star
12

goldphish

Arbitrage bot for the Ethereum blockchain
Python
56
star
13

popkorn-artifact

Python
55
star
14

boomerang

Exploiting the Semantic Gap in Trusted Execution Environments
C
54
star
15

sailfish

Data and code for the IEEE S&P'22 paper SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in Seconds
Python
50
star
16

heapster

Identify and test the security of dynamic memory allocators in monolithic firmware images
C
41
star
17

diane

DiAne is a smart fuzzer for IoT devices
Python
38
star
18

sasi

Signedness-Agnostic Strided-Interval
C++
34
star
19

actor

Source code for ACTOR, an action-guided kernel fuzzer (USENIX 2023 paper)
Go
27
star
20

android_ui_deception

Source code for our "What the App is That? Deception and Countermeasures in the Android User Interface" paper
Java
19
star
21

android_broken_fingers

Java
16
star
22

BullseyePoison

Bullseye Polytope Clean-Label Poisoning Attack
Python
14
star
23

autofacts

Towards Automatically Generating a Sound and Complete Dataset for Evaluating Static Analysis Tools
C++
14
star
24

syml

Python
13
star
25

symbexcel

Python
13
star
26

Neurlux

Code from the paper: Neurlux: Dynamic Malware Analysis Without Feature Engineering
Python
12
star
27

nft-security-study

Code and data of the CCS '22 paper titled "Understanding Security Issues in the NFT Ecosystem"
10
star
28

LoopMC

All code related to the LoopMC paper
Python
8
star
29

chainreactor

PDDL
8
star
30

ictf-service-samples

Sample services for the 2015 iCTF
Python
7
star
31

regulator-dynamic

C++
6
star
32

shimware

Python
6
star
33

turi

Python
5
star
34

DeepCASE-Dataset

5
star
35

bran

C
4
star
36

trust.io

A method for automatically protecting the physical interfaces on cyber-physical systems using TrustZone.
VHDL
4
star
37

hacrs

The human-assisted cyber reasoning system
JavaScript
4
star
38

jackal

Confusum Contractum: Confused Deputy Vulnerabilities in Ethereum Smart Contracts
Python
4
star
39

DeepCASE

Python
3
star
40

iCTF23

An educational CTF centered about the concept of AI and Cybersecurity
HTML
3
star
41

conware

Framework for automatically modeling hardware peripherals.
C
3
star
42

android_device_public

Java
3
star
43

columbus

Source code for Columbus (ICSE 2023 paper)
3
star
44

VenoMave

2
star
45

crush

Python
2
star
46

SECrow

Sources ad Guide for Secure Crowdsourced Location Tracking System paper.
Python
2
star
47

slither-sailfish

Modified Slither for Sailfish
Python
1
star
48

glitch_resistor

C++
1
star
49

cs177-ctfd-oracle-challenges

Plugin for CTFd to manage oracle challenges
Python
1
star
50

invisible-code

C
1
star
51

heapster-dataset-metadata

Collection of metadata for the firmware images used in Heapster
C
1
star
52

GUIDE-ENRICHER

Python
1
star