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.
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
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.
Support for storing extended attribute information was added to wget in version 1.19 using the following commit:
Therefore this issue does not affect the version of wget shipped with Red Hat Enterprise Linux 5, 6 and 7.
Created wget tracking bugs for this issue:
Affects: fedora-all [bug 1662833]
curl seems to have a similar issue, filed an upstream bug at:
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.
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.
Created curl tracking bugs for this issue:
Affects: fedora-all [bug 1662852]
(In reply to Huzaifa S. Sidhpurwala from comment #9)
> curl seems to have a similar issue, filed an upstream bug at:
... and here is the corresponding pull request at curl upstream:
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
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):