I guess you would not have landed here if you don’t read about Heartbleed. In case you really don’t know what its all about, catch up here. Since OpenVPN makes use of SSL/TLS (and most distributions use OpenSSL as the implementation of choice), OpenVPN is affected too (check the official page). Most test utilities out there can test HTTP and other protocols, however, I didn’t found a test which validates that a OpenVPN installation is safe. So I created one.
You can find the Python script over at Github. My version is an heavily altered version I found at Fox-It created by Jared Stafford and Yonathan Klijnsma.
Right now, the utility only supports UDP (which is used by default). The first arguments need to be the test server which then will be contacted and a TLS session initialized. The script then sends a invalid heartbeat request, which the server will respond to if he is vulnerable.
$ ./heartbleed_test_openvpn.py my.server.com my.server.com|VULNERABLE 0000 18 03 01 10 13 02 10 00 48 65 61 72 74 62 6C 65 ........Heartble 0010 65 64 20 74 65 73 74 20 70 61 79 6C 6F 61 64 E2 ed test payload. 0020 0B 9E 38 34 EC 3D 66 2B 9C D5 63 00 00 68 C0 14 ..84.=f+..c..h.. 0030 C0 0A 22 C0 C0 21 00 39 00 38 00 88 00 87 C0 0F ...".!.9.8...... 0040 C0 05 00 35 00 84 C0 21 C4 08 1C 1C C0 1B 00 16 ...5............ 0050 00 13 C0 0D C0 03 00 0A C0 13 C0 09 C0 1F C0 1E ................ 0060 00 00 00 32 ...2
If the server is patched, the client won’t receive an answer on that TLS heartbeat request, instead the underlying OpenVPN protocol just confirms the reception of the message itself, without transmitting further data.
$ ./heartbleed_test_openvpn.py other.server.com other.server.com|NOT VULNERABLE
The OpenVPN protocol implements its own lightweight ordering logic and reliability messages (ACKs) which the TLS protocol runs on top of it. My script implements a hacky version of that protocol just to get some packages through in order to find out weather the server handles malicious heartbeat requests or not.
Please use the utility with care and only against your own servers!
Are servers that have tls-auth enabled vulnerable? The script does not work work in that case (and OpenVPN reports error “TLS Error: cannot locate HMAC in incoming packet”). Is that just a matter of modifying the script, or is the server actually safe in this case? If I understand correctly tls-auth requires the client to authenticate itself before sending anything and thus the exploit would not work from random attackers. (but maybe authorized clients can still do it?)
Hi, i have used your script to test my openvpn server
for the Heartbleed bug and the server is VULNERABLE! so i installed the latest openssl-version 1.0.1g but when i use your script again it is still VULNERABLE!!
On OpenVPN site it says to update the openssl-library but it not helped!
Regards
rubiktubik
Thanks for the heartbleed_test_openvpn.py program. It nicely identified my tomato shibby openvpn server as exposed. However, it just hung when I protected the server with the tls-auth option as described in:
openvpn.net/index.php/open-source/documentation/howto.html#security
It also hung when run against a server using a static key.
Thanks for this. Couldn’t find any other tools online for testing OpenVPN
@nobody: In the tls-auth case packages need a HMAC signature which by design only can be sent by a valid client (given that the hash function is not broken). But after that, the OpenSSL Bug is still there. So a client can still read out servers memory (which could be the servers private key), hence your server is still vulnerable. Although, you are in a lot better position since an attack can only be done by a valid client…
@rubiktubik: Did you restart the OpenVPN server daemon?