1 -----------------------------------------------------------------------
2 sniffdet - Remote Sniffer Detection Tool/Library
3 http://sniffdet.sourceforge.net
4 -----------------------------------------------------------------------
6 -----------------------------------------------------------------------
7 Explanation and general introduction about sniffers and the techniques
9 -----------------------------------------------------------------------
10 Last revision: 10Jan2003
13 If you can read in brazilian portuguese, there's a full paper covering
14 this and much more available at our website: "Implementação de um
15 Sistema Para a Detecção Remota de Sniffers em Redes TCP/IP".
17 ----------------------------------------------------------------------
18 What's a network sniffer
19 ----------------------------------------------------------------------
21 Tipically, any program that runs collecting data from the network over an
22 interface is, potentially, a sniffer. Such applications can be used by
23 system administrator to detect problems in a network, but also by attacker
24 and malicious users to read data wich doesn't belong to them.
26 A sniffer is usually a passive interactor, which means it inject packets
27 in the network as less as possible. This characteristic makes it difficult
28 to find them. We have to explore OS characteristics and use empiric tests
29 to accomplish that task. It's like a race: if the sniffer is smart enough,
30 it can always bypass our tests by detecting and reacting to them in time,
31 and the tests always have to improve in order to make this task more
34 If the network interface is running in "normal mode", all a sniffer can
35 capture is the data being transfered betwen the two hosts comunicating (or
36 a broadcast transmission). But if the network card is running in
37 "promiscuous mode", all the traffic in the wire can be read, and the
38 potential of finding something useful increases (there's a lot of
39 discussion about switched networks, wireless networks and
40 broadcast/difusion/hub networks, but we will not address these topics
41 here... Our paper in portuguese (see above) covers all that, thought.
43 A sniffer usually runs in promiscuous mode, and that's the main
44 characteristic that we try to find with a test: if a machine is running in
45 promiscuous mode (but there are several other tests/approaches too).
48 ----------------------------------------------------------------------
50 ----------------------------------------------------------------------
52 There are, tipically, two ways of finding sniffers: locally and
55 Besides the local way being much more deterministic (you just have to test
56 the interface for the promiscuous mode setting) it's much harder to
57 implement in a network which is very large or contains several kinds of
58 operating systems. You also have to trust the machine environment and it
59 may require manual intervention from the administrator. Basically, that's
60 why the remote way is preferred.
62 Also remember that if the machine where the sniffer is potentially running
63 is compromissed the invader can do whatever he wants to hide himself and
64 the sniffer (use rootkits, kernel modules, etc).
66 In the remote detecting way, there are two category of tests
67 representing the different approachs to detect sniffers in an
70 The passive tests just read packets from network, trying to find
71 typical signatures of anomalies usually seen in sniffers behaviours. A
72 typical example are those sniffers that pretend they are the local
73 router machine, sending its address to machines wich perform the
74 who-is-the-router query, usually using ARP.
76 The active tests, however, try to detect the sniffer by sending altered
77 packets to it and waiting for a response related to a host working in a
78 promiscuous mode. These tests explore certains caracteristics of sniffers
79 and Operational Systems, usually finding network cards running in
82 The tests above are the basic idea of the approaches used to detect
83 sniffers. Most of them are implemented in someway in sniffet, but there
84 are a lot of variations to every test (the goal of libsniffdet is to
85 provide a full set of tests, with a lot of customization and variations
89 ICMP TEST (implemented in sniffdet)
90 ----------------------------------------------------------------------
91 Send a ICMP ECHO REQUEST with a bogus MAC address to the suspicious host
92 and await for a reply. If it happens, then the machine is capturing traffic
93 that is not destined to it (a good sign that it is in promiscuos mode).
96 - Build an icmp packet with a bogus mac address (0xff 0x...)
98 - Wait for a ICMP reply
99 Got a response? --> Remote machine is in promiscuous mode
100 No reponse? --> The remote machine is probably not in promiscuous
101 mode (there's no way to be sure).
102 } while (...timeout, max_tries, found, etc...)
105 ARP TEST (implemented in sniffdet)
106 ----------------------------------------------------------------------
107 The same idea of ICMP test, but using the ARP protocol.
110 DNS TEST (implemented in sniffdet)
111 ----------------------------------------------------------------------
112 Inject a false traffic betwen two machines that don't exist in the network
113 and watch the wire looking for DNS requests to resolve these (inexistend)
114 addresses. If it happens, the machine were the request was being sent is
115 probably running a sniffer (which is interested in reverse resolving the
116 IP address it founds in the traffic - something very common).
119 - Build a dns packet with invalid IP as source/destination
120 - Put the packet in the wire
121 - Sniff the wire looking for dns resolve requests for
123 Got a request? --> The machine from which the request originated
124 is probably in promiscuous mode.
125 No reponse? --> Whatever... We just don't know.
126 } while (...timeout, max_tries, found, etc...)
129 LATENCY TEST (implemented in sniffdet)
130 ----------------------------------------------------------------------
131 Flood the network with specially crafted packets that only machines in
132 promiscuous mode would capture. By doing some sort of test to measure the
133 responsiveness of the machines being tested (like ICMP ECHO
134 REQUEST/REPLY), you can detect machines running in promiscuous mode and/or
137 - Measure the response time of the remote machine
139 Thread1: Cause a DoS (flood) in that machine using packets with
140 invalid MAC addresses
141 Thread2: Measure the response time of the remote machine
142 - Interpret the difference between the two response times:
143 Huge difference: The machine is probably in promiscuous mode.
144 Small difference: If the machine is in promiscuous mode, then
145 either the DoS is not effective or the machine
147 Notice this test is heavily subjective. It depends on a lot of factors
148 (CPU/network power, OS, effectivenes of the DoS attack, etc).
151 HONEYPOT TEST (not - yet at least - implemented in sniffdet)
152 ----------------------------------------------------------------------
153 Just put some bait traffic in the network and await for the attacker to
154 use it in any of your severs.
156 - Use some sensitive traffic as a bait (passwords, usernames, etc);
157 - sniff the wire looking for use of these baits;
161 ----------------------------------------------------------------------
163 Sniffing (network wiretap, sniffer) FAQ
164 by Robert Graham <sniffing-faq@robertgraham.com>
165 http://www.robertgraham.com/pubs/sniffing-faq.html
167 Sniffer Detection Tools and Countermeasures
168 http://rr.sans.org/covertchannels/sniffer.php
170 Evading Passive Sniffer Detection With IDS Sensors
171 http://rr.sans.org/intrusion/IDS_sensors.php
173 I Can See you Behind Layer 2...
174 Overcoming the difficulties of Packet Capturing on a
176 http://rr.sans.org/switchednet/layer2.php
178 Sniffers: What are they and How to Protect From Them
179 http://rr.sans.org/switchednet/sniffers.php
181 Internetworking with TCP/IP
182 Vol.1: Principles, Protocols, and Architecture (4th Edition)
183 Douglas E. Comer, ISBN: 0130183806