Actions

Secure Command Line / Tor Browser Downloads

From Whonix



Securedownloads.jpg

Frequently users will want to download files from the Internet in order to achieve desired aims. Secure downloading of files is a complex subject and the potential security implications are often poorly understood.

Downloads with scurl - SSL Command Line Downloader[edit]

Introduction[edit]

Info Note: This is for advanced users. In all cases avoid downloading files over plain HTTP.

When using the command line to download files or webpages, resorting to the simple wget command is ill-advised because it is buggy [archive]. For example, if users do not force a request to use SSL encryption, wget can fail silently [archive]. Even when SSL is enforced with a command line option, this can break interoperability with some sites [archive] that use self-signed, expired or invalid certificates. Users could potentially ignore certificate verification warnings and proceed with downloads where the site's authenticity is in question.

To provide greater security when downloading, scurl [archive] comes pre-installed in Whonix ™ and provides a simple wrapper around curl [archive]:

  • /usr/bin/scurl [archive] simply adds --tlsv1.3 --proto =https to all curl instances to enforce strong encryption.
  • scurl-download [archive] additionally adds --location to follow redirects as well as --remote-name to use extract the file name from the URL. [1]

Stream Isolation is enforced in Whonix ™, because /usr/bin/curl is a uwt wrapper symlinked to /usr/libexec/uwt/uwtwrapper, which will ultimately run /usr/bin/curl.real.

scurl is not vulnerable to SSLstrip [archive]. This is a man-in-the-middle attack which forces a user's browser to communicate with the adversary in plain-text over HTTP (poisoning the download). At present, scurl is available in Whonix ™ and the command will generally not work in other distributions.

How-to: Invoke scurl-download[edit]

Note: In the examples below, the file will be saved in the user's current working directory. If the file should be saved elsewhere, change the current working directory before running scurl.

To invoke scurl-download to download a file, simply run (replace the https:// example with the actual file location).

scurl https://dist.torproject.org/torbrowser/9.5/tor-browser-linux64-9.5_en-US.tar.xz

This will download tor-browser-linux64-9.5_en-US.tar.xz to the current working directory.

Figure: scurl Command in Whonix ™

Scurltorbrowser.png

To invoke scurl-download to download a web page, run (replace the https:// example with the actual webpage).

scurl-download https://check.torproject.org

All other curl/Linux features continue to work, such as storing the input inside of a file (change index.html to the desired file name).

scurl https://check.torproject.org > index.html

scurl Errors[edit]

As expected, attempting scurl with plain HTTP will fail.

scurl http://check.torproject.org

This will result in the following output.

curl: (1) Protocol http not supported or disabled in libcurl

Similarly, scurl fails with the following attempt.

scurl check.torproject.org

Returning the following output.

curl: (1) Protocol http not supported or disabled in libcurl

Running scurl against a self-signed or invalid SSL certificate also fails.

scurl https://www.debian-administration.org

This results in an error, for example.

curl: (60) SSL certificate problem: self signed certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file is not adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Secure Downloads with Tor Browser[edit]

Preventing SSLStrip Attacks[edit]

Info If clicking or pasting a download link, make sure it is https://. The s in https:// stands for "secure".

Users often mistakenly believe that a secure, green padlock and a https:// URL makes any download from that particular website secure. This is not the case because the website might be redirecting to http. In fact, an SSLstrip attack [archive] might succeed if a link is pasted or typed into the address bar without the https:// component (e.g. torproject.org instead of https://torproject.org [archive]). [2]

In this instance, it is impossible to confirm if the file is being downloaded over https://. Potentially, a SSLstrip attack might have made the download take place over plain http. The reason is a padlock is not visible; it just appears empty.

To avoid this risk and similar threats, always explicitly type or paste https:// in the URL / address bar. The SSL certificate button or padlock will not appear in this instance, but that is nothing to be concerned about. Unfortunately, few users follow this sage advice; instead most mistakenly believe pasting or typing www.torproject.org into the address bar is safe.

Other Precautions[edit]

For even greater safety, download files from onion services (.onion addresses) whenever possible. Improved security is provided by onion service downloads, since the connection is encrypted end-to-end (with PFS), targeting of individuals is difficult, and adversaries cannot easily determine where the user is connecting to or from.

Also, if files are already available in repositories, then prefer mechanisms which simplify and automate software upgrades and installations (like APT functions), rather than download Internet resources. Avoid installing unsigned software and be sure to always verify key fingerprints and digital signatures of signed software from the Internet, before importing keys or completing installations. For more on this topic, see: Installing Software Best Practices.

Finally, consider using Multiple Whonix-Workstation ™ when downloading and installing additional software, to better compartmentalize user activities and minimize the threat of misbehaving applications.

Outside of Whonix[edit]

curl[edit]

curl --tlsv1.3 --proto =https --location  --remote-name

Footnotes[edit]

  1. write output to a local file with the same name as the remote file retrieved [archive]. Only the file part of the remote file is used and the path is cut off.
  2. And that website does not:


Fosshost is sponsors Kicksecure ™ stage server 100px
Fosshost About Advertisements

Search engines: YaCy | Qwant | ecosia | MetaGer | peekier | Whonix ™ Wiki


Follow: 1024px-Telegram 2019 Logo.svg.png Iconfinder Apple Mail 2697658.png Twitter.png Facebook.png Rss.png Reddit.jpg 200px-Mastodon Logotype (Simple).svg.png

Support: Discourse logo.png

Donate: Donate Bank Wire Paypal Bitcoin accepted here Monero accepted here Contribute

Whonix donate bitcoin.png Monero donate Whonix.png United Federation of Planets 1000px.png

Twitter-share-button.png Facebook-share-button.png Telegram-share.png link=mailto:?subject=Secure Downloads&body=./Secure_Downloads link=https://reddit.com/submit?url=./Secure_Downloads&title=Secure Downloads link=https://news.ycombinator.com/submitlink?u=./Secure_Downloads&t=Secure Downloads link=https://mastodon.technology/share?message=Secure Downloads%20./Secure_Downloads&t=Secure Downloads

AppArmor Join us in testing our new AppArmor profiles for improved security! ( forum discussion)

https link onion link Priority Support | Investors | Professional Support

Whonix | © ENCRYPTED SUPPORT LP | Heckert gnu.big.png Freedom Software / Osi standard logo 0.png Open Source (Why?)

The personal opinions of moderators or contributors to the Whonix ™ project do not represent the project as a whole.

By using our website, you acknowledge that you have read, understood and agreed to our Privacy Policy, Cookie Policy, Terms of Service, and E-Sign Consent.