GCC Compiler – How to install the GCC Compiler on Windows 7 and create a Buffer Overflow – The Visual Guide
The GCC Compiler runs on Windows 7, this is how to install it.
Step 1 – Download GCC Compiler
Step 2 – Run Installer
Right click the install.exe and “Run as Administrator”
Select 32 or 64 bit Architecture (defaults is 32 bit)
Allow some time to download > Next
That’s it – GCC is now installed.
Step 3 – Download Notepad++
Download it here:
Save your programs as *filename.c
(.c is for c programs).
Step 4 – Write a Buffer Overflow in Notepad++
Copy this program into Notepad++ to test out your GCC compiler.
When you run the buffer.c program – it will crash.
Code – for buffer overflow
int main (int argc, char* argv) //start of main
char smallbuff; //8 chars in buffer
}//end of main
Step 5 – Launch the GCC Compiler
Start > All Programs
MinGw > x64-4.8.1 > Run Terminal
I created c: test directory to store all notepad programs. Note c:\test\buffer.c
cd c:\test (to get to our test directory)
Now we compile and generate buffer.exe – which we run.
gcc buffer.c -o buffer.exe