***___ Intro To Buffer Overflows: My knowledge and research ___***

Hello, and welcome to my newest tutorial that is a relatively short one that I will use to briefly describe in simple (n00bish) terms for those starting out and learning about Buffer Overflows.. Let's jump into action!

What Is A Buffer Overflow?

My goal while explaining this to you is to make this as simple to understand as possible. So, here goes.. A Buffer Overflow can easily be defined as a problem where a specific active process tries to hold more data in a single buffer than the memory inside it will hold, thus causing an overflow. It is generally an attack on the data integrity of a system. However, what is a buffer, you may be asking? A buffer can simply be defined as a temporary data storage area. Simply put, no? Anyways, what ends up happening as a result, is the extra data will end up causing problems and/or corrupting data stored in additional/extra memory locations. Buffer Overflows have been known to and are used to sometimes crash a specific process, usually one vital to a system. Because this is a problem that damages the memory locations in a system that hold data, this has proven to be the "backbone" to many other exploits.. ones that are typically far more advanced (obviously).

Spyder's Fast Fact: Buffer Overflows are typically coded in C/C++ (AFAIK, they are the only ones.. but I'm not 100% on that). To fully grasp the attack however, one should have a good understanding of those two languages AND any advanced programming language for that matter.

Here's a small example of a code snippet that would work:

 int main () {
    int buffer[40];
    buffer[120] = 40;
As you can see, the allocated memory unit for this buffer is 40. This program (when compiled, obviously) would attempt to write past that allocated amount, thus causing some unexpected problems. Not good... Another example:

void function (char *str) {
   char buffer[32];
   strcpy (buffer, str);
int main () {
  char *str = "I am greater than 32 bytes"; // length of str = 89 bytes
  function (str);
The problem in this would be obvious -- a string of 89 bytes has been transfered into a buffer with a memory allocation of 32 bytes.. thus, once again.. causing the buffer to overflow with data (ahh, we're getting the meaning behind "Buffer Overflow" now, aren't we? ). Which in turn, corrupts the data, files could be lost, and all hell breaks loose.


Despite it's smooth sounding name and rather lack of public hearsay, the Buffer Overflow attack isn't as complicated as many would have it out to be. Now, understanding Stack Regions and the problems associated with it while corrupting the process stack is a tad complicated.. something I'm still getting down myself and it's something that I'll possibly make a tutorial out of somewhere down the line. But there you have it -- a very simple, begginers explanation of a buffer overflow.

Anyways, hope you enjoyed the little tutorial.. my goal was meant to merely educate those new to the subject, not go in-depth about it. For those who want a more in-depth explanation or for further re-iteration, PM me or post here that you'd like to see this be made into a series.