Skip to content

seoProductions/stack-buffer-overflows

Repository files navigation

Performing Buffer overflows

Here i'm learning how the stack memory & Frames work. I also learned how to use the Gnu Debugger image

Writing to non const integer in C

#include <stdio.h>

void function()
{
    int modify_me = 8;
    char buff[8];
    gets(buff);

    printf("value is %i", modify_me);
}

int main()
{
    function();
}
image

The Result

I am able to modify the variables allocated above the buffer in stack memory. I set the variable modify_me from 8 to 12345 image

Learning & Reference

Write the word 'pikachu' followed by nop

perl -e 'print pack("H*", "70696B61636875909090a0");' 

Or write it to a binary file

perl -e "print pack('H*', '48656c6c6f');" > input.bin 

View contents

cat input.bin  | hexdump -C

Compile with 0 saftey 🫨

gcc program.c -g -fno-stack-protector

start debuging

 gdb a.out

# with pipe redirection
(gdb) start < input.bin 

view memory at the $sp stack pointer

x/10xw $sp

# view hex bytes
x/16bx $sp

# view 8 byte chunks fowarding the stack pointer
x/10gx $sp

What I Learned

This was very difficult and low level for me (at the time of writing this! 6/13/2026) but JUST as interesting. I didnt feel too too intimidated since I have reversed Engineered programs from https://crackmes.one/ using x64dbg . This was during my senior year in highschool- I managed to crack 2 programs, but this time I went DEEP into the topics of buffer overflows. I was amazed to see how this hacking technique was used in the Morris Worm attacking the Networking services used back in the 90's.

At the time of writing this- this is my 3rd attempt! I tried 2 times back in April & I failed miserably. Looking foward to learning more about software and deployment security in the near future 🙂 ima go touch grass now ive been sitting here forever ha!

About

Intro to Computer Security

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors