CAPECattack pattern
CAPEC-24 Filter Failure through Buffer Overflow
High
Official page ↗
- Abstraction
- Detailed
- Status
- Draft
- Likelihood of attack
- High
- Typical severity
- High
- CAPEC version
- 3.9
Description
In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. the user input is let into the system unfiltered).
Execution flow
1. [Explore] [Survey] The attacker surveys the target application, possibly as a valid and authenticated user
2. [Experiment] [Attempt injections] Try to feed overly long data to the system. This can be done manually or a dynamic tool (black box) can be used to automate this. An attacker can also use a custom script for that purpose.
3. [Experiment] [Monitor responses] Watch for any indication of failure occurring. Carefully watch to see what happened when filter failure occurred. Did the data get in?
4. [Exploit] [Abuse the system through filter failure] An attacker writes a script to consistently induce the filter failure.
Prerequisites
• Ability to control the length of data passed to an active filter.
Skills required
• [Low] An attacker can simply overflow a buffer by inserting a long string into an attacker-modifiable injection vector. The result can be a DoS.
• [High] Exploiting a buffer overflow to inject malicious code into the stack of a software system or even the heap can require a higher skill level.
Consequences
• Integrity: Modify Data
• Confidentiality, Integrity, Availability: Execute Unauthorized Commands
• Confidentiality, Access Control, Authorization: Bypass Protection Mechanism
• Availability: Unreliable Execution
Mitigations
• Make sure that ANY failure occurring in the filtering or input validation routine is properly handled and that offending input is NOT allowed to go through. Basically make sure that the vault is closed when failure occurs.
• Pre-design: Use a language or compiler that performs automatic bounds checking.
• Pre-design through Build: 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.
• Operational: Use OS-level preventative functionality. Not a complete solution.
• Design: Use an abstraction library to abstract away risky APIs. Not a complete solution.
Related
Child of · CAPEC (1)
- CAPEC-100 Overflow Buffers attack pattern
Weakness · CWE (8)
- CWE-118 Incorrect Access of Indexable Resource weakness
- 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-20 Improper Input Validation weakness
- CWE-680 Integer Overflow to Buffer Overflow weakness
- CWE-697 Incorrect Comparison weakness
- CWE-733 Compiler Optimization Removal or Modification of Security-critical Code weakness
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness
Referenced by CWE · attack pattern (8)
- CWE-118 Incorrect Access of Indexable Resource weakness
- 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-20 Improper Input Validation weakness
- CWE-680 Integer Overflow to Buffer Overflow weakness
- CWE-697 Incorrect Comparison weakness
- CWE-733 Compiler Optimization Removal or Modification of Security-critical Code weakness
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness