Bug 833831 - When redirected, wget should use the original page name for saving
When redirected, wget should use the original page name for saving
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: wget (Show other bugs)
6.5
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Tomas Hozza
Jan Kepler
: Patch, Security, SecurityTracking
Depends On:
Blocks: CVE-2010-2252
  Show dependency treegraph
 
Reported: 2012-06-20 08:54 EDT by Petr Šplíchal
Modified: 2016-05-31 21:43 EDT (History)
5 users (show)

See Also:
Fixed In Version: wget-1.12-1.11.el6_5
Doc Type: Release Note
Doc Text:
Cause: Consequence: Fix: Result:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-02-10 12:29:57 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
[PATCH] Introduce --trust-server-names option (6.14 KB, patch)
2012-11-20 06:54 EST, Tomas Hozza
no flags Details | Diff

  None (edit)
Description Petr Šplíchal 2012-06-20 08:54:24 EDT
Description of problem:

When wget fetches a page which is redirected to another page it
uses the redirected page name for file creation which could be
something user is not expecting and could probably present a
security issue. This is correctly fixed in latest wget in RHEL7.

Version-Release number of selected component (if applicable):
wget-1.12-1.4.el6.x86_64

Steps to Reproduce:
1. Set up some redirection on the server
2. wget the redirected page
  
Actual results:

For example:
wget --max-redirect=40 http://localhost/wget/redir/00.html

--2012-06-20 16:39:28--  http://localhost/wget/redir/00.html
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/01.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/01.html
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/02.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/02.html
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/03.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/03.html
...
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/28.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/28.html
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/29.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/29.html
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://localhost/wget/redir/30.html [following]
--2012-06-20 16:39:28--  http://localhost/wget/redir/30.html
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15 [text/html]
Saving to: `30.html'

Expected results:
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15 [text/html]
Saving to: `00.html'
Comment 1 RHEL Product and Program Management 2012-07-10 04:29:45 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 2 RHEL Product and Program Management 2012-07-10 22:04:01 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 3 RHEL Product and Program Management 2012-09-07 01:34:00 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 7 Tomas Hozza 2012-11-20 06:54:48 EST
Created attachment 648415 [details]
[PATCH] Introduce --trust-server-names option
Comment 8 Tomas Hozza 2012-11-20 06:57:31 EST
Wget WITHOUT patch:
$ ./wget http://localhost/wget/00.php
--2012-11-20 12:45:40--  http://localhost/wget/00.php
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/01.php [following]
--2012-11-20 12:45:40--  http://localhost/wget/01.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/02.php [following]
--2012-11-20 12:45:40--  http://localhost/wget/02.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/03.php [following]
--2012-11-20 12:45:40--  http://localhost/wget/03.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/index.html [following]
--2012-11-20 12:45:40--  http://localhost/index.html
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 127 [text/html]
Saving to: `index.html'

100%[==============================================================>] 127         --.-K/s   in 0s      

2012-11-20 12:45:40 (7.76 MB/s) - `index.html' saved [127/127]



Wget WITH patch:
$ ./wget http://localhost/wget/00.php
--2012-11-20 12:51:20--  http://localhost/wget/00.php
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/01.php [following]
--2012-11-20 12:51:20--  http://localhost/wget/01.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/02.php [following]
--2012-11-20 12:51:20--  http://localhost/wget/02.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/03.php [following]
--2012-11-20 12:51:20--  http://localhost/wget/03.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/index.html [following]
--2012-11-20 12:51:20--  http://localhost/index.html
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 127 [text/html]
Saving to: `00.php'

100%[==============================================================>] 127         --.-K/s   in 0s      

2012-11-20 12:51:20 (6.52 MB/s) - `00.php' saved [127/127]


$ ./wget --trust-server-names http://localhost/wget/00.php
--2012-11-20 12:51:38--  http://localhost/wget/00.php
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/01.php [following]
--2012-11-20 12:51:38--  http://localhost/wget/01.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/02.php [following]
--2012-11-20 12:51:38--  http://localhost/wget/02.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/wget/03.php [following]
--2012-11-20 12:51:38--  http://localhost/wget/03.php
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/index.html [following]
--2012-11-20 12:51:38--  http://localhost/index.html
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 127 [text/html]
Saving to: `index.html'

100%[==============================================================>] 127         --.-K/s   in 0s      

2012-11-20 12:51:38 (8.27 MB/s) - `index.html' saved [127/127]
Comment 9 RHEL Product and Program Management 2013-10-13 20:35:45 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 11 Vasiliy Glazov 2014-01-31 02:34:59 EST
Same problem when using wget for downloading archives from github.
For example:
wget http://github.com/LibreCAD/LibreCAD/archive/2.0.2.tar.gz

--2014-01-31 11:31:28--  http://github.com/LibreCAD/LibreCAD/archive/2.0.2.tar.gz
Resolving github.com... 192.30.252.130
Connecting to github.com|192.30.252.130|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/LibreCAD/LibreCAD/archive/2.0.2.tar.gz [following]
--2014-01-31 11:31:34--  https://github.com/LibreCAD/LibreCAD/archive/2.0.2.tar.gz
Connecting to github.com|192.30.252.130|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/LibreCAD/LibreCAD/tar.gz/2.0.2 [following]
--2014-01-31 11:31:34--  https://codeload.github.com/LibreCAD/LibreCAD/tar.gz/2.0.2
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15429871 (15M) [application/x-gzip]
Saving to: “2.0.2”

2014-01-31 11:32:17 (414 KB/s) - “2.0.2” saved [15429871/15429871]

But file must be saved as 2.0.2.tar.gz

And same problem when github archive uses as Source0 in rpm package for RHEL6.

Please, update wget.
Comment 17 errata-xmlrpc 2014-02-10 12:29:57 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2014-0151.html

Note You need to log in before you can comment on or make changes to this bug.