Skip to content

Demonstrating buffer overflow attack in 32 Bit and 64 Bit binaries within 20 lines of C code.

Notifications You must be signed in to change notification settings

bnlrnz/buffer_overflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buffer_overflow

Demonstrating buffer overflow in 32 Bit and 64 Bit binaries. The binaries are compiled as position dependent code/executable (-no-pie).

Makefile / Run buffer overflow

make       # will build the binaries and payloads
./vuln32 < payload32
./vuln64 < payload64

make run   # will build the binaries and payloads, and runs both binaries with the payload as input
make run32 # like run, but just for 32 Bit
make run64 # like run, but just for 64 Bit
make clean # you know what it does

PIE/PIC

If you enable PIE/PIC you need to recalculate the function address of "secretFunction" and run the buffer overflow in gdb (which disables aslr internally) or temporarily deactivate aslr globally for your kernel or locally in a shell session.

Global (needs root)

echo 0 | sudo tee /proc/sys/kernel/randomize_va_space

Don't forget to enable afterwards:

echo 2 | sudo tee /proc/sys/kernel/randomize_va_space

Local

setarch -R /bin/bash

About

Demonstrating buffer overflow attack in 32 Bit and 64 Bit binaries within 20 lines of C code.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published