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
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.
External References: http://git.savannah.gnu.org/cgit/wget.git/tree/NEWS
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.
Created wget tracking bugs for this issue: Affects: fedora-all [bug 1662833]
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.
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.
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: > https://github.com/curl/curl/issues/3423 ... and here is the corresponding pull request at curl upstream: https://github.com/curl/curl/pull/3433
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): https://access.redhat.com/security/cve/cve-2018-20483