Contact Us Today 01642 716680

Buffer Overflow

Definition: A buffer overflow is a programming error where a process attempts to write more data to a fixed-length block of memory, or buffer, than it can hold, causing data to overflow into adjacent buffers, corrupting or overwriting the valid data held in them.

Buffer overflows are significant in cyber security due to their potential exploitation by attackers to disrupt the execution of a program and execute arbitrary code. A buffer overflow occurs when data exceeds a buffer’s storage capacity, leading to adjacent memory locations being overwritten. As a result, an attacker may manipulate the application and system behaviour by inserting malicious code into the memory spaces that have been corrupted.

The exploitation of buffer overflow vulnerabilities can lead to various adverse effects, ranging from a simple crash or data corruption to a full system compromise. These vulnerabilities are commonly associated with languages that do not enforce automatic bounds checking, such as C and C++. Attackers can use buffer overflows to alter the flow of execution within an application, particularly to inject malicious shellcode or cause the program to execute functions out of sequence, potentially allowing them to gain unauthorised access to system resources.

Mitigation strategies include using safer programming languages or practices that inherently check memory bounds, implementing stack canaries, address space randomisation (ASLR), data execution prevention (DEP), and conducting thorough testing and code review to identify and correct buffer overflows before software is released.

Inadequate buffer handling practices and the existence of this type of vulnerability underscore the importance of rigorous software development practices and security auditing. Buffer overflow mitigations are essential in designing secure systems and are a focal point for both developers and cyber security professionals.

Key Characteristics:

  • Involvement of writing more data than a buffer is allocated to handle
  • Potential to provoke program crashes or execute arbitrary code
  • Presence primarily in languages without automatic bounds checking
  • Addressed via secure coding techniques and system-level protections


  • Real-World Example: The infamous Morris Worm of 1988 exploited a buffer overflow in the Unix ‘fingerd’ network service to propagate itself and cause widespread disruption on early Internet systems.
  • Hypothetical Scenario: An online game’s chat function does not limit the length of messages. An attacker sends a specially crafted message that exceeds the expected length, causing a buffer overflow that overwrites critical parts of the game’s memory and allows the attacker to execute a payload granting them administrative privileges.

Related Terms:

  • Memory Safety: The state in which memory access operations are checked to prevent buffer overflows and related issues.
  • Shellcode: A small piece of code used as the payload in the exploitation of a software vulnerability, like a buffer overflow.
  • Stack Canary: A security mechanism that can detect a stack buffer overflow before execution of malicious code can occur.
  • Address Space Randomisation (ASLR): A system-level protection that helps prevent buffer overflow exploitation by randomising the location of a process’s address space.

What is the OWASP Top 10: Download our flash cards to find out.

Inside you will find a description of the most common web vulnerabilities.

Contact us

Get a free, no obligation quote from one of our expert staff.