Forging an email is the easiest thing in the world. Once you see
how easy it is then I think you’ll understand why you should
never trust the From header in an email.
A while ago I used
the Montagues and Capulets to explain how the domain name system worked.
I’ll do the same again to show how easy it is for anyone to
spoof your email address.
The plot thickens!
As per the story, Romeo and Juliet are separated after the party.
Tybalt wants to kill Romeo and knows he can use the lure of Juliet
to trap him. Tybalt’s email address is
tybalt@capulet.net but he wants to email
romeo@montague.net as Juliet.
Ordinary email programs
don‘t allow you to pretend to be someone else (though they could if they wanted). But when a program sends an email it is just having a very simple conversation with a mail server using a predefined protocol. So all Tybalt needs to do is have that same ’conversation’
with the mail server.
A program called telnet lets you get down to the
gritty details. You can pretend you’re an email program, a
web browser or anything else, as long as you give the correct
response to the questions you receive from the other computer.
Tybalt gets started
First, he has to log in to the Capulet family mail server using
telnet. The line with the dollar sign is where he runs
it from the command line. You can easily try this at home if you
know the name of your mail server.
$ telnet mail.capulet.net 25
Trying 192.168.2.14...
Connected to mail.capulet.net (192.168.2.14).
Escape character is '^]'.
The mail server sends messages prefixed with a number. This is the
status code which your email program would recognise and respond
to. The words on the rest of the line are put there for the benefit
of people who want to test the system at this low level (or subvert
it). Any line which doesn’t begin with a number is written by
Tybalt.
First, the mail server identifies itself and then Tybalt does
likewise—and pretends to be Juliet’s laptop.
220 mail.capulet.net ESMTP
HELO julietslaptop
The mail server then shows that it’s ready to take commands.
This is where Tybalt pretends the email is coming from
Juliet’s address and going to Romeo:
235 Nice to meet you julietslaptop
MAIL from: juliet@capulet.net
250 OK ... Sender accepted.
RCPT to: romeo@montague.net
250 OK ... Recipient accepted.
Then Tybalt has to tell the mail server to receive the content of
the email, using the DATA command. Notice that he puts
To and From information in this part of the message too. If he
omitted these then Romeo would still get the message but the To and
From headers in his email program would appear blank. This is like
putting ‘Dear Romeo’ and ‘from Juliet’
inside the letter—the bit above is just the address on the
envelope.
DATA
354 Ready for message. Enter "." on its own line to finish.
From: "Juliet" juliet@capulet.net
To: "Romeo" romeo@montague.net
Subject: secret meeting
Come to the town square at midnight, behind the clock.
Come alone and make sure you're not followed.
J. xxx
.
250 OK Message transmitted ID 82679401
The dirty deed is done. Tybalt can log off and head out to capture
Romeo unawares.
Or will he?! Find out next time…