Red Hat Bugzilla – Bug 591580
CVE-2010-2251 lftp: multiple HTTP client download filename vulnerability [OCERT 2010-001]
Last modified: 2018-08-15 17:49:47 EDT
The draft advisory from oCERT follows:
The lftp, wget and lwp-download applications are ftp/http clients and file
transfer tools supporting various network protocols. The lwp-download
script is shipped along with the libwww-perl library.
Unsafe behaviours have been found in lftp and lwp-download handling the
Content-Disposition header in conjunction with the 'suggested filename'
Additionally unsafe behaviours have been found in wget and lwp-download in
case of HTTP 3xx redirections during file dowloading. The two applications
automatically use the URL's filename portion specified in the Location
Implicitly trusting the suggested filenames results in a saved file that
differs from the expected one according to the URL specified by the user.
This can be used by a malicious attacker to silently write hidden and/or
initialization files under the user's current directory (e.g. .login,
The impact of this vulnerability is increased in the case of lftp/lftpget
as the default configuration allows file overwrite without prompting
confirmation to the user. In case of lftp the get1 command is affected.
This command can be invoked directly by the user from lftp's command line
interface or indirectly by using the lftpget script, packaged within lftp
lftp <= 4.0.5
wget <= 1.12
libwww-perl <= 5.834
lftp >= 4.0.6
libwww-perl >= 5.835
Vulnerability discovered and reported by Hank Leininger and Solar Designer
under the Openwall Project, with further analysis by Daniele Bianco of
No patches from upstream are available on any of these, however lftp 4.0.6 does correct the issue, so we should be able to generate a patch based on a diff between 4.0.5 and 4.0.6. The NEWS file indicates:
* use O_EXCL flag when xfer:clobber is off.
* better validation of server-provided file name.
* new setting xfer:auto-rename (off by default).
All three issues are relevant, but the last is the big one. To test, try:
A vulnerable lftp will produce wordpress-2.9.2.tar.gz silently, whereas a fixed lftp will generate latest.tar.gz unless the user explicitly sets xfer:auto-rename. This WordPress example is only useful when testing the Content-Disposition HTTP header, not Location.
libwww-perl 5.835 is also supposed to fix this issue, so a diff between 5.834 and 5.835 should produce a relevant patch.
This is now public:
Florian made a post to oss-security with a preliminary patch for wget. It probably requires some upstream review as it does add a new configuration option:
However, Ludwig Nussel indicates that wget's behaviour is acceptable and probably doesn't require fixing at all, as wget does not overwrite existing files by default (adds suffixes like .1 and .2 to the new file if it already exists), and also prints the file name it used so there are no surprises.
In light of that, I would consider this a non-issue for wget, especially considering how intrusive the patch is for a backport.
MITRE has assigned the following CVE names for the three packages noted in this advisory, and as a result this bug has been cloned to distinguish between the three:
CVE-2010-2252: wget (see bug #602797)
CVE-2010-2253: perl-libwww-perl (see bug #602800)
Created attachment 423030 [details]
patch to correct the issue
This patch is the relevant differences between 4.0.5 and 4.0.6, and also includes the following change from 4.0.7:
* GetJob.cc: make xfer:clobber=no by default.
Created lftp tracking bugs for this issue
Affects: fedora-all [bug 602836]
lftp-4.0.8-1.fc12 has been submitted as an update for Fedora 12.
lftp-4.0.8-1.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.
This issue did not affect the version of lftp as shipped with Red Hat Enterprise Linux 3 and 4 as they did not include support for renaming files to a server-suggested file name.
Created attachment 435311 [details]
Corrected patch with manpage changes
I added manpage corrections into the patch and changed it to respect xfer:clobber ... Old version of the patch had regression that it failed to rename the file if xfer:clobber was activated via conf file. This one works for me in all cases correctly.
As a side note - as lftp doesn't use temporary file, it still deletes the old file if it exists - as it downloads the file with the requested name and then it renames it to the servesuggested name.
This issue has been addressed in following products:
Red Hat Enterprise Linux 5
Via RHSA-2010:0585 https://rhn.redhat.com/errata/RHSA-2010-0585.html