https://github.com/dhavalkapil/stack-guard
A toy implementation of 'Stack Guard' on top of the LLVM compiler toolchain
https://github.com/dhavalkapil/stack-guard
clang llvm stack taint-analysis
Last synced: 12 months ago
JSON representation
A toy implementation of 'Stack Guard' on top of the LLVM compiler toolchain
- Host: GitHub
- URL: https://github.com/dhavalkapil/stack-guard
- Owner: DhavalKapil
- License: mit
- Created: 2017-06-30T16:01:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-01T17:48:55.000Z (over 8 years ago)
- Last Synced: 2025-03-21T05:12:03.244Z (about 1 year ago)
- Topics: clang, llvm, stack, taint-analysis
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 24
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stack-guard
A toy implementation of 'Stack Guard' on top of the [LLVM](http://llvm.org/) compiler toolchain.
Instrumentation code is added during compilation process to insert and verify stack canaries. Local variables (on the stack) are reordered to prevent buffers overflowing into other local variables. Vulnerable buffers are identified by performing a simple version of static taint analysis. Dependencies are maintained between function calls and pointer manipulations.
**Note**: This was developed as a hobby project for fun. It should only be used for educational purposes. Some of its features could be implemented in a much simpler way, but I choose techniques which involved more of LLVM API, just to get used to it.
## Installation
StackGuard requires `cmake` >= 3.8. It has been tested on llvm 3.5 and clang 3.5.
To build:
```
mkdir build && cd build
cmake -DLLVM_ROOT=/path/to/llvm/build ..
make
```
## Usage
```
clang -Xload -load -Xload /path/to/StackGuard/build/StackGuardPass/LLVMStackGuardPass.so
```
Tests are present in `./tests`. Run them using:
```
make test
```
## License
StackGuard is licensed under the [MIT license](https://dhaval.mit-license.org/2017/license.txt).