Monday, 30 April 2018

Buffer OverFlow:What Is Buffer Overflow? Buffer Overflow Attack Example

In this tutorial, I will be going to tell you about
buffer overflow.What is Buffer Overflow?I will show
you a buffer overflow attack example.So, Let's start
what is a buffer overflow?

A buffer overflow occurs whenever a program or a process tries to put more data into a fixed length block of memory or than the buffer is allocated to hold.Buffers are made to hold a specific or defined amount of data,  the unnecessary data can overwrite other data values in memory unless the program includes discard data when too much is data is being sent to memory. If an attacker is able to exploit the buffer overflow.He will be able to crash the program process or can modify its internal values. Buffer overflow is a most common vulnerability. It ranks high in top 25 Most Dangerous  Software errors and is specified as CWE-120 under the common weakness Enumeration dictionary of weakness types.

A buffer overflow can occur knowingly, but it can also occur whenever a malicious actor sends
crafted input to a program that tries to store the received data into a buffer, that is not large
enough to store that input.

If more data is written to the contiguous buffer, it can overwrite any other data held there.If the original data includes the exploited function's return pointer, the address where the process would go next, an attacker can set the new values to point to an address of his choosing values. The attacker sets the new values to point to a location where the exploit has been set.
This changes the path of execution of the process and actually moves the control to the attacker's vicious code.

Today In programming languages like C and C++ are prostrate to buffer overflow attacks
because there is no built-in protection against overwriting data in any part of their memory and attackers can perform direct memory manipulation with current programming constructs.
Latest Programming languages like C#, Java, and Perl abate the chances of buffer overflow
vulnerabilities, but buffer overflow can exist in any programming environment where
direct memory manipulation is allowed.

Techniques that are used to exploit buffer overflow vulnerabilities vary based on the operating
system being used and programming language, but the goal is to dispense computer's memory
to control the program execution. Buffer Overflows are classified according to the position of the buffer in the process memory, Two main types of buffer overflow are stack-based overflow and heap-based overflow.

The stack is a prolonged space in memory used to organize data associated with function calls,
 that  includes function parameters, local variables, and management information, like
frame and instruction pointers.

The heap is a structure of memory that is used to manage dynamic memory. Programmers mostly use the heap to allocate memory whose size is not known at the time of compiling,
where the amount of memory required is too large to fit on the stack.

There is another buffer overflow attack that is integer overflow, which is when a number is used in an operation, the result of which require more memory to store.
Let's take an example, 8 bits of memory requires storing the number 192, if the process adds 64 to this number, the answer 256 will not fit in the allocated memory because it requires 9 bits.

Buffer overflow vulnerability can occur in both web or application servers. When web apps use
libraries, such as a graphics library to create images, they become prone to potential buffer
overflow attacks.

How to Protect yourself from buffer overflow attack

Check for the latest bug reports of your web and application server products and other products in your internet infrastructure. Assign the latest patches to these products. Keep scanning your site periodically with the best and commonly available scanner to look for the buffer overflow and other vulnerabilities. Check your custom application code manually that takes input from the users via HTTP request and make sure that it checks for the appropriate size on all such inputs.


This Is The Oldest Page
This Is The Oldest Page

Delivered by FeedBurner