Bug 1662705 (CVE-2018-20483) - CVE-2018-20483 wget: Information exposure in set_file_metadata function in xattr.c
Summary: CVE-2018-20483 wget: Information exposure in set_file_metadata function in xa...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2018-20483
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1662833 1662834 1662851 1662852
Blocks: 1662706
TreeView+ depends on / blocked
 
Reported: 2018-12-31 21:09 UTC by Pedro Sampaio
Modified: 2019-11-06 00:51 UTC (History)
10 users (show)

Fixed In Version: wget 1.20.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 00:51:34 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:3701 None None None 2019-11-05 22:06:05 UTC

Description Pedro Sampaio 2018-12-31 21:09:50 UTC
set_file_metadata in xattr.c in GNU Wget before 1.20.1 stores a file's origin URL in the user.xdg.origin.url metadata attribute of the extended attributes of the downloaded file, which allows local users to obtain sensitive information (e.g., credentials contained in the URL) by reading this attribute, as demonstrated by getfattr. This also applies to Referer information in the user.xdg.referrer.url metadata attribute. According to 2016-07-22 in the Wget ChangeLog, user.xdg.origin.url was partially based on the behavior of fwrite_xattr in tool_xattr.c in curl.

References:

http://git.savannah.gnu.org/cgit/wget.git/tree/NEWS

Upstream patches:

http://git.savannah.gnu.org/cgit/wget.git/commit/?id=c125d24762962d91050d925fbbd9e6f30b2302f8
http://git.savannah.gnu.org/cgit/wget.git/commit/?id=3cdfb594cf75f11cdbb9702ac5e856c332ccacfa

Comment 3 Huzaifa S. Sidhpurwala 2019-01-02 06:26:55 UTC
Analysis notes:

The security flaw exists in the way wget caches credentials passed as a part of the URL, in the extended attributes of the downloaded file. For example:

$ wget https://user1:redhat@localhost
[..] 
Saving to: ‘index.html’
index.html                          [ <=>                                                   ]       0  --.-KB/s    in 0s      

$ getfattr -n user.xdg.origin.url index.html 
# file: index.html
user.xdg.origin.url="https://user1:redhat@localhost/"

However credentials passed to wget using the "--user"/"--password" command line parameters are not cached. Similarly when "--user"/"--ask-password" is used which prompts the user to enter password on the command line (hereby preventing the password appearing in the command line history), the credentials will not be cached.

Further to this wget already has a command line flags called "--no-xattr" which when used will turn off storage of metadata in extended file attributes.

The patch applied by upstream ensures that:
1. --no-xattr is the default behaviour and storing of extended attributes can be turned on by the user using the new --xattr flag.
2. By default no username/passwords are not saved in the file extended attributes.

Comment 4 Huzaifa S. Sidhpurwala 2019-01-02 06:28:48 UTC
External References:

http://git.savannah.gnu.org/cgit/wget.git/tree/NEWS

Comment 6 Huzaifa S. Sidhpurwala 2019-01-02 06:46:16 UTC
Support for storing extended attribute information was added to wget in version 1.19 using the following commit:
http://git.savannah.gnu.org/cgit/wget.git/commit/?id=a933bdd31eee9c956a3b5cc142f004ef1fa94cb3

Therefore this issue does not affect the version of wget shipped with Red Hat Enterprise Linux 5, 6 and 7.

Comment 7 Huzaifa S. Sidhpurwala 2019-01-02 06:46:26 UTC
Created wget tracking bugs for this issue:

Affects: fedora-all [bug 1662833]

Comment 9 Huzaifa S. Sidhpurwala 2019-01-02 06:54:04 UTC
curl seems to have a similar issue, filed an upstream bug at:
https://github.com/curl/curl/issues/3423

except that in curl storage of extended attributes is disabled by default and needs to be explicitly enabled by passing the --xattr command line argument.

Comment 10 Huzaifa S. Sidhpurwala 2019-01-02 08:22:36 UTC
Mitigation:

wget users should pass credentials using the "--user/password" or the "--user/--ask-password" command line argument to wget or use --no-xattr to turn off saving extended attribute information. In curl downloading extended attributes is disabled by default.

Comment 12 Huzaifa S. Sidhpurwala 2019-01-02 08:24:07 UTC
Created curl tracking bugs for this issue:

Affects: fedora-all [bug 1662852]

Comment 15 Kamil Dudka 2019-01-03 10:39:15 UTC
(In reply to Huzaifa S. Sidhpurwala from comment #9)
> curl seems to have a similar issue, filed an upstream bug at:
> https://github.com/curl/curl/issues/3423

... and here is the corresponding pull request at curl upstream:

https://github.com/curl/curl/pull/3433

Comment 19 errata-xmlrpc 2019-11-05 22:06:04 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2019:3701 https://access.redhat.com/errata/RHSA-2019:3701

Comment 20 Product Security DevOps Team 2019-11-06 00:51:34 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2018-20483


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