CAPECattack pattern

CAPEC-100 Overflow Buffers

Very High Official page ↗
Abstraction
Standard
Status
Draft
Likelihood of attack
High
Typical severity
Very High
CAPEC version
3.9

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.

Execution flow

1. [Explore] [Identify target application] The adversary identifies a target application or program to perform the buffer overflow on. Adversaries often look for applications that accept user input and that perform manual memory management. 2. [Experiment] [Find injection vector] The adversary identifies an injection vector to deliver the excessive content to the targeted application's buffer. 3. [Experiment] [Craft overflow content] The adversary crafts the content to be injected. If the intent is to simply cause the software to crash, the content need only consist of an excessive quantity of random data. If the intent is to leverage the overflow for execution of arbitrary code, the adversary crafts the payload in such a way that the overwritten return address is replaced with one of the adversary's choosing. 4. [Exploit] [Overflow the buffer] Using the injection vector, the adversary injects the crafted overflow content into the buffer.

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

• [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. • [High] In 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 • Confidentiality, Integrity, Availability: Execute Unauthorized Commands • Confidentiality, Access Control, Authorization: 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

Child of · CAPEC (1)

  • CAPEC-123 Buffer Manipulation attack pattern

Weakness · CWE (6)

  • CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer weakness
  • CWE-120 Buffer Copy without Checking Size of Input weakness
  • CWE-129 Improper Validation of Array Index weakness
  • CWE-131 Incorrect Calculation of Buffer Size weakness
  • CWE-680 Integer Overflow to Buffer Overflow weakness
  • CWE-805 Buffer Access with Incorrect Length Value weakness

Referenced by CAPEC · can follow (1)

  • CAPEC-234 Hijacking a privileged process attack pattern

Referenced by CAPEC · child of (12)

  • CAPEC-10 Buffer Overflow via Environment Variables attack pattern
  • CAPEC-14 Client-side Injection-induced Buffer Overflow attack pattern
  • CAPEC-24 Filter Failure through Buffer Overflow attack pattern
  • CAPEC-256 SOAP Array Overflow attack pattern
  • CAPEC-42 MIME Conversion attack pattern
  • CAPEC-44 Overflow Binary Resource File attack pattern
  • CAPEC-45 Buffer Overflow via Symbolic Links attack pattern
  • CAPEC-46 Overflow Variables and Tags attack pattern
  • CAPEC-47 Buffer Overflow via Parameter Expansion attack pattern
  • CAPEC-67 String Format Overflow in syslog() attack pattern
  • CAPEC-8 Buffer Overflow in an API Call attack pattern
  • CAPEC-9 Buffer Overflow in Local Command-Line Utilities attack pattern

Referenced by CWE · attack pattern (6)

  • CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer weakness
  • CWE-120 Buffer Copy without Checking Size of Input weakness
  • CWE-129 Improper Validation of Array Index weakness
  • CWE-131 Incorrect Calculation of Buffer Size weakness
  • CWE-680 Integer Overflow to Buffer Overflow weakness
  • CWE-805 Buffer Access with Incorrect Length Value weakness