From: <Microsoft Internet Explorer 5¡Æ¢® AuAa>
Subject: The power of the sniffer snoop!
Date: Sun, 17 Jun 2001 12:02:13 +0900
MIME-Version: 1.0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.enteract.com/~lspitz/snoop.html
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>The power of the sniffer snoop!</TITLE>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3018.900" name=3DGENERATOR>
<META=20
content=3D"Published article on how to leverage the network sniffer, =
snoop.  Article includes examples of command syntax and traffic =
analysis. Snoop is a powerful tool standard with the Solaris operating =
system.>   <META name=3D"=20
name=3Ddescription></HEAD>
<BODY><I><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+1>A =
passive=20
approach to your network security</FONT></FONT></I> <BR><B><FONT=20
face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+4>The Secrets of=20
Snoop</FONT></FONT></B> <BR><B><FONT face=3D"Palatino,Book =
Antiqua"><FONT=20
size=3D-1><A href=3D"mailto:lance@honeynet.org?Subject=3DThe Secrets of =
Snoop">Lance=20
Spitzner</A></FONT></FONT></B>=20
<P><B>Sniffers have exploded in popularity over the past several years, =
from=20
Network General&#8217;s Netxray and Microsoft&#8217;s Network Monitor, =
to public domain=20
tools such as Etherman and Curry Sniffer. These tools are used for =
various=20
reasons, including network troubleshooting, traffic analysis, node =
discovery,=20
etc. We will be covering one of the most common, yet effective sniffers, =
snoop.=20
Of all the sniffers, this is one standby you always have access to with =
Solaris.=20
The purpose of this article is to demonstrate how to leverage snoop, =
with=20
examples focusing on network security.</B> <BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+2>What =
is=20
snoop?</FONT></FONT></B>=20
<P>Snoop is an executable binary that puts your system&#8217;s =
interface(s) in=20
promiscuous mode. By being in promiscuous mode, snoop captures all =
packets on=20
you network, in either real time or capture file format. What makes =
snoop so=20
powerful is the detail of information it provides and the flexibility of =
the=20
tool.=20
<P>In the first half of this article we will focus on snoop commands, =
how to get=20
the information we want. The second half of this article we will focus =
on=20
analyzing network traffic with real world examples, focusing on =
security. The=20
examples will be IP, but snoop can be used to capture and analyze other =
network=20
packets, such as DECnet and AppleTalk. For packet analysis, I will be =
using the=20
standard 7 layer OSI model (see Figure 1 for a refresher). <BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+2>How =
to Use=20
Snoop</FONT></FONT></B>=20
<P>The first thing you have to decide is do you want real time data, or =
capture=20
packets to a snoop capture file? Most of the time, you will capture the =
data to=20
a file. In real-time mode the data flies across you screen to fast to =
read. Its=20
only real benefit is to give you a quick feel of what traffic is moving =
on your=20
network. To do some serious analysis, you will want to capture your =
network=20
traffic to a file so you can take your time.=20
<P>To capture data to a file, the command is <BR><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1>#snoop &#8211;o =
<I>filename</I></FONT></FONT>=20

<P>This saves all the data in binary format to <I>filename</I>. To see =
data=20
real-time, exclude the command "-o filename". Otherwise, all command =
syntax is=20
the same for snoop.=20
<P>The first thing we need to do is determine how many packets to =
capture. If no=20
number is determined, snoop will continue to gather packets until you =
CRTL-C or=20
run out of resources. To set the number, use the command.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>#snoop &#8211;o =
<I>filename</I> &#8211;c=20
1000 .</FONT></FONT>=20
<P>Snoop will capture 1000 packets in about 60 seconds on a standard =
10Mbps=20
network.=20
<P>Next, we want to determine what level of detail we need. Snoop comes =
in three=20
flavors, summary (default), verbose summary (-V), and verbose mode (-v). =
Summary=20
gives us the least information, only the highest protocol level, layer =
5,6 or 7=20
, and packet source/destination. Below is a single packet in summary =
mode. This=20
is the 27<SUP>th</SUP> packet captured, it shows a Telnet connection =
between=20
squirrel and my school account. 0.01743 is the time between packet 26 =
and 27.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>27 0.01743 =
squirrel -&gt;=20
ICARUS.CC.UIC.EDU TELNET C port=3D45330</FONT></FONT>=20
<P>Verbose summary (-V) gives us all the layers of the OSI model, =
(layers 2,3,4,=20
and 5, 6 or 7) but in summarized fashion, one line for each layer. Below =
we see=20
an example, packet 27 again. Notice it gives us layer 2 (ETHER), layer 3 =
(IP),=20
layer 4 (TCP), and layer 7 (Telnet). Note how it also gives Syn and Seq=20
(sequence number). There is no Ack (Acknowledge number) so this is the =
first=20
packet for this Telnet session.=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>27 0.01743 squirrel -&gt;=20
ICARUS.CC.UIC.EDU ETHER Type=3D0800 (IP), size =3D 58 =
bytes</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>27 0.01743 squirrel -&gt; =
ICARUS.CC.UIC.EDU IP=20
D=3D128.248.121.53 S=3D208.194.41.20 LEN=3D44, ID=3D6082</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>27 0.01743 squirrel -&gt; =
ICARUS.CC.UIC.EDU TCP=20
D=3D23 S=3D45330 Syn Seq=3D678057692 Len=3D0 Win=3D8760</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>27 0.01743 squirrel -&gt; =
ICARUS.CC.UIC.EDU=20
TELNET C port=3D45330</FONT></FONT>=20
<P>Verbose gives us all the gory details of each packet, all the way to =
the bit=20
level on the OSI model. Below is a packet 27 in verbose mode. Here we =
see=20
detailed information of each layer, layer 2 (Ethernet), layer 3 (IP), =
and layer=20
4 (TCP) header. See <A=20
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc894.txt">RFC =
894</A>=20
(Ether), <A=20
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc791.txt">791</=
A> (IP),=20
and <A =
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc793.txt">793</=
A>=20
(TCP) for specific header information.=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>ETHER: ----- Ether Header=20
-----</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>ETHER:</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>ETHER:=20
Packet 27 arrived at 10:40:36.07</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>ETHER: Packet size =3D 58 =
bytes</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>ETHER: Destination =3D =
8:0:20:8d:fc:d2,=20
Sun</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>ETHER: =
Source =3D=20
8:0:20:c:df:aa, Sun</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>ETHER: Ethertype =3D 0800 (IP)</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>ETHER:</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: ----- IP Header =
-----</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>IP:</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: Version =3D 4</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: Header length =3D 20 =
bytes</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>IP: Type of service =3D=20
0x00</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>IP: =
xxx. .... =3D 0=20
(precedence)</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP: ...0=20
.... =3D normal delay</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP:=20
.... 0... =3D normal throughput</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>IP: .... .0.. =3D normal reliability</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: Total length =3D 44 =
bytes</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>IP: Identification =3D=20
6082</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>IP: =
Flags =3D=20
0x4</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>IP: =
.1.. .... =3D do=20
not fragment</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP: ..0.=20
.... =3D last fragment</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>IP: Fragment offset =3D 0 bytes</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: Time to live =3D 255=20
seconds/hops</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP:=20
Protocol =3D 6 (TCP)</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP:=20
Header checksum =3D 7005</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>IP: Source address =3D 208.194.41.20, squirrel</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>IP: Destination address =3D =
128.248.121.53,=20
ICARUS.CC.UIC.EDU</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>IP:=20
No options</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>IP:</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>TCP: -----=20
TCP Header -----</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>TCP:</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>TCP:=20
Source port =3D 45330</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =

size=3D-1>TCP: Destination port =3D 23 (TELNET)</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>TCP: Sequence number =3D =
678057692</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Acknowledgement =
number =3D=20
0</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Data =
offset =3D 24=20
bytes</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: =
Flags =3D=20
0x02</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: =
..0. .... =3D=20
No urgent pointer</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>TCP:=20
...0 .... =3D No acknowledgement</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>TCP: .... 0... =3D No push</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>TCP: .... .0.. =3D No =
reset</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: .... ..1. =3D =
Syn</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: .... ...0 =3D No =
Fin</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Window =3D =
8760</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Checksum =3D =
0x517a</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Urgent pointer =3D =
0</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: Options: (4 =
bytes)</FONT></FONT>=20
<BR><FONT face=3D"Courier New"><FONT size=3D-1>TCP: - Maximum segment =
size =3D 1460=20
bytes</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>TCP:</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>TELNET:=20
----- TELNET: -----</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>TELNET:</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT =
size=3D-1>TELNET:=20
""</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>TELNET:</FONT></FONT>=20
<P>No one level of detail is "better" then the other. It depends on what =
type of=20
information you are looking for. Keep in mind however that snoop can be =
resource=20
intensive. In verbose mode, snoop may overwhelm the system, forcing it =
to drop=20
packets depending on your network traffic. In some cases, you may have =
to use a=20
dedicated server for snoop, depending on your verbose level and number =
of=20
packets gathered. To capture 1000 packets in verbose summary mode:=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>#snoop &#8211;V =
&#8211;o <I>filename</I>=20
&#8211;c 1000</FONT></FONT>=20
<P>To read a capture file, use &#8211;i <I>filename</I>. If you captured =
packets in=20
verbose mode, you can read a capture file in summary, verbose summary, =
or=20
verbose mode. I recommend you scan through the capture file in summary =
mode,=20
identify what packets are interesting, then view specific packets in =
verbose=20
mode. To look at a specific packet, use &#8211;p<I>packet</I>#. Below is =
an example of=20
looking at packets 10-32 and packet 56 in verbose mode.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>snoop &#8211;i =
<I>filename </I>&#8211;v<I>=20
</I>&#8211;p10-32,56</FONT></FONT>=20
<P>Now lets leverage the true power of snoop. Snoop has a variety of =
filtering=20
tools, allowing us to focus on the type of packets we capture, be it =
source,=20
destination, protocol layer, etc. Here we will cover some of the most =
commonly=20
used options. However, for complete information, be sure to do a man on=20
snoop(1).=20
<P>First, we can select what systems, by either MAC (layer 2) or IP or =
host=20
name, (layer 3) will be snooped. This limits what packets are captured =
at the=20
interface. If you have just one node you want to snoop, include its IP =
address.=20
If there are several, use the expression "and" or "or" between the =
nodes. You=20
can focus the expression even more with the qualifier "from" or "to" =
which match=20
the source or destination address. The "!" or "not" performs a logical =
NOT=20
operation. Last, the expression "net" captures all packets that belong =
to a=20
specific network. The command below captures all packets coming from =
zeus, going=20
to 8:0:20:f1:b3:51, or packets belonging to the network 192.168.3.0, =
except=20
192.168.3.58. Note, the host name zeus must be resolvable, be it =
/etc/hosts or=20
DNS.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>snoop &#8211;o =
<I>filename</I> from=20
zeus or to 8:0:20:f1:b3:51or net 192.168.3.0 not =
192.168.3.58</FONT></FONT>=20
<P>Just as we can qualify specific hosts or networks at layer 2 or 3, we =
can=20
limit packets captured at layers 4, 5, 6, and 7. At layer 4, we can =
qualify=20
"tcp", "udp", or "icmp" (actually RFC 792 states icmp is a layer 3 =
protocol, but=20
I have placed it here to reflect snoop&#8217;s man page). For layers 5,6 =
and 7 use the=20
qualifiers "port" and "rpc" (based on the /etc/services and /etc/rpc =
files). The=20
command below captures all DNS or NFS packets=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>snoop &#8211;o =
<I>filename</I> &#8211;V=20
port domain or rpc nfs</FONT></FONT>=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+2>Snoop =
and=20
Security</FONT></FONT></B>=20
<P>Now that we have covered the flexibility of snoop, lets apply it to =
your=20
network security. With snoop, you silently sit on the network and =
capture data.=20
Unlike active measures, such as network discovery using ICMP, snoop does =
not=20
alert anyone to its presence. This allows you to analyze the security of =
your=20
network, without notifying anyone. Also, snoop can run over a long =
period of=20
time, compared to active measures that run in a single point of time. If =
a=20
server is down for several minutes while you are pinging the network, =
you will=20
miss it. Snoop will pick up these servers, as long as they eventually =
send or=20
receive traffic.=20
<P>Snoop does two critical things for security, it tells you who is on =
your=20
network, and what they are doing. You need to first identify what your =
security=20
concern is, then configure snoop to find that information.=20
<P>Often, a security concern is having a node or gateway on your network =
that=20
you do not know about. This node could be an innocent dial-up server, or =
a=20
gateway a hacker set-up. I know of a company where an unknown Internet=20
connection was recently identified with a sniffer. Active measures will =
tell you=20
who is on the network, only if the machine is on. But what if a node is =
on only=20
at night, or has been configured not to ICMP_REPLY, then what? Using the =

qualifiers we covered above, snoop could capture information on your =
network.=20
With a perl or shell script, you could parse this information, =
identifying=20
unknown nodes on your network.=20
<P>Another security issue is what is going on your network. You may be =
concerned=20
about specific websites or downloads. Perhaps you are concerned that =
users are=20
downloading the latest hacker attacks. You can snoop your network, =
looking for=20
FTP downloads from known websites. I know of a recent incident where an =
employee=20
was identified of this during a routine network analysis.=20
<P>Perhaps you have several critical servers that have been hit with =
denial of=20
service attacks, such as land.c or ping of death. You can qualify snoop =
to look=20
for land.c by capturing packets with source and destination the same. =
For ping=20
of death, look for icmp packets with extremely large lengths.=20
<P>So far we have discussed what snoop can do, now we will cover what =
snoop=20
cannot do. Unlike active measures, snoop, like most sniffers, cannot =
operate in=20
a switched environment. Snoop only records packets that cross the =
designated=20
interface. Switches block and forward IP packets based on their MAC , =
layer 2,=20
address. If you have a switch, snoop will capture only the packets in =
its=20
collision domain.=20
<P>Where you snoop is just as important as what you snoop. If you want =
to=20
monitor all the traffic on your network, place your sniffer on the =
Internet=20
router segment. This way your are capturing all Internet traffic, you =
are no=20
limited to specific collision domains.=20
<P>This limitation of snoop can also be used to your advantage. A common =
tactic=20
of hackers is to compromise a system and implement. Once compromised, =
the=20
sniffer picks up user names and passwords. Several months ago, the SANS=20
Institute was compromised by this same method. A prime target for this =
are=20
systems on your DMZ, or the network segment between your Internet router =
and=20
Firewall. Often companies place unsecured systems outside the firewall, =
such as=20
webservers. However, once compromised, these systems make excellent =
platforms=20
for capturing user names and passwords. To protect your network, place =
these=20
systems behind a switch. If compromised, they are still isolated in =
their=20
collision domain, thus protecting you from sniffing (note, if possible, =
you may=20
want to hardcode the MAC address on the switch to specific ports).=20
<P>Snoop is an extremely powerful and flexible tool. Its uses are as =
varied as=20
its qualifiers. The ideas and concepts covered in this article are only =
an=20
introduction to its capabilities.=20
<P><B><FONT face=3DHelvetica,Arial>Figure A</FONT></B> <BR><I><FONT=20
face=3DHelvetica,Arial>OSI 7 Layer Model</FONT></I> <BR><I><FONT=20
face=3DHelvetica,Arial>The OSI model (Open Systems Interconnection =
model) was=20
developed in 1974 by the International Standards Organization) The seven =
layer=20
model is an international standard that allows systems to communicate =
with each=20
other as if they were the same system. Each layer has a specific purpose =

independent of each other. A packet starts at the applications layer, =
works it=20
way down the stack, and is then sent to the other system. The other =
system=20
receives the packet at the first layer, then sends it back up the stack. =
Not all=20
layers, specifically 5 and 6, may be utilized.</FONT></I>=20
<P><B><FONT face=3D"Palatino,Book Antiqua"><FONT size=3D-1>Layer 7 =
Application=20
(SMTP, TELNET)</FONT></FONT></B> <BR><I>Defines the network =
applications.</I>=20
<P><B>Layer 6 Presentation (Encryption)</B> <BR><I>Data translation =
(format of=20
the data)</I>=20
<P><B>Layer 5 Session</B> <BR><I>Establishes, maintains, and disconnects =
a=20
communications link between two stations on a network</I>=20
<P><B>Layer 4 Transport (TCP, UDP)</B> <BR><I>Provides for end-to-end=20
transmission of data</I>=20
<P><B>Layer 3 Network (IP, IPX, AppleTalk)</B> <BR><I>Controls =
forwarding of=20
packets between stations.</I>=20
<P><B>Layer 2 Data Link (Ethernet, Token Ring)</B> <BR><I>Physical layer =

addressing , synchronizes transmission and handles frame-level error =
control and=20
recovery</I>=20
<P><B>Layer 1 Physical (UTP, Fiber)</B> <BR><I>Method used to transmit =
data=20
(media, voltage, etc)</I> <BR>&nbsp;=20
<P><B><I><FONT face=3D"Helvetica-Narrow,Arial Narrow">Author&#8217;s =
bio</FONT></I></B>=20
<BR><I>Lance Spitzner enjoys learning by blowing up his Unix systems at =
home.=20
Before this, he was an <A=20
href=3D"http://www.enteract.com/~lspitz/officer.html">Officer in the =
Rapid=20
Deployment Force,</A> where he blew up things of a different nature. You =
can=20
reach him at <A =
href=3D"mailto:lance@honeynet.org">lance@honeynet.org</A> .</I>=20
<BR>&nbsp; <BR>&nbsp; <BR>&nbsp;=20
<CENTER>
<TABLE border=3D5>
  <TBODY>
  <TR>
    <TD><I><FONT face=3DBraggadocio><FONT color=3D#800000><FONT =
size=3D+2><A=20
      href=3D"http://www.enteract.com/~lspitz/pubs.html">Whitepapers /=20
      =
Publications</A></FONT></FONT></FONT></I></TD></TR></TBODY></TABLE></CENT=
ER></BODY></HTML>

