iDEFENSE has identified an NTLM Buffer Overflow Vulnerability in
wget/curl. This vulnerability was submitted to iDEFENSE through our
Vulnerability Contributor Program:

        http://www.idefense.com/poi/teams/vcp.jsp

iDEFENSE Labs has validated this vulnerability and has drafted the
attached advisory. In accordance with our vendor disclosure policy 

        http://www.idefense.com/legal_disclosure.jsp

We would request that you acknowledge receipt of this initial
notification within five business days so that we may begin the process
of coordinating an appropriate public disclosure date for this issue
that will provide your company with adequate time to develop a patch or
workaround to mitigate this vulnerability. If you have questions
regarding this issue or require further details to assist with your own
analysis, please do not hesitate to contact us.

It is always our goal to coordinate on the public disclosure of
patches/advisories as quickly as possible after a vulnerability is
discovered. If however a reasonable timeframe cannot be agreed upon for
this issue, it will be publicly released in 60 days on 12/12/2005.
iDEFENSE is willing to work with a vendor to find a mutually agreeable
release date beyond this timeframe so long as the vendor continues to
make good faith efforts to produce patches in a timely fashion and
regularly informs iDEFENSE of their progress in doing so.

Please note that if the affected product is included within other
applications and/or operating systems, iDEFENSE will not be coordinating
disclosure of the vulnerability to affected third parties. We would ask
that you handle this coordination separately.

Regards,
Michael Sutton

Michael Sutton
Director, iDEFENSE Labs
iDEFENSE
1875 Campus Commons Drive, Suite 210
Reston, VA 20191
direct: 703.480.5628
voice: 703.390.1230
fax: 703.390.9456
[EMAIL PROTECTED]
www.idefense.com
Multiple Vendor wget/curl NTLM Username Buffer Overflow Vulnerability

iDEFENSE Security Advisory XX.XX.05
http://www.idefense.com/application/poi/display?type=vulnerabilities
MMM DD, 2005

I. BACKGROUND

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. More
information on Wget is available from the vendor website:

        http://www.gnu.org/software/wget/wget.html

curl is a command line tool for transferring files with URL syntax,
supporting FTP, FTPS, 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. More information
on curl is available from the vendor website:

        http://curl.haxx.se/

II. DESCRIPTION

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

The vulnerability specifically exists due to insufficent 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.

III. ANALYSIS

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 
codebase. 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.

IV. DETECTION

iDEFENSE Labs has confirmed the following software versions are 
vulnerable:

    •   wget 1.10
    •   curl 7.13.2
    •   libcurl 7.13.2 

V. WORKAROUND

As a workaround solution, disable ntlm support in wget and curl 
installations until the vendor releases a patch.

VI. VENDOR RESPONSE

[Quoted vendor response if available. Otherwise include vendor fix
details.]

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CAN-2005-XXXX to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org), which standardizes names for
security problems.

[OR]

A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.

VIII. DISCLOSURE TIMELINE

10/22/2005  Initial vendor notification
XX/XX/2005  Initial vendor response
XX/XX/2005  Coordinated public disclosure

IX. CREDIT

The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

Free tools, research and upcoming events
http://labs.idefense.com

X. LEGAL NOTICES

Copyright © 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.

Reply via email to