NON MALICIOUS PROGRAM ERRORS

Being human, programmers and other developers make many mistakes, most of which are unintentional andnonmalicious. Many such errors cause program malfunctions but do not lead to more serious security vulnerabilities. However, a few classes of errors have plagued programmers and security professionals for decades, and there is no reason to believe they will disappear. In this section we consider three classic error types that have enabled many recent security breaches. We explain each type, why it is relevant to security, and how it can be prevented or mitigated.
Buffer Overflows: A buffer overflow is the computing equivalent of trying to pour two liters of water into a one-liter pitcher: Some water is going to spill out and make a mess. And in computing, what a mess these errors have madel.
Definition
A buffer (or array or string) is a space in which data can be held. A buffer resides in memory. Because memory is finite, a buffer's capacity is finite. For this reason, in many programming languages the programmer must declare the buffer's maximum size so that the compiler can set aside that amount of space. Unfortunately, in some languages, buffer sizes do not have to be predefined, so there is no way to detect an out-of-bounds error. More importantly, the code needed to check each subscript against its potential maximum value takes time and space during execution, and the resources are applied to catch a problem that occurs relatively infrequently. Even if the compiler were careful in analyzing the buffer declaration and use, this same problem can be caused with pointers, for which there is no reasonable way to define a proper limit. Thus, some compilers do not generate the code to check for exceeding bounds. Let us examine this problem more closely. It is important to recognize that the potential overflow causes a serious problem only in some instances. The problem's occurrence depends on what is adjacent to the array sample.All program and data elements are in memory during execution, sharing space with the operating   system, other code, and resident routines. So there are four cases to consider in deciding where the 'B'   goes. If the extra character overflows into the user's data space, it simply   overwrites an existing variable value (or it may be written into an as-yet unused location), perhaps   affecting the program's result, but affecting no other program or data.

 

References

  1. P. Pfleeger, Shari Lawrence Pfleeger Charles: Security in Computing, PHI
  2. Notes: Veer Surendra Sai University of Technology (VSSUT)

Next