Hosting Services on the Dark Web

In this tutorial I’m going to cover the following:

  • Tor Browser and Service
  • Creating a basic web page
  • Starting a basic web server to host our web page
  • Hosting our web page on the Dark Web with a custom Onion address

Tor Browser and Service

A Tor Browser allows you to access the “Dark Web”, “Deep Web” or “Hidden Web”. I’m going to demonstrate this using Kali linux, and it is not installed by default. You can also install the Tor Browser on Windows, OS X, Linux and Android.

The first step is to install “tor”.

kali@kali:~$ sudo apt-get update -y && sudo apt-get upgrade -ykali@kali:~$ sudo apt-get install tor -y

Then, we start the “tor” service…

kali@kali:~$ service tor status● tor.service – Anonymizing overlay network for TCP (multi-instance-master) Loaded: loaded (/lib/systemd/system/tor.service; disabled; vendor preset: disabled) Active: inactive (dead)kali@kali:~$ service tor start==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===Authentication is required to start ‘tor.service’.Authenticating as: Kali User,,, (kali)Password: ==== AUTHENTICATION COMPLETE ===

Optionally, we can also start the “tor” service on boot…

kali@kali:~$ sudo systemctl enable torSynchronizing state of tor.service with SysV service script with /lib/systemd/systemd-sysv-install.Executing: /lib/systemd/systemd-sysv-install enable torCreated symlink /etc/systemd/system/multi-user.target.wants/tor.service → /lib/systemd/system/tor.service.

Which ever operating system you use, the Tor browser requires a dedicated non-root user to run and there is a good reason for this. If for any reason the browser is compromised by some vulnerability or dodgy download, you want to limit the attack surface as much as possible on your system. For the same reason you would never want to run this as root.

kali@kali:~$ sudo adduser torAdding user `tor’ …Adding new group `tor’ (1001) …Adding new user `tor’ (1001) with group `tor’ …Creating home directory `/home/tor’ …Copying files from `/etc/skel’ …New password: Retype new password: passwd: password updated successfullyChanging the user information for torEnter the new value, or press ENTER for the default Full Name []: Tor Browser Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y

READ:  Difference Between Domain and Hosting

You will now want to log out of Kali and log in with this new dedicated user.

  1. Log into Kali with your “tor” user.
  2. Start your browser
  3. Open, “https://www.torproject.org
  4. Click on “Download Tor Browser
  5. Find the version for your operating system and download it
  6. Locate the archive on your system and open the archive
  7. Extract the “Browser” directory and “start-tor-browser.desktop” file to your desktop
  8. Close the archive
  9. Open “Tor Browser Setup” on your desktop

Click “Connect”. If for any reason it fails click on “Configure” and select that Tor is censored in your country and use a bridge. This should fix it then “Connect” again.

The Tor browser may look like a normal browser but it is special in the way it handles your network traffic by routing via proxy nodes. It also allows you to access special “.onion urls” on the “Dark Web”.

If you want to see an example of this search for “hiddenwiki url” in the “Search with DuckDuckGo” box. The “hiddenwiki” keeps moving so you will need to search for it. It contains a lot of many unindexed non-searchable .onion urls. Please be aware that a lot of it will be illegal to access so don’t do it.

I wanted to find an example .onion url to show you. In the hidden wiki, the DuckDuckGo browser also has an .onion url and can be accessed like this, “https://3g2upl4pq6kufc4m.onion”. This link will not work in a normal browser but in the “Dark Web” you can access it with the Tor browser.

READ:  Compare The Best Free Web Hosting Plans

As a pen tester and ethical hacker, you will find a lot of useful information on the “Dark Web” in order to carry out your job more effectively. The hacking forums are particularly interesting.

I guess it goes without saying to never run anything from the “Dark Web” on your regular machine or anyone’s machine for that matter. If you do want to run or look at something offline make sure you run it in a contained virtual machine with no external access.

Create yourself a basic web page

Let’s just make this as simple as possible.

Start by creating a directory for your website.

kali@kali:~$ sudo mkdir /var/www/onionkali@kali:~$ sudo chown kali:tor /var/www/onionkali@kali:~$ sudo chmod 775 /var/www/onion

Then create yourself a basic HTML page.

kali@kali:~$ cd /var/www/onionkali@kali:/var/www/onion$ echo “<html><head><title>Medium Tutorial</title></head><body>Medium Tutorial</body></html>” > index.htmlkali@kali:/var/www/onion$ ls -latotal 12drwxrwxr-x 2 kali tor 4096 Nov 21 23:47 .drwxr-xr-x 4 root root 4096 Nov 21 23:43 ..-rw-r-r- 1 kali kali 85 Nov 21 23:47 index.htmlkali@kali:/var/www/onion$ cat index.html<html><head><title>Medium Tutorial</title></head><body>Medium Tutorial</body></html>

Create yourself a basic web server

You can use anything you like here. You could go for a more production ready service like Apache or Nginx or just use a quick and dirty web server “one liner” using Python, Node, PHP etc.

I’ll use Python 3 as you will probably have it installed already and will be easiest to demonstrate.

MacOS

# Install XCode% xcode-select -install# Install Homebrew% ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”# Confirm Homebrew is installed% brew doctor# Install Python 3$ brew install python3% python3 -version Python 3.8.3

READ:  Mapping Network Drives - Dummies.com

Debian, Ubuntu, Kali etc.

# Update & Upgrade System# apt-get update -y && apt-get upgrade -y# Install Python 3# apt-get install python3 -y# python3 -versionPython 3.8.5

Redhat, CentOS etc.

# Update & Upgrade System# yum update -y# Install Python 3# yum install python38 -y# python3 -versionPython 3.8.3

Let’s confirm our web server works and the web page site loads…

kali@kali:/var/www/onion$ python3 -m http.server -bind 127.0.0.1 8080Serving HTTP on 127.0.0.1 port 8080 (http://127.0.0.1:8080/) …

Now open your browser and go to, “http://127.0.0.1:8080”.

Configuring our Dark Web service

You will need to do this next part as root.

kali@kali:/var/www/onion$ sudo su –[sudo] password for kali: root@kali:~#root@kali:~# vi /etc/tor/torrc

Navigate down to these lines…

#HiddenServiceDir /var/lib/tor/hidden_service/#HiddenServicePort 80 127.0.0.1:80

Uncomment the lines and change the port from 80 to 8080.

HiddenServiceDir /var/lib/tor/hidden_service/HiddenServicePort 80 127.0.0.1:8080

Save the file and exit.

Restart the “tor” service.

root@kali:~# service tor restart

And navigate to this directory.

root@kali:~# cd /var/lib/tor/hidden_serviceroot@kali:/var/lib/tor/hidden_service#

The “onion address” of our web site on the Dark Web is, “3vqzzssig3kbcnkgo3n6uf23xglgmupbrrky6zh3uyhee5mcbrz5d4qd.onion”

root@kali:/var/lib/tor/hidden_service# cat hostname3vqzzssig3kbcnkgo3n6uf23xglgmupbrrky6zh3uyhee5mcbrz5d4qd.onion

I’m going to log back into the Tor Browser “tor” user on my Kali linux system as I will want to browse to my onion site.

Let’s start our Python 3 web service…

┌──(tor㉿kali)-[~]└─$ cd /var/www/onion ┌──(tor㉿kali)-[/var/www/onion]└─$ python3 -m http.server -bind 127.0.0.1 8080Serving HTTP on 127.0.0.1 port 8080 (http://127.0.0.1:8080/) …

And confirm it still works locally…

Start up your Tor Browser and navigate to our onion address on the Dark Web.

And it works!

What is interesting as well is I didn’t need to open up any firewall rules to allow this web site to be hosted. It’s all handled through the Tor service.

  • If you enjoyed this, please follow me on Medium
  • Interested in collaborating? Let’s connect on LinkedIn