Douglas Crawford

Douglas Crawford

May 17, 2013

As internet censorship tightens across the world, governments are becoming more and more concerned about preventing the use of VPN to circumvent their restrictions. China, with its Great Firewall, has been particularly active in this regard, and there have been many reports from people using a VPN in China and having their connections blocked.

The problem is that while it is impossible to ‘see’  the data in an encrypted VPN tunnel, increasingly sophisticated firewalls are able use Deep Packet Inspection (DPI) techniques to determine that encryption is being used (to detect for example the SSL encryption used by OpenVPN).

There are a number of solutions to this problem, but most of them require a degree of technical expertise and server-side configuration, which is why this article is simply an introduction to the options available. If hiding your VPN signal is important to you and Port 443 forwarding  (see below) is insufficient, then you should contact your VPN provider to discuss whether they would be willing to implement one of the solutions outlined below (or alternatively find a provider, such as AirVPN, who already offers this type of support).

Port Forward OpenVPN through TCP port 443

By far the simplest method, one that can be easily performed from your (the client) end, requires no server-side implementation, and will work in most cases, is to forward your OpenVPN traffic through TCP port 443.

OpenVPN by default uses TCP port 1194, so it is common for firewalls to monitor port 1194 (and other commonly used ports), rejecting encrypted traffic that tries to use it (or them).  TCP port 443 is the default port used by HTTPS (Hypertext Transfer Protocol Secure), the protocol used to secure https:// websites, and used throughout the internet by banks, gmail, twitter, and many more essential web services.

Not only is the use of OpenVPN, which like HTTPS uses SSL encryption, very difficult to detect over port 443, but blocking that port would severely cripple access to the internet and is therefore not usually a viable option for would-be web censors.

Port forwarding is one of the most commonly supported features in custom OpenVPN clients, making changing to TCP port 443 ridiculously easy. If your VPN provider does not supply such a client, then you should contact them.

Unfortunately, the SSL encryption used by OpenVPN is not exactly the same as ‘standard’ SSL, and advanced Deep Packet Inspection (of the type increasingly used in places such as China), can tell if encrypted traffic conforms to the ‘real’ SSL/HTP handshake. In such cases alternative methods of evading detection need to be found.

Obfsproxy

Obfsproxy is a tool designed to wrap data into an obfuscation layer, making it difficult to detect that OpenVPN (or other VPN protocols) are being used. It has recently been adopted by the Tor network, largely as response to China blocking access to public Tor nodes, but it is independent of Tor, and can be configured for OpenVPN .

To work, obfsproxy needs to be installed on both the client’s computer (using for example port 1194), and the VPN server. However, all that is then required is that the following command line be entered on the server:

obfsproxy obfs2 –dest=127.0.0.1:1194 server x.x.x.x:5573

This tells obfsproxy to listen on port 1194, to connect locally to port 1194 and forward the de-encapsulated data to it (x.x.x.x should be replaced with your IP address or 0.0.0.0 to listen on all network interfaces). It is probably best to set up a static IP with your VPN provider so the server knows which port to listen in on.

Compared to the tunnelling options presented below, obfsproxy is not as secure, as it does not wrap the traffic in encryption, but it does have a much lower bandwidth overhead since it is not carrying an additional layer of encryption. This can be a particularly relevant for users in places such as Syria or Ethiopia, where bandwidth is often a critical resource. Obfsproxy is also somewhat easier to set up and configure.

OpenVPN through an SSL tunnel

A Secure Socket Layer (SSL) tunnel can, on its own, be used as an effective alternative to OpenVPN, and in fact many proxy servers use one to secure their connections (an article on setting this up is available here). It can also be used to completely hide the fact that you are using OpenVPN.

As we noted above, OpenVPN uses a TLS/SSL encryption protocol that is slightly different from ‘true’ SSL, and which can be detected by sophisticated DPI’s. In order to avoid this, it is possible to ‘wrap‘ the OpenVPN data in an additional layer of encryption. As DPIs are unable to penetrate this ‘outer’ layer of SSL encryption, they are unable to detect the OpenVPN encryption ‘inside’.

SSL tunnels are usually made using the multi-platform stunnel software, which must be configured on both the server (in this case your VPN provider’s VPN server) and the client (your computer). It is therefore necessary to discuss the situation with your VPN provider if you want to use SSL tunnelling (a setup guides is available here for reference), and receive configuration instructions from them if they agree. A few providers offer this as a standard service, but AirVPN is the only one we have so far reviewed (anonypoz being another).

Using this technique does incur a performance hit, as an extra layer of data is being added to the signal.

OpenVPN through an SSH tunnel

This works in a very similar way to using OpenVPN through an SSL tunnel, except that the OpenVPN encrypted data is wrapped inside a layer of Secure Shell (SSH) encryption instead. SSH is used primarily for accessing shell accounts on Unix systems, so its use is mainly restricted to the business world, and is nowhere near as popular as SSL.

As with SSL tunnelling, you will need to talk to your VPN provider to get it working, although AirVPN supports it ‘out of the box’. SSH tunnelling uses the PuTTY telnet/SSH client, and a relatively simple setup guide can be found here.

Conclusion

Without very deep packet inspection, OpenVPN encrypted data looks just like regular SSL traffic. This is especially true if routed via TCP port 443, where a) you would expect to see SSL traffic and b) blocking it would hamstring the internet.

However, counties such as Iran and China are very determined to control their population’s uncensored access to the internet, and have put into place technically impressive (if morally objectionable) measures to detect OpenVPN encrypted traffic. As even being discovered using OpenVPN can get you into trouble with the law in such countries, it is in these situations a very good idea to use one of the additional precautions outlined above.

Douglas Crawford
May 29th, 2018

I am a freelance writer, technology enthusiast, and lover of life who enjoys spinning words and sharing knowledge for a living. You can now follow me on Twitter - @douglasjcrawf.

31 responses to “How to hide OpenVPN traffic – an introduction

  1. Thank you for a very good tutorial. I am having problems for some friends connecting to my openvpn (ASUS router), they can login and ping but they cannot surf, the page does not come up. I have no problems connecting to the server from outside and surfing is fine. My guess is that it is because of firewall settings they have. Reading your tutorial I am a little confused, Is it correct if I change the server form UDP to TCP, and the port it uses today (1194) to 443, after that I generate the .ovpn file and they use it to login. Is it correct?

    1. Hi Kan,

      Changing to TCP port 443 is useful for evading attempts at blocking OpenVPN. If your friends can connect to your router over OpenVPN, though, then that is not the problem (although you are correct about how to change your settings). I’m afraid that am not sure why your friends cannot surf from your router…

  2. Hi

    I am trying to connect to a China website via a Korea VPS, which is extremely stable and fast. I am using openVPN, but it not working, I think possibly because of the port. How do you switch the port to 443 like you mentioned?

    1. Hi Michelle,

      You can change the port used by your OpenVPN instance by editing the OpenVPN server configuration file (server.conf?) and changing/adding the line ‘port 443’ (if you have 2 configuration files ensure this line is added to both).

  3. Surprised you didn’t mention the openvpn “port-share” option that has been there for years – even years before you wrote this post.

    Configure openvpn to listen on TCP-443, configure certificate authentication (with optional password auth, your call), then also enable the additional tls-auth feature. Once that all works, then configure port-share to a valid but very benign HTTPS website. Then setup port 80 with the same website, optionally with a redirect to https/443.

    Any connections that openvpn gets that are not tls-auth’d will be transparently sent to the HTTPS server. If anyone sees your traffic and goes to investigate without the proper tls-key they will simply see the website you sent them too.

    Various use cases I’ve set up:

    hidden openvpn and my person website, both listening on TCP-443

    hidden openvpn and a RSS/ATOM -> Static HTML news feed both on TCP-443

    Setting reverse dns on the IP to the website name, to help feed the illusion this is simply a website that I frequent.

    The best part is, TCP-443 traverses most firewalls and proxies in most locations. Since OpenVPN is based on SSL, it’s traffic looks like a valid, though long running SSL connection. In most cases it goes unnoticed. Usually the give-away is the duration of the connection, and the amount of data transferred. Most proxies don’t appear log until the connection is finished, however, so that helps avoid detection.

    I convinced one client that the connection must be due to a browser bug when reading my news-site.

    99% of the time I can use this to egress most of my client’s networks without issue.

    1. Hi Sinister Brain,

      Thanks for the idea! This does require that you setup your own OpenVPN server, but it is a great way to hide OpenVPN traffic (it is also useful for accessing the internet on locked-down networks where access is typically restricted to ports 80 and 443.) When I get an OpenVPN server up and running again I’ll do a tutorial on this.

  4. How do i find this traffic on network? I think users are using this to play WOW. How do u use Wireshark to catch it? I am new to this. Thanks guys!

    1. You can’t. If users are playing online games, you might be able to induce half a second of lag and let them go crazy and give up.

  5. I’ve read the whole article but I have a question: I know that Thor has implemented obfuscted ssl too. How can I use both OpenVpn, and Thor to encrypt my connection?

    Maybe doing a fusion between OVPN and Thor? If there any configuration for it?

Leave a Reply

Your email address will not be published. Required fields are marked *