Small wrapper C library that remembers malloc's with their max-sizes and helps convert vulnerable overflow calls to safer calls
Compile:
gcc -shared -fPIC -fno-builtin -o <libsafer.so> wrapper.c linkedlist.c -ldl
Run:
LD_PRELOAD=./<libsafe.so> <path to binary>
Test Cases in test_cases folder. Running them without LD_PRELOAD should give seg-faults/memory corruption.
Bugs:
- dlsym - calloc recursive call loops
- Known seg-faults with vim, gdb and python
Further Improvements :
- Use hashmap instead of linked list for linear performance
- See if malloc-hooks is a better approach
- See if something is possible for dealing with stack based buffers