Common Attack Pattern Enumeration and Classification
A Community Resource for Identifying and Understanding Attacks
Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an attacker. As a consequence, an attacker is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the attackers' choice.
The most straightforward example is an application that reads in input from the user and stores it in an internal buffer but does not check that the size of the input data is less than or equal to the size of the buffer. If the user enters excessive length data, the buffer may overflow leading to the application crashing, or worse, enabling the user to cause execution of injected code.
Many web servers enforce security in web applications through the use of filter plugins. An example is the SiteMinder plugin used for authentication. An overflow in such a plugin, possibly through a long URL or redirect parameter, can allow an attacker not only to bypass the security checks but also execute arbitrary code on the target web server in the context of the user that runs the web server process.
Skill or Knowledge Level: Low
In most cases, overflowing a buffer does not require advanced skills beyond the ability to notice an overflow and stuff an input variable with content.
Skill or Knowledge Level: High
In cases of directed overflows, where the motive is to divert the flow of the program or application as per the attackers' bidding, high level skills are required. This may involve detailed knowledge of the target system architecture and kernel.
None: Detecting and exploiting a buffer overflow does not require any resources beyond knowledge of and access to the target system.
The attacker sends an overly long input in variables under his control. If the target system or application handles it gracefully, the attack becomes difficult. However, an error condition or a system crash point to a high likelihood of successful exploitation.
In cases where the attack is directed at a particular system or application, such as an operating system or a web server, the attacker can refer to system architecture and design documentation to figure out the exact point of injection and exploitation.
An attack designed to leverage a buffer overflow and redirect execution as per the attackers' bidding is fairly difficult to detect. An attack aimed solely at bringing the system down is usually preceded by a barrage of long inputs that make no sense. In either case, it is likely that the attacker would have resorted to a few hit-or-miss attempts that will be recorded in the system event logs, if they exist.
A buffer overflow attack itself is pretty difficult to obfuscate. There, however, exist fairly advanced techniques to obfuscate the payload, in order to bypass an intrusion detection system or filtering, either in the application or by means of an application firewall of some sorts.
Use a language or compiler that performs automatic bounds checking.
Use secure functions not vulnerable to buffer overflow.
If you have to use dangerous functions, make sure that you do boundary checking.
Compiler-based canary mechanisms such as StackGuard, ProPolice and the Microsoft Visual Studio /GS flag. Unless this provides automatic bounds checking, it is not a complete solution.
Use OS-level preventative functionality. Not a complete solution.
Utilize static source code analysis tools to identify potential buffer overflow weaknesses in the software.
A buffer overflow attack is an injection-driven attack with the payload delivered via user-controllable input. Any input that an adversary can control is a potential injection point if that input is not validated and is subsequently used in a vulnerable buffer-related operation.
The payload for a buffer overflow attack is an overly long input string, often containing system shell code or commands.
Denial of service, escalated privileges, execution of arbitrary code, including system commands and low-level assembly code.
All user-controllable input must be strictly validated for enforcement of length and semantic checks
All exception conditions (such as ArrayIndexOutOfBounds) in applications must be gracefully handled through use of available exception handling mechanisms.
All applications and processes must be run with minimum privileges necessary so as to avoid an escalation of privilege in case of a successful exploit.
More information is available — Please select a different filter.