CAPEC-100: Overflow Buffers
Description
Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an adversary. As a consequence, an adversary 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 adversaries' choice.
- Likelihood of attack
- High
- Typical severity
- Very High
- Abstraction
- StandardA specific methodology or technique used in an attack.
Mechanism of attack: Manipulate Data Structures
Prerequisites
- Targeted software performs buffer operations.
- Targeted software inadequately performs bounds-checking on buffer operations.
- Adversary has the capability to influence the input to buffer operations.
Skills required
- LowIn most cases, overflowing a buffer does not require advanced skills beyond the ability to notice an overflow and stuff an input variable with content.
- HighIn cases of directed overflows, where the motive is to divert the flow of the program or application as per the adversaries' bidding, high level skills are required. This may involve detailed knowledge of the target system architecture and kernel.
Consequences
- Availability
Unreliable Execution
- ConfidentialityIntegrityAvailability
Execute Unauthorized Commands
Run Arbitrary Code
- ConfidentialityAccess ControlAuthorization
Gain Privileges
Mitigations
- 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.
Related weaknesses (CWE)
- CWE-119Improper Restriction of Operations within the Bounds of a Memory Buffer
- CWE-120Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
- CWE-129Improper Validation of Array Index
- CWE-131Incorrect Calculation of Buffer Size
- CWE-680Integer Overflow to Buffer Overflow
- CWE-805Buffer Access with Incorrect Length Value
Related attack patterns
Parent
More specific patterns
- CAPEC-8Buffer Overflow in an API CallDetailed
- CAPEC-9Buffer Overflow in Local Command-Line UtilitiesDetailed
- CAPEC-10Buffer Overflow via Environment VariablesDetailed
- CAPEC-14Client-side Injection-induced Buffer OverflowDetailed
- CAPEC-24Filter Failure through Buffer OverflowDetailed
- CAPEC-42MIME ConversionDetailed
- CAPEC-44Overflow Binary Resource FileDetailed
- CAPEC-45Buffer Overflow via Symbolic LinksDetailed
- CAPEC-46Overflow Variables and TagsDetailed
- CAPEC-47Buffer Overflow via Parameter ExpansionDetailed
- CAPEC-67String Format Overflow in syslog()Detailed
- CAPEC-256SOAP Array OverflowDetailed