Understanding the
buffer overflow and format string attacks
In computer
security and programming, a buffer overflow, or buffer overrun, is an anomaly where a program,
while writing data to a buffer, overruns the
buffer's boundary and overwrites adjacent memory. This is a special case of
violation of memory safety.
Buffer overflows can be
triggered by inputs that are designed to execute code, or alter the way the
program operates. This may result in erratic program behavior, including memory access
errors, incorrect results, a crash, or a breach of system
security. Thus, they are the basis of many software vulnerabilities and can be maliciously exploited.
Programming languages commonly associated
with buffer overflows include C and C++,
which provide no built-in protection against accessing or overwriting data in
any part of memory and do not automatically check that data written to an array
(the built-in buffer type) is within the boundaries of that array. Bounds
checking can
prevent buffer overflows.
FORMAT
STRING ATTACKS:
Uncontrolled format string is a type of software
vulnerability, discovered around 1999, that can be
used in security exploits.
Previously thought harmless, format
string exploits can be used
to crash a program or to execute harmful code.
The problem stems from the use of unchecked user
input as
the format string parameter in certain Cfunctions
that perform formatting, such as printf(). A malicious user may
use the
%s
and %x
format tokens, among others, to print data from the stack or
possibly other locations in memory. One may also write arbitrary data to
arbitrary locations using the %n
format token, which commands printf()
and similar functions to write the number of bytes formatted
to an address stored on the stack.
Comments
Post a Comment