Search This Blog

Monday, October 17, 2005

[UNIX] wget and curl NTLM Username Buffer Overflow

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html

- - - - - - - - -

wget and curl NTLM Username Buffer Overflow
------------------------------------------------------------------------

SUMMARY

" <http://www.gnu.org/software/wget/wget.html> GNU Wget is a free software
package for retrieving files using HTTP, HTTPS and FTP, the most
widely-used Internet protocols. It is a non-interactive commandline tool,
so it may easily be called from scripts, cron jobs, terminals without
X-Windows support, etc."

" <http://curl.haxx.se/> curl is a command line tool for transferring
files with URL syntax, supporting FTP, FTPS, TFTP, HTTP, HTTPS, GOPHER,
TELNET, DICT, FILE and LDAP. curl supports HTTPS certificates, HTTP POST,
HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies,
user+password authentication (Basic, Digest, NTLM, Negotiate,
kerberos...), file transfer resume, proxy tunneling and a busload of other
useful tricks."

A buffer overflow vulnerability in multiple vendor's implementations of
curl and wget allows attackers to execute arbitrary code.

DETAILS

Vulnerable Systems:
* wget version 1.10
* curl version 7.13.2
* libcurl version 7.13.2

Immune Systems:
* wget version 1.10.2
* curl version 7.10.5 and prior
* libcurl version 7.10.5 and prior
* curl version 7.15.0
* libcurl version 7.15.0

The vulnerability specifically exists due to insufficient bounds checking
on user-supplied data supplied to a memory copy operation. The memcpy() of
the supplied ntlm username to ntlmbuf shown below results in a stack
overflow:

http-ntlm.c in ntlm_output() on line 532:

/* size is now 64 */
size=64;
ntlmbuf[62]=ntlmbuf[63]=0;

memcpy(&ntlmbuf[size], domain, domlen);
size += domlen;

memcpy(&ntlmbuf[size], usr, userlen);
size += userlen;

The resulting stack overflow can be leveraged to gain arbitrary code
execution with user privileges.

Successful exploitation of the vulnerability allows remote attackers to
execute arbitrary code with permissions of the http client process.
User interaction is required. Exploitation requires a user to use one of
the affected clients to connect to a malicious website.

This vulnerability affects both wget and curl clients similarly because
wget 1.10 adopted the curl ntlm authentication source code into its own
code base. The described vulnerability requires that ntlm authentication
is enabled in the affected client versions. A factor that somewhat
increases the risk of this vulnerability is that a client can be forced to
reconnect using NTLM authentication by issuing a HTTP 302 REDIRECT command
to the connecting client.

CVE Information:
<http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-3185>
CAN-2005-3185

Vendor Status:
wget 1.10.2 has been released to address this issue and is available for
download at: <http://ftp.gnu.org/pub/gnu/wget/>
http://ftp.gnu.org/pub/gnu/wget/

curl has released the following patch to address this issue:
<http://curl.haxx.se/libcurl-ntlmbuf.patch>
http://curl.haxx.se/libcurl-ntlmbuf.patch

Disclosure Timeline:
10/12/2005 - Initial vendor notification
10/12/2005 - Initial vendor response
10/13/2005 - Coordinated public disclosure

ADDITIONAL INFORMATION

The information has been provided by <mailto:labs-no-reply@idefense.com>
iDEFENSE Labs.
The original article can be found at:
<http://www.idefense.com/application/poi/display?id=322&type=vulnerabilities&flashstatus=true> http://www.idefense.com/application/poi/display?id=322&type=vulnerabilities&flashstatus=true

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.

No comments: