Name |
Filter Failure through Buffer Overflow |
|
Likelyhood of attack |
Typical severity |
High |
High |
|
Summary |
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). |
Prerequisites |
Ability to control the length of data passed to an active filter. |
Execution Flow |
Step |
Phase |
Description |
Techniques |
1 |
Explore |
[Survey] The attacker surveys the target application, possibly as a valid and authenticated user |
- Spidering web sites for inputs that involve potential filtering
- Brute force guessing of filtered inputs
|
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. |
- Brute force attack through black box penetration test tool.
- Fuzzing of communications protocols
- Manual testing of possible inputs with attack data.
|
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? |
- Boron tagging. Choose clear attack inputs that are easy to notice in output. In binary this is often 0xa5a5a5a5 (alternating 1s and 0s). Another obvious tag value is all zeroes, but it is not always obvious what goes wrong if the null values get into the data.
- Check Log files. An attacker with access to log files can look at the outcome of bad input.
|
4 |
Exploit |
[Abuse the system through filter failure] An attacker writes a script to consistently induce the filter failure. |
- DoS through filter failure. The attacker causes the system to crash or stay down because of its failure to filter properly.
- Malicious code execution. An attacker introduces a malicious payload and executes arbitrary code on the target system.
- An attacker can use the filter failure to introduce malicious data into the system and leverage a subsequent SQL injection, Cross Site Scripting, Command Injection or similar weakness if it exists.
|
|
Solutions | 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 Weaknesses |
CWE ID
|
Description
|
CWE-20 |
Improper Input Validation |
CWE-74 |
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') |
CWE-118 |
Incorrect Access of Indexable Resource ('Range Error') |
CWE-119 |
Improper Restriction of Operations within the Bounds of a Memory Buffer |
CWE-120 |
Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') |
CWE-680 |
Integer Overflow to Buffer Overflow |
CWE-697 |
Incorrect Comparison |
CWE-733 |
Compiler Optimization Removal or Modification of Security-critical Code |
|
Related CAPECS |
CAPEC ID
|
Description
|
CAPEC-100 |
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. |
|