Sender authentication part 5: More on received headers

We saw in part 2 of this series that when a receiving email server gets the message, it inserts a Received: header into the mail headers of the message.  Let's go back to our previous example and see what happens if the message is routed through a couple of more servers.

Suppose that on its way from, mail sent from had to go through a couple of forwarding relays.

Received: from ( []) by (8.8.5) for with EMSTP id 123456789-0AH for <>Received: from ( []) by an_email_program (1.0) with SMTP id 71718149989; Thu, June 21, 2007 23:06 -0800
Received: from ( []) by another_email_program (7.3) with SMTP id 9899481717; Thu, June 21, 2007 23:01 -0800
Date: Fri, Jun 18, 2007 20:20:20 PST
Message-ID: <>
Subject: How's it going?

I've highlighted the received headers in different colors.  In general, you read received headers from bottom to top, with the most recent one getting stamped at the top and being the most reliable one.  In the above example, the message started from the IP at a mail host called  It got routed through their competitors (IP =, went through before finally arriving at its end destination at  It's a complicated process but from the above, we can see that the message originated at, the first IP address.

In real life, it doesn't quite work that way.  Spammers will often insert fake routine information into the headers.  Here is a real life example of a spam message that I just received in my own email account (with some of the identifying information removed):

Received: from ( []) by (Postfix) with ESMTP id 78128787654; Thu, 21 Jun 2007 22:46:40 +0000 (UTC)
Received: from (HELO by with esmtp (1/9B/+4-) LD*H)
id (<C/(,-Q>,0(B-E< for; Thu, 21 Jun 2007 22:46:50 +0300

From the above, we can see that the message originated at from a machine calling itself, passed itself to a machine in a DSL pool in Argentina before finally arriving at my inbox.  Or did it?

Look at the blue received header,  it looks suspicious.  That first received header is wrong.  For one thing, it says Received: from <IP address> rather than Received: from mail host.  Then, typically we would expect to see IP address in parentheses rather than only the name of the host.  Of course, some mail servers are configured differently and this could be a configuration issue, but it is suspicious.  Generally, as a spam analyst I would use this information alone to call it a forgery.

Moving onwards, look at the SMTP id.  A bunch of characters including forward slashes, + and - signs and the asterisk.  That, too, is suspicious and more than enough to confirm this received header as a forgery and is not authentic.  Thus, we look at the line above and see that this mail originated from

Spammers can insert more than one extra received header.  Sometimes they are easy to spot, sometimes they are not.  The times when they don't look like regular received headers gives them away; they will have syntax errors and extra X-headers that don't make any sense.  Other times, spammers will be quite subtle in that they will mimic actual received headers.  That makes things harder to pick out.

The last (ie, first in the header list) received header is correct because it contains the latest hop that the message went through and your machine stamped it.  It doesn't mean that the mail originated at that IP but at least you have some information about where the mail recently came from.