Giter Club home page Giter Club logo

llvm-stack-guard's Introduction

Simplified LLVM StackProtector

This is a simplified llvm Stackprotector which can only run on the x86_64 machine, if you want to build this project on your own machine, you can follow the following steps:

  1. You should make sure that llvm is properly built on your machine. The tuotorial can be found from the link

  2. First, clone the git repository into your workspace

git clone https://github.com/bin2415/llvm-stack-guard.git
  1. Second, mkdir a dirtory named build and cmake in it
mkdir build && cd ./build
cmake ../
make
  1. Then, you can find a .so file in /build/SSPPass/

  2. In test folder, you can find the test file named stack_example.c

  3. Compile it through clang

clang -S -emit-llvm -o stack_example.ll stack_example.c
  1. Use the pass to protect stack.
opt -load ../build/SSPPass/libSSPass.so -SSPPass stack_example.ll -S -o stack_example_protect.ll
  1. Use the llc tool to generate .o file
llc -filetype=obj stack_example_protect.ll -o stack_example_protect.o
  1. Use clang to generate a binary file
clang -o stack_example_llvm stack_example_protect.o
  1. Run the example file and input 111111111111111111111111 to corrupt the program
./stack_example_llvm
111111111111111111111111111111111

And the result is shown as belows:

corrupt

  1. You can disassemble the binary to find code that implement the stack smashing protect
objdump -S stack_example_llvm > stack_example_llvm.s
vi stack_example_llvm.s

disassemble code

Enjoy doing it!

llvm-stack-guard's People

Contributors

pangbin2415 avatar

Watchers

 avatar  avatar

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.