How to Block Tor (The Onion Router)
The Tor network (The Onion Router) disguises user identity by moving their data across different Tor servers, and encrypting that traffic so it isn't traced back to the user. Anyone who tries to trace would see traffic coming from random nodes on the Tor network, rather than the user's computer.
The following configurations on the Palo Alto Networks Next-Generation firewall can block Tor application traffic on your network.
Note: Blocking any evasive application like Tor needs a combination of different capabilities as outlined above. In many cases, just using a single capability is not enough. Use as many of these configurations as needed to properly block Tor.
Palo Alto Networks has created applications such as tor and tor2web to identify Tor connections. Like any other anonymizer, Tor uses different techniques to bypass your security. Just blocking tor and tor2web applications in the security policy is not enough.
Create a security policy to block the following applications to the internet:
Inside the WebGUI > Policy > Security, be sure to create a rule that denies access to the above list, and make sure that the "Service" is set to "Application Default".
There are many avoidance applications out there that are being created as demand rises from users wanting to bypass restrictions. A good way to keep up with new applications is to use application filter and block applications based on behavior rather than manually adding each individual application to the security policy.
Application Filter dynamically groups applications based on the chosen category. More details on how to create application filters can be found in the PAN-OS Administration Guide (https://www.paloaltonetworks.com/documentation/80/pan-os/pan-os/app-id/create-an-application-filter)
Using Application Filter,(Objects > Application Filters) we can create a new group (Name - VPN) of applications based on the category "networking" and subcategory "proxy". This filter will include applications such as psiphon, tor2web, your-freedom...etc
Next, inside Policies > Security, create a security policy to block applications that are subcategorized as proxy. Include the application filter "VPN" in the security policy and set the action to "Deny".
Note: As a best practice, while white listing applications in your security policy, use "application-default" for the Service. The firewall compares the port used with the list of default ports for that application. If the port used is not a default port for the application, the firewall drops the session and logs the message "appid policy lookup deny".
Create URL Filtering profile that blocks access to web sites categorized as:
Associate the URL Filtering profile to security policy to enforce stricter control. Do this inside Objects > Security Profiles > URL Filtering. Find each category and block access to those categories above.
Note: Please follow the link: Create Best Practice Security Profiles for best practices when it comes to configuring security profiles.
As a best practice, it is advised to block any applications that are categorized as unknown-tcp, unknown-udp and unknown-p2p in your network.
If there are applications that users need to access in the internet that gets identified by the firewall as unknown-tcp or unknown-udp and if there is a need to allow access to these applications, create a security policy that allows unknown-tcp or unknown-udp on specific ports used by that specific application.
For other traffic that gets identified as "unknown-tcp" or "unknown-udp" or "unknown-p2p", we will create a security policy that denies the traffic.
Make sure you create this rule inside of Policies > Security, to look like below.
This can be achieved without having to actually decrypt traffic and can be quite effective in blocking Tor. We reccommend customers use a "decryption profile" as shown below as part of a no-decrypt rule to limit Tor from connecting.
To do this, go into Objects > Decryption Profile. If you do not already have a no-decrypt rule, please add it with the "Add" button. Inside the "No Decryption" tab, make sure the 2 options are selected.
Then inside Policies > Decryption and again, if you do not have a No Decryption rule, please add it with the "Add" button, and then inside of that rule, in the Options tab,
Once done, you should see the Decryption Profile name listed in the rules.
If, despite implementing all the controls suggested above, Tor can still connect, then we reccommend turning on SSL decryption for this traffic, which will help blocking Tor.
Create a decryption profile iniside Objects > Decryption Profile. Click "Add" at the bottom and give it a name. I used "decrypt". Be sure to select any options for Server Certificate Verification and Unsupported Mode Checks.
Then be sure to go into Policies > Decryption and associate the decrypt profile to a decrypt policy. Do this inside the "Options" tab inside the Decryption Policy Rule.
For more information on setting up SSL Decryption, please see:
Please refer to PAN-OS 8.0 Administration guide to create External Dynamic List to block traffic to Tor Nodes:(https://www.paloaltonetworks.com/documentation/80/pan-os/pan-os/policy/external-dynamic-list)
The following web-server (https://panwdbl.appspot.com/lists/ettor.txt) contains a list of Tor exit nodes. The list gets updated frequently and the firewall can obtain the list dynamically at the configured interval.
Note: This web-server (https://panwdbl.appspot.com/lists/ettor.txt) is managed externally by a third party organization, which will take care of the maintenance of the site.
To set the External Dynamic List, go into Objects > External Dynamic Lists and create a new list with "Add". Give it a name - Tor. Be sure to put the url: https://panwdbl.appspot.com/lists/ettor.txt inside of the source field.
Then inside of Policies > Security, create a new rule (Add) for the new EDL (External Dynamic List).
Inside of the Destination tab, be sure to use the EDL you just created "Tor".