Vous êtes sur la page 1sur 5

Buffer Overflow and its latest attacks

Gukhool M. Rizwan
C-DAC School Of Advanced Computing

Abstract 2. How does Buffer overflow occur?


Buffer overflow is one of the vulnerabilities which has Basically the problem occurs due to lack of good
become more and more common, especially for the past practices by programmers.
ten years. The damages due to its flaw have been great  When the variable is not null terminated (\n),
and one of its first exploitation is the Internet Worm of which means that the variable can be of infinite
1988. length.
On top of that, Buffer overflow vulnerabilities has
 When using string functions (strcpy(), strcat(),
become dominant in the area of remote network
penetration vulnerabilities, where an anonymous Internet sprintf(), gets(), scanf()) and verifications are not
user seeks to gain partial or total control of a host [1]. made

1. Introduction 3. Simple Example


Buffer overflow or Buffer overrun occurs when a process
function(char *buf_src)
or program writes more data into the buffer than the
{ char buf_dest[16];
memory allocated. The additional space taken by the data
strcpy(buf_dest, buf_src);
overwrites adjacent memory space, resulting in abnormal
}
behavior.
/* main function */
This situation can easily be exploited by malicious people
main()
who can take control of the program execution path and
{ int i;
execute their desired code instead of that of the program.
char str[256];
Buffer overflow is related to C programming language
for(i=0; i<256; i++) str[i] = ‘a’;
and it was discovered around 1972-1973. The very first
function(str);
exploit occurred in 1988 when over 6000 systems were
}
shutdown in a few hours by the famous Internet Worm [2,
3].
To this date (13 June 2010), 5415 cases of buffer Note that a buffer of 16 has been allocated for the
overflow have been listed as vulnerabilities in destination but the size of the array is 256 and no size
cve.mitre.org and out of these around 130 are for the year checking/ verification is being made.
2010 only. The latest record (CVE-2010-2102) which is There is no doubt that a buffer overflow will occur, where
still under review is a case where Buffer overflow occurs data will be overwriting adjacent memory.
in Webby Webserver 1.01 allowing remote attackers to
execute arbitrary code via a long HTTP GET request [4].
The statistics of vulnerabilities at web.nvd.nist.gov show
that there have been 5315 records. The latest record
(published on 06/15/2010: CVE-2010-2185) is that of
Buffer overflow in Adobe Flash Player before 9.0.277.0
and 10.x before 10.1.53.64, and Adobe AIR before
2.0.2.12610, might allow attackers to execute arbitrary
code via unspecified vectors. [5].

The overall goal of a buffer overflow attack is to


Overflow completely the function of a privileged program
so that the attacker can take control of that program, and
if the program is sufficiently privileged, thence control
the host [1].
Figure 1: Memory Stack
We can see from figure 1 that the content of array code. When the subroutine terminates, the program jumps
str(256-character ‘a’s, i.e., 0x616161…) has already to the malicious code, and that code is executed. The
overwritten all the former contents from buf_dest to results of executing the attacker’s malicious code could be
buf_dest+256, including the EBP and RET saved when catastrophic. If the malicious code reformats the system’s
function calling. So when the function exits, it will return hard drive, crucial data may be lost, and significant time
to 0x61616161, the segment fault occurred. will be wasted rebuilding the system.
Buffer overflow can change the executing sequence of Just as easily, the malicious code could attack other
program. If we can write a starting address of an elaborate machines, install backdoors, steal passwords, or any
attack code to RET, the system can be hijacked. If the number of other possibilities. The malicious code runs
attacked program having the suid bit and the attacking under the process context of the application it is attacking.
code get an interactive Shell, the hacker will get the root Thus, if the application has root- or administrator-level
privilege. This is the main method used by hackers [6]. privileges, the code will run as root and be able to execute
any command. If the application is not running as root,
4. Exploitation of the buffer overflow the attacker can still use a buffer overflow exploit to load
vulnerability a privilege escalation exploit which would then give the
If the attacker sends 1000 characters that are carefully desired root privileges. Thus, buffer overflow exploits are
chosen, he or she can control the return address. Rather very useful to attackers [7].
than jumping to a non-existent address, the attacker can
instruct the program to jump to the address of malicious 4.2. Heap Exploitation
exploit code. There are two tasks that must be performed Memory on the heap is dynamically allocated by the
to accomplish: application at run-time and typically contains program
 Loading the malicious code data. Exploitation is performed by corrupting this data in
 Executing the malicious code specific ways to cause the application to overwrite
internal structures such as linked list pointers. The
There are 2 types of exploitation: canonical heap overflow technique overwrites dynamic
 Stack memory allocation linkage (such as malloc metadata) and
uses the resulting pointer exchange to overwrite a
 Heap
program function pointer [3].
A common misconception by programmers is that by
4.1. Stack Exploitation dynamically allocating memory (utilizing heaps) they can
Each time a process or program is executed, the latter avoid using the stack, and thus, reduce the likelihood of
writes data to memory, but at some point in time, if the exploitation. While stack overflows may be the low-
programmer has not properly written the codes, adjacent hanging fruit, utilizing heaps does not instead eliminate
memory may be wrongly overwritten on the stack thus the possibility of exploitation [8].
causing abnormal behavior. Heap-based overflows act similarly to stack-based
A malicious attacker can make use of this flaw to overflows, but overflow buffers on the heap. Return into-
manipulate the program in one of the following ways: libc exploits use buffer overflows on the stack or heap to
 A local variable which is near the buffer in cause execution of code in the system’s own libc library.
memory on the stack may be overwritten to These newer techniques provide new avenues of buffer
change the behavior of the program, overflow attack that are more and more difficult to detect
 The return address of a stack frame can be and prevent [7].
overwritten which, when the function returns,
execution of the program will resume at the 5. Latest attacks
return address specified by the attacker A brief description of the latest attacks (for the month
of June 2010 only) from several security websites:
 A function pointer or exception handler may be
http://cve.mitre.org
overwritten and can be executed afterwards.  CVE-2010-2287 Buffer overflow in the
SigComp Universal Decompressor Virtual
When a stack buffer is overflowed, both, loading and
executing malicious code can be achieved. The attacker Machine dissector in Wireshark 0.10.8 through
sends a very long string of input data to the program. The 1.0.13 and 1.2.0 through 1.2.8 has unknown
input data includes the malicious code as well as the impact and remote attack vectors.
address of that code.  CVE-2010-2284 Buffer overflow in the ASN.1
When this input data overflows the stack, the malicious BER dissector in Wireshark 0.10.13 through
code is loaded into stack memory, and the subroutine’s 1.0.13 and 1.2.0 through 1.2.8 has unknown
return address is overwritten to point to that malicious
impact and remote attack vectors. CVE-2010- Summary: Buffer overflow in the SigComp
2102 Buffer overflow in Webby Webserver 1.01 Universal Decompressor Virtual Machine
allows remote attackers to execute arbitrary code dissector in Wireshark 0.10.8 through 1.0.13 and
via a long HTTP GET request. 1.2.0 through 1.2.8 has unknown impact and
 CVE-2010-2028 Buffer overflow in remote attack vectors.
k23productions TFTPUtil GUI (aka TFTPGUI) Published: 06/15/2010
1.4.5 allows remote attackers to cause a denial of CVSS Severity: 8.3 (HIGH)
service (crash) and possibly execute arbitrary  CVE-2010-2284
code via a long transport mode. Summary: Buffer overflow in the ASN.1 BER
 CVE-2010-2009 Stack-based buffer overflow in dissector in Wireshark 0.10.13 through 1.0.13
the media library in BS.Global BS.Player 2.51 and 1.2.0 through 1.2.8 has unknown impact and
build 1022, 2.41 build 1003, and possibly other remote attack vectors.
versions allows user-assisted remote attackers to Published: 06/15/2010
execute arbitrary code via a long ID3 tag in a CVSS Severity: 8.3 (HIGH)
.MP3 file. NOTE: some of these details are  CVE-2009-4893
obtained from third party information. Summary: Buffer overflow in UnrealIRCd
 CVE-2010-2004 Stack-based buffer overflow in 3.2beta11 through 3.2.8, when
BS.Global BS.Player 2.51 Build 1022 Free, and allow::options::noident is enabled, allows remote
possibly other versions, allows user-assisted attackers to cause a denial of service (crash) and
remote attackers to execute arbitrary code via the possibly execute arbitrary code via unspecified
Skin parameter in the Options section of a skins vectors.
file (.bsi), a different vulnerability than CVE- Published: 06/15/2010
2009-1068 [4]. CVSS Severity: 6.8 (MEDIUM)
 CVE-2010-0990
http://web.nvd.nist.gov
Summary: Stack-based buffer overflow in
 CVE-2010-2185
Creative Software AutoUpdate Engine ActiveX
Summary: Buffer overflow in Adobe Flash
Control 2.0.12.0, as used in Creative Software
Player before 9.0.277.0 and 10.x before
AutoUpdate 1.40.01, allows remote attackers to
10.1.53.64, and Adobe AIR before 2.0.2.12610,
execute arbitrary code via vectors related to the
might allow attackers to execute arbitrary code
BrowseFolder method.
via unspecified vectors.
Published: 06/15/2010
Published: 06/15/2010
CVSS Severity: 10.0 (HIGH)
 CVE-2010-2167
 CVE-2010-1961
Summary: Multiple heap-based buffer overflows
Summary: Buffer overflow in ovutil.dll in
in Adobe Flash Player before 9.0.277.0 and 10.x
ovwebsnmpsrv.exe in HP OpenView Network
before 10.1.53.64, and Adobe AIR before
Node Manager (OV NNM) 7.51 and 7.53 allows
2.0.2.12610, might allow attackers to execute
remote attackers to execute arbitrary code via
arbitrary code via unspecified vectors.
unspecified variables to jovgraph.exe, which are
Published: 06/15/2010
not properly handled in a call to the sprintf
 CVE-2010-1937
function.
Summary: Heap-based buffer overflow in
Published: 06/10/2010
httpAdapter.c in httpAdapter in SBLIM SFCB
CVSS Severity: 10.0 (HIGH)
before 1.3.8 might allow remote attackers to
 CVE-2010-1960
execute arbitrary code via a Content-Length
Summary: Buffer overflow in the error handling
HTTP header that specifies a value too small for
functionality in ovwebsnmpsrv.exe in HP
the amount of POST data, aka bug #3001896.
OpenView Network Node Manager (OV NNM)
Published: 06/15/2010
7.51 and 7.53 allows remote attackers to execute
CVSS Severity: 10.0 (HIGH)
 CVE-2010-2287
arbitrary code via a long, invalid option to Successful exploitation may allow execution of
jovgraph.exe. arbitrary code.
Published: 06/10/2010 The vulnerability is reported in version 4.4.4.
CVSS Severity: 10.0 (HIGH) Other versions may also be affected.
 CVE-2010-1850 Solution
Summary: Buffer overflow in MySQL 5.0 Do not open untrusted playlist files.
through 5.0.91 and 5.1 before 5.1.47 allows  Secunia Advisory SA40141: Date released
remote authenticated users to execute arbitrary 15/06/2010
code via a COM_FIELD_LIST command with a XnView MBM Processing Buffer Overflow
long table name. Vulnerability
Published: 06/08/2010 Description
CVSS Severity: 6.0 (MEDIUM) Mauro Olea has discovered a vulnerability in
XnView, which can be exploited by malicious
people to compromise a user's system.
http://secunia.com The vulnerability is caused due to an error when
 Secunia Advisory SA40197: Date released
processing certain MBM (MultiBitMap) files,
16/06/2010
which can be exploited to cause a heap-based
File Sharing Wizard "Content-Length" Buffer
buffer overflow by e.g. tricking a user into
Overflow Vulnerability
opening a specially crafted MBM file.
Description
The vulnerability is confirmed in version 1.97.4.
A vulnerability has been discovered in File
Prior versions may also be affected.
Sharing Wizard, which can be exploited by
Solution
malicious people to compromise a vulnerable
Update to version 1.97.5.
system.
 Secunia Advisory SA40153: Date released
The vulnerability is caused due to a boundary
15/06/2010
error when processing HTTP requests. This can
AnNoText AdvoAkte KeyHelp ActiveX Control
be exploited to cause a stack-based buffer
Buffer Overflow Vulnerability
overflow via an HTTP request having an overly
Description
long "Content-Length" header.
Nikolas Sotiriu has reported vulnerability in
Successful exploitation may allow execution of
AnNoText AdvoAkte, which can be exploited by
arbitrary code.
malicious people to compromise a user's system.
The vulnerability is confirmed in demo version
The vulnerability is caused due to a boundary
1.5.0. Other versions may also be affected.
error in the included third party
Solution
KeyHelp.KeyCtrl.1 ActiveX control
Restrict access to the HTTP service by using e.g.
(KeyHelp.ocx).
a firewall.
Solution
 Secunia Advisory SA40195: Date released
Set the kill-bit for the affected ActiveX control.
16/06/2010
 Secunia Advisory SA40119: Date released
Rosoft Audio Converter Playlist Processing
14/06/2010
Buffer Overflow
Kodak Ofoto Upload Manager ActiveX Buffer
Description
Overflow Vulnerabilities
A vulnerability has been reported in Rosoft
Audio Converter, which can be exploited by
Description
malicious people to compromise a user's system. Some vulnerabilities have been discovered
The vulnerability is caused due to a boundary in the Kodak Ofoto Upload Manager
error when processing playlist files. This can be ActiveX control, which can be exploited by
exploited to cause a buffer overflow by tricking a malicious people to compromise a user's
user into e.g. loading a specially crafted M3U system.
file and converting an overly long entry. The vulnerabilities are caused due to
boundary errors in the reported and under investigation shows its severity and
axofupld.OFUploadMgr.1 ActiveX Control impact.
(axofupld.dll) when processing property
8. References
assignments. These can be exploited to
cause heap-based buffer overflows via [1] Crispin Cowan, Perry Wagle, Calton Pu, Steve Beattie
overly long strings assigned to e.g. the and Jonathan Walpole, “Buffer overflows attacks and
"SITEURL", "UPLOADURL", defenses for the vulnerability of the decade,” Oregon
Graduate Institute of Science & Technology.
"SESSIONID", or "SOURCEID" properties.
Successful exploitation of the vulnerabilities [2] Marc.E Donaldson, “Inside the buffer overflow attack
allows execution of arbitrary code. mechanism method & prevention”, SANS Institute.
The vulnerabilities are confirmed in version
[3] Buffer Overflow on Wikipedia [online]. Available:
1.0.1.54. Other versions may also be http://en.wikipedia.org/wiki/Buffer_overflow
affected.
Solution [4] Search result of Buffer overflow on
http://cve.mitre.org [online]. Available:
Microsoft has set the kill-bit via MS10-034.
http://cve.mitre.org/cgi-bin/cvekey.cgi?
keyword=buffer+overflow

6. Prevention [5] Search result of Buffer overflow on


http://web.nvd.nist.gov [online]. Available:
Some prevention techniques: http://web.nvd.nist.gov/view/vuln/search-results?cid=2
 Code auditing (automated or manual)
 Developer training – bounds checking, use of [6] Zhimin Gu Jiandong Yao Jun Qin, “Buffer Overflow
unsafe functions, and group standards Attacks on Linux Principles Analyzing and Protection”,
 Non-executable stacks – many operating systems Beijing Institute of Technology
have at least some support for this
[7] M. Barnes, “Buffer overflow exploits: the why and
 Compiler tools – StackShield, StackGuard, and how”, McAfee April 2005
Libsafe, among others
 Safe functions – use strncat instead of strcat, [8] Eric Chien and Péter Ször.” Blended Attacks Exploits,
strncpy instead of strcpy, etc Vulnerabilities and Buffer-Overflow Techniques in
 Patches – Be sure to keep your web and Computer Viruses”, Symantec Security Response
application servers fully patched, and be aware
[9]Buffer overflow on http://www.owasp.org [online].
of bug reports relating to applications upon
Available:
which your code is dependent. http://www.owasp.org/index.php/Buffer_Overflows
 Periodically scan your application with one or
more of the commonly available scanners that [10] Search result of Buffer overflow on
look for buffer overflow flaws in your server http://secunia.com [online]. Available:
products and your custom web applications [9]. http://secunia.com/advisories/search/?
search=buffer+overflow

7. Conclusion
The buffer overflow vulnerability can be considered as
a real threat in security systems.
The first step which allows it to occur is wrong
programming skills of developers and it is very difficult
to monitor each and every line of code. The different
techniques mentioned before will be effective only if the
programmers themselves build up this culture.
It remains no doubt that this vulnerability is a very serious
one and the fact that till date so many cases have been

Vous aimerez peut-être aussi