This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Testing for DoS Buffer Overflows (OWASP-DS-003)"

From OWASP
Jump to: navigation, search
Line 2: Line 2:
 
{{Template:OWASP Testing Guide v2}}
 
{{Template:OWASP Testing Guide v2}}
  
Any language where the developer has direct responsibility for managing memory allocation, most notably C & C++, has the potential for a buffer overflow. While the most serious risk related to a buffer overflow is the ability to execute arbitrary code on the server, the first risk comes from the denial of service that can happen if the application crashes. Buffer overflows will be discussed in more detail elsewhere in this testing document, but we will briefly give an example as it relates to an application denial of service.
+
== Brief Summary ==
 +
In this test we check whether it is possible to cause a denial of service condition by overflowing one or more data structures of the target application.
  
==Code Example==
+
== Description of the Issue ==
 +
Any language where the developer has direct responsibility for managing memory allocation, most notably C & C++, has the potential for a buffer overflow. While the most serious risk related to a buffer overflow is the ability to execute arbitrary code on the server, the first risk comes from the denial of service that can happen if the application crashes. Buffer overflows are discussed in more detail elsewhere in this testing document, but we will briefly give an example as it relates to an application denial of service. 
  
 
The following is a simplified example of vulnerable code in C:
 
The following is a simplified example of vulnerable code in C:
Line 20: Line 22:
 
</pre>
 
</pre>
  
If this code example were executed, it would cause a segmentation fault and dump core. While this above example is an extremely simple case, the reality is that in a web based application there may be places where the str value was not static, but rather taken from a value provided within a name/value pair.
+
If this code example were executed, it would cause a segmentation fault and dump core. The reason is that strcpy would try to copy 53 characters into an array of 10 elements only, overwriting adjacent memory locations. While this example above is an extremely simple case, the reality is that in a web based application there may be places where the user input is not adequately checked for its length, making this kind of attack possible.
  
==Testing Black Box==
+
==Black Box Testing==
  
Refer to the Buffer Overflow section for how to submit a range of lengths to the application looking for possible locations that may be vulnerable.  As it relates to a DoS, if you have received a message that makes you believe that the overflow has occurred, attempt to make another legitimate request from the server and see if it still responsds.
+
Refer to the [[Buffer_Overflow_Testing_AoC]] section for how to submit a range of lengths to the application looking for possible locations that may be vulnerable.  As it relates to a DoS, if you have received a response (or a lack of) that makes you believe that the overflow has occurred, attempt to make another request to the server and see if it still responds.
  
==Testing White Box==
+
==Gray Box Testing==
Please refer to the Buffer Overflow section of this document for detailed information on this testing.
+
Please refer to the [[Buffer_Overflow_Testing_AoC]] section of the Guide for detailed information on this testing.
  
 
{{Category:OWASP Testing Project AoC}}
 
{{Category:OWASP Testing Project AoC}}
 
[[category:Denial of Service Attack]]
 
[[category:Denial of Service Attack]]
 
[[category:Buffer Overflow Attack]]
 
[[category:Buffer Overflow Attack]]

Revision as of 23:09, 13 November 2006

[Up]
OWASP Testing Guide v2 Table of Contents

Brief Summary

In this test we check whether it is possible to cause a denial of service condition by overflowing one or more data structures of the target application.

Description of the Issue

Any language where the developer has direct responsibility for managing memory allocation, most notably C & C++, has the potential for a buffer overflow. While the most serious risk related to a buffer overflow is the ability to execute arbitrary code on the server, the first risk comes from the denial of service that can happen if the application crashes. Buffer overflows are discussed in more detail elsewhere in this testing document, but we will briefly give an example as it relates to an application denial of service.

The following is a simplified example of vulnerable code in C:

void overflow (char *str) {
   char buffer[10];
   strcpy(buffer, str); // Dangerous!
}

int main () {
  char *str = "This is a string that is larger than the buffer of 10";
  overflow(str);
}

If this code example were executed, it would cause a segmentation fault and dump core. The reason is that strcpy would try to copy 53 characters into an array of 10 elements only, overwriting adjacent memory locations. While this example above is an extremely simple case, the reality is that in a web based application there may be places where the user input is not adequately checked for its length, making this kind of attack possible.

Black Box Testing

Refer to the Buffer_Overflow_Testing_AoC section for how to submit a range of lengths to the application looking for possible locations that may be vulnerable. As it relates to a DoS, if you have received a response (or a lack of) that makes you believe that the overflow has occurred, attempt to make another request to the server and see if it still responds.

Gray Box Testing

Please refer to the Buffer_Overflow_Testing_AoC section of the Guide for detailed information on this testing.


OWASP Testing Guide v2

Here is the OWASP Testing Guide v2 Table of Contents