StunTour: SSL Enabler for mIRC

Background

Being able to connect securely to SSL-enabled IRC chat servers is something that remains difficult for most Win32 IRC applications. Very few IRC clients natively support connecting to servers with SSL, and the few that do are generally of very poor quality.

If you want to securely use a client such as the popular Win32 mIRC client, then you must generally resort to running a separate tunneling application (such as stunnel) and then make mIRC to connect to a port bound to a localhost listening socket. This has the added overhead of requiring another application to be running at all times, and makes it difficult to change what server you connect to since you must manipulate the destination of the tunnel application. Also, running an external program is inconvenient and prone to problems.

What is it?

After growing tired of fighting with stunnel, I decided to write a mIRC plugin DLL that would natively allow it to connect to SSL-enabled IRC servers. StunTour is a utility that automatically intercepts connections with destination port of 994. This allows you to connect to IRC servers using a secure SSL connection (provided that the server supports connecting over SSL on port 994).

There are currently very few IRC networks that support SSL connections. However, one IRC network that this program has been tested with is CuckooNet IRC (irc.cuckoo.net or irc.distributed.net), which is the IRC network run primarily for the users of distributed.net.

Due to the hooking technique that is being used, this program is only compatible with Windows 2000 and Windows XP machines.  It will not work on Windows 95, Windows 98, or Windows Me.

How do I load it?

  1. You can run the STUNRUN.EXE helper utility.

    This causes mIRC to be automatically launched with the DLL pre-loaded. You should ensure that mIRC is not already running when you do this.

  2. You can start MIRC.EXE as you normally would, but load the DLL manually in mIRC with the command (before you connect):
    	/dll stuntour.dll load_stunnel
    
  3. You can start MIRC.EXE as you normally would, but have the DLL loaded automatically with scripting. Simply add this line to your "Remote" script tab:
            on *:start: { /dll stuntour.dll load_stunnel }
    

    Note that you cannot put a the dll load lines in the "Perform" script box since those commands are run after mIRC successfully connects to the server.

If you use the manual loading techniques (methods 2 or 3) and want to unload the library hooks manually for some reason without having to exit mIRC, use the following command:

	/dll -u stuntour.dll

Okay it's loaded, how do I use it?

StunTour is a automatically intercepts connections with destination port of 994. Simply configure mIRC to directly connect to the IRC server on port 994 and that connection will be automatically wrapped in an SSL encrypted tunnel.  Actually, StunTour currently allows any of the following ports to be used (contact me if your IRC network uses a port that is not listed and I'll add it):

How does it work?

I'm using a the OpenSSL library for the implementation of the encryption layer, and the Microsoft Detours library to perform API interception/hooking on several of the standard Winsock functions. From mIRC's perspective, it is still opening an unencrypted connection to the server, but my code is doing the necessary work to ensure that the actual connection is actually SSL encrypted. I do this by using the Microsoft Detours library to intercept the Winsock connect(), send(), recv(), etc functions and making them utilize the OpenSSL equivalents when a connection is made to a remote server on port 994.

Why is it named "stuntour"?

The name is simply a shortened contraction of "SSL tunnel detour". The word "detour" is simply the name of the API hooking library that I'm using to perform some of the critical network interception calls.


Jeff Lawson <jlawson@bovine.net>