Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 12187 - net-misc/wget
Summary: net-misc/wget
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: Highest critical (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-15 05:48 UTC by Daniel Ahlberg (RETIRED)
Modified: 2003-02-04 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Ahlberg (RETIRED) gentoo-dev 2002-12-15 05:48:08 UTC
[RHSA-2002:229-10] Updated wget packages fix directory traversal bug 
 
From:  
bugzilla@redhat.com 
 
 
To:  
redhat-watch-list@redhat.com, redhat-announce-list@redhat.com 
 
 
Date:  
Tuesday 16.23.00 
 
 
--------------------------------------------------------------------- 
                   Red Hat, Inc. Red Hat Security Advisory 
 
Synopsis:          Updated wget packages fix directory traversal bug 
Advisory ID:       RHSA-2002:229-10 
Issue date:        2002-12-10 
Updated on:        2002-12-04 
Product:           Red Hat Linux 
Keywords:          wget directory traversal ftp client flaw:dot 
Cross references:   
Obsoletes:          
CVE Names:         CAN-2002-1344 
--------------------------------------------------------------------- 
 
1. Topic: 
 
The wget packages shipped with Red Hat Linux 6.2 through 8.0 contain a 
security bug which, under certain circumstances, can cause local files to 
be written outside the download directory. 
 
2. Relevant releases/architectures: 
 
Red Hat Linux 6.2 - i386 
Red Hat Linux 7.0 - i386 
Red Hat Linux 7.1 - i386, ia64 
Red Hat Linux 7.2 - i386, ia64 
Red Hat Linux 7.3 - i386 
Red Hat Linux 8.0 - i386 
 
3. Problem description: 
 
Versions of wget prior to 1.8.2-4 contain a bug that permits a malicious 
FTP server to create or overwrite files anywhere on the local file system. 
 
FTP clients must check to see if an FTP server's response to the NLST 
command includes any directory information along with the list of filenames 
required by the FTP protocol (RFC 959, section 4.1.3). 
 
If the FTP client fails to do so, a malicious FTP server can send filenames 
beginning with '/' or containing '/../' which can be used to direct a 
vulnerable FTP client to write files (such as .forward, .rhosts, .shost, 
etc.) that can then be used for later attacks against the client machine. 
 
All Red Hat Linux users using wget < 1.8.2-4  should upgrade 
to the errata packages which are not vulnerable to this issue. 
 
Thanks to Steven M. Christey for his work in discovering this issue 
in current FTP clients and for providing a patched FTP server to verify 
the new packages. 
 
4. Solution: 
 
Before applying this update, make sure all previously released errata 
relevant to your system have been applied. 
 
To update all RPMs for your particular architecture, run: 
 
rpm -Fvh [filenames] 
 
where [filenames] is a list of the RPMs you wish to upgrade.  Only those 
RPMs which are currently installed will be updated.  Those RPMs which are 
not installed but included in the list will not be updated.  Note that you 
can also use wildcards (*.rpm) if your current directory *only* contains the 
desired RPMs. 
 
Please note that this update is also available via Red Hat Network.  Many 
people find this an easier way to apply updates.  To use Red Hat Network, 
launch the Red Hat Update Agent with the following command: 
 
up2date 
 
This will start an interactive process that will result in the appropriate 
RPMs being upgraded on your system. 
 
5. RPMs required: 
 
Red Hat Linux 6.2: 
 
SRPMS: 
ftp://updates.redhat.com/6.2/en/os/SRPMS/wget-1.8.2-4.6x.src.rpm 
 
i386: 
ftp://updates.redhat.com/6.2/en/os/i386/wget-1.8.2-4.6x.i386.rpm 
 
Red Hat Linux 7.0: 
 
SRPMS: 
ftp://updates.redhat.com/7.0/en/os/SRPMS/wget-1.8.2-4.70.src.rpm 
 
i386: 
ftp://updates.redhat.com/7.0/en/os/i386/wget-1.8.2-4.70.i386.rpm 
 
Red Hat Linux 7.1: 
 
SRPMS: 
ftp://updates.redhat.com/7.1/en/os/SRPMS/wget-1.8.2-4.71.src.rpm 
 
i386: 
ftp://updates.redhat.com/7.1/en/os/i386/wget-1.8.2-4.71.i386.rpm 
 
ia64: 
ftp://updates.redhat.com/7.1/en/os/ia64/wget-1.8.2-4.71.ia64.rpm 
 
Red Hat Linux 7.2: 
 
SRPMS: 
ftp://updates.redhat.com/7.2/en/os/SRPMS/wget-1.8.2-4.72.src.rpm 
 
i386: 
ftp://updates.redhat.com/7.2/en/os/i386/wget-1.8.2-4.72.i386.rpm 
 
ia64: 
ftp://updates.redhat.com/7.2/en/os/ia64/wget-1.8.2-4.72.ia64.rpm 
 
Red Hat Linux 7.3: 
 
SRPMS: 
ftp://updates.redhat.com/7.3/en/os/SRPMS/wget-1.8.2-4.73.src.rpm 
 
i386: 
ftp://updates.redhat.com/7.3/en/os/i386/wget-1.8.2-4.73.i386.rpm 
 
Red Hat Linux 8.0: 
 
SRPMS: 
ftp://updates.redhat.com/8.0/en/os/SRPMS/wget-1.8.2-5.src.rpm 
 
i386: 
ftp://updates.redhat.com/8.0/en/os/i386/wget-1.8.2-5.i386.rpm 
 
 
 
6. Verification: 
 
MD5 sum                          Package Name 
-------------------------------------------------------------------------- 
2c06b1ab033d70ec287bb9c91a8daa68 6.2/en/os/SRPMS/wget-1.8.2-4.6x.src.rpm 
fffbaeacd02411c23d011b1000f0ab49 6.2/en/os/i386/wget-1.8.2-4.6x.i386.rpm 
8cfc796d3489f3d19d4af589bb73641b 7.0/en/os/SRPMS/wget-1.8.2-4.70.src.rpm 
8c8abf8f81f057dbd74098b87fb9b54c 7.0/en/os/i386/wget-1.8.2-4.70.i386.rpm 
5e022a0c2f4afe5285a5ed6b8abc0ee8 7.1/en/os/SRPMS/wget-1.8.2-4.71.src.rpm 
229949e6fdde7a02f56999b4271bc5b1 7.1/en/os/i386/wget-1.8.2-4.71.i386.rpm 
e24aba62d9589e0999678f880db6de08 7.1/en/os/ia64/wget-1.8.2-4.71.ia64.rpm 
eefe85c57b07aa14522ab79a5c2f5607 7.2/en/os/SRPMS/wget-1.8.2-4.72.src.rpm 
03ae8545b03f137b72b57dc2b2e91e22 7.2/en/os/i386/wget-1.8.2-4.72.i386.rpm 
9f349807fbd8ecc7a2678af45e5d4ad1 7.2/en/os/ia64/wget-1.8.2-4.72.ia64.rpm 
554d83dadce4e18f0c601c571d43564e 7.3/en/os/SRPMS/wget-1.8.2-4.73.src.rpm 
20deb3f2c37f331e87a473fb1cac3d83 7.3/en/os/i386/wget-1.8.2-4.73.i386.rpm 
2ab86f0e4955e8e5dc9bf37a4037bfcf 8.0/en/os/SRPMS/wget-1.8.2-5.src.rpm 
efbebb343ded09fc553e5a34c75697f0 8.0/en/os/i386/wget-1.8.2-5.i386.rpm 
 
 
These packages are GPG signed by Red Hat, Inc. for security.  Our key 
is available at http://www.redhat.com/about/contact/pgpkey.html 
 
You can verify each package with the following command: 
     
    rpm --checksig -v <filename> 
 
If you only wish to verify that each package has not been corrupted or 
tampered with, examine only the md5sum with the following command: 
     
    md5sum <filename> 
 
 
7. References: 
 
http://marc.theaimsgroup.com/?l=bugtraq&m=87602746719482 
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2002-1344 
 
8. Contact: 
 
The Red Hat security contact is <security@redhat.com>.  More contact 
details at http://www.redhat.com/solutions/security/news/contact.html 
 
Copyright(c) 2000, 2001, 2002 Red Hat, Inc.
Comment 1 Daniel Ahlberg (RETIRED) gentoo-dev 2002-12-15 05:49:48 UTC
RedHat's patch: 
 
diff -urN wget-1.8.2/src/fnmatch.c wget-1.8.2_save/src/fnmatch.c 
--- wget-1.8.2/src/fnmatch.c    Sat May 18 05:05:15 2002 
+++ wget-1.8.2_save/src/fnmatch.c       Fri Oct  4 14:53:40 2002 
@@ -198,6 +198,17 @@ 
   return (FNM_NOMATCH); 
 } 
 
+/* Return non-zero if S has a leading '/'  or contains '../' */ 
+int 
+has_invalid_name (const char *s) 
+{ 
+       if (*s == '/') 
+               return 1; 
+       if (strstr(s, "../") != 0) 
+               return 1; 
+       return 0; 
+} 
+ 
 /* Return non-zero if S contains globbing wildcards (`*', `?', `[' or 
    `]').  */ 
 int 
diff -urN wget-1.8.2/src/ftp.c wget-1.8.2_save/src/ftp.c 
--- wget-1.8.2/src/ftp.c        Sat May 18 05:05:16 2002 
+++ wget-1.8.2_save/src/ftp.c   Fri Oct  4 15:07:22 2002 
@@ -1551,6 +1551,8 @@ 
 { 
   struct fileinfo *orig, *start; 
   uerr_t res; 
+  struct fileinfo *f; 
+ 
 
   con->cmd |= LEAVE_PENDING; 
 
@@ -1562,8 +1564,7 @@ 
      opt.accepts and opt.rejects.  */ 
   if (opt.accepts || opt.rejects) 
     { 
-      struct fileinfo *f = orig; 
- 
+       f = orig; 
       while (f) 
        { 
          if (f->type != FT_DIRECTORY && !acceptable (f->name)) 
@@ -1575,6 +1576,18 @@ 
            f = f->next; 
        } 
     } 
+  /* Remove all files with possible harmful names */ 
+  f = orig; 
+  while (f) 
+  { 
+     if (has_invalid_name(f->name)) 
+     { 
+         logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"), f->name); 
+         f = delelement (f, &start); 
+     } 
+     else 
+         f = f->next; 
+  } 
   /* Now weed out the files that do not match our globbing pattern. 
      If we are dealing with a globbing pattern, that is.  */ 
   if (*u->file && (action == GLOBALL || action == GETONE)) 
 
Comment 2 Daniel Ahlberg (RETIRED) gentoo-dev 2002-12-20 11:25:49 UTC
GLSA sent.