By Robert Jones
Price: $39.95 USD
£28.50 GBP
Cover | Table of Contents | Colophon
www.lavasoftusa.com/software/adaware/
www.safer-networking.org/en/index.html
208.12.16.5.www.oreilly.com.208.12.16.5.www.oreilly.com.dig
, whois, and traceroute are all included in standard Unix and Mac OS X distributions. Windows users will find variants of all of these, available for free or as shareware. Unfortunately there are so many of these that it is hard to make any specific recommendations. Look them up on your favorite search engine and try a few of them out. Web page interfaces to the tools can also be found on a number of sites.dig (domain information groper) is a DNS lookup utility
that I will use extensively in the course of this book. dig can help you find the IP address for a given hostname and the hostname, if any, for a given IP address.nslookup
. A precursor of dig, its use is now discouraged, even though it is still included in most Unix distributions. The same applies to host, which is also widely available. You may find that you prefer the command syntax or output format of one tool over another. I am only going to describe dig in detail here.dig will get the IP address for the supplied hostname. Here is a typical example:
1 % dig www.craic.com
2 ; <<>> DiG 9.2.3 <<>> www.craic.com
3 ;; global options: printcmd
4 ;; Got answer:
5 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57325
6 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 1
7
8 ;; QUESTION SECTION:
9 ;www.craic.com. IN A
10
11 ;; ANSWER SECTION:
12 www.craic.com. 600 IN A 208.12.16.5
13
14 ;; AUTHORITY SECTION:
15 craic.com. 600 IN NS dns3.seanet.com.
16 craic.com. 600 IN NS dns1.seanet.com.
17 craic.com. 600 IN NS dns2.seanet.com.
18
19 ;; ADDITIONAL SECTION:
20 dns3.seanet.com. 82411 IN A 199.181.164.3
21
22 ;; Query time: 98 msec
23 ;; SERVER: 192.168.2.18#53(192.168.2.18)
24 ;; WHEN: Fri Jan 7 14:16:07 2005
25 ;; MSG SIZE rcvd: 127
http://isc.sans.org/presentations/dnspoisoning.php.dig on the hostnames. Table 2-3 shows a small sample of the results from that survey, sorted by IP address.|
Hostname
|
IP address
|
|---|---|
adv3.pureadvances.com
|
66.111.233.138
|
adv4.pureadvances.com
|
66.111.233.139
|
gold4.goldenbeachexlusives.com
|
http://rfc.net/rfc2076.html, but, as you will see, there is considerable variation in their format.
Delivered-To: XYZ@gmail.com
Return-Path: <ABC@craic.com>
Received: by 10.54.18.32 with SMTP id 32cs2945wrr;
Fri, 25 Feb 2005 15:27:07 -0800 (PST)
Received: by 10.54.7.40 with SMTP id 40mr65062wrg;
Fri, 25 Feb 2005 15:27:05 -0800 (PST)
Received: from gateway.craic.com
(gateway.craic.com [208.12.16.5])
by mx.gmail.com
with ESMTP id 9si124319wrl.2005.02.25.15.26.58;
Fri, 25 Feb 2005 15:27:04 -0800 (PST)
Received: from [192.168.2.7] (nexus.craic.com [208.12.16.2])
by gateway.craic.com (8.11.6/8.11.6)
with ESMTP id j1PNQvl31568
for <XYZ@gmail.com>;
Fri, 25 Feb 2005 15:26:58 -0800
Message-ID: <421FB441.8030406@craic.com>
Date: Fri, 25 Feb 2005 15:26:57 -0800
From: ABC <ABC@craic.com>
User-Agent: Mozilla Thunderbird 0.9 (X11/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: XYZ@gmail.com
Subject: Test
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This is a testhttp://rfc.net/rfc2076.html, but, as you will see, there is considerable variation in their format.
Delivered-To: XYZ@gmail.com
Return-Path: <ABC@craic.com>
Received: by 10.54.18.32 with SMTP id 32cs2945wrr;
Fri, 25 Feb 2005 15:27:07 -0800 (PST)
Received: by 10.54.7.40 with SMTP id 40mr65062wrg;
Fri, 25 Feb 2005 15:27:05 -0800 (PST)
Received: from gateway.craic.com
(gateway.craic.com [208.12.16.5])
by mx.gmail.com
with ESMTP id 9si124319wrl.2005.02.25.15.26.58;
Fri, 25 Feb 2005 15:27:04 -0800 (PST)
Received: from [192.168.2.7] (nexus.craic.com [208.12.16.2])
by gateway.craic.com (8.11.6/8.11.6)
with ESMTP id j1PNQvl31568
for <XYZ@gmail.com>;
Fri, 25 Feb 2005 15:26:58 -0800
Message-ID: <421FB441.8030406@craic.com>
Date: Fri, 25 Feb 2005 15:26:57 -0800
From: ABC <ABC@craic.com>
User-Agent: Mozilla Thunderbird 0.9 (X11/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: XYZ@gmail.com
Subject: Test
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This is a test
Return-Path: <Web@fbi.gov>
Received: from nvwyu.gov (i528C1073.versanet.de [82.140.16.115])
by gateway.craic.com (8.11.6/8.11.6)
with SMTP id j1R0aU702669
for <XYZ@craic.com>; Sat, 26 Feb 2005 16:36:30 -0800
From: Web@fbi.gov
To: XYZ@craic.com
Date: Sat, 26 Feb 2005 23:17:43 GMT
Subject: You visit illegal websites
Message-ID: <dea28bde431c7ce0c@fbi.gov>
[...]
From, Return-Path, and Message-ID headers all referring to the domain fbi.gov. But the single Received header tells a different story. The message was received by gateway and because I control this machine, I trust it to report the correct IP address of the sending MTA. The hostname within the parentheses is the result of a DNS lookup by my server, so I also trust this. This is clearly not an FBI host. The domain is owned by an ISP located in Germany, and the alphanumeric string used as the hostname (i528C1073) has the look of an address assigned to an subscriber's computer, most likely at home. Preceding the parentheses is a fictitious domain, nvwyu.gov, which has been created by the sender.root and send out notification emails whenever certain events take place. I don't want people replying to root, so I forge the From address to either my address or that of the recipient. This is a useful technique that illustrates just how easy it is to generate spam.sendmail on a Unix system. Regular mail clients like Outlook and Thunderbird are not set up to do this. Start by writing a simple message to yourself in a file using an editor. Put your address in the To line and set the From line to whatever you like. In this example, I am going to impersonate someone at O'Reilly. Add a Reply-To header and even make up your own Message-Id. For example:
To: XYZ@craic.com
From: ABC@oreilly.com
Reply-To: ABC@oreilly.com
Message-Id: <12345678@oreilly.com>
Subject: Test
Hello World
sendmail to read those headers from the file rather than the command line by giving it the -t flag.
% /usr/lib/sendmail -t < test_message
Return-Path: <root@biotech.craic.com>
Received: from biotech.craic.com (biotech.craic.com [208.12.16.3])
by gateway.craic.com (8.11.6/8.11.6)
with ESMTP id j21NSQ721278
for <XYZ@craic.com>; Tue, 1 Mar 2005 15:28:26 -0800
Date: Tue, 1 Mar 2005 15:28:21 -0800
Reply-To: ABC@oreilly.com
Message-Id: <12345678@oreilly.com>
To: XYZ@craic.com
From: ABC@oreilly.com
Subject: Test
Hello World
Return-Path and hostname for the sender. You can fix the first of these problems by specifying the From address as a command-line option, thus:
% /usr/lib/sendmail -t -fABC@oreilly.com < test_message
sendmail, as well as most other MTAs, can be configured to record information about the messages it handles in log files
. The default level of logging in sendmail captures pretty much the same information as the Received headers in the messages themselves. But there is much less opportunity for forgery in these logs, at least as long as the server has not been compromised. More importantly, by examining log files, we might be able to discover groups of related messages being transferred at the same time, indicative of a coordinated spam campaign rather than a single unsolicited message. Distinctions like this are very important in legal proceedings related to spam.gateway, the MTA that received the delivered message. A typical location for these log files on a Unix or Mac OS X system is /var/log. We can use the message ID generated on that server to find the matching records.
% grep j21Mui721208 /var/log/maillog
Mar 1 14:56:44 gateway sendmail[21208]: j21Mui721208:
from=<ABC@oreilly.com>, size=286, class=0, nrcpts=1,
msgid=<12345678@oreilly.com>, proto=ESMTP, daemon=MTA,
relay=biotech.craic.com [208.12.16.3]
Mar 1 14:56:44 gateway sendmail[21209]: j21Mui721208:
to=<XYZ@craic.com>, delay=00:00:00, xdelay=00:00:00,
mailer=local, pri=30022, dsn=2.0.0, stat=Senthttp://www.lurhq.com/sobig-e.html. For a more detailed technical analysis, written by a group of analysts who have chosen to remain anonymous, you might find this document of interest: http://spamkings.oreilly.com/WhoWroteSobig.pdf. It offers a fascinating insight into the world of virus tracking and even names the individual that the authors believe created the worm.
From: support@symantec.com
To: XYZ@craic.com
Subject: Re: Submit a Virus Sample
Date: Sat, 15 Jan 2005 23:58:39 +0800
The sample file you sent contains a new virus version of mydoom.j.
Please clean your system with the attached signature.
Sincerly,
Robert Ferrew
+++ Attachment: No Virus found
+++ MessageLabs AntiVirus - www.messagelabs.com
From: support@symantec.com
To: XYZ@craic.com
Subject: Re: Submit a Virus Sample
Date: Sat, 15 Jan 2005 23:58:39 +0800
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0016----=_NextPart_000_0016"
This is a multi-part message in MIME format.
------=_NextPart_000_0016----=_NextPart_000_0016
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: 7bit
The sample file you sent contains a new virus version of mydoom.j.
[...]
------=_NextPart_000_0016----=_NextPart_000_0016
Content-Type: application/octet-stream;
name="datfiles.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="datfiles.zip"
UEsDBAoAAAAAAEtqLzKjiB3egHMAAIBzAABTAAAAZG9jdW1lbnQudHh0ICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
[...]
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5l
eGVQSwUGAAAAAAEAAQCBAAAA8XMAAAAA
------=_NextPart_000_0016----=_NextPart_000_0016--http://spamassassin.apache.org/). Statistical filtering, using Bayesian analysis, looks at things like word frequencies in sets of messages that have been manually classified as spam or not, typically by the end user. As such it reflects their personal interests and can adapt to changes in the types of email that an individual receives. This is the approach taken in the Thunderbird email client, among others. A good introduction to Bayesian filtering is this paper by Paul Graham: http://www.paulgraham.com/spam.html. If spam can be traced back to a specific network address, then that address can be added to a Block List, or blacklist, of known spammers. A mail server can look up the address of each MTA that wants to transfer a message and automatically reject those that are on the list. This approach will become less effective in the face of proxy servers that were created by the Sobig worms. The Spamhaus Block List
is a leading example of this approach, and their web site is an excellent resource: http://www.spamhaus.orghttp://www.craic.com
http://208.12.16.5
http://www.craic.com
http://208.12.16.5
http://%77%77%77%2e%63%72%61%69%63%2e%63%6f%6d
http://www.oreilly.com@www.craic.com
http) but other options include https, ftp, file, and mailto.www.craic.com, or a numeric IP address, such as 208.12.16.5.http://208.12.16.5 and http://www.craic.com are completely equivalent. But most people don't remember the IP address of their own computer, let alone one for eBay or Citibank. Most people tend to assume that an IP address is valid, whereas a false hostname is more likely to arouse suspicion. Scammers exploit this and often use IP addresses
in their URLs.http://202.87.128.138/sys/index.php