wlanboy
Content Contributer
This is a small and nasty one: http://www.cvedetails.com/cve/CVE-2014-4877/
lrwxrwxrwx 1 root root 33 Nov 03 2014 BAD -> /
drwxrwxr-x 15 root root 4096 Nov 03 2014 BAD
Wget would first create a local symlink named TARGET that points to the root filesystem. It would then enter the BAD directory and mirror its contents across the user's filesystem.
The flaw is triggered when wget receives a directory listing that includes a symlink followed by a directory with the same name. The output of the LIST command would look like the following, which is not possible on a real FTP server.Absolute path traversal vulnerability in GNU Wget before 1.16, when recursion is enabled, allows remote FTP servers to write to arbitrary files, and consequently execute arbitrary code, via a LIST response that references the same filename within two entries, one of which indicates that the filename is for a symlink.
lrwxrwxrwx 1 root root 33 Nov 03 2014 BAD -> /
drwxrwxr-x 15 root root 4096 Nov 03 2014 BAD
Wget would first create a local symlink named TARGET that points to the root filesystem. It would then enter the BAD directory and mirror its contents across the user's filesystem.
Upgrade to wget version 1.16 or a package that has backported the CVE-2014-4877 patch. If you use a distribution that does not ship a patched version of wget, you can mitigate the issue by adding the line "retr-symlinks=on" to either /etc/wgetrc or ~/.wgetrc. This issue is only exploitable when running wget with recursive mode against a FTP server URL. Although a HTTP service can redirect wget to a FTP URL, it implicitly disables the recursive option after following this redirect, and is not exploitable in this scenario.