Encrypting IRC Client and Server

For IRC Issues

Encrypting IRC Client and Server

Post by -Ninjex- on Mon Sep 24, 2012 1:15 am
([msg=69596]see Encrypting IRC Client and Server[/msg])

In the example below, we look at encrypting communication between an IRC client and server, via tunneling a connection to a remote server, even though the IRC server does not directly support encrypted communications.

This works as follows:

I will connect to a remote host using ssh, specifying a port to be used to forward connections to the remote server. This will then make it possible to start the service which is to be encrypted on the client machine, connecting to the same local port, and ssh will encrypt and forward the connection.

Before we start, if you are wondering
#-- I am using backtrack 5 R3 Gnome 64
#-- I am using xChat IRC
#-- I purchased a VPS and used it as the remote host. (I am blocking out the IP of my VPS for security reason of course)

The following example will show you how to tunnel an IRC session from client machine “127.0.0.1” (localhost) to remote server “hackthissite.org”

Code: Select all
:~# ssh -f -L 1234:localhost:6667 208.**.**.** sleep 10

Code: Select all
:~# xchat --url=irc://irc.hackthissite.org:6667


This tunnels a connection to to your remote server, and allows allows the ports to connect to IRC server "hackthissite.org”. It doesn't matter which port is used, as long as it's greater than 1023 (also, keep in mind that you can only open ports on privileged sockets if you are running as root) and doesn't conflict with any ports already in use. The connection then gets forwarded to port 6667 on the remote server, since in most cases, that will be the port for IRC services.
In the example above, you would make sure to replace IP "208.**.**.**" with your remote host.

The -f option backgrounds ssh and the command “sleep 10” will allow 10 seconds to start the service which is to be tunnelled. If no connections are made within the time specified, ssh will exit.

If you need the irc client xChat IRC just run:

Code: Select all
:~# sudo apt-get install xchat


I hope some of you can learn something from this.
Last edited by -Ninjex- on Mon Sep 24, 2012 4:39 pm, edited 1 time in total.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
^(-.^)>
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1468
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Encrypting IRC Client and Server

Post by weekend hacker on Mon Sep 24, 2012 10:38 am
([msg=69606]see Re: Encrypting IRC Client and Server[/msg])

Correct me if I'm wrong, but you're tunneling from your local port 1234 to your remote servers port 6667(not hts, as we don't provide ssh access | also not sure why theres the extra localhost:6667)
then you're telling xchat to totaly ignore all this and use port 7000(with + to specify that it should use ssl) so its connection will be encrypted.
<Yoda> if someone says something i don't like, i ban him, ban whoever defends him, and then ban the witnesses...
User avatar
weekend hacker
Administrator
Administrator
 
Posts: 192
Joined: Sun Apr 13, 2008 2:39 pm
Location: 127.0.0.1
Blog: View Blog (0)


Re: Encrypting IRC Client and Server

Post by -Ninjex- on Mon Sep 24, 2012 4:34 pm
([msg=69617]see Re: Encrypting IRC Client and Server[/msg])

weekend hacker wrote:Correct me if I'm wrong, but you're tunneling from your local port 1234 to your remote servers port 6667(not hts, as we don't provide ssh access | also not sure why theres the extra localhost:6667)
then you're telling xchat to totaly ignore all this and use port 7000(with + to specify that it should use ssl) so its connection will be encrypted.



Ahh, thanks for the reply my friend, after hearing what you said, I realized I had messed up my code and post.
The first code should be executed as follows:

Code: Select all
ssh -f -L 1234:localhost:6667 208.**.**.** sleep 10


Code: Select all
xchat --url=irc://irc.hackthissite.org:6667


This will tunnel the connection to the vps or remote host as you stated.
All of your statements above are correct, I was just hitting the "up" key on my terminal and copied the codes that I thought to have used and I was wrong, and did my whole post explaining things wrong.

Thanks for the reply and the insight, I will now go back and fix the errors in my original post, thanks.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
^(-.^)>
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1468
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Encrypting IRC Client and Server

Post by weekend hacker on Mon Sep 24, 2012 6:05 pm
([msg=69620]see Re: Encrypting IRC Client and Server[/msg])

Still not tunneling though
use something like
Code: Select all
ssh -f -L 1234:irc.hackthissite.org:6667 208.**.**.** sleep 10

to have local port 1234 tunnel through server 208.**.**.**(possibly add a username here) to irc.hackthissite.org on port 6667
and
Code: Select all
xchat --url=irc://localhost:1234

to have xchat connect to localhost port 1234

And possibly you could do(I haven't tested, sounds like you have homework to do)
Code: Select all
ssh -f -L 1234:irc.hackthissite.org:7000 208.**.**.** sleep 10

to have local port 1234 tunnel through server 208.**.**.**(possibly add a username here) to irc.hackthissite.org on port 7000
and
Code: Select all
xchat --url=irc://localhost:+1234

to have xchat use an ssl connection through said tunnel.
if this works then you'll have a secure connection to your vpn, and another secure connection from your home machine to the HTS server through the secure tunnel. in the top example your vpn could still be spying on you as all traffic from it to the HTS server is unencrypted, with the below example it can't.
If this ware https this would totaly fuck up your certs because your hostname wouldn't match the one on the cert.(which in turn you could possibly solve by changing your hosts file to have www.hackthissite.org resolve to localhost.. but which would add the problem that the ssh tunnel doesn't know the real ip(s) of www.hackthissite.org.. yay tunnels)
<Yoda> if someone says something i don't like, i ban him, ban whoever defends him, and then ban the witnesses...
User avatar
weekend hacker
Administrator
Administrator
 
Posts: 192
Joined: Sun Apr 13, 2008 2:39 pm
Location: 127.0.0.1
Blog: View Blog (0)


Re: Encrypting IRC Client and Server

Post by -Ninjex- on Mon Sep 24, 2012 9:10 pm
([msg=69625]see Re: Encrypting IRC Client and Server[/msg])

weekend hacker wrote:Still not tunneling though
use something like
Code: Select all
ssh -f -L 1234:irc.hackthissite.org:6667 208.**.**.** sleep 10

to have local port 1234 tunnel through server 208.**.**.**(possibly add a username here) to irc.hackthissite.org on port 6667
and
Code: Select all
xchat --url=irc://localhost:1234

to have xchat connect to localhost port 1234

And possibly you could do(I haven't tested, sounds like you have homework to do)
Code: Select all
ssh -f -L 1234:irc.hackthissite.org:7000 208.**.**.** sleep 10

to have local port 1234 tunnel through server 208.**.**.**(possibly add a username here) to irc.hackthissite.org on port 7000
and
Code: Select all
xchat --url=irc://localhost:+1234

to have xchat use an ssl connection through said tunnel.
if this works then you'll have a secure connection to your vpn, and another secure connection from your home machine to the HTS server through the secure tunnel. in the top example your vpn could still be spying on you as all traffic from it to the HTS server is unencrypted, with the below example it can't.
If this ware https this would totaly fuck up your certs because your hostname wouldn't match the one on the cert.(which in turn you could possibly solve by changing your hosts file to have http://www.hackthissite.org resolve to localhost.. but which would add the problem that the ssh tunnel doesn't know the real ip(s) of http://www.hackthissite.org.. yay tunnels)


Thanks again, this is honestly the first tutorial I have written in my hacking career and was just trying to bring some stuff to the community. I realize now that I should have delved further into my studies before posting a tutorial that I am not 100% confident with. I used a section from the Manuel of ssh as follows:

Code: Select all
In the example below, we look at encrypting communication between an IRC
     client and server, even though the IRC server does not directly support
     encrypted communications.  This works as follows: the user connects to
     the remote host using ssh, specifying a port to be used to forward con‐
     nections to the remote server.  After that it is possible to start the
     service which is to be encrypted on the client machine, connecting to the
     same local port, and ssh will encrypt and forward the connection.

     The following example tunnels an IRC session from client machine
     “127.0.0.1” (localhost) to remote server “server.example.com”:

         $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
         $ irc -c '#users' -p 1234 pinky 127.0.0.1

     This tunnels a connection to IRC server “server.example.com”, joining channel “#users”, nickname “pinky”, using port 1234.  It doesn't matter which port is used, as long as it's greater than 1023 (remember, only root can open sockets on privileged ports) and doesn't conflict with any ports already in use.  The connection is forwarded to port 6667 on the remote server, since that's the standard port for IRC services.

     The -f option backgrounds ssh and the remote command “sleep 10” is speci‐
     fied to allow an amount of time (10 seconds, in the example) to start the
     service which is to be tunnelled.  If no connections are made within the
     time specified, ssh will exit.


I used this to build my tutorial, and I will admit, I am new to ssh and found it fascinating, and I was wrong.
Thanks, Weekend for helping clean up the scratches in my posts!
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
^(-.^)>
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1468
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)



Return to IRC

Who is online

Users browsing this forum: No registered users and 0 guests