Giter Club home page Giter Club logo

usbs's Introduction

μSBS (Discovery and Identification of Memory Corruption Vulnerabilities on Bare-metal Embedded Devices)

μSBS: Static Binary Sanitization of Bare-metal Embedded Devices

Required packages

μSBS requires Python2 and is built on several open-source tools.

  • capstone (for linear disassembling)
  • keystone (for assembling)
  • pyelftools (for reading elf binaries)
  • LIEF (for modifying elf sections and segments)

To simplify the setup, we provide a Dockerfile with which you can enjoy an already setup environment.

Starting the container

  1. git clone and cd into this repo.
  2. make run will build the Docker images specified Dockerfile and run a container. See Makefile for parameters.
  3. Within the container you will have access to usbs: python -m usbs -h

Executing μSBS

In order to execute μSBS just for binary translation, you can run uSBS.py with the binary firmware as an argument. Furthermore, for instrumenting the binary, you need to run asan.py with firmware binary as an argument.

Note 1: The asan.py can be modified for any instrumentation policy (i.e. other sanitization policies).

Note 2 This project has been tested on Ubuntu 18.04 and with STM32 NUCLEO-F401RE and STM32479I-Eval boards.

Flashing the STM32 device and running the application

Connect to the OpenOCD server and upload the program with the following commands:

  • telnet localhost 4444
  • init
  • reset init
  • halt
  • flash write_image erase (application_name).elf
  • exit

Citing

The following publication cover technical parts of μSBS project:

@inproceedings{μSBS:RAID2020,
  author    = {Majid Salehi and Danny Hughes and Bruno Crispo},
  title     = {μSBS: Static Binary Sanitization of Bare-metal Embedded Devices for Fault Observability},
  booktitle = {Proceedings of the 23rd International Symposium on Research in Attacks, Intrusions and Defenses (RAID'20)},
  address = {San Sebastian},
  pages = {381--395},
  url = {https://www.usenix.org/conference/raid2020/presentation/salehi},
  publisher = {{USENIX} Association},
  year      = {2020},
  month     = {OCTOBER}
}

usbs's People

Contributors

0ddc0de avatar ddlucad96 avatar pwnforce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

usbs's Issues

Invalid configuration for installing requirements in docker container

Hi,
when I clone the repository and run "make run" to build the docker container, the installation fails due to the package "setuptools", which has to have a version higher than 46.4.0. To fix this issue and be able to run the docker container properly, I changed this line in the Dockerfile:

RUN pip install pathlib2 lief==0.8.0.post7 pwntools==4.3.1 keystone-engine==0.9.2 six==1.16.0
to
RUN pip install pyelftools==0.24 pathlib2 lief==0.8.0.post7 pwntools==4.3.1 keystone-engine==0.9.2 six==1.16.0
This way I am able to build to docker container properly.

Could you change this in the Dockerfile configuration?
Thanks!

How do I download the rewritten binary to target?

Hello,

I was trying to rewrite the binary with uSBS. I encountered some problems:

  1. Based on the paper, the firmware entry point would be redirected to .newsec (.newtext) section (Am I correct?) Does this mean it's enough to download .newtext section to the target device? Do I still need to dowoload the original binary to the flash memory as well? In the former case, if download the .newtext section to my Nucleo-F401RE board, it traps into hard fault. In the latter case, it runs the original firmware, other than the rewritten one

  2. I rewrote the firmware using the command line provided in the readme, it seems that it only translated the binary but didn't instrument ASan. How do I enable ASan instrumentation?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.