Skip to content

NJUSeclab/PolymorphicCanaries

 
 

Repository files navigation

To-Detect-Stack-Buffer-Overflow-With-Polymorphic-Canaries.

=======================================================.
A High Efficient Protection against Brute-force Attacks =======================================================.

Authors

Publications

If you used our code, please cite our paper.

To Detect Stack Buffer Overflow with Polymorphic Canaries

@inproceedings{polymorphiccanaries,
  author = {Z. Wang and X. Ding and C. Pang and J. Guo and J. Zhu and B. Mao},
  booktitle = {2018 48th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN)},
  title = {To Detect Stack Buffer Overflow with Polymorphic Canaries},
  year = {2018},
  volume = {00},
  number = {},
  pages = {243-254},
  keywords={Security;Runtime;Instruments;Force;Tools;Instruction sets},
  doi = {10.1109/DSN.2018.00035},
  url = {doi.ieeecomputersociety.org/10.1109/DSN.2018.00035},
  ISSN = {2158-3927},
  month={Jun}
}

Installation

Compiler based PSSP

For program with source code.

Build Runtime Environment

# build runtime environment
$ cd /Runtime Environment
$ make

Build Compiler Plugin

Make your choose according your needs.

# build LLVM pass 
$ mkdir build && cd build
$ cmake ..
$ make
$ cd Compiler based Implementation/P-SSP
$ make

# build gcc plugin(if your compiler is GCC)
$ mkdir build && cd build
$ cmake ..
$ make
$ cd Compiler based Implementation/P-SSP
$ make

Compile your Program

GCC
# For small program, compile your application with the following (GNU GCC) flags: 
$ gcc -fstack-protector -fplugin=<PROJECT_SOURCE_DIR>/GCC_PLUGIN/PolymorphicCanaries.so test.c -o test

# For larger projects, adding `-fstack-protector',`-fno-omit-frame-pointer', and `-fplugin=<PROJECT_SOURCE_DIR>/GCC_PLUGIN/PolymorphicCanaries.so' to `CFLAGS'.
LLVM
# For small program, compile your application with the following flags: 
$ clang -Xclang -load -Xclang <PROJECT_SOURCE_DIR>/Compiler based Implementation/P-SSP/libStackDoubleProtector.so test.c -o test


# For larger projects, adding `-Xclang -load -Xclang <PROJECT_SOURCE_DIR>/Compiler based Implementation/P-SSP/libStackDoubleProtector.so' to `CFLAGS'.

Run your program with PSSP

# run 
$ export LD_PRELOAD=<PROJECT_SOURCE_DIR>/Runtime Environment/LIBPolymorphicCanaries.so
$ ./yourprogram

Binary rewriter

For program without source code.

Build Instrumentor

# Build runtime environment
$ cd Binary based implementation/dynamic linked proram/
$ make

# Rewrite your programs
$ ./Binary based implementation/dynamic linked proram/InstrumentationCode yourprogram

# Run your program with PSSP
$ export LD_PRELOAD=<PROJECT_SOURCE_DIR>/Runtime Environment/LIBPolymorphicCanaries.so
$ ./yourprogram

About

Implementation of Polymorphic Canaries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 55.5%
  • C 36.8%
  • CMake 3.7%
  • Python 2.7%
  • Makefile 1.3%