• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

CHANGESH A D23-May-20038.7 KiB272170

CREDITSH A D23-May-20036.9 KiB175113

LICENSEH A D23-May-200315 KiB305239

MakefileH A D23-May-20036 KiB218133

README.COMPATH A D23-May-2003372 1512

README.installH A D23-May-200320.5 KiB475359

README.methodsH A D23-May-20035.2 KiB13391

README.stealthH A D23-May-20037.1 KiB165126

ignore.cshH A D23-May-20032.7 KiB6731

portsentry.cH A D03-May-202253.1 KiB1,7791,381

portsentry.confH A D03-May-202210.9 KiB29614

portsentry.hH A D23-May-20032.8 KiB9660

portsentry.ignoreH A D23-May-2003480 2220

portsentry_config.hH A D03-May-20221.7 KiB395

portsentry_io.cH A D23-May-200320.5 KiB822613

portsentry_io.hH A D23-May-20031.9 KiB4322

portsentry_tcpip.hH A D23-May-20034.6 KiB170109

portsentry_util.cH A D23-May-20034.5 KiB14684

portsentry_util.hH A D23-May-20031.3 KiB284

README.COMPAT

1Tested and found to work on:
2
3Linux 1.x/2.x		<crowland at psionic.com>
4BSDI 2.x/3.x		<crowland at psionic.com>
5OpenBSD 2.x		<crowland at psionic.com>
6FreeBSD 3.x 		<angio at aros.net>
7HPUX 10.20		<anonymous>
8Solaris 2.6+		<various>
9AIX			<sauron at the-infinite.org>
10SCO			<jonco at sco.COM>
11Digital Unix		<ALLAN at mnhep1.hep.umn.edu>
12NetBSD			<various>
13OSX			<various>
14
15

README.install

1PortSentry - Port scan detection and active defense.
2=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
3
4$Id: README.install,v 1.29 2003/05/23 18:10:02 crowland Exp crowland $
5
6E-Mail : craigrowland at users dot sourceforge dot net
7Date   : 05-23-2003
8Version: 1.2
9
10Introduction
11=-=-=-=-=-=-
12
13This is the "long" install version. You should read this file if you want
14to understand everything going on and the method to the madness in the
15program logic. Skip to Install down below if you don't care about this.
16
17More information can be obtained from http://sourceforge.net/projects/sentrytools
18
19PortSentry has a number of options to detect port scans, when it finds one it
20can react in the following ways:
21
22	- A log indicating the incident is made via syslog()
23	- The target host is automatically dropped into /etc/hosts.deny
24	  for TCP Wrappers
25	- The local host is automatically re-configured to route all
26	  traffic to the target to a dead host to make the target system
27	  disappear.
28	- The local host is automatically re-configured to drop all
29	  packets from the target via a local packet filter.
30
31
32The purpose of this is to give an admin a heads up that their host is
33being probed. There are similar programs that do this already (klaxon,
34etc.) We have added a little twist to the whole idea (auto-blocking), plus
35extensive support for stealth scan detection.
36
37PortSentry has four "stealth" scan detection modes. Method one uses a
38pre-defined list of ports to watch over. If someone pokes at them
39it activates. The second method is what is called "inverse" port binding,
40where every port under a range is watched *except* for those that the
41system has bound for network daemons when the PortSentry starts or ones that
42you've manually excluded. This is a very sensitive way for looking for
43port probes, but also the most prone to false alarms.
44
45Install
46=-=-=-=
47
48Step ONE:
49
50Pull the portsentry_config.h file into your editor and make sure the
51following are to your liking:
52
53CONFIG_FILE - The path to the PortSentry configuration file.
54WRAPPER_HOSTS_DENY - The path and name of TCP wrapper hosts.deny file.
55SYSLOG_FACILITY - The syslog facility for PortSentry to use.
56SYSLOG_LEVEL - The syslog level to send messages.
57
58We suggest not changing any of these options unless you know what you
59are doing.
60
61NOTE: For advanced users, you may wish to change the SYSLOG_FACILITY from
62LOG_DAEMON to LOG_LOCAL0 (or one of the other LOCAL reporting facilities).
63This will allow you to edit the syslog.conf file and drop PortSentry
64messages direcly to its own file on the system for separate monitoring.
65
66SECOND NOTE: DO NOT DELETE THE "#" SIGNS FROM THIS FILE. They are NOT comments,
67they are required by the C compiler to pre-process the headers. If you delete
68the "#" signs you will get compile errors.
69
70
71Step TWO:
72
73Next, pull in portsentry.conf into your editor and check/change the
74following options:
75
76TCP_PORTS - A comma delimited string of TCP ports you want PortSentry to
77listen to. This string can NOT have any spaces in it. You can put in as
78many sockets as you want. PortSentry will try to bind them all up until
79the default limit of 64.
80
81For the stealth scan detection modes, the ports are not "bound" per se,
82but they are monitored at the socket level for connections.
83
84For the Advanced Stealth Scan Detection (see below). This list is *ignored*
85
86UDP_PORTS - The same as above, except for UDP ports. You need to be
87very careful with UDP mode as an attacker can forge a port sweep and
88make you block any number of hosts. Use this option with caution, or
89not at all if your host is a well-known Internet connected system.
90
91For the Advanced Stealth Scan Detection (see below). This list is *ignored*
92
93ADVANCED_PORTS_TCP - A number indicating the highest port number to
94monitor down from. Any port *below* this number is then monitored. The
95default is 1024 (reserved port range), but can be made as large as 65535
96(system max). I don't recommend going over 1024 with this option.
97
98ADVANCED_PORTS_UDP - Same as above, except for UDP.
99
100ADVANCED_EXCLUDE_TCP - A comma delimited string of TCP ports that should
101be manually excluded from monitoring in Advanced mode. These are normally
102ports that may get hit by mistake by remote clients and shouldn't cause
103alarms (ident, SSL, etc).
104
105ADVANCED_EXCLUDE_UDP - Same as above, except for UDP.
106
107IGNORE_FILE - The path to the file that contains IP addresses of hosts you
108want to always be ignored. This will be explained later.
109
110BLOCKED_FILE - The path to the file that contains the IP addresses of
111blocked hosts.
112
113RESOLVE_HOST - This option turns off DNS resolution for hosts. If you have a
114slow DNS server it may be more effective to turn off resolution.
115
116BLOCK_UDP - This option disables all automatic responses to UDP probes.
117Because UDP can be easily forged, it may allow an attacker to start a
118denial of service attack against the protected host, causing it to block
119all manner of hosts that should normally be left alone. Setting this option
120to "0" will disable all responses, although the connects are still logged.
121This option is mainly useful for Internet exposed hosts. For internal hosts
122you should leave this enabled. If someone internally is firing spoofed
123packets at you, then you have a much bigger problem than a denial of service.
124
125BLOCK_TCP - Same as above, but for TCP. Packet forgery is not as big a problem
126though because PortSentry waits for a full connect to occur and this is much
127harder to forge in the basic modes. Leave this enabled, even for
128Internet connected hosts. For stealth scan detection modes the UDP warning
129applies:
130
131	An attacker can cause you to block hosts you don't want to
132	through packet forgery.
133
134KILL_ROUTE - This is the command to run to drop the offending route if
135an attack is detected. This is the *full path* to the route command
136along with the necessary parameters to make the command work. The macro
137$TARGET$ will be substituted with the attacking host IP and is
138REQUIRED in this option. Your gateway should be a *dead host* on the
139local subnet. On some systems though you can just put in the localhost
140address (127.0.0.1) and this will probably work. All packets from the
141target host will get routed to this address so don't mess this up.
142More modern route commands will include a "-blackhole" or "-reject" flag.
143Check your man(1) pages and if your route command supports this feature
144you should use it (although we recommend using packet filtering
145instead, see below).
146
147Also be aware that this creates what is known as an "asynchronous
148route" which basically means packets enter your host via one route
149and are sent out on another (dead) route. This works OK for full
150TCP connect requests, but for UDP and stealth scan modes it
151still allows packets to activate PortSentry and you may get a
152series of "already blocked" alarms by PortSentry. For UDP scans
153this method prevents ICMP messages from returning to the attacker
154so all ports appear open. However, if the attacker is performing
155an actual exploit with UDP the drop route method will not work.
156The asynchronous route allows the packet to hit the system and the
157attacker could perform a "blind" attack with UDP if they know what
158the responses are going to be.
159
160By far the best method is to use the local packet filter (such as Linux
161ipfwadm/ipchains or *BSD ipfw). This is a much cleaner solution and is
162detailed in the config file. The macro $PORT$ will substitute the port
163that was connected to by the attacker, but this is NOT required for this
164option. The macro $MODE$ reports what mode the blocking occurred in
165(tcp, udp, stcp, sudp, atcp, audp) but is also NOT required.
166
167KILL_HOSTS_DENY - This is the format of the string to drop into the
168hosts.deny file that TCP wrappers uses. Again the $TARGET$ macro is
169expanded out to be the IP of the attacker and is required. You can
170also drop in any TCP wrapper escape codes here as well (%h, twist,
171etc). The macro $PORT$ will substitute the port that was connected to
172by the attacker, but this is NOT required for this option. The macro
173$MODE$ reports what mode the blocking occurred in (tcp, udp, stcp,
174sudp, atcp, audp) but is also NOT required.
175
176KILL_RUN_CMD - This is a command you want run *before* the route
177is dropped to the attacker. You can put in any program/script you want
178executed when an attack is detected. WE NEVER RECOMMEND PUTTING IN
179RETALIATORY ACTION AGAINST AN ATTACKING HOST. Virtually every time you're
180are port scanned the host doing the scanning has been compromised itself.
181Therefore, if you retaliate you are probably attacking an innocent(?)
182party. Also the goal of security is to make the person GO AWAY. You don't
183want to irritate them into making a personal vendetta against you.
184Remember, even a 13 year old can run a [insert favorite D.O.S. program
185here] attack against you from their Windows box to make your life
186miserable. As above, the $TARGET$, $PORT$, and $MODE$ macros are
187available to you but they are not required with this option as above.
188
189KILL_RUN_CMD_FIRST - Setting this to "0" makes the command above run
190before the route is dropped. Setting it to "1" makes the command run
191aftter the blocking has occurred.
192
193SCAN_TRIGGER - PortSentry has a state engine that will remember hosts
194that connected to it. Setting this value will tell PortSentry to allow X
195number of grace port hits before it reacts. This will detect both
196sequential and random port sweeps. The default is 0 which will react
197immediately. A setting of 1 or 2 will reduce false alarms, anything
198higher is probably too much as anything more than 3 hits to different
199ports is pretty suspicious behavior. Usually you can leave this at 0
200without any consequence, with the exception of Advanced stealth scan
201detection modes where you may create a "hair trigger" if you aren't
202careful. Use your own discretion.
203
204PORT_BANNER - A text banner you want displayed to the connecting host if
205the PortSentry is activated. Leave this commented out if you don't want this
206feature. If you do use it, try not to taunt the person too badly. We
207recommend keeping it professional and to the point. The banner is *not*
208displayed when stealth scan detection modes are used.
209
210
211Step THREE:
212
213Pull the portsentry.ignore file into your editor and add in any host you
214want to have ignored if it connects to a tripwired port. This should always
215contain at least the localhost (127.0.0.1) and the IP's of the local
216interfaces. We would *not* recommend putting in every machine IP on your
217network, but you can use a netmask to do this. Format for this is:
218
219<IP Address>/<Netmask Bits>
220
221192.168.2.0/24
222192.168.0.0/16
223etc.
224
225We don't recommend ignoring too much. It may be important for you to see
226who is connecting to you, even if it is a "friendly" machine. This can
227help you detect internal host compromises faster. To answer your paranoia,
228yes this does happen and we've had cases of admins ignoring too much and
229getting hacked by their own machines as a result with no warning.
230
231
232Step FOUR:
233
234Compile. Type make and pick your system type and allow it to build and install.
235The default directory is /usr/local/psionic/portsentry. If you don't like
236this directory just edit the Makefile and make sure your portsentry.conf and
237portsentry_config.h files reflect the new path.
238
239Type make install after the build to have it copy files to your install
240directory.
241
242Step FIVE:
243
244Start up PortSentry. PortSentry has six modes of operation. ONLY ONE PROTOCOL MODE
245TYPE CAN BE STARTED AT A TIME (i.e. one TCP mode and one UDP mode) The available
246modes are:
247
248portsentry -tcp (basic port-bound TCP mode)
249portsentry -udp (basic port-bound UDP mode)
250portsentry -stcp (Stealth TCP scan detection)
251portsentry -atcp (Advanced TCP stealth scan detection)
252portsentry -sudp ("Stealth" UDP scan detection)
253portsentry -audp (Advanced "Stealth" UDP scan detection)
254
255-tcp - Basic port-bound TCP mode
256
257PortSentry will check the config files and then bind to all the TCP ports in
258the background. If you want to check the init status you should just look
259in your local syslog file that you are having the messages directed to.
260
261-udp - Basic port-bound UDP mode
262
263PortSentry will check the config files and then bind to all the UDP ports in
264the background. If you want to check the init status you should just look
265in your local syslog file that you are having the messages directed to.
266UDP/Stealth scan warnings apply (read: README.stealth).
267
268-stcp - Stealth TCP scan detection mode
269
270PortSentry will use a raw socket to monitor all incoming packets. If an incoming
271packet is destined for a monitored port it will react to block the host. This
272method will detect connect() scans, SYN/half-open scans, and FIN scans.
273UDP/Stealth scan warnings apply (read: README.stealth).
274
275-sudp - "Stealth" UDP scan detection mode
276
277This operates the same as the TCP stealth mode above. UDP ports need to be
278listed and they are then monitored. This does not bind any sockets, and
279while not really "stealth" scan detection (doesn't usually apply to UDP),
280it operates in a similar manner (reacts to *any* UDP packet). UDP/Stealth
281scan warnings apply (read: README.stealth).
282
283-atcp - Advanced TCP stealth scan detection mode
284
285PortSentry will start by making a list of all the ports listening in the port
286area under the ADVANCED_PORTS_TCP option and will then create an exclusion
287list based on these ports. Any host connecting to *any port* in this range
288that is *not excluded* (i.e not a listening network daemon [SMTP, HTTP,
289etc.]) is blocked. This has some very powerful implications that you
290should be aware of:
291
2921) This mode is the most sensitive and the most effective of all the protection
293options. It reacts to port probes with lightning speed because you don't have
294to wait for them to hit a tripwired port.
295
2962) Because it reacts so abruptly, you may cut off legitimate traffic. A
297FTP site may send an ident request at you. If you are monitoring the
298ident port (113 TCP) then you have just cut off the FTP site you were
299going to! As a result you should put in ports that fall into this
300situation in this list.
301
302** Advanced Logic Mode ** - PortSentry is intelligent about how it monitors
303ports. For some protocols such as FTP the client actually opens up ports
304in the ephemeral range (1024-65535) and the server then connects *back* to
305you. This would normally cause the port scanner to activate. PortSentry though
306will look at the incoming connection and determine if it is destined for
307one of these "temporary" bindings. If it is, then the connection is
308ignored for that one time. As soon as the connection is torn down the
309window closes and full protection is back again. This is in fact a
310rudimentary stateful inspection engine. UDP/Stealth scan warnings apply
311(read: README.stealth).
312
313
314-audp - Advanced UDP "stealth" scan detection mode
315
316This is the same as above except for the UDP protocol. This is a very
317advanced option and you stand a good chance of causing false alarms. This
318is because PortSentry makes no distinction between broadcast and direct
319traffic. If you have a router on your local network putting out RIP
320broadcasts then there is a good likelihood you will block them. Use this
321option with extreme caution. You need to be sure you put in these
322exclusions into the ADVANCED_EXCLUDE_UDP line (i.e 520 [RIP]) UDP/Stealth
323scan warnings apply (read: README.stealth).
324
325
326Test the install:
327
328Tail the local log and you should see several PortSentry initialization
329messages.
330
331A successful startup looks like this:
332
333Oct  9 09:11:35 nemesis portsentry[1644]: adminalert: portsentry is
334starting.
335Oct  9 09:11:36 nemesis portsentry[1644]: adminalert: Going into listen
336mode on TCP port: 143
337. . .
338Oct  9 09:11:37 nemesis portsentry[1644]: adminalert: PortSentry is now active and
339listening.
340
341************************************************************************
342** The last line indicates the PortSentry is properly initialized, if **
343** you don't see it then something failed. 			      **
344************************************************************************
345
346You should see all the ports you told it to listen to in the log. If a port
347is in use PortSentry will give you a warning that it couldn't bind to it and will
348continue on until all the other ports are bound. If *none* of the ports
349could be bound it will exit with an error.
350
351For the Advanced stealth scan detection mode it will list the ports that it
352will *not* listen for. This is an inverse binding.
353
354Now you can go to another host and telnet to a booby-trapped port. DO NOT DO THIS
355FROM YOUR ONLY ACCESS POINT TO THE PROTECTED HOST BECAUSE YOU WILL BLOCK
356YOURSELF OFF COMPLETELY IF IT WORKS. You should immediately see something like:
357
358Oct  9 09:12:44 nemesis portsentry[1644]: attackalert: Connect from
359host: 123.345.56.78 to TCP port: 143
360
361Oct  9 09:12:46 nemesis portsentry[1644]: attackalert: Host
362server.haxor.org/123.345.56.78 has been blocked via dropped route.
363
364Oct  9 09:12:46 nemesis portsentry[1644]: attackalert: Host
365server.haxor.org/123.345.56.78 has been blocked via wrappers.
366
367For advanced mode you can telnet to any port not excluded to trip an
368alarm.
369
370If you disconnect and try to telnet back again you should find that the
371target system is now unreachable. Congratulations you are now operational.
372
373If you are running Logcheck this will show up in the next pass and
374it should be screaming at you.
375
376If you do a netstat -rn you will see the suspect host pointed at the dead
377route you supplied (unless using a packet filter, which is what we
378recommend).
379
380Drop the PortSentry commands in a startup file and get back to work as
381you are done.
382
383How will it help?
384
385Here are some ideas:
386
387	- Run as a UDP service on port 69 to catch TFTP probes.
388	- Run as a UDP service on port 161,162 to catch SNMP probes.
389	- Run as a UDP service in the port range 32000-33000 to catch RPC
390	  probes.
391	- Run as a TCP service on port 143 to catch IMAP probes.
392	- Run as a TCP service on ports 11,15 to catch netstat/systat
393	  probes.
394	- etc.
395
396The fact is that PortSentry reacts quickly enough that a port scan of your
397host by an attacker will be stopped within one second after hitting any
398tripwired port, even faster in the Advanced TCP stealth scan detection
399mode.
400
401For any type of UDP scan it will prove highly irritating for the person
402trying to scan you as all the ports will likely appear "open." For TCP scans
403the attacker will simply get no response whatsoever.
404
405Safety
406=-=-=-
407
408If we missed anything in the program's safety considerations we would very
409much like to hear about it before you post it to BugTraq :).
410
411Messages
412=-=-=-=-
413
414To the best we could, all states/errors/successes and unknowns are written
415to the syslog. The following tags identify each one:
416
417adminalert: - Some message indicating the status of the PortSentry.
418securityalert: - A message indicating a security relevant event occurred.
419attackalert: - A host has tripped a sensor and an action was performed.
420
421
422Files
423=-=-=
424
425As it stands now, all hosts are dropped into the portsentry.blocked.* file
426when they are blocked as well as a portsentry.history file. The blocked file
427is erased each time PortSentry is restarted. The history file is simply
428appended to and can be used as a record of all hosts that have been blocked
429to date. The portsentry.blocked.* has an appended extension indicating what mode
430it applies to. I.E.:
431
432portsentry.blocked.tcp
433portsentry.blocked.udp
434portsentry.blocked.stcp
435portsentry.blocked.sudp
436portsentry.blocked.atcp
437portsentry.blocked.audp
438
439Each file is created depending on what startup mode is selected and is removed
440when PortSentry re-starts.
441
442The way the route blocking works is that it drops the *return* route to the
443attacking host, not the *incoming* route. If an attacker is doing a UDP
444scan of your host the packets will still trip the sensor, they just don't
445return to the host. If the blocked file did not exist the host would be
446written possibly hundreds or thousands of times to hosts.deny!! This is not
447good. A better solution is to integrate in with a real packet filter
448locally (ala Linux ipfwadm which is supported or any other similar
449package on your system).
450
451After a period of time elapses you may wish to delete the local dead route
452to the offender and keep them in the hosts.deny file. This is solely your
453choice. If you wish to re-enable blocking should the offender return, just
454re-start PortSentry or delete the individual entry from the blocked file.
455
456If you need to restore the route to the blocked host on most systems you can
457simply delete the route like so:
458
459Linux:
460
461route del <ip_address> reject
462
463Others:
464
465route delete <ip_address> <dead_route>
466
467Or you can simply flush your packet filters.
468
469That's about it. We highly recommend you use Logcheck to keep an eye
470on things in the log files as well so you can detect other problems, and
471see what the PortSentry is saying to you. You can find this program at:
472
473http://sourceforget.net/projects/sentrytools
474
475

README.methods

1PortSentry Errata
2=-=-=-=-=-=-=-=-=
3
4$Id: README.methods,v 1.15 2003/05/23 17:42:28 crowland Exp crowland $
5
6
7This is file contains some answers to questions we've been asked, or you
8may be wondering.
9
101) How did you pick the ports in the default .conf file?
11
122) Why should I be careful about running the PortSentry program?
13   (PLEASE READ THIS)
14
15Why did you pick the ports in the default .conf file?
16=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
17
18There are some methods to the madness in the way ports were picked. Allow
19me to explain:
20
21
22TCP Ports - Chosen for a particular interest that they pose to an attacker.
23These ports are generally the most likely to be abused by a person seeking
24to gain access to a host.
25
26Low Range - Ports: 1-20
27
28These ports are chosen for two specific purposes:
29
301) Because some scanners do sequential scanning starting at 1 and working
31up. This will allow the PortSentry to respond rapidly to a scan before any real
32services are revealed.
33
342) Several of these services (systat, netstat) are used by attackers as recon
35mechanisms and are frequently looked for when they are performing a targeted
36non-sequential port sweep.
37
38Low-Mid Range - Ports: 20-500
39
40These ports contain a large number of services that are very commonly
41looked for by attackers. Some of these services can be used for recon
42purposes or for full remote access.
43
44Mid Range - Ports: 500-1024
45
46These ports contain a host of services commonly looked for by attackers (rsh,
47rlogin, rexec, mountd).
48
49Mid-High Range - Ports: 1024-32768
50
51These ports contain a wealth of services such as X-Windows, IRC servers,
52router serial ports, MUDs and others. One particular port (31337) is
53sometimes used as a backdoor, and is used by the program "netcat" to
54facilitate UDP (yes that's UDP) scanning of the target host.
55
56High Range - Ports 32769-65535
57
58These ports are generally not used, with the exception of a really nasty bug
59in Solaris in which the portmapper service (normally on port 111) would
60present a copy of itself listening in the 327XX range of ports. This allows
61an attacker to use a modified portmapper probe to hop filters and dump
62RPC services on the target. Some scans target this range specifically.
63The port 49724 is used by the scanning tool "nmap" to do UDP scanning
64much like netcat as well.
65
66-------------------------------------------------------------------------------
67
68UDP Ports - These ports harbor a large number of services (largely RPC related)
69and have become the frequent target of "stealth" RPC scanning in which the
70attacker attempts to locate RPC services manually instead of using
71portmapper. This prevents notification of admins of unauthorized use
72of the portmapper, a feature found in Wietse Venema's portmapper version.
73
74Low Range - Ports: 1-20
75
76As above, some scanners do sequential scanning starting at 1 and working
77up. These ports will allow the PortSentry to respond rapidly to a scan before
78any real services are revealed.
79
80Low-Mid Range - Ports: 20-500
81
82TFTP(69), SNMP(161,162), and SMB(137,138) are commonly sought ports in this
83region for the information and compromise potential they provide.
84
85Mid Range - Ports: 500-1024
86
87A large number of RPC services are located in this area. Some attempts
88to do "stealth" RPC scanning concentrate a UDP scan in the 500-700
89range. This will allow admins to get notification of this activity.
90
91Mid-High Range - Ports: 1024-32768
92
93NFS (2049) is the main problem here, along with some RPC services and
94Back Orifice (31337).
95
96
97High Range - Ports 32769-65535
98
99These ports are generally not used, again though, Solaris has a habit of
100concentrating services in the 327XX range. Waiting here for connections
101will find people probing for these services quickly. People shouldn't be
102here unless portmapper sent them, and since we don't register with
103portmapper they shouldn't know about us unless they are up to no good.
104
105
106Why should I be careful about running the PortSentry program?
107=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
108
109Because you have the potential of presenting information to an attacker
110that may tempt them to return at a later date. If you show a person
111a load of ports open then it may pique their curiosity. If they return
112they may find a real problem with your system that the PortSentry cannot
113defend. Additionally you may do something un-professional like present
114a banner to them that says "You k-rad HaX0r d00d you'll NeVEr brek
115r00t heRe!!" and this then makes it a challenge. This is something
116to consider.
117
118With UDP/stealth scan detection, there is the possibility that an
119attacker can flood your host with bogus packets causing PortSentry to
120continuously activate and write out warnings to your log. This can create
121a denial of service attack that you should be aware of. We do not recommend
122running UDP/stealth scan detection on an Internet host that is
123high-profile and subject to frequent abuse.
124
125It is our experience though that spoofed scans are not an issue and we
126recommend people use auto-blocking knowing that %99.9 of the time it
127will block a scan. If you run into a denial of service problem on
128your host, just go back to "classic" TCP mode and the problem will go away.
129
130Again though, we strongly feel that the benefits of blocking hosts
131*far outweighs* the limited risk you take by having auto-blocking turned on.
132
133

README.stealth

1*************************************************************************
2	STEALTH MODE ONLY SUPPORTED FOR LINUX SYSTEMS ONLY
3*************************************************************************
4
5$Id: README.stealth,v 1.9 2000/09/27 04:17:23 crowland Exp crowland $
6
7Stealth Scans
8=-=-=-=-=-=-=
9
10Right now PortSentry will detect the following:
11
12- Strobe-style scans (full connect() scans)
13- SYN/Half open scans.
14- FIN scans.
15- NULL scans.
16- XMAS scans.
17- UDP scans (not really stealth scans per se)
18- Any odd-ball packet with flags not matching the above.
19
20You can test out this functionality by grabbing "nmap" Which is a popular
21scanner. You can get it from:
22
23http://www.insecure.org
24
25
26A few notes on the implementation:
27=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
28
29Stealth scan detection mode one
30-------------------------------
31
32This mode will monitor ports just like the original version of PortSentry. The
33primary difference being that it does not bind to anything. An attacker
34still has to hit a tripwired port to activate the sensor though.
35To prevent other issues, this scan mode will not react if the ACK flag of
36the TCP packet is set. This prevents causing alarms on "established"
37connections that happen to take one of your high ports temporarily.
38
39
40Stealth scan detection mode two
41-------------------------------
42
43** Advanced Logic Mode ** - PortSentry is intelligent about how it monitors
44ports. For some protocols such as FTP the client actually opens up ports
45in the ephemeral range (1024-65535) and the server then connects *back* to
46you. This would normally cause the port scanner to activate. PortSentry though
47will look at the incoming connection and determine if it is destined for
48one of these "temporary" bindings. If it is, then the connection is
49ignored for that one time. As soon as the connection is torn down the
50window closes and full protection is back again. This is in fact a
51rudimentary stateful inspection engine.
52
53Trying it out:
54--------------
55
561) Fire up PortSentry in any one of the stealth modes (-stcp, -atcp, -sudp,
57-audp).
58
592) Take a program such as netcat and bind up to a protected port on the
60host (i.e. "nc -p 143 -l").
61
623) Go to a remote machine and telnet to that port, you will now connect to
63netcat and can see the text you type on your host.
64
654) Now disconnect and shut down netcat.
66
675) Re-Connect to the same protected port again from the remote host and
68now PortSentry will block you normally.
69
70This logic is built into all of the stealth modes (UDP and TCP).
71
72
73UDP "stealth" scan detection
74----------------------------
75
76The UDP flags are not really "stealth" scan detection in the traditional
77sense, but acts like the other TCP stealth scan options. Simply put, it
78doesn't bind ports but uses a raw socket. The same warnings apply.
79
80We don't suggest using Advanced mode UDP stealth scan detection unless you
81know what you are doing. It is very good if you know enough to
82exclude broadcast traffic (you may want to run it in non-blocking mode
83to see what alarms are generated and then set this up). The ports that
84generally cause this are route (520) and NetBIOS (137/138).
85
86General WARNINGS and CAUTIONS
87-----------------------------
88
89As stated in several places, it is possible that an attacker can forge
90packets to appear from any host and can use this to trick PortSentry into
91activating against the forged host IP. This can cause a variety of
92problems in theory such as blocking gateways or name servers.
93
94Sometimes though theory and reality just don't mix. The reality is
95that not many people are using this tactic. In fact recent
96versions of nmap even put in a "decoy" feature which we can only assume was
97prompted by the release of PortSentry. This feature uses a list of forged
98hosts to try to conceal the real culprit. The theory being that the
99attacker is hidden in a list of chaff and the port scan detector is
100blocking everyone thereby making it ineffective.
101
102Well arguments can be made all day on the pluses and minuses of
103auto-blocking hosts. When the theory is examined, the reality
104sets in which shows through our own (informal) observations that your
105chances of someone doing this to you are small. In fact we think that
106it is small enough that if you are considering running the stealth
107scan detection on a small *not-well-known* host the benefits outweigh
108the risk. Why is this? Well:
109
1101) The person port scanning you doesn't want to be found, that is why they
111are "stealth" scanning you to begin with. It is kind of silly to spray
112false packets at a host during the scan as this only increases the
113chances of being spotted and no matter what gets your host blocked
114anyway.
115
1162) Spraying X number of additional packets slows your scan down by a
117similar amount. Most attackers are going for quantity, not quality. They
118want a scan to finish ASAP and with the least amount of noise.
119
1203) Many networks now deploy anti-spoof filters which will prevent "decoy"
121packets from exiting the border routers due to a bogus source address not
122on the network. This means an attacker going through an ISP or similarly
123clueful network will cause many router log messages to be generated and
124will certainly grab attention of any aware admin from the originating
125network. This also means the decoy packets won't make it to your host and
126the real scanning host is revealed.
127
1284) Even if the intruder is smart and uses decoy addresses from the local
129subnet to allow them to exit the network it still raises a red flag that
130a network administrator will know where to start. Despite what people
131think, it's not *that* hard to find out which of 10 (or whatever) possible
132hosts are compromised and doing a port scan.
133
134Does this mean you are risk free?? No. But we have not received a
135single complaint so far about people using forge scan tactics on
136a widespread basis (in fact we haven't received a *single* complaint
137of this tactic being used at all). So for the time being (as of
138this writing) you are probably OK if you look at all the facts.
139
140So where do we stand on the issue??
141
142Well we use full connect mode for any external host, but this is because
143some of the hosts we watch are high-profile and we don't want to risk
144people playing games with us. For internal hosts though we will use the
145stealth modes because we want to know immediately of a probe; forged or
146not.
147
148Now the conservative side would like to add a few things. We would like to
149say that the initial version of this tool only did full connect TCP scan
150detection. This was done deliberately to prevent such attacks from
151possibly occurring. Because of this, we only recommend the full connect
152mode (-tcp) for deployment on critical hosts or hosts subject to frequent
153abuse...
154
155...and the band played on...
156
157Over time we had many people write about UDP support and stealth scan
158support so we put them in because we thought they would be useful.
159What this means is that our physical-world philosophy matches our
160virtual-world philosophy. Basically, we accept the fact that people
161are capable of making their own decisions when given adequate information.
162Therefore, you are responsible for your own actions. We have given you
163all the information you should need to decide what mode to use the tool.
164So don't complain if something bad happens, because it is your choice.
165