Subject: iDEFENSE Security Advisory 02.21.05: Multiple Unix/Linux Vendor cURL/libcURL Kerberos Authentication Buffer Overflow Vulnerability
Date: Mon, 21 Feb 2005 15:38:49 -0500
Message-ID: <FB24803D1DF2A34FA59FC157B77C970503E2462D@idserv04.idef.com.>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: iDEFENSE Security Advisory 02.21.05: Multiple Unix/Linux Vendor cURL/libcURL Kerberos Authentication Buffer Overflow Vulnerability
Thread-Index: AcUYVWtWJMAyfOhQQ1iiRUSZ1Q3y8g==
From: "iDEFENSE Labs" <labs-no-reply@idefense.com.>
To: <bugtraq@securityfocus.com.>, <vulnwatch@vulnwatch.org.>
X-Virus-Scanned: antivirus-gw at tyumen.ru
Multiple Unix/Linux Vendor cURL/libcURL Kerberos Authentication Buffer
Overflow Vulnerability
iDEFENSE Security Advisory 02.21.05:
www.idefense.com/application/poi/display?id=3D203&type=3Dvulnerabilities
February 21, 2005
I. BACKGROUND
cURL is a command line tool for transferring files with URL syntax,
supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP.
More information about cURL and libcURL is available from:
http://curl.haxx.se/
II. DESCRIPTION
Remote exploitation of a stack-based buffer overflow in various Unix /
Linux vendors' implementation of cURL could allow for arbitrary code
execution on the targeted host.
An exploitable stack-based buffer overflow condition exists when using
Kerberos authentication. The problem specifically exists within the
functions Curl_krb_kauth() and krb4_auth() defined in lib/krb4.c.
Within these functions a statically allocated stack-based buffer of size
1250, from struct KTEXT_ST.dat, is passed to the Curl_base64_decode()
routine defined in lib/base64.c as can be seen here:
len =3D Curl_base64_decode(p, (char *)adat.dat);
tmp =3D Curl_base64_decode(p, (char *)tkt.dat);
The Curl_base64_decode() routine relies on the calling function to
validate the decoded length. This function base64 decodes and copies
data directly from the HTTP reply of a server to the destination buffer,
in this case buffer[]. An attacker can construct a long base64 encoded
malicious payload that upon decoding will overflow the static buffer and
overwrite the saved EIP. This in turn can lead to arbitrary code
execution.
III. ANALYSIS
Successful exploitation allows remote attackers to execute arbitrary
code
under the privileges of the target user. Exploitation requires that an
attacker either coerce or force a target to connect to a malicious
server using Kerberos authentication.
IV. DETECTION
iDEFENSE has confirmed the existence of this vulnerability in cURL
version 7.12.1. It is suspected that prior versions are affected as
well.
Any application built using a vulnerable version libcURL will also be
affected.
V. WORKAROUND
Recompile cURL without Kerberos support if it is not needed.
VI. VENDOR RESPONSE
No vendor response received.
VII. CVE INFORMATION
A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.
VIII. DISCLOSURE TIMELINE
12/23/2004 Initial vendor notification - No response
02/10/2005 Secondary vendor notification - No response
02/21/2005 Public disclosure
IX. CREDIT
infamous41md[at]hotpop.com is credited with this discovery.
Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp
X. LEGAL NOTICES
Copyright (c) 2005 iDEFENSE, Inc.
Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email [email protected] for permission.
Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.