Help - Search - Members - Calendar
Full Version: ..- INTRUSION DETECTION -..
B.I.S.S. Forums > Internet Security Forum > B.I.S.S. Security Guides
Moore
INTRUSION DETECTION :


What is a "network intrusion detection system (NIDS)"?

[quote]An intrusion is somebody (A.K.A. "hacker" or "cracker") attempting to break into or misuse your system. The word "misuse" is broad, and can reflect something severe as stealing confidential data to something minor such as misusing your email system for spam (though for many of us, that is a major issue!).

An "Intrusion Detection System (IDS)" is a system for detecting such intrusions. For the purposes of this FAQ, IDS can be broken down into the following categories:

network intrusion detection systems (NIDS) monitors packets on the network wire and attempts to discover if a hacker/cracker is attempting to break into a system (or cause a denial of service attack). A typical example is a system that watches for large number of TCP connection requests (SYN) to many different ports on a target machine, thus discovering if someone is attempting a TCP port scan. A NIDS may run either on the target machine who watches its own traffic (usually integrated with the stack and services themselves), or on an independent machine promiscuously watching all network traffic (hub, router, probe). Note that a "network" IDS monitors many machines, whereas the others monitor only a single machine (the one they are installed on).

system integrity verifiers (SIV) monitors system files to find when a intruder changes them (thereby leaving behind a backdoor). The most famous of such systems is "Tripwire". A SIV may watch other components as well, such as the Windows registry and chron configuration, in order to find well known signatures. It may also detect when a normal user somehow acquires root/administrator level privleges. Many existing products in this area should be considered more "tools" than complete "systems": i.e. something like "Tripwire" detects changes in critical system components, but doesn't generate real-time alerts upon an intrusion.

log file monitors (LFM) monitor log files generated by network services. In a similar manner to NIDS, these systems look for patterns in the log files that suggest an intruder is attacking. A typical example would be a parser for HTTP server log files that looking for intruders who try well-known security holes, such as the "phf" attack. Example: swatch [/quote]


Network Intrusion Detection Systems:
http://www.ticm.com/kb/faq/idsfaq.html

-

IDS (Intrusion Detection System)

Has your data been stolen? Did you even notice it?

Prevention is better than cure. A good intrusion detection system that detects stealthy movements will help you.

http://bobcares.com/article55.html

-

Packet Sniffing:
http://www.mindcrime.net/~niehaus/robertgr...iffing-faq.html

Firewall Seen:
http://security.uoregon.edu/rgraham.html
http://www.linuxsecurity.com/resource_file...ewall-seen.html
http://security-protocols.com/textfiles/fa...ewall-pr0n.html

--

Intrusion Detection Analysis: A Case Study
http://www.zeltser.com/intrusion-detection-analysis/


Host Based VS Network Intrusion Detection :
http://www.windowsecurity.com/articles/Hid...Nids_Part1.html


For more info about Intrusion Detection systems, see: http://www.icsa.net/idswhite/.

[quote]How much danger from intrusions is there?

I frequently hear from people the statement "There's nothing on the system that anybody would want anyway". I walk them through various scenarios, such as simple ones if they've ever paid for anything on-line with a credit card or if they have any financial records or social security number on their personal machine.

More importantly, there is the issue of legal liability.

You are potentially liable for damages caused by a hacker using your machine.

You must be able to prove to a court that you took "reasonable" measures to defend yourself from hackers. For example, consider if you put a machine on a fast link (cable modem or DSL) and left administrator/root accounts open with no password. Then if a hacker breaks into that machine, then uses that machine to break into a bank, you may be held liable because you did not take the most obvious measures in securing the machine. [/quote]


There is a good paper http://www.cert.org/research/JHThesis/Start.html
by John D. Howard that discusses how much hacking goes on over the Internet, and how much danger you are in.


What other countermeasures besides IDS are there?

[quote]Firewalls

Most people think of the firewall as their first line of defense.

This means if intruders figure out how to bypass it (easy, especially since most intrusions are committed by employees inside the firewall), they will have free run of the network. A better approach is to think of it as the last line of defense: you should be pretty sure machines are configured right and intrusion detection is operating, and then place the firewall up just to avoid the wannabe script-kiddies. Note that almost any router these days can be configured with some firewall filtering. While firewalls protect external access, they leave the network unprotected from internal intrusions. It has been estimated that 80% of losses due to "hackers" have been internal attacks.

authentication
You should run scanners that automated the finding of open accounts. You should enforce automatically strict policies for passwords (7 character minimum, including numbers, dual-case, and punctuation) using crack or built in policy checkers (WinNT native, add-on for UNIX). You can also consider single-sign on products and integrating as many password systems as you can, such as RADIUS/TACACS integration with UNIX or NT (for dial-up style login), integrating UNIX and WinNT authentication (with existing tools are the new Kerberos in Windows 2000). These authentication systems will help you also remove "clear-text" passwords from protocols such as Telnet, FTP, IMAP, POP, etc.

VPNs (Virtual Private Networks)
VPNs create a secure connection over the Internet for remote access (e.g. for telecomuters). Example #1: Microsoft includes a a technology called PPTP (PPP over TCP) built into Windows. This gives a machine two IP addresses, one on the Internet, and a virtual one on the corporate network. Example #2: IPsec enhances the traditional IP protocol with security. While VPN vendors claim their product "enhance security", the reality is that they decrease corporate security. While the pipe itself is secure (authenticated, encrypted), either ends of the pipe are wide open. A home machine compromised with a backdoor rootkit allows a hacker to subvert the VPN connection, allow full, undetectable access to the other side of the firewall.

Encryption
Encryption is becoming increasingly popular. You have your choice of e-mail encryption (PGP, SMIME), file encryption (PGP again), or file system encryption (BestCrypt, PGP again).

lures/honeypots
Programs that pretend to be a service, but which do not advertise themselves. It can be something as simple as one of the many BackOrifice emulators (such as NFR's Back Officer Friendly/TDS-3 - see trojan guide for more info), or as complex as an entire subnet of bogus systems installed for that purpose. [/quote]



=================================
-----------------------------------------------
INTRUSION DETCTION SYSTEMS:
-----------------------------------------------
=================================

CHX-I PACKET FILTER:

[quote]In its default configuration the packet filter does not impose any security restrictions on any type of traffic.

The CHX-I Packet Filter is not a personal firewall and should not be used by those expecting out-of-the box security configurations or unfamiliar with TCP/IP networking and IP security in general. Several configuration templates are provided to assist first time users in grasping CHX-I filtering concepts. These templates can be obtained in the idrci.net download area.

First time users are encouraged to make extensive use of the available logging features (and the GoTo Related Filter feature) when debugging their CHX-I IP security policies.

The packet filter cannot facilitate address/port translation in gateway environments. The CHX-I NAT module was designed to provide this functionality as either a stand alone or add-on to the packet filter management console. [/quote]


http://www.idrci.net/
http://www.idrci.net/packetfilter/html/index.html

------------------------------------------------

kFSENSOR:-

somewhere over the rainbow ... , this costs 800 +$$ holy shit.! smile.gif

[quote]KFSensor is a honeypot based Intrusion Detection System (IDS).
It acts as a honeypot to attract and detect hackers by simulating vulnerable system services and trojans.
The system is highly configurable and features detailed logging, analysis of attack and security alerts. This approach complements other forms of security and adds another defense against the growing security threat faced by all organizations. [/quote]

http://www.keyfocus.net/kfsensor/help/index.php
http://www.keyfocus.net/kfsensor/help/Manu.../man_Manual.php

--------------------------------------------------

LOGIDS:

screenshot:
http://iquebec.ifrance.com/securit/image/figure1.gif

[quote]LogIDS is a real-time log-analysis based intrusion detection system. The graphical interface presents you with a representation of your network map, where each node (host or subnet) have its own little console window, where the logs belonging to it can eventually be displayed (depending on your rules).

You get to specify the format of the log files you want to monitor, apply rules to these log files using field names you have previously defined, and you configure it to correspond to your environment and that's it! Rules can be displaying the fields you choose in the GUI, emit sounds for warnings or alerts, display icons pertaining to the actions depicted in the logs, or disregard the data if it contains no useful data.[/quote]

http://iquebec.ifrance.com/securit/download.html

-------------------------------------------------------

Intrusion Detection Systems from Securepoint : nuzzler basic

http://www.securepoint.cc/en/products-ids2.html

[quote]The Securepoint Intrusion Detection System (Nuzzler Basic) offers you the possibility to explore your network and your computers and detect security gaps. SIDS enables you to trace illegal datapackages and explores the network for viruses and trojans. Nuzzler Basic can be operated from each and any PC in the network. In doing so the whole network traffic is being analysed and filtered. The surface of Nuzzler Basic allows for a quick survey over all important functions and display elements. Nuzzler Basic is being delivered with a large library of rules.

In addition, new rules can be created and edited.
This tool is free of charge and runs under Windows98, NT, XP and ME.

Easy GUI for fast overview
Over 1.500 rules inclusive with different signatures (viruses, trojans, hacker packages, etc)
Scans over 1000 data packages in less then one second
Traffic monitor gives you the possibility to show the active running traffic in the network.
IDS log-file shows the rules which encounters. Easy double click on an item to get more information.
Temporary rules window for own rules. For example: Somebody is trying to access a special homepage. Here you can add and edit those rules.
Advance filtering
No special network card needed
Runs on most windows platforms [/quote]

[quote]Warning: The Securepoint Intrusion Detection is not legalized in every country. You are only allowed to use the software for your own network test and finding of security holes. Securepoint gives no warranty on it. The software is being delivered to you AS IS and Securepoint makes no warranty as to its use or performance. All Rights Reserved. [/quote]

--------------------------------------------------------------------------------------------


PureSecure: Personal Edition - For Home

[quote]PureSecure Personal Edition is provided free of charge to personal users as a means to secure their home networks. With more and more individuals remaining connected to the Internet on fast speed broadband connections at home, they are increasingly becoming targets of attacks. The need for a quality security solution to maintain the integrity of their personal computer systems is essential. PureSecure is that solution, and will ensure that you are doing everything you can to protect your personal systems at home.

Network Summary
From the moment you login, all of the most pertinent details about the state of your network is available to you. Information is automatically updated, to ensure that no critical data goes unnoticed. 

Network Intrusion Detection
PureSecure harnesses the raw power of the Snort IDS engine into the well organized convenience of a centralized management console. Using the console, you are able to view detailed reports and search for alerts with unrivaled ease. 

Extensible Service Monitoring
The service monitoring features allow you to make sure that each of your network services remain accessible at all times. You will be able to detect trends that would have otherwise been lost in a cloud of information. 

System Integrity Verification
The system integrity verification features of PureSecure allow not only for immediate discovery of files that have been tampered with, but also offer an additional level of security over standard file integrity systems as the "known good" data is able to be stored securely, away from the compromised file system.  [/quote]
http://www.demarc.com/products/puresecure/
http://www.demarc.com/downloads/PureSecure/personal
http://www.demarc.com/products/puresecure/features/


-----------------

- Snort -
[quote]is an open source network intrusion detection system, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching/matching and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, CGI attacks, SMB probes, OS fingerprinting attempts, and much more.

Snort uses a flexible rules language to describe traffic that it should collect or pass, as well as a detection engine that utilizes a modular plugin architecture. Snort has a real-time alerting capability as well, incorporating alerting mechanisms for syslog, a user specified file, a UNIX socket, or WinPopup messages to Windows clients using Samba's smbclient.

Snort has three primary uses. It can be used as a straight packet sniffer like tcpdump(1), a packet logger (useful for network traffic debugging, etc), or as a full blown network intrusion detection system[/quote]
windows and linux free downloads:

http://www.snort.org/
http://www.snort.org/dl/binaries/

http://www.winsnort.com/
http://www.codecraftconsultants.com/Snort.aspx
http://www.sans.org/resources/idfaq/snort.php

http://www.snort.org/docs/writing_rules/ch....html#tth_chAp2

http://www.chaotic.org/guardian/
Guardian is a security program which works in conjunction with Snort to automaticly update firewall rules based on alerts generated by Snort

http://www.snortsam.net/
Snort ip blocking plugin


About SnortCenter :

http://users.pandora.be/larc/

[quote]SnortCenter is a web-based client-server management system written in PHP and Perl. It will help you to configure Snort and keep the signatures up-to-date.
The Management Console will build the configuration files for you and then send it to the remote sensor.
Some features:
SSL encryption between Management System and remote Sensor Agents.
Build in user authentication.
Automatic update / import new snort signatures from the internet and push them to the sensors.
Start-Stop Snort remotely and push the specific configuration to the sensor.
Create personal rules or modify the snort rules.
Rule Templates support for easy configuring multiple sensors.
Support for SnortSam
One Sensor Agent can handle multiple snort daemons if the system has multiple network interfaces.
Multi Language support (english, german, french, spanish, italian, dutch).
Management Console and Sensor Agents for Linux, BSD, *NIX, Windows.  [/quote]


------------------------------

WinDump/TCP DUMP:

http://windump.polito.it/

================================================================


-------------------------------------------


FingerPrint v2.1.3
All versions of Windows
1,461KB

FingerPrint v2.1.3
[quote]A utility to see if any files in one or more directories have been created, deleted, or changed since the last scan. It's useful for checking if a program, e.g. viruses and trojans, has changed your all-important Windows files (this is similar to such security software as Tripwire).  The use of MD5 checksums guarantee detection of file changes. FingerPrint can also be used to find duplicate files, search for files with a specific MD5 value, and save MD5 values to file (and compare with). A command line version is also included.[/quote]

fingerprint:
http://www.mjleaver.com/bb/viewforum.php?f...4f374ef81e10180

=================================================================


arachNIDSThis comprehensive database of network attack "signature" information can dynamically create and export signature strings that are compatible with IDS software such as Snort, Dragon Sensor, DefenseWorx, Pakemon, or Shoki. Network and System administrators can use the arachNIDS signatures to detect attacks against their networks. Also, security professionals have often found arachNIDS useful in researching network vulnerabilities.

http://www.whitehats.com/ids/


GOOGLE DIRECTORY ON INTRUSION DETECTION SYSTEMS:

http://directory.google.com/Top/Computers/...n_Systems/?tc=1


Internet vunerabilities/Security information sites

- intrusion detection ;
- http://www.sans.org/resources/idfaq/
- http://www.snort.org/docs/idspaper/
- http://www.cert.org/
- http://isc.incidents.org/
- http://www.securityfocus.com/bugtraq/archive
- http://www.packetstormsecurity.org/papers.html

- http://www.networkintrusion.co.uk/ids.htm
- http://www.security-protocols.com/
- http://www.hazeleger.net/
- http://www.firewall.cx/
- http://www.dslreports.com/
- http://www.gladiator-antivirus.com/

Distributed Intrusion Detection System

- http://www.dshield.org/
- http://www.dshield.org/block_list_info.php -
- http://www.dshield.org/top10.php


[Port 137 - NETBIOS
Every computer connected to the internet is identified by a so called "IP address".
This IP address is a number, very much like a telephone number.
Usually, these numbers are written as a group of four number,
seperated by a "." (e.g. 192.168.2.1).

As it is hard to remember numbers like this,
'domain names' and 'host names' where introduced.
In order to link a given host name (e.g. http://www.dshield.org/)
to an IP address (64.71.137.130),
a directory service called DNS (Domain Name Server) is used.

This service usually uses port 53 to communicate.
So how is all this related to port 137?
Windows uses it's own system to translate IP addresses into Windows names.
These windows names are usually used to identify PCs participating in windows file sharing.
However, Windows will attempt to obtain the "windows name" of every other computer it connects to.

As a result, Windows has the habit of "probing" port 137.

So what does this mean to all the "port 137" entries I see in my firewall log?
A port 137 hit is frequently the first step in a scan for open file shares.

Port 53 -DNS Server
Port 53 is usually used by the Domain Names Service (DNS).
DNS is a critical component of the internet,
as it allows for an automatic translation of human readable names
(like http://www.dshield.org/) into internet addresses (123.32.123.32).
In other words, DNS fulfills the same function as a directory assistance for the phone system.



----------------------------------------------------------------------

heres an introduction to IP spoofing posted by Red Zulu biggrin.gif
http://www.securityfocus.com/infocus/1674

another good link posted by sentinel of gladiator forums:
Checklist for Deploying an IDS :
http://www.securityfocus.com/infocus/1754

----------------------------------------------------------------------



Studying Normal Traffic, Part One
by Karen Kent Frederick - NFR

Many intrusion detection analysts concentrate on identifying the characteristics of suspicious packets - illegal TCP flag combinations or reserved IP addresses, for example. However, it is also important to be familiar with what normal traffic looks like. A great way to learn what traffic should look like is to generate some normal traffic, capture the packets and examine them. In this article in SecurityFocus.com's Intrusion Detection Systems focus area, Karen Kent Frederick will discuss a tool for logging packets, and will review some packet captures in depth.

http://www.securityfocus.com/infocus/1221

Studying Normal Traffic, Part Two: Studying FTP Traffic
by Karen Kent Frederick

This is the second article in a three-part series devoted to studying normal traffic. Many intrusion detection analysts concentrate on identifying the characteristics of suspicious packets. However, it is also important to be familiar with what normal traffic looks like. A great way to do this is to generate some normal traffic, capture the packets and examine them. The first article in this series explained how to capture packets using WinDump and reviewed some simple examples of normal TCP/IP traffic. In this article, we will be examining FTP traffic, which, from a traffic flow standpoint, is more complicated than many other protocols.

http://www.securityfocus.com/infocus/1222

Studying Normal Traffic, Part Three: TCP Headers
by Karen Kent Frederick

This is the final article in a three-part series devoted to studying normal traffic. As was explained in Studying Normal Traffic, Part One and Studying Normal Traffic, Part Two; Studying FTP Traffic, we often focus our attention on the characteristics of suspicious packets without first becoming familiar with the characteristics of normal traffic. A good way to accomplish the latter is to generate, capture and examine your own normal traffic. The first two articles in this series showed how to capture packets using WinDump and reviewed some of the basics of normal TCP/IP traffic. In this article, we will be looking at two other aspects of normal TCP traffic: the structure of TCP packets and the use of TCP options. Note that in order to understand this material, you should already know the fundamentals of TCP/IP.

http://www.securityfocus.com/infocus/1223


########################################################################
Moore

####################################################################


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Abnormal IP Packets


by Karen Kent Frederick
http://www.nfr.com/resource/articles.php

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


###################################################################


------------------------------
Introduction
------------------------------

QUOTE
This article, a discussion of the characteristics of abnormal Internet Protocol (IP) packets, is the first in a series of tutorials that are intended to educate intrusion detection system administrators about IP. As the use of network intrusion detection systems becomes more widespread, system administrators must learn how to use them effectively. Unfortunately, many admins do not have a thorough knowledge of IP. So even though an IDS may produce alerts about particular scans and attacks, an admin may not understand what the alerts mean.

IP protocol standards are defined in the RFC (Request for Comments) documents, which are available at http://www.ietf.org/rfc.html. For the sake of this article, we define abnormal packets as those which violate those standards. Abnormal packets may be generated through benign means, such as a malfunctioning router, but they are usually specially crafted by attackers. The abnormality is often introduced into the packet purposely so that the packet may avoid being blocked by a firewall or intrusion detection system. In other cases, abnormal packets are used to attempt to crash systems. A great place to see real examples of abnormal packets is the SANS Institute's Global Incident Analysis Center.


IP Protocol Types
QUOTE
There are many different types of IP protocols. You are probably familiar with at least three of them: the Transmission Control Protocol (TCP), the User Datagram Protocol (UDP) and the Internet Control Message Protocol (ICMP). There are dozens of other IP protocols; examples that you may know include routing protocols such as IGRP, EIGRP and OSPF. Each IP protocol type has its own value, called an Internet Protocol number. These are important to know because some systems log packets by the IP number, not the corresponding abbreviation. In this article, we will review some characteristics of the most commonly seen types, which are type 1 (ICMP), type 6 (TCP) and type 17 (UDP). A list of all of the IP numbers is available at ftp://ftp.isi.edu/in-notes/iana/assignmen...rotocol-numbers.

RFC 791 described a four bit field that was to be used to identify the underlying internetworking protocol of a packet. The Internet Protocol that we are familiar with is version number 4. The new version of IP, which will be deployed in the coming years, is version number 6. Normally, you should never see any packet with a version number other than 4, but you may occasionally come across one. If you see a packet with a version other than 4, you can be pretty sure that it is crafted. For more information, visit http://www.isi.edu/in-notes/iana/assignmen...version-numbers.


IP Addresses
QUOTE
Certain IP addresses have been specially designated by the Internet Assigned Numbers Authority (IANA) as reserved for internal network use only, not for Internet use.

The reserved address ranges are:
10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255 and 192.168.0.0 - 192.168.255.255.

(Read RFC 1918, "Address Allocation for Private Internets", at http://www.isi.edu/in-notes/rfc1918.txt for more information.) Although these addresses should never be seen over the Internet, they are. Sometimes this is caused by equipment which has been misconfigured; for example, a firewall may accidentally be allowing internal address to "leak" onto the Internet. Also, computers that unsuccessfully attempt to get a valid IP address through DHCP typically are assigned addresses on the 169.254 subnet. Another reason for seeing these addresses on the Internet is that attackers are creating crafted packets with false IP addresses. This technique is better known as IP spoofing.

The main reason for performing IP spoofing is to make it harder for an attack to be traced back to its real IP address. Attackers may use addresses in the reserved address ranges listed above; more commonly, they use regular addresses which belong to someone else. So if your system is attacked, you may trace it back to an innocent third party. Another type of IP spoofing attack, called a Land attack, uses packets with the source and destination address set to the same value. Packets should always have different source and destination addresses, so your network devices should reject any packet where those values are the same.

In order to protect your network from IP spoofing generated by attackers on the Internet or on your own network, you should only permit incoming packets with a source address outside your network's range, and outgoing packets with a source address in your network's range. Also, packets that have a source or destination address in one of the ranges previously mentioned should not be permitted through Internet-based devices.


TCP Packets
QUOTE
TCP is a connection-oriented protocol; it uses various flags to indicate that a connection is being started or ended, or that the data carries a high priority. Many attacks are based on altering the TCP flags. Certain illegal combinations of TCP flags may be able to help packets avoid detection by firewalls or intrusion detection systems; other illegal combinations may be used to crash operating systems.

The functional specification for TCP is defined in RFC 793. This RFC and others define how systems should respond to legitimate packets, but they don't explain how systems should handle illegal combinations of flags. Consequently, different operating systems respond differently to illegal flag combinations. Attackers can exploit this to determine what operating system a device is using.



At least one of these six flags must be set in each TCP packet; each flag corresponds to a particular bit in the TCP header.

The six flags are:

QUOTE
SYN (Synchronization) - Initiate a TCP connection.
ACK (Acknowledgment) - Indicates that the value in the acknowledgment number field is valid.
FIN (Finish) - Gracefully end a TCP connection.
RST (Reset) - Immediately end a TCP connection.
PSH (Push) - Tells the receiver to pass on the data as soon as possible.
URG (Urgent) - Indicates that the urgent pointer is valid; often caused by an interrupt.
Before reviewing abnormal flag combinations, let's look at the normal ones:

SYN, SYN ACK, and ACK are used during the three-way handshake which establishes a TCP connection.
Except for the initial SYN packet, every packet in a connection must have the ACK bit set.
FIN ACK and ACK are used during the graceful teardown of an existing connection. PSH FIN ACK may also be seen at the beginning of a graceful teardown.
RST or RST ACK can be used to immediately terminate an existing connection.
Packets during the "conversation" portion of the connection (after the three-way handshake but before the teardown or termination) contain just an ACK by default. Optionally, they may also contain PSH and/or URG.
Packets with any other flag combination can be classified as abnormal. Here are some of the most commonly occurring ones:

SYN FIN is probably the best known illegal combination. Remember that SYN is used to start a connection, while FIN is used to end an existing connection. It is nonsensical to perform both actions at the same time. Many scanning tools use SYN FIN packets, because many intrusion detection systems did not catch these in the past, although most do so now. You can safely assume that any SYN FIN packets you see are malicious.
SYN FIN PSH, SYN FIN RST, SYN FIN RST PSH, and other variants on SYN FIN also exist. These packets may be used by attackers who are aware that intrusion detection systems may be looking for packets with just the SYN and FIN bits set, not additional bits set. Again, these are clearly malicious.
Packets should never contain just a FIN flag. FIN packets are frequently used for port scans, network mapping and other stealth activities.
Some packets have absolutely no flags set at all; these are referred to as "null" packets. It is illegal to have a packet with no flags set.
Besides the six flag bits described here, TCP packets have two additional bits which are reserved for future use. These are commonly referred to as the "reserved bits". Any packet which has either or both of the reserved bits activated is almost certainly crafted.


There are several other characteristics of TCP traffic where abnormalities may be seen:

QUOTE
Packets should never have a source or destination port set to 0.
The acknowledgment number should never be set to 0 when the ACK flag is set.
A SYN only packet, which should only occur when a new connection is being initiated, should not contain any data.
Packets should not use a destination address that is a broadcast address, usually ending in .0 or .255. (You may not be familiar with .0 as a broadcast address; it was an older style of broadcast.) Broadcasts are normally not performed using TCP.

Many of the tools used by attackers to scan and probe your networks are based on the use of abnormal TCP packets. A large percentage of alerts detected by intrusion detection systems involve these types of packets, so it is critical to be able to identify them and understand their purpose. By configuring your intrusion detection system to alert on all abnormal TCP packets, you may catch malicious activity that you were not previously seeing.


UDP Packets
QUOTE
Unlike TCP, UDP is a connectionless protocol. UDP does not have the flag and reserved bits that TCP does. However, both TCP and UDP rely on source and destination ports. Like TCP, packets, UDP packets should never have a source or destination port set to 0. UDP packets can also be fragmented maliciously; see the "Fragmentation" section below for more information on this technique.


ICMP Packets
QUOTE
ICMP is used to pass an error message between two hosts or a host and a network device such as a router. Since UDP and IP are connectionless protocols, they rely on ICMP to transmit error messages on their behalf. To avoid potential error message loops, responses are never sent to ICMP error messages. ICMP has no port numbers; it uses ICMP message types and codes instead. Another noteworthy characteristic of ICMP is that it supports broadcast traffic. Since ICMP packets are not very complicated, there are not that many ways that they can be made abnormal.

One type of ICMP message that is used maliciously is a redirect. ICMP redirect messages are intended to be sent from a router to a host, in order to inform that host that a different router is more optimal than it is when contacting a particular destination address. Some attacks such as WinFreeze use false ICMP redirect messages to attempt to convince a host to use itself as the optimal router. Obviously, any packet which tells a device to route everything to itself should be considered highly abnormal.

Most ICMP packets are composed of a small header and payload; for example, most ICMP echo request packets have an 8-byte header and a 56-byte payload. ICMP packets that are significantly larger than normal should be considered suspicious. Also, some ICMP types, such as echo requests, should not be carrying any data. Some malicious applications, including various distributed denial of service programs and tunneling programs, use ICMP packets as "containers" that hide other traffic. So an ICMP echo reply might actually contain a completely different IP protocol within its data, for example. If you monitor your systems for large ICMP packets or for packets of specific ICMP types that should not contain data but do, you should be able to detect this type of traffic.


Fragmentation
QUOTE
When an IP packet is too large to be transmitted as one entity, it must be split into two or more smaller pieces that can be sent across networks. Each piece of a packet is referred to as a fragment. Fragmentation occurs for all of the protocols we are discussing - TCP, UDP and ICMP - although it occurs most frequently for TCP. However, attackers can create artificially fragmented packets. In some cases, this is done in order to attempt to crash systems; in other cases, it is done to circumvent firewall rules or avoid intrusion detection systems. Some firewalls and intrusion detection systems do not perform packet reassembly, so they can only consider the properties of each individual fragment.

One type of malicious fragmentation involves fragments that have illegal offsets. An offset value indicates where a fragment's data should be placed in a reassembled packet. The first fragment appears to be normal, except that it is usually very small. The second fragment has a data offset value which is less than the length of the data in the first packet. So if the first fragment had 24 bytes of data, the second fragment might claim to have an offset of 20 bytes. This would mean that the data in the second fragment would overwrite the last four bytes of the data from the first fragment. If the fragmented packet was TCP, then the first fragment would contain the TCP header. The purpose of the offset value of the second fragment would be to overwrite part of the first packet's TCP header, such as the destination port number, when the packet is reassembled at the destination. So an attacker could send a fragmented packet through your firewall to your web server on port 80, but when the web server reassembles the fragments, the final packet could actually go to a completely different port.

The same type of attack can be used to crash systems. In some older operating systems, when the receiving host attempts to rebuild such a packet, it calculates a negative length for the second fragment. This value is passed to a function which should do a copy from memory. Unfortunately, the memory copy cannot handle a negative number, so it thinks that the small negative number is actually an enormous positive number.

A second type of attack involving fragments is known as the tiny fragment attack. Two TCP fragments are created. The first fragment is so small that it does not even include the full TCP header, particularly the destination port number. The second fragment contains the remainder of the TCP header, including the port number. Some firewalls and intrusion detection systems may let one or both fragments pass through, particularly if they do not perform packet reassembly.

Another type of attack involves sending a fragmented, abnormally large packet. The attacker hopes that when the receiving host receives the fragments, it will crash while attempting to reassemble the packet, since the whole packet has an illegal length. (In case you are not aware, packets have minimum and maximum lengths.) The best-known example of this attack type is the infamous Ping of Death attack. It creates an ICMP echo request packet which is larger than the maximum packet size of 65,535 bytes.

Some attacks use packets that are not illegal but are extremely suspicious. For example, suppose that you receive a fragmented TCP packet that only has the SYN flag set. Since a SYN-only packet is not allowed to carry any data, it should not be large enough to require fragmentation. If you encounter such a packet, treat it with great suspicion.

So how can you protect your network against fragmentation attacks? As mentioned previously, you should implement firewalls and intrusion detection systems that can perform packet reassembly. You should also configure your intrusion detection system to alert on any extremely small fragments other than the final fragment in a packet. Under normal circumstances, you should not be seeing small initial fragments; these are normally malicious in nature. Also, remember to keep your systems current with all patches and updates.


Conclusion
QUOTE
Anyone who is involved with intrusion detection should have a solid knowledge of what normal and abnormal IP traffic is. It is not uncommon for the administrator of an intrusion detection system to get great alerts from the IDS but not understand what they really mean. Hopefully, by studying more about IP and thinking about the concepts presented in this article, you can better interpret alerts and analyze what is really happening on your network.

Karen Kent Frederick is a senior security engineer for NFR Security. Karen has a B.S. in Computer Science and is completing her Master's thesis in intrusion detection through the University of Idaho's Engineering Outreach program. She holds several certifications, including Microsoft Certified Systems Engineer + Internet, Check Point Certified Security Administrator, and GIAC Certified Intrusion Analyst. Karen is one of the authors and editors of "Intrusion Signatures and Analysis", a book on intrusion detection that will be published in January 2001.


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

##############################################################
Moore
####################################################################


Distributed Denial of Service Attack Tools


####################################################################

Internet Security Systems (ISS) has identified a number of distributed denial of service
tools readily available on the Internet.

Some of these attack tools include: TFN, Trin00, TFN2K, and Stacheldraht.
These attack tools differ in their capabilities and complexities,
but all share the common goal of attempting to overwhelm a victim with an abundant
amount of difficult to detect or filter traffic. The evolution of these tools has introduced
both encryption and additional tiers to avoid their detection and increase their scalability,
as their following descriptions, listed in the order they were discovered, will show:


1.1 How does a denial of service attack work?


Denial of service attacks are designed to bring down an enterprise network or e-commerce site by flooding it with large amounts of traffic, similar to hundreds of people repeatedly dialing a telephone number to keep it busy and unavailable. These attacks also send “specially crafted” packets that crash remote software/services running on a machine. This is generally accomplished by sending a high volume of useless packets such as SYN or PING. Most Firewalls and Intrusion Detection Systems will recognize and report these attacks.


1.2 What is a distributed denial of service attack?


A distributed Denial Of Service (DOS) attack uses the same methods as a regular DOS attack, but it is launched from multiple sources. Typically, the attacker will use downloaded tools to infiltrate unsuspecting hosts. After gaining the proper access on the host machine, the attacker will install software that places services or daemons on the host system (hereafter referred to as agents.) These agents will lie dormant on the host system until they are given a command from their master. The master will order them to run a DOS attack against a specified target. With the spread of cable modems, DSL, and the availability of powerful hacking tools- there are plenty of easily accessible hosts. The danger with distributed DOS attacks is that a master can launch thousands of DOS attacks against a single target simultaneously. While a single DOS attack may not overwhelm a site with high bandwidth Internet access, thousands of these attacks coming from all over the globe will.

1.3 What can these attacks do to my network?

These attacks can effectively bring down Internet access. To most businesses, this would result in inconvience and some loss of productivity. To web based and ecommerce companies, this could result it substantial monetary losses- from loss of sales and customer confidence issues. Generally, the purpose of these attacks is not to penetrate your network, but to cut it off from the outside world. Sometimes, however, these distributed attacks can be used on a smaller scale to hide penetration attempts by the attacker. In these instances, the attacker will not launch enough DOS attacks to overwhelm your gateway- just enough to keep your firewall and IDS busy. This is not a common scenario though as the hacker must compete with the DOS attacks and legitimate connections for bandwidth.

1.4 What DDOS tools are currently being used?

There are several distributed denial of service attacks that can be downloaded from the Internet and many mutations are sure to show up.
these are popular tools:



Tribe Flood Network/TFN2K

Tribe Flood Network comes in two forms- TFN and TFN2K. Both versions share the following in common:
They have the following attacks available to them: SYNflood, PingFlood, UDP bomb, and SMURF.
They have the ability to spoof packets (fake the source address.)

TFN was the first highly visible distributed denial of service attack tool to surface. It is
has been nicknamed “Teletubby Flood Network” or “Tribal Flood Network”. TFN exhibits
a two tier architecture, involving a client that controls the targeting and options of the
attack system, and multiple daemons, which function as listeners for the client’s
commands, and perform the actual denial of service attacks, chosen from a variety
provided in the tool.

TFN daemon runs as a hidden service on the machines it uses, able to receive
commands from the client hidden subliminally in standard network
communications/protocols. It also hides the client and daemon’s source in all
communications and attacks.

In addition to the above, TFN2K has the following properties:
CAST encrypted TCP, UDP, or ICMP communication with clients as opposed to unencrypted ICMP packets for TFN
Added attacks- Mix, Targa3
Decoy packets
Configurable client daemon ports

TFN2K, while not evolving to a three-tier architecture like Trin00, added encryption to its
communication between its 2 tiers, client and daemons, making it harder to detect.
TFN2K also added a new type of denial of service attack, “Targa3”.

For more detailed information on this attack, check out the following links:

http://xforce.iss.net/alerts/advise40.php

http://www.cert.org/incident_notes/IN-99-07.html#tfn
 



Trin00

Trin00 moved to a three tier architecture, including a client (telnet or netcat), used by the
attacker, that sends its commands, including targets, to master servers, which control
multiple daemons, knowing their addresses and forwarding commands received from the
client.

This additional tier made this tool harder to trace back to the attacker, adding an
additional layer to the communication. However, Trin00 did not take advantage of all of
TFN’s technology to hide itself, communicating using it’s own proprietary channels and
failing to hide the source of it’s attack traffic. Trin00 also was limited to only one form of
denial of service attack, unlike TFN, which had a variety.

Trin00 is a DDOS tool with three parts- a master, clients, and broadcast. The attacker sends a TCP packet on port 27665 to a master. The master then sends a UDP packet on port 27444 to all of its clients. These clients in turn call the program "broadcast" which starts a UDP bomb directed at its target.
For more technical information about this tool, check out the following links:

http://www.cert.org/incident_notes/IN-99-07.html

http://xforce.iss.net/alerts/advise40.php



Stacheldraht (XXbarbed wireXX)

Stacheldraht took Trin00 and TFN’s technology and combined them, hiding the source
addresses of it’s traffic and adding the variety of denial of service attacks from TFN,
while adding the three tier architecture of Trin00. A new version of stacheldraht has
recently emerged with additional technology to hide its presence and communications.

It has the same attacks (SYNflood, PingFlood, UDP bomb, and SMURF) and the ability to spoof packet source address just like TFN. In addition, Stacheldraht adds encrypted master/client communication. This attack uses a variety of TCP / UDP ports and specially formatted ICMP packets for communication. Like Trin00, Stacheldraht uses three components: a master, clients, and agents. One thing that makes Stacheldraht interesting is that it has a built in updater for the agents. They will actually download and install newer versions of the agent program.



Distributed Denial of Service Mitigation

Introduction
This paper discusses various options for dealing with Distributed Denial of Service
(DDoS) attacks. Some options are aimed at reducing the effect of an attack, others at
detecting the attack, others are aimed at providing forensic information, others discuss
how to prevent the attack altogether.

Attack Survival
A DDoS attack involves many hosts sending random data to a target. In most cases, the
data is spoofed, typically with random source addresses for each packet. We present an
option for packet filtering that uses this feature, along with the robustness of TCP, to
filter the flood. The current tools use the same target IP address for the duration of the
attack, and we present another option that uses this to avoid the attack.

Moving Target Defense
One method of surviving an attack is to change the IP address of the target system.
This causes the remainder of the attack packets to be delivered to the old, now invalid IP
address. Depending on whether the routers are flooded, it may be necessary to remove
the routes to the old IP address from the Internet (by using BGP or something). In order
to maintain connectivity during the IP address change, it will be necessary to update
DNS. To perform the IP address change with the minimum amount of downtime to the
host system it would be best to have a separate Network Address Translation system,
and change the address at the NAT system. This makes the change transparent to the
actual target. It might be possible to create an automated system that detects the attack
and makes the necessary DNS, BGP, and NAT changes to keep things the target site
available.

The method mentioned above can be done differently – instead of changing IP
addresses when an attack is detected, the change can occur periodically, every day or
every hour, as well as whenever an attack occurs. This forces the attacker to perform
frequent DNS requests to determine the current IP address of the target, and these DNS
requests can provide useful forensics information, but we’ll talk about that later.

Filtering Defenses
Surviving an attack by filtering requires being able to filter the flood packets. There are
two ways to do this. One way is with a signature-based packet filter. If we can create
signatures for typical flood packets (TCP packets with zero data size for example, or
unusually large ICMP packets), and filter out those packets, we can filter the flood
packets while allowing “normal” traffic to proceed. This can be done using RealSecure’s
signature technology and engine, and adding a proxy to it. Obviously, this leads to an
arms race between packet generators and signature writers. This technology can also
be used to prevent attacks, by filtering out control channels. Since the number of
signatures for DDoS is small, it may be possible to run this tool at relatively high
throughputs.

Another filtering option is to reject (not pass through the filter) the first IP packet from any
IP address. This works with the current generation of attack tools because they all tend
to use a flat distribution random number generator to generate spoofed source
addresses, and they only use each random address once. This would only work for
websites or other TCP-based servers, because TCP is robust enough that if the first
packet is rejected, it will send a second request, which this method allows through, along
with all subsequent packets. It is also possible that this method will allow normal traffic
of UDP and ICMP protocols through, if the protocols implement a retry after the first
packet is ignored (i.e. a timeout). The main problem with this approach is that once the
method is discovered, hackers will change the tools to work around them (by sending
multiple packets from each random source address). There may be a way to respond to
this, starting another arms race.

Another possibility is to divert traffic based on IP protocol to different servers or even
route it differently. Thus, for a web server it might be possible to route ICMP and UDP
traffic bound for the web server somewhere else entirely, or even block it at the router,
so that only TCP-based floods will succeed. This at least narrows the scope of attacks
that can be made.

Bandwidth Defense
A brute force method of defense for websites and other content providers is to utilize a
service like Akamai or Sandpiper that uses large pipes and large distributed networks to
provide enough bandwidth to survive an attack.

Rate Filtering
If an attacked site peers with multiple providers, it may be the case that one of the
providers is carrying more of the flood traffic than the other. The attacked site may
choose to filter access from the provider that is carrying the majority of the traffic, or
even terminate their connection with that provider, to reduce the impact of the flood.

Attack Prevention
Preventing the attack in the first place is the ideal situation. Preventing the attacks from
utilizing spoofing is also of some use, since it makes it easy to track down the source of
the attack, and it also makes it easy to filter traffic from the attacking hosts.

Ingress Filtering
One of the best ways to prevent attacks that utilize spoofing is to implement “ingress”
filtering at the point of attack. Ingress filtering prevents spoofed attacks from entering
the network by putting rules on point-of-entry routers that restrict source addresses to a
known valid range.

Because ingress filtering must be present at each point-of-entry, it must be set for each
subnet on each router in the organization. This means it is a lot of work to check each
router by hand. There are a couple of ways to check the ingress filtering configuration of
an organization.

One way is to provide an easily distributed program that sends spoofed packets to a
listener program. If the listener program receives the spoofed packets, it can notify the
remote program that the packet was received and also log the network from which it
received the spoofed. After the program has been run at each location, the listener can
present a status report of the ingress filtering configuration in the organization.

Another option is to integrate with some popular network management platform such as
OpenView or Tivoli. These tools may already have stored the filtering rules, and may
also be able to push them out to the routers in the organization if they are missing. Our
tool can examine the list of rules and determine if any changes need to be made.
A third possibility is to perform automatic ingress filtering by creating a packet filter
device which sits on the wire and stores up a list of usual source addresses. When it
notices a large number of unusual source addresses, especially if they are all going to
the same target address, it can do several things. It can reject the unusual source
addressed packets, it can notify the target address, and it can even reject all traffic to the
target address until the attack is over. This is also a method for detecting when an
attack is happening.

Control Channel Filtering
By filtering out DDoS control messages, we prevent the attacker from causing the attack
servers to begin the attack. This prevents the attack altogether. This can be
accomplished using a signature-based packet filter mentioned in the Attack Survival
section. If we can develop signatures for most control channel packets, we can simply
reject them at the control channel packet filter, and they will disappear from the wire.

Active Response
Another possible attack prevention method is especially useful for prevention when
control channels are detected and unencrypted (or decrypted). By using credentials
sniffed from the control channel, it should be possible to take control of the attack server
and shut it down.


---------------------------


2. Pre-attack precautions

2.1 Who should be in charge of protecting my network?

QUOTE
The FBI, CERT, and your ISP will help you if you are under attack, but they will not secure your network. This leaves you with two security options- in-house security or a managed security solution. In either case, you need to have an incident response team. This team should include senior technical staff who can help formulate a plan of action, and should have access to senior management who can authorize the action. Time can be a critical factor in a denial of service attack. The more time it takes to figure out who is capable of making decisions, the longer you will cut off. One key role of this team is to have a contact person to coordinate with other organizations (e.g. CERT, below) during the incident.


2.2 Forming an Emergency Response Plan

QUOTE
Put together an Emergency Response Plan, and identify a team who will be responsible for implementing it. Ensure that the team has senior management contact, and the necessary technical skills. The ISS X-Force offers a great deal of technical information useful for technical staff education at http://xforce.iss.net/. If these skills are not available in-house, consider outsourcing this from a company offering Emergency Response Services. ISS' Emergency Response Services (ERS) are specifically geared to help companies build and improve upon incident preparedness. This is achieved through quarterly on site workshops with customers. This service then helps ISS' Emergency Response Team be more effective with its 24x7 service in the event that the client comes under attack. The Emergency Response Plan should include an escalation policy, and you should educate your organization on this policy.


2.3 How can I protect my network?

QUOTE
When dealing with distributed denial of service attacks, there is no way for you to be able to stop them at your network. These attacks end up being a war of bandwidth and the attacker is likely to win that battle because of the distributed components. This is not to say that there is no way to stop them or that there is nothing for you to do. There are several hardware/software solutions that you can implement that will minimize the effect of these attacks and offer you some protection. These solutions can also prevent you from becoming an unwilling component of a DDOS attack (which will also affect bandwidth and network performance.)



Firewalls
QUOTE
A Firewall is your first line of defense. It defines legal connections, helps prevent intrusion (which would be required to plant agent or zombie programs on your network,) and is capable of keeping detailed logs on suspicious activity. Firewalls are not a final solution. A skilled attacker or someone who has downloaded good tools can easily get past the best firewalls if vulnerabilities exist on your network. You can think of a firewall as defining the doors and windows on a house. If vulnerabilities exist on your network, the cracker need only knock on the door and someone will let him or her in from the inside. Just because you have a firewall in place doesn't mean that someone hasn't planted zombies in your network- finding those zombies is best left to scanners and watching for intrusion is best left to IDS software.

During an attack, the firewall will take the brunt of the attack and will mean the difference between no Internet connection and an entirely locked up network. Any firewall with the proper rule base can recognize all of the flooding attacks used by these distributed tools and drop the packets before they penetrate into the network. Most commercial firewalls can also be set to notify you that the attack is underway. The most important feature in this type of attack may be the firewall's ability to log this suspicious traffic. The more information that you are able to give your ISP about the traffic you are seeing, the faster they will be able to filter out the traffic before it gets to your network. This information will also help the FBI track down the attacker and the zombie machines making life easier for everyone.


Scanners
QUOTE
When it comes to DDOS, the value of scanning programs is two fold. First of all, products like our Internet Scanner, System Scanner, and Database Scanner will scan your network for vulnerabilities and tell you how to fix them (give you links to patches, tell you step-by-step how to configure OS settings or software, etc.) These vulnerabilities are what the attacker exploits in order to plant the DDOS agents. If the vulnerabilities are corrected, the attacker is unable to gain a foot hold on your network. Secondly, Internet Scanner can scan your network for existing back doors and DDOS agents so that you will be able to remove them.


IDS
QUOTE
A good IDS is your best friend when it comes to security. I will once again use the analogy of a house. If a firewall defines the doors and windows on a house, an Intrusion Detection System (IDS) is like an alarm system. An IDS does not look for vulnerabilities on a network; it churns thru all of the packets that go to a network segment or a host and looks for anyone trying to scan your network or exploit a vulnerability (whether the particular vulnerability exists on your network or not.) An IDS acts as a watchdog that looks for signs of trouble and can be set to automatically respond to any signs of danger.

In order for an attacker to place agents on your network, he or she must first penetrate your network and then root one or more of your machines (rooting a machine means gaining root or administrator access to a machine by elicit means.) This is not an instantaneous process and requires several stages in order to accomplish this goal. First, the intruder has to scan your firewall and see what is open. Then an exploit must be run in order to gain access into your network. At this point he or she would have to establish a connection to an internal machine (probably the one that let him in) and transfer the source code or binaries to the machine. After installing the software, the attacker would probably scan the network for other vulnerable machines and repeat the process. If a good IDS was on this network, the attacker never would have gotten past the initial scan. The most powerful and widely used IDS on the market is our very own RealSecure. In addition to being able to detect a master trying to talk to an existing agent, RS network sensors (or engines) are able to detect and respond to more exploit attempts than any other IDS. Our responses range from logging (see above for the importance of this,) notification (real time display, email, paging), reconfiguring your firewall on the fly, killing connections, and user defined responses.

During a DDOS attack, the immediate notification of everyone on the response team can result in a speedier recovery of Internet access. The ability to reconfigure the firewall will help prevent these packets from slowing down your internal network. Firing kills for SYNfloods will free up some of your resources and take some strain off of your firewall and logging will assist your ISP and the FBI in stopping the attack.


2.4 How do I stay current on important security issues?

There are several web sites and mailing lists that can help keep you aware of current exploits and security issues. Here is a list of some good security resources:

X-Force - ISS
The most comprehensive public database of security related alerts and exploits.
http://xforce.iss.net/alerts/
Alert mailing lists: http://xforce.iss.net/maillists/

NT Security
This site lists general security info and in depth coverage of all security issues involving NT/2000
http://www.ntsecurity.net
Their security alert and zine mailing list can be subscribed to on this page.

CERT
Current alerts and activity can be seen on their web page
www.cert.org
To subscribe to their list go to: http://www.cert.org/contact_cert/certmaillist.html

3. During an Attack

3.1 How do I recognize an attack?

QUOTE
The easiest way to spot a DOS attack is to have it reported by an IDS or Firewall. It will show up as any of the following: SYNflood, PingFlood, UDP bomb, or SMURF. Since you should assume that the source IP field is most likely spoofed, the MAC address is how you tell if it is distributed. If you are seeing multiple attacks from varying MAC addresses, chances are it is a DDOS attack.


3.2 What do I do if I'm under attack and who do I need to contact?

Get help. Contact your Internet Service Provider (ISP) to inform them of the attack. It is possible that the ISP can take action to block the attacks before they reach your computer systems. Call the Computer Emergency Response Team (CERT). You can email them at cert@cert.org or fax them pertinent information at +1 (412) 268-6989. You can also contact ISS at incidents@iss.net. Include information about:

Your name, telephone number, email address, and time zone (e.g. Eastern Standard Time)
The name and IP address of the system under attack,
The apparent source of the attack (hostname or IP address)
A description of the attack (methods, tools, etc)


QUOTE
Contact Law Enforcement authorities to inform them of the incident, such as the FBI. You may not be the only organization under attack, and they may be able to provide technical assistance or contacts to help your response efforts. You can help the law enforcement efforts by collecting system log information from target systems. These logs may be important evidence that law enforcement needs to take action; it is critical that this information be collected and protected before it is accidentally (or deliberately) erased.
 
Monitor important systems during the attack using intrusion detection software or services. This can help mitigate the attack, by discovering actions that can be taken (e.g. installing security patches, expanding RAM to help the OS to maintain performance during Denial-Of-Service attacks). It can also help detect signs that this attack is more than a nuisance - for example, that a Denial-Of-Service attack is a diversion intended to distract your attention from an actual takeover of your systems. In particular, if other organizations are under particular attack, check any of your systems that might be similar for signs of that attack as well.



########################################################################
Moore
############################################################
##########################################################

internet storm center

http://isc.sans.org/

http://isc.sans.org/top10.html

http://isc.sans.org/port_details.html?port=80


--------------------------------------------------------------------------------
Introduction to Denial of Service
www.pentics.net/denial-of-service/white-papers/smurf.cgi
Network-Based Denial of Service Attacks
---------------------------------------------------------------------------------------


#########################################################
############################################################


DOS attacks

DoS
A Denial-of-Service (DoS) is an attack whose purpose isn't to break into a system, but instead to simply "deny" anybody else from using the system.

Types of DoS attacks:
crash
Tries to crash software running on the system, or crash the entire machine.

disconnect
Tries to disconnect two systems from communicating with each other, or disconnect the system from the network entirely.

slow
Tries to slow down the system or its network connection.

hang
Tries to make the system go into an infinite loop. If a system crashes, it often restarts, but if it "hangs", it will stay like that until an administrator manually stops and restarts it.

DoS attacks can be used as part of other attacks.
For example, in order to hijack a TCP connection, the machine you are taking of the place of must first be taken offline with DoS.

By some estimates, DoS attacks like smurf and the massive DDoS attacks account for more than half the traffic accross Internet backbones.



Port Scan : fragmented
Another stealth approach is to fragment the IP datagrams within the TCP header. This bypasses some firewalls acting as "packet filters" because they cannot see a complete TCP header that can match their filter rules.

----------------------------------------------------------------------------------------

:Port Scan : half-open
One problem with port scanning is that it is easily logged by those services listening at the ports. They see an incoming connection, but no data, so they log an error. There exist a number of stealth scan techniques to avoid this. One is the half-open scan that only partially opens a connection, but stops halfway through. This is also known as a SYN scan because it only sends the SYN packet. This stops the service from ever being notified of the incoming connection.
------------------------------------------------------------------------------------------

:Port Scan : flags
The typical TCP scan attempts to open connections (at least part way). Another technique sends erroneous packets at a port, expecting that "open" listening ports will send back different error messages than "closed" ports.

The most common of these scans is the FIN scan, which attempts to close a connection that isn't open. If no service is listening at the target port, the operating system will generate an error message. If a service is listening, the operating system will silently drop the incoming packet. Therefore, no response indicates a listening service at the port. However, since packets can be dropped accidentally on the wire or by firewalls, this isn't a very effective scan.

Other techniques might consist of XMAS scans where all flags in the TCP packet are set, or NULL scans where none of the bits are set. However, different operating systems respond differently to these scans.

------------------------------------------------------------------------------------------

:Port Scan : UDP
Port scanning usually means scanning for TCP ports, which are connection-oriented and therefore give good feedback to the attacker. UDP, or connection-less traffic, responds in a different manner. In order to find UDP ports, the attacker generally sends empty UDP datagrams at the port. If the port is listening, the service will send back an error message or ignore the incoming datagram. If the port is closed, then the operating system sends back an "ICMP Port Unreachable" message.

-----------------------------------------------------------------------------------------

Port Scan : reverse ident
UNIX offers a service called ident or auth which will identify the user of a TCP connection. In the intended operation of this feature, when a user connects to a server, the server sends back a request to the ident service to discover the user's identity.

However, it can also be used in a reverse way. If a server itself also has the ident feature turned on, when a user connects the the server, the user can query the identify of the service it is connecting to.

This helps discover possible accounts that can be broken into.

advICE: IDENT-More about the IDENT protocol

---------------------------------------------------------------------------------------

:Port Scan : strobe The strobe varient of a port scan tries only a few ports the hacker knows how to attack. The name comes from one of the original TCP scanning programs, though now virtually all scanning tools include this feature.

-----------------------------------------------------------------------------------------

Reconnaissance
The first stage of any attack is "reconnaissance": scanning the victims looking for ways into their systems.

The purpose of a this stage is to map out the target network and systems. The hacker will try to list all the systems on the network, then try to list all the holes available on the target systems.

In order to map the target network, the hacker will try:

ping sweep
Find out which machines respond by pinging them.
DNS zone transfer
Finds out all the machines that are listed in the DNS server, which often includes machines outside the the company's address range (colocated at hosting sites).
whois
Queries the InterNIC for assigned addresses and names.

Once the hacker has a list of systems, he/she will scan the system looking for possible entry points into the system:

TCP or UDP port scan
The hacker looks for "listening" or "open" ports. This is a list of programs on the system that will respond to network requests.
Sun or Microsoft RPC port/end-point dump
Lists all the RPC programs running on the system. This supplements a port scan by identifying the services running at ports.
showmount -e target
Will list the "shares" or "exports" of the NFS server.

banner-check
Scan for logon banners
Port Scans
Reconnaissance scans detected by Network ICE intrusion detection system.


----------------------------------------------------------------------------------------

smurf
QUOTE
Smurf is a simple attack based on IP spoofing and broadcasts. A single packet (such as an ICMP Echo Request) is sent as a directed broadcast to a subnet on the Internet. All the machines on that subnet respond to this broadcast. By spoofing the source IP address of the packet, all the responses will get sent to the spoofed IP address. Thus, a hacker can often flood a victim with hundreds of responses for every request the hacker sends out.
There is not much the victim can do, because the incoming link is being overloaded. However, the victim does known the subnet number of the amplifier, and should contact the owner to tell them to turn off amplification (i.e. enable filtering of ICMP Echoes).

IRC servers are the primary victim to smurf attacks. Script-kiddies run programs that scan the Internet looking for "amplifiers" (i.e. subnets that will respond). They compile lists of these amplifiers and exchange them with their friends. Thus, when a victim is flooded with responses, they will appear to come from all over the Internet.

On IRCs, hackers will use bots (automated programs) that connect to IRC servers and gather a victim's IP address. The bots then send the forged packets to the amplifiers to inundate the victim.

The owner of the amplifier is also a victim in this attack. They can easily defend against the attack by filtering the incoming broadcasts.

The hacker is able to saturate the links and gateways leading to the inundated victim, thus no firewall can really protect the victim. The only real defense is to trace back to the amplifiers and contact those system administrators.

The attack is named "smurf" after a popular program that generates the attack.

Fraggle, a variant uses UDP instead of ICMP. In this case, the ports echo, chargen, daytime, qotd are used to trigger responses. These ports are also susceptible to pingpong attack, and should be turned off.



QUOTE
A type of network security breach in which a network connected to the Internet is swamped with replies to ICMP echo (PING) requests. A smurf attacker sends PING requests to an Internet broadcast address. These are special addresses that broadcast all received messages to the hosts connected to the subnet. Each broadcast address can support up to 255 hosts, so a single PING request can be multiplied 255 times. The return address of the request itself is spoofed to be the address of the attacker's victim. All the hosts receiving the PING request reply to this victim's address instead of the real sender's address. A single attacker sending hundreds or thousands of these PING messages per second can fill the victim's T-1 (or even T-3) line with ping replies, bring the entire Internet service to its knees.
Smurfing falls under the general category of Denial of Service attacks -- security attacks that don't try to steal information, but instead attempt to disable a computer or network.

http://www.webopedia.com/TERM/S/smurf.html


-------------------------------------------------------------------------------------------

Why a Denial-of-Service attack can be dangerous


Summary
Many of our articles in the exploits section describe Denial of Service attacks.
Since these attacks are less "glamorous" than attacks that can be used to immediately achieve privileged access, this form of attack is usually underestimated, and the result is very dangerous from a security point of view.
This article will try to explain why Denial of Service attacks should be taken very seriously.


Competition
A Denial-of-Service attack can be an easy way for the competition to shut your business down temporarily, or permanently. Just imagine your e-mail and web server crashing, leaving your business disconnected from your customers. Think about launching a new service where suddenly your server, which was designed to serve millions of remote users, is suddenly slowing down considerably for a non-apparent reason.
This is a true weapon in today's competitive markets.

For the Fun of it
This is a factor that is always underestimated. People always tell me "I have no security threat - Who would possibly want to harm me?" The problem lies with many "crackers" who want to do damage, just for the fun of it. How much fun is it watching a server crashing? Plenty of fun, apparently.
Since Denial-of-Service are the simplest attacks to conduct, and they are usually impossible to trace back to the attackers, Denial-of-Service is sometimes a preferred form of attack. There are many crackers, and crackers wannabes out there. One of those might be knocking at your door.

The Attack
This is the most dangerous possibility. Sometimes DoS attacks precede the actual attack. A Denial-of-Service attack serves the following purposes as part of a full system attack:
- When all the attention concentrates on getting the server to work again, very little attention is put on what goes on exactly on the local network
- The attack creates several anomalies that can easily go undistinguished if buried in a large number of anomalies created by the DoS attacks.
- Sometimes a denial-of-service can really bring immediate results to an attacker: Consider a router that contains a filter that blocks certain ports or IP addresses. Now imagine the router is attacked by a DoS that makes it stop working completely. The administrator will naturally come and restart its operation. But if it happens constantly, the administrator will start to look for the problem. The simplest (and most common) way to check which filter rule makes the problem is to remove all the rules and apply the one by one. This leaves the router exposed! (Although this exposure is for a short period of time, the attacker knows its exact time). Now think about this attack directed at a firewalled machine. As soon as the firewall is brought down (usually, due to massive pressure from the co-workers who want to continue their communication), the attacker can quietly and safely break in.
- Denial-of-Service attacks are sometimes a required step during a full-scale attack. For example, some attacks require the attacker to reboot the machine. This can easily be performed by shutting down a crucial service or by crashing the host (the administrator will naturally come and restart the affected machine, thus making the necessary reboot).

Therefore, it's very recommended to pay attention to possible DoS attacks and to avoid them (by applying new patches) when possible.
http://www.securiteam.com/securitynews/2JUQ6QAQTE.html

------------------------------------------------------------------------------------------
http://www.securiteam.com/exploits/
http://www.securiteam.com/exploits/archive.html
------------------------------------------------------------------------------------------

Understanding and Defending Against Distributed Denial of Service Attacks
Over the first quarter of this year, there has been an alarming increase in the number of Denial of Service (DoS) attacks against e-commerce companies and other organizations. As the name implies, DoS attacks are designed to inhibit access to one or more systems. There are numerous variations on the DoS theme, but two general methods can be defined:

Disabling one or more host systems either by causing applications, protocols (especially the IP stack), or the operating system to "crash", or by consuming all of the host's resources (CPU time, RAM, etc.) so that there are insufficient resources available to handle normal requests.
Consuming as much bandwidth as possible on one or more LAN/WAN links so that normal network traffic is bottlenecked.
In both cases, the net result is a loss of host availability to its legitimate users. Major types of DoS attacks include SYN floods, ping floods, comm buffer consumption, ping of death, UDP bomb, finger bomb, and many others.

Now these DoS attacks are being taken to a higher (or lower?) level of ingenuity with the increasing prevalence of Distributed Denial of Service (DDoS) attacks. There are several types of DDoS attacks, but their methods are very similar in that they rely on a large group of previously compromised systems to direct a coordinated distributed flood attack against a particular target.

In preparation for these attacks, the culprit will compromise many systems (sometimes hundreds) on which the agent software can be loaded. The agent software is referred to as a "Zombie" program since it lies asleep until awakened. The attacker then uses a master console to communicate with and configure the Zombie agents. At a specified time, all of the agents initiate an otherwise standard DoS attack against the intended target. The attack is so devastating because of the tremendous traffic volume generated by the "army" of agents.

There are four major DDoS tools currently available to crackers. The table below shows the name of each exploit script and the specific attack types that can be launched by each.

DDoS Tool
DoS Attack Type(s)

trin00
UDP flood
TFN (Tribe Flood Network)
UDP bomb, SYN and ICMP (ping flood), and Smurf
TFN2K
UDP bomb, SYN and ICMP (ping flood), and Smurf
Stacheldraht ("Barbed Wire")
ICMP, UDP, and SYN floods

The nature of these attacks make them very difficult to track. Firewalls and intrusion detection systems may or may not detect the attacker as he exploits the systems on which he will install the agent software. If your organization is selected by the culprit to be a "safe haven" for the software agents described above, will you know about it? If your organization is selected as the target of a DDoS attack, can you prevent it? Let’s look at these two vital questions individually.

First, the bad news is that not all security scanners (security assessment tools) will locate the Zombie programs that act as DDoS agents. Unfortunately, many organizations have tools that will do the job, but they don’t have a well-defined security assessment policy that will allow them to recognize the presence of these programs in a timely manner. The good news is that the better security scanners (e.g. ISS System Scanner and Internet Scanner, Network Associates CyberCop, and others) will locate these Zombie programs and provide information on how to safely eliminate them from your systems. However, in order for the tools to work, they must be used frequently. The results of the scans must be properly interpreted, and the appropriate corrective actions must be implemented quickly. If this is done, then you can significantly reduce the probability that your systems will become unknowing and unwilling accomplices in a DDoS scheme.

But what if your network is the target? The bad news here is that you will not know that an attack is being prepared since the agents will typically be installed on systems across a broad range of other organizations and locations. Any preventative measures you have in place (i.e. a good periodic assessment plan) will never detect the selection and compromise of the agent systems as the Zombie programs are installed. The first indication that you will have of the attack is when it begins. So the only remaining question is: "Are your defenses good enough?" The good news in this area is that the actual exploits used in DDoS attacks are well-known and are usually handled well by properly-configured firewalls and intrusion detection systems. Obviously, it is vital to ensure that you have complied with all recommendations regarding these DoS vulnerabilities. Be certain that you have applied all DoS-related patches to your systems. Re-evaluate firewall rules and filters to ensure their effectiveness against these exploits. Review related policies in your intrusion detection system to verify that it will respond to the attacks in the desired manner.

Finally, it is important to have a plan for responding to these attacks. Many security-related references are available which detail scaled responses depending on the level of attack or penetration. One good source is Maximum Security, 2nd Edition published by SAMS. One chapter of this security reference describes the "SAMS Crack Level Index" and provides guidelines for responses to each level of compromise.

DDoS attacks are just the latest trend in the perpetual battle with crackers. These attacks are unmitigated attempts to disable your systems. While focusing on these attacks, also remember that there are hundreds of other types of attacks. In some cases, a cracker may use a DoS attack as a feint to draw attention away from another exploit such as an attempt to access critical confidential data on another system in your network. Only a soundly designed and enforced security policy which includes regular assessments and real-time adaptive intrusion detection can provide the margin of safety that your network resources require. While these measures are not guarantees that you will not be cracked, they may be the difference between an averted attack and a disaster.

------------------------------------------------------------------------------------------

Cyber Threats: Viruses, Worms, Trojans, and DoS Attacks
Scott Hobbs
December 18, 2000

People are becoming cyber aware, now as computers and the Internet become part of people’s daily lives and business. While using the Internet is becoming easier, so are the cyber threats and attacks to which people, companies, and groups are becoming exposed. There are many different types of cyber threats and methods to which to carry out the threats. Computer users, companies or individual web sites are vulnerable to cyber threats like viruses, Trojans, worms, and Denial of Service attacks. These common and often malicious threats need to be understood by anyone who has a computer. By understanding what the threats are and what they can do, users can better prepare themselves and their computers against the cyber threats.

One type of cyber threat comes in the form of Viruses. Viruses can be used to target a specific computer or they can be placed "in the wild" and make anyone with a computer a potential victim. A virus is "in the wild" when it is in the general public. Viruses are defined as files that are self-replicating, regardless whether it is malicious or not. Virus programs also require that the user activate them by opening the infected file, which launches the virus program. When the virus program is executed, one of its functions is to use the users e-mail application to replicate by sending itself to the addresses in the address book. If a virus is malicious, the virus program can have it take up space, delete the victim’s hard drive, and/or delete or damage important files. The virus’s design places the virus into three classifications of viruses; boot sector, file-infecting, and macro.

Boot sector viruses are platform dependent. This means that boot sector viruses can only affect specific hardware architecture. This virus mainly comes from infected floppy diskettes that are then used to boot to when the computer starts up. The virus is executed upon booting and then copies itself to the drive boot sector. From the time of infection and every time the computer is booted, the virus is loaded and can infect any new floppy diskette placed in the computer. Because boot sector viruses are platform dependent and rely on floppy diskettes as the way they are typically spread, they have become rare because people don’t share floppy disks as much due to the Internet and electronic mail. A good precaution is to scan the floppy diskette with an anti-virus scanner that has updated virus signature files before booting from it, in order to prevent the virus from being loaded onto the computer.

The Internet has made file-infecting viruses very easy to spread. With the Internet, users can send more files and quicker than they could with floppy diskettes, thus making file infecting viruses a true cyber threat. File-infecting viruses also known as COM or EXE viruses, are platform as well as operating system dependent. They are easily spread through e-mails and any file transfer system. While file-infecting viruses are known as COM or EXE viruses, DLL, VxB, BAT, and HTML are some of the additional forms that viruses are currently being programmed with. These files need to be executed by the user, by launching the infected file. The virus then infects other files and depending on the program can continue to infect files or unload itself and repeat the infection cycle every time an infected file is executed again. The ILOVEYOU virus is an example of a file-infecting virus. The virus, written in VxB, overwrites .jpg and .mp3 files, sends a copy of itself to e-mail addressed in the victims address book in MS Outlook. A good precaution is to scan the executable with an anti-virus scanner that has updated virus signature files before executing the file.

Along with file infecting viruses, Macro viruses are a popular form in which viruses are being written in today. Macro viruses are application dependent, meaning that the virus can only run/affect the application the virus was written for. Microsoft Word, Excel, and PowerPoint, to name a few, are vulnerable to macro viruses written for them. The viruses are written to specifically exploit the macros in these applications. The macro is executed when the user opens an infected document in the appropriate application that uses the macro needed. The virus copies itself to the templates in the application, in order to infect future documents so when new documents are created they are infected with the macro virus as well. Besides scanning the file with an anti-virus scanner, a precaution that users can take is to not allow macros to be used in the applications. This will prevent the virus from being executed.

Similar to viruses but with a key difference are Trojans. A Trojan, also referred to as a Trojan Horse, may be or may not be a malicious program, that does something other than advertised or expected. Trojans are sometimes hidden with authorized programs or files and can be used to attack the victim at a later or predetermined date. Many Trojans are used to place remote access tools onto the victim’s system to exploit the computer at the attackers will and without the user’s knowledge. Trojans do require the user to initially open or run the virus program. Once executed, the Trojan installs the code to carry out its designed, but unexpected, program. ExploreZip, is a Trojan that affects Windows systems and propagates itself in e-mail attachments. Once installed, the Trojan propagates and executes without any user interaction to other systems that are networked to the infected machine.

The characteristics that Trojans display, cross the line into another popular form of viruses, known as worms. Worms propagate through primarily through e-mail and mainly spread through a network. Worms are also file infectors or macro viruses that spread using MS Outlook. Unlike other viruses, worms do not need to be activated by a user or program in order for it to replicate itself. A worm is network aware and uses its awareness for its replication. A few examples of worms are W32/ExploreZip.worm and the Navidad Internet worm. These worms spread themselves through MS Outlook and change the registry of the infected computer. W32/ExplorerZip also targets other MS products, like MS Exchange and MS Outlook Express. While these worms concentrate on Microsoft products, any operating system or application is vulnerable to worms, but Microsoft is the most common operating system, so it is targeted the most. Just like with the other forms of viruses, Trojans and worms need to be scanned for. So the user should scan the files before executing them.

Denial of Service (DoS) attacks are a cyber threats that have to be specifically targeted, unlike viruses, worms, or Trojans. Basic DoS uses a single server to tie up a network’s connection, deny users access to the targeted web site, or flood the server with useless emails with the purpose of bringing the server down. Distributed coordinated attacks (DDoS) use an unknown number of servers, or zombie systems, to attack the single server or web site. Using a DDoS disguises the attack, for the attack looks like legitimate attempts to access the server or web site because it comes from different sources, the zombie systems. Intrusion software cannot distinguish whether it is an attack or real connection attempt. Basic DoS attacks are possible to detect, with current software but very hard to prevent. This cyber threat can be easily carried out and accomplished with existing software and Trojans. Software is used to exploit holes in systems in order to gain control of them and Trojans are used to place remote access tools on systems for which the attacker can use to in the DoS attack, amking them zombie systems. In February of 2000, Yahoo, eBay, and CNN.com became victims of DoS attacks. The attacks either crashed the servers or slowed down access to the sites to the point that it disrupted business and created a major concern among people on the Internet. Just recently, due to the tensions in the Middle East, Lucent Technologies was attack by a DoS attack.

The characteristics of viruses, Trojans, and worms, blur the line as to what is specifically a virus, or a Trojan, or a worm. The ExploreZip virus has characteristics of a Trojan but also has the network awareness that might make it a worm. The Melissa virus is considered a macro virus since it exploits the macros in Microsoft Word, yet it too has network awareness to use Microsoft Outlook to send itself, thus making it a worm. Denial of Service (DoS) is another cyber threat that has characteristic of different types. While the basic DoS is not a Trojan, the Distributed coordinated attack (DDoS) uses systems that had Trojans place remote access tools on them and making available to be used in the DDoS attacks. While DoS is one type of attack, it incorporates other malicious programs in order to carry out the attack on the victim. As seen in the examples, malicious code writers use a combination of the different types to make the virus more effective and devastating.

Cyber threats are prevalent and devastating to systems, if they are infected, but there are preventative measures that can be taken to avoid becoming a victim. Simple security policies or procedures can be followed to protect computers. One is to use virus scanners that have updated virus signature files. This might take a concerted effort on the users part to keep the virus scanner updated but it is better than the alternative of being infected by a virus, worm, or Trojan. Never executing or opening unknown files is another procedure that should be followed in order to protect computers. Viruses and Trojan are dependent on unsuspecting users to open the infected files in order to activate the malicious code. So scanning and not opening unknown files will help prevent users from infecting their computer. Firewalls and intrusion detection software will help user protect their system from being taken advantage of or being used by others like in Denial of Service Attacks. Users cannot always keep the most determined attacker from infecting or using their system. But knowing what and how viruses, worms, Trojans, and Denial of Service attacks work, users will be aware of what they should and should not do to keep themselves and their computers relatively safe from cyber threats.


#####################################################
####################################################
##################################################
Moore
########################################################
for educational purposes only
########################################################

:: Original Source ::
http://seclists.org/bugtraq/2001/Jan/0047.html

Examining port scan methods - Analysing Audible Techniques

[quote]
whitepaper by dethy@synnergy.net


Abstract

I  will  attempt  to   enumerate  a  variety  of   ways  to  discover  and   map
internal/external  networks  using  signature-based  packet  replies  and  known
protocol responses when scanning. Specifically, this document presents all known
techniques used to determine  open/closed ports on a  host and ways an  attacker
may identify the network services running on arbitrary servers.
[/quote]

1.1 Introduction

[quote]
This paper will provide  an in-depth analysis of  known port scan methods,  with
exhaustive information  for each  technique used  in the  wild today  to map and
identify open and closed ports on various network servers.

Note: This  paper will  not describe  techniques used  to fingerprint  operating
systems nor identify daemon versions (banner scanning).

With an epidemic of port scan  instances occurring each and everyday, it  should
be recognized the ways an attacker could probe network hosts using a variety  of
techniques aimed to avoid detection  whilst obscuring the sender's true  source.
Understanding actions to defend against these network oriented scans is first to
identify and acknowledge the ways a scan can present appearing as normal inbound
traffic.

Port scanning is one of the most popular techniques used in the wild to discover
and map services that  are listening on a  specified port. Using this  method an
attacker can then create a  list of potential weaknesses and  vulnerabilities in
the proposed open port leading to exploitation and compromise of a remote host.

One of the primary  stages in penetrating/auditing a  remote host is to  firstly
compose a  list of  open ports,  using one  or more  of the techniques described
below.  Once  this has  been  established, the  results  will help  an  attacker
identify various services that are  running on that port using  an RFC-compliant
port  list,  (/etc/services  in  UNIX,  getservbyport()  function  automatically
obtains this)  allowing further  compromisation of  the remote  host after  this
initial discovery.

Port scanning techniques take form in three specific and differentiated ways.

* open scanning
* half-open scanning
* stealth scanning

Each  of these  techniques allow  an attack  to locate  open/closed ports  on a
server, but  knowing to  use the  correct scan  in a  given environment  depends
completely on the type of network topology, IDS, logging features a remote  host
has in place.  Although open scans  log heavily and  are easily detectable  they
produce fairly positive results on open/closed ports.

Alternatively, using a stealth scan,  may avoid certain IDS and  bypass firewall
rulesets but the scanning mechanism,  such as packet flags, used  in identifying
these open/closed ports maybe offset by dropped packets over a network,  leading
to false positives. Further  discussion of this concept  takes place in the  FIN
scan section of this document.[/quote]


Focusing more directly at each of the above techniques, these methods can be
further categorised into individual scan types. Let's look at a basic scan model
which includes PING sweeping:


[quote]                            ___________
            |           |
            | scan type |
                          |___________|
            __________________________________|___________________________________
           /                  |                 \                  |              |
          /                   |                  \                 |              |
    _____|_____          _____|_____         _____|_____       ____|___       ____|____
   |         |        |           |       |           |     |        |     |         |
   | open scan |        | half-open |       |  stealth  |     | sweeps |     |  misc.  |
   |___________|        |___________|       |___________|     |________|     |_________|
         |        |            |     |               |
   ______|______         _____|____          _____|_____       ____|_____      ____|_____
  |          |       |          |        |           |     |          |    |          |
  | TCP connect |       | SYN flag |        | FIN flag  |     | TCP echo |    | UDP/ICMP |
  |_____________|       |__________|        |___________|     |__________|    |  error   |
  |        |            |                |          |__________|
  _______|_______      _______|______        _____|_____       ____|_____           |
|          |    |       |     |           |     |          |     _____|______
| reverse ident |    | IP ID header |     | ACK flags |     | UDP echo |    |            |
|_______________|    | "dumb scan"  |     |___________|     |__________|    | FTP bounce |
        |______________|           |                |          |____________|
                 _____|______      ____|_____
                       |            |    |          |
                       | NULL flags |    | TCP ACK  |
                       |____________|    |__________|
                      |                |
          _____|_____       ____|_____
         |           |     |          |
         | ALL flags |     | TCP SYN  |
         |  (XMAS)   |     |__________|
         |___________|          |
        |            ____|______     
       ________|________   |           |
      |                 |  | ICMP echo |
      | tcp fragmenting |  |___________|
      |_________________|
        |
        _______|_______
       |    |
       | SYN|ACK flags |
       |_______________|

[/quote]


Diagram: known scan methods

The first nodes indicate the scan category which then traverses downward to list
the individual scans for that class.


1.2 open scan methods

[quote]Open scanning techniques are blatantly easy  to detect and to filter. This  type
of scan  method involves  opening a  full connection  to a  remote host  using a
typical three-way TCP/IP handshake. A standard transaction involves issuing  the
following flags to create an accepted connection:


   client -> SYN
   server -> SYN|ACK
   client -> ACK 


The above example shows a port  answering our initial connection request with  a
SYN|ACK. This  response means  the port  the packet  was targeted  to is  in the
LISTENING  (open)  state.  Once  this  full  handshake  has  taken  effect,  the
connection  will  be  terminated by  the  client  allowing a  new  socket  to be
created/called allowing  the next  port to  be checked,  until the  maximum port
threshold has been reached.

Reversely, taking  a look  at a  response from  a closed  port would  reveal the
following:

   client -> SYN
   server -> RST|ACK
   client -> RST

The RST|ACK flags returned by the server is telling the client to tear down  the
connection attempt since the port is not in LISTENING state thus is closed.

This  method  is  created   through  connect()  system  call,   allowing  almost
instantaneous identification of  an open or  closed port. If  the connect() call
returns true, the port is open, else the port is closed.

Since this  technique issues  a three-way  handshake to  connect to an arbitrary
host,  a spoofed  connection is  impossible, that  is to  say a  client can  not
manipulate the true source IP, as a spoofed connection attempt involves  sending
a correct sequence number as well  as setting the correct return flags  to setup
for data transaction.

Obviously this technique is easily  identifiable on any inbound traffic  because
it opens a full  connection, thus all IDS  and firewalls are able  to detect and
block against this scan.  However, because the  connect() method uses  the three
way handshake, results of  this scan are about  as accurate as you  could get to
determine open/closed ports.

Advantages   :   fast,  accurate,   requires  no   additional  user  privileges
Disadvantages: easily detectable and logged[/quote]


1.2.1 - reverse ident scanning

[quote]This technique  involves issuing  a response  to the  ident/auth daemon, usually
port 113 to  query the service  for the owner  of the running  process. The main
reason behind this  is to find  daemons running as  root, obviously this  result
would  entice an  intruder to  find a  vulnerable overflow  and instigate  other
suspicious activities involving  this port. Alternatively,  a daemon running  as
user nobody (httpd) may not be as attractive to a user because of limited access
privileges. Unknowing to most users  is that identd could release  miscellaneous
private information such as:

* user info
* entities
* objects
* processes

Although  the  identification  protocol   would  appear  as  an   authentication
mechanism, it was not designed or intended for this purpose. As the RFC  states,
"At best, it provides some  additional auditing information with respect  to TCP
connections".  Needless to  say, it  should not  be used  as an  access control
service nor relied upon added host/username authenticity.

The formal syntax taken from RFC 1413 reveals the following EBNF:

FORMAL SYNTAX

   <request> ::= <port-pair> <EOL>

   <port-pair> ::= <integer> "," <integer>

   <EOL> ::= "015 012"  ; CR-LF End of Line Indicator, octal \r\n equivalents

   <integer> ::= 1*5<digit> ; 1-5 digits.


Using this grammar applied to the data we send to an arbitrary host piped to the
ident/auth port  will reveal  the process  owner running  on a  given port, even
though we initiated the connection.

Advantages   : fast, requires no additional privileges, return vital service information
Disadvantages: easily detactable[/quote]


1.3 - half open scan methods

[quote]The term  'half-open' applies  to the  way the  client terminates the connection
before the  three-way handshake  is completed.  As such,  this scan  method will
often go  unlogged by  connection based  IDS', and  will return  fairly positive
results (reliability of open/closed port recognition).[/quote]

1.3.1 - SYN scanning

[quote]The implementation of this scan method is similar to a full TCP connect() three
way handshake except instead of  sending ACK responses we immediately  tear down
the connection. A demonstration of  this technique is necessary  to show a half
open transaction:

   client -> SYN
   server -> SYN|ACK
   client -> RST


This example has shown the target port was open, since the server responded with
SYN|ACK flags. The RST bit is kernel oriented, that is, the client need not send
another packet  with this  bit, since  the kernel's  TCP/IP stack code automates
this.

Inversely, a closed port will respond with RST|ACK.


   client -> SYN
   server -> RST|ACK


As is displayed,  this combination of  flags is indicative  of a non-  listening
port.

Although, this technique has become rather easy to detect by many IDS, owing  to
the  fact that  a paramount  of Denial  of Service  (DoS) utilities  base their
attacks  by  sending excess  SYN  packets. Fairly  standard  intrusion detection
systems are  no doubt  capable of  logging these  half-open scans: TCP wrappers,
SNORT, Courtney, iplog,  to a name  a few, thus  the effectiveness has  dithered
over recent years.

Advantages   : fast, reliable, avoids basic IDS, avoids TCP three-way handshake
Disadvantages: require root privileges, rulesets block many SYN scan attempts[/quote]

1.3.2 - IP ID header aka "dumb" scanning

[quote]ID header  scanning is  a rather  obscure scan  method involving  implementation
peculiarities in  the TCP/IP  stack of  most operating  systems. Originally this
technique was discovered by antirez,  who described it's technical details  in a
post to bugtraq. Evidently the basis of this scans implementation is  reflective
on the SYN scan method, although involves  a third party host to use as  a dummy
source.

Before explaining  any further  it's important  to recognize  what a  so- called
"dumb" host is. Contrasting to a bastion host, a silent or dumb host is a server
that sends and receives  little to no traffic  at all, hence the  characteristic
name endowed upon it. Locating one of these hosts requires much effort and  host
sweeping  itself,  and  is  probably  more  trouble  than  what  it  is   worth.
Nevertheless, it is a  genuine and creative scan,  that brings a thirdhost  into
play adding to it's obscurity.

Involved in this scenario are three hosts:

* A -> attackers host
* B -> dumb host
* C -> target host

Let's examine this cycle.

* Host A sends a series of PING's analysing the ID field, encapsulated within
   the IP header to Host B. A dumb host will have the ID increment the reply by
   1 each time during the PING sequence.


   60 bytes from BBB.BBB.BBB.BBB: seq=1 ttl=64 id=+1 win=0 time=96 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=2 ttl=64 id=+1 win=0 time=88 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=3 ttl=64 id=+1 win=0 time=92 ms


* Host A sends a spoofed SYN packet to Host C using the source address of Host B.
   The remote port is any arbitrary port (1-65535) that the attacker wishes to test
   for open/closed responses. Host C will reply to Host B with one of two standard
   responses:

   -> SYN|ACK response indicates an open LISTENING port. Host B will then reply with
      an RST bit flagged in the packet (automated by kernel).
   -> RST|ACK will indicate a NON-LISTENING port, (a standard SYN scan method reply),
      and Host B will ignore that packet and send nothing in reply.


Now, how could Host A know what flags were sent to Host B ?

Well, assuming the port  was open on the  target server, our series  of parallel
PING's that Host A  had been sending whilst  the spoofed SYN packets  were being
sent will hold our answers.
Analyzing the ID field  in these PING responses,   one would notice a  higher ID
increment.


   60 bytes from BBB.BBB.BBB.BBB: seq=25 ttl=64 id=+1 win=0 time=92 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=26 ttl=64 id=+3 win=0 time=80 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=27 ttl=64 id=+2 win=0 time=83 ms


Notice the second and third packets ID responses contain values greater than  1,
hence  an  open port  was  located. Any  further  increment of  more  than 1  is
indicative of an open port in Host B's responses, during this period.

Originally, the increment  was 1, but  because Host A  sent a spoofed  SYN to an
open port,  Host B  had to  reply to  Host C  with the  SYN|ACK bit packet, thus
incrementing the ID field. Following this the PING response to Host A would then
in turn have a higher ID field, as suspected.

On the other hand,  a closed port state  on Host C would  not require Host B  to
send anything, so the ID field in the PING response would not be incremented  at
all.

   60 bytes from BBB.BBB.BBB.BBB: seq=30 ttl=64 id=+1 win=0 time=90 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=31 ttl=64 id=+1 win=0 time=88 ms
   60 bytes from BBB.BBB.BBB.BBB: seq=32 ttl=64 id=+1 win=0 time=87 ms


As is shown, the ID field is still bounded by a constant of 1.

Once again  this is  why a  "dumb" host  is required,  so incoming  and outgoing
traffic is kept at a bare minimum in order to decrease false- positive results.

In fact, a  variety of scan  methods could be  used involving a  dumb host. This
scan is not limited to the SYN  scan technique. Any method involving  Host B  to
respond  to  Host A's  port  reply could  be  practiced (hint:  inverse  mapping
techniques).[/quote]


1.4 - stealth scanning

[quote]The definition of a "stealth" scan has varied over recent years from what  Chris
Klaus, author  of a  paper titled  "Stealth Scanning:  Bypassing Firewalls/SATAN
Detectors" delineated.   Originally the  term was  used to  describe a technique
that  avoided  IDS  and  logging, now  know  as  "half-open"  scanning. However,
nowadays stealth is considered  to be any scan  that is concerned with  a few of
the following:

* setting individual flags (ACK, FIN, RST, .. )
* NULL flags set
* All flags set
* bypassing filters, firewalls, routers
* appearing as casual network traffic
* varied packet dispersal rates

All the scans described below use the  inverse mapping technique for  open port
assumptions.[/quote]


1.4.1 - SYN|ACK scanning

[quote]This technique has been disregarded in most, if not all, port scanners to  date.
Ironically, the theory behind this method  is not unlike the SYN method,  we cut
out the first step in our half-open TCP/IP setup. A standard response would  act
as follows:

   client -> SYN|ACK
   server -> RST


The above flags have denoted to the client that the port is in a non-  listening
state. Since the transmission control protocol realizes that no initial SYN  was
sent,  an immediate  termination response  was sent  out. In  other words,  the
protocol thinks there has  been an error in  the connection transaction to  that
port when a SYN|ACK has been received without a SYN, as a result the reset  flag
is sent back.

On the other hand a LISTENING port will not respond to these flags.


   client -> SYN|ACK
   server -> -


As is seen, the server ignores the SYN|ACK packet sent to an open port. Needless
to say the absence of the  server's response packet to ours, will  produce false
positives. Imagine  sending a  SYN|ACK packet  and receiving  no response due to
stately packet filters, firewalls or even timeout limits blocking  transmission,
thus the  scanner would  then produce  false positives  for that port. Naturally
this scan is not considered as  reliable as TCP connect() scans because  of this
very reason.  This type  of assumption  falls under  what is  known as  "inverse
mapping".

Advantages   : fast, avoids basic IDS/firewalls, avoids TCP three-way  handshake
Disadvantages: less reliable (false positives)[/quote]


1.4.2 - FIN scanning

[quote]The  FIN   scan  method   uses  inverse   mapping  to   discover  closed  ports.
Unfortunately,  this  techniques  relies  on bad  BSD  network  code  which most
operating  systems  have  based  their TCP/IP  stacks  on  (all  the better  for
scanning). Ideally, once a FIN flagged packet is sent, a closed port will resend
with  an  RST  bit. Open  ports,  alternatively  will not  send  a  packet back,
therefore what precisely is not answered with the FIN bit, is assumed to be open
through this process of inverse mapping.

Take a look at the negotiation for open/closed port recognition displayed below.


   client -> FIN
   server -> -

No  reply  signaled by  the  server is  iconic  of an  open  port. The  server's
operating system silently dropped the incoming FIN packet to the service running
on that port. Opposing this  is the RST reply by  the server upon a closed  port
reached. Since, no service is bound on that port, issuing a FIN invokes a  reset
(RST) response from the server.


   client -> FIN
   server -> RST


Arguably there are two ways to test  for an open port. The first is  receiving a
list of closed port responses and subtracting these port replies from a list  of
the port probes originally sent. For example, sending 3 packets to ports 1, 2, 3
on a remote host.

If the response back is an RST for  ports 1 and 3, we then compare the  original
port list:  1, 2, 3 to the  received ports: 1, 3 and  deduce that 2 is the  open
port via comparison.

The second test involves using a timeout for the packet response. If the timeout
limit is reached to receive the packet in question then we assume it to be open.
Obviously, this method is test for  false positives and should be avoided  where
possible. The responses for the  packet could be obscured because  of firewalls,
filters, routers, slow links, and heavy traffic, thus is not a solid test to  be
used as a rule of thumb for stealth FIN scanning.


Advantages   : avoids many IDS, avoids TCP three-way handshake
Disadvantages: slow false positives[/quote]


1.4.3 - ACK scanning

[quote]Uriel Maimon first described this technique in Phrack 49 article 15. Needless to
say this  technique revolves  around a  bug in  the IP  layer of a few operating
systems.

In order to  test for an  open port using  this method an  initial ACK packet is
sent to the target  host. There are actually  two ways to classify  the response
packet.  The  first involves  an  assessment of  the  TTL field,  the  second is
analyzing the WINDOW  field. Both of  these fields should  be obtained with  the
response packet that has the RST bit set.

The reply should be a reset connection, that is, a packet with the RST bit  set.
Accompanying the  RST flag,  an analysis  of the  IP header,  for some operating
systems, will provide a TTL that is lower than the other packets received from a
closed port. Evidently any TTL sent to an open port would reveal a TTL less than
or equal to 64, if the upper/lower ports have a higher TTL.


   client -> ACK
   server -> RST -> (TTL <= 64)


A real life response is show below:

packet 1: host XXX.XXX.XXX.XXX port 20: F:RST -> ttl: 70 win: 0 => closed
packet 2: host XXX.XXX.XXX.XXX port 21: F:RST -> ttl: 70 win: 0 => closed
packet 3: host XXX.XXX.XXX.XXX port 22: F:RST -> ttl: 40 win: 0 => open
packet 4: host XXX.XXX.XXX.XXX port 23: F:RST -> ttl: 70 win: 0 => closed


Notice the TTL  of the sequential  packets before and  after packet 3  is higher
than 64. As packet 3 is received it is observed that the TTL for port 22 is less
than the boundary 64, indicating an open port.

Using the WINDOW  field method, any  non-zero response packet  received from the
server  is indicative  of an  open port.  This is  true for  several early  BSD
(FreeBSD,  OpenBSD) and  UNIX (AIX,  DGUX) but  has been  patched/fixed in  more
recent versions.

   client -> ACK
   server -> RST -> WINDOW (non-zero)


A real life response is shown below:

packet 6: host XXX.XXX.XXX.XXX port 20: F:RST -> ttl: 64 win: 0 => closed
packet 7: host XXX.XXX.XXX.XXX port 21: F:RST -> ttl: 64 win: 0 => closed
packet 8: host XXX.XXX.XXX.XXX port 22: F:RST -> ttl: 64 win: 512 => open
packet 9: host XXX.XXX.XXX.XXX port 23: F:RST -> ttl: 64 win: 0 => closed


Notice that although the  TTL equals 64, the  surrounding packets do also.  Thus
the TTL method  would not work  on this host,  however the WINDOW  offset method
shows a non-zero value indicative of an open port.

Advantages   : difficult to log, avoids IDS detection
Disadvantages: relies on BSD network code bug, OS incompatible[/quote]


1.4.4 - NULL scanning

[quote]Clearly through it's endowed named, the NULL scan unsets ALL flags available  in
the TCP header. ACK, FIN, RST, SYN, URG, PSH all become unassigned. The reserved
bits (RES1, RES2) actually do not effect the result of any scan, whether or  not
they are set clearly does not matter.  On arrival of this packet to the  server,
BSD networking code informs the kernel to drop the incoming call if the port  is
open.


   client -> NULL (no flags)
   server -> -


Alternatively, an RST packet will be returned if a closed port has been  reached
(yes another inverse mapped scan).


   client -> NULL (no flags)
   server -> RST


Owing to  the fact  that the  RFC does  not exclaim  exactly how  a host  should
respond to these types of packets, various network code for the major  operating
systems will differ in the packet responses, ie Microsoft vs UNIX.

Advantages   : avoids IDS, avoids TCP three-way handshake
Disadvantages: UNIX only, false positives[/quote]


1.4.5 - XMAS scanning

[quote]Contrastedly, a so called XMAS scan is the inverse of the NULL scan method.  All
the available flags in  the TCP header are  set (ACK, FIN, RST,  SYN, URG, PSH).
XMAS  or "Christmas  Tree" scanning  is named  rightly so  after the  decorative
effect the scan has with the  flagging implementation. The reserved bits do  not
effect the scan result, so setting or unsetting is ofno importance. Once  again,
since this method is based on  BSD networking code the technique will  only work
against UNIX hosts.

XMAS scanning works by initializing  all the flags and transmitting  this packet
to the remote host. The  kernel will drop the packet  if an open port is  at the
receiving end. A returned RST  flag will reflect a  closed, NON-LISTENING port
again this is an inverse mapped scan, so false positives is all a client has  to
detect an open/closed port.


   client -> XMAS (all flags)
   server -> -


This signature tells us that the port  is in LISTENING state, or the packet  was
filtered by  a firewall/router.  Alternatively a  closed port  will produce  the
following reply:

   client -> XMAS (all flags)
   server -> RST


The RST would be sent to the client because the server is tricked into  thinking
that the  client has  a connection  on that  port without  negotiating with  the
standard three-way handshake. Since TCP is stateful the kernel sends a reset bit
(RST) back to the client to end transmission immediately.

Advantages   : avoids IDS, avoid TCP three-way handshake
Disadvantages: UNIX only, false positives[/quote]


1.4.6 - TCP Fragmenting

[quote]TCP fragmenting is not a scan method  so to speak, although it employs a  method
to obscure  scanning implementations  by splitting  the TCP  header into smaller
fragments. IP reassembly on the server-side can often lead to unpredictable  and
abnormal results (IP  headers carrying data  can be fragmented).  Many hosts are
unable to  parse and  reassemble the  tiny packets  and thus  may cause crashes,
reboots,  or even  network device  monitoring dumps.  Alternatively, these  tiny
packets may be potentially blocked by  IP fragmentation queues in the kernel  or
caught by a stately firewall ruleset.

Since many intrusion detection systems use signature-based mechanisms to signify
scanning attempts based on IP and/or the TCP header, fragmentation is often able
to defeat this type  of packet filtering and  detection, and naturally the  scan
will go undiscovered.

A  minimally allowable  fragmented TCP  header must  contain a  destination and
source port for the first packet  (8 octect, 64 bit), typically the  initialized
flags  in the  next, allowing  the remote  host to  reassemble the  packet upon
arrival. The actual reassembly is established through an IPM (internet  protocol
module) that identifies  the fragmented packets  by the field  equivalent values
of:

* source
* destination
* protocol
* identification

Advantages   : avoids IDS, stealth
Disadvantages: may cause network problems on remote host[/quote]


1.5 Miscellaneous

[quote]This category  represents scans  that can  not be  entirely classified  into the
broader open/half-open/stealth classes. The scans here are dissimilar in  nature
but are techniques still used in the wild today.[/quote]

1.5.1 - UDP ICMP_PORT_UNREACHABLE scanning

[quote]Unlike the above scanning methods, the  User Datagram Protocol (UDP) is used  to
determining open/closed ports on a remote host rather than TCP.

UDP is  a connectionless datagram protocol that sends  datagrams as  a means  of
packet transmission.  Similarly to  the inverse  mapping system,  sending a  UDP
packet to an open port will receive no response from a server. However, a closed
port will respond with an Internet Control Message Protocol (ICMP) error  reply.
Using a process of extrapolation it  is simple to identify the open  from closed
ports. The message type, ICMP_PORT_UNREACH (type 3 code 3), does not technically
need to be sent when a closed  port received a UDP packet, hence the  difficulty
with  this scanning  method. Additionally,  UDP is  known to  be an  unreliable
protocol  since   packets  are   easily  dropped   during  transmission,   hence
retransmission needs  to take  place, otherwise  even more  false positives  are
assumed  in the  scan result.  Linux kernels  limit ICMP  error message  rates,
destination unreachable are set to 80  per 4 seconds with 1/4 second  penalty if
that is exceeded, adding to the scanning technicality, as Fyodor pointed out.

An open port signature should send no reply, also a retransmitted packet is sent
to reduce false positives:


   client -> udp packet
   server -> -
   client -> udp packet
   server -> -


Closed ports will response with the ICMP error.


   client -> udp packet
   server -> ICMP (ICMP_PORT_UNREACH)


Advantages   : scans non-TCP ports, avoids TCP IDS
Disadvantages: requires root, packets easily dropped, easily detected[/quote]


1.5.2 FTP server bounce attack

[quote]This ingenious method  was described in  a paper by  the hobbit. Using,  the FTP
PORT command  to set  a clients  passive mode,  a host  is able to determine the
status of a port  by issuing an IP  and port as arbitrary  parameters to connect
to. If a connection is established as a means of active data transfer processing
(DTP), the client knows a  port is open, with a  150 and 226 response issued  by
the server. If the transfer fails a  425 error will be generated with a  refused
build data message.

Early versions of WU-FTPD (less than 16) were vulnerable to this type of attack,
nowadays  the  presence of  this  bug has  been  patched in  most  FTPD's. Other
vulnerable versions include:

Sun FTP server in SunOS 4.1.x/5.x,  SCO OpenServer 5.0.4, SCO UnixWare 2.1,  AIX
3.2/4.2/4.2./4.3, Caldera 1.2, RedHat 4.X, Slackware 3.1 - 3.3.

An easy way to disallow this kind of attack is to prevent third party  transfers
through modification  of the  PORT command  and/or disallowing  specification of
reserved ports, except port 20 the standard default data port.

Advantages   : bypass firewalls, allows access to local nets, hard to trace
Disadvantages: slow, most FTPD's have been patched[/quote]


1.6 Blocking packet anomalies

[quote]Isolating and  filtering the  packets used  in all  the above  scans is one step
forward into securing any inter-network  connected node. Any application of  the
following rulesets will yield many port scanning techniques with false  positive
information, highlighting the well known "security through obscurity" objective.

* block unassigned port traffic  (traffic to ports with unassigned services)
* application-layer monitoring
* deny pass-through traffic
* monitor transport-layer connections (control of TCP, SYN, RST, ACK)
* monitor source address matching well known addresses
* filter ICMP type 3 and 8
* active network monitoring


Many audible scanning techniques exist to gather information about the  services
that  exist on  a host.  However, none  of these  techniques will  evade a  well
configured proxy along with an active systems analyst to spot potential  traffic
abnormalities.[/quote]


[quote]References

Art of portscanning by Fyodor   - http://www.insecure.org/nmap/nmap_doc.html
Networking Scanning by Ofir Afkin - http://www.sys-security.com
FTP bounce attack by hobbit   -  http://www.insecure.org/nmap/hobbit.ftpbounce.txt

http://seclists.org/
-----------------------------------------------------------------------------------------
©opyright 2001 by dethy@synnergy.net         Synnergy Networks[/quote]

########################################################
Moore
###########################################################
###########################################################

Scan Detection Examples:

###########################################################
###########################################################

Robert Hew
http://www.giac.org/practical/Robert_Hew.txt
All addresses have been changed to bogus addresses.

QUOTE
1) Here is a slow host sweep for the telnet port.  The scan program used random destination
address in addition to being a slow sweep to hide it from an intrusion detection system.
The hacker was probably looking for a Unix box or network box (router/switch) to try brute
force login attempts.

Jan 10 10:01:03 10.10.10.1:2532 -> 192.168.1.5:23 SYN **S*****
Jan 10 10:05:04 10.10.10.1:2573 -> 192.168.1.100:23 SYN **S*****
Jan 10 10:12:08 10.10.10.1:2640 -> 192.168.1.25:23 SYN **S*****
Jan 10 10:32:08 10.10.10.1:2681 -> 192.168.1.220:23 SYN **S*****
Jan 10 10:41:10 10.10.10.1:2801 -> 192.168.1.17:23 SYN **S*****
Jan 10 11:23:13 10.10.10.1:2950 -> 192.168.1.21:23 SYN **S*****
Jan 10 11:43:04 10.10.10.1:3051 -> 192.168.1.140:23 SYN **S*****
Jan 10 11:52:18 10.10.10.1:3162 -> 192.168.1.111:23 SYN **S*****
Jan 10 12:04:18 10.10.10.1:3263 -> 192.168.1.74:23 SYN **S*****
Jan 10 12:09:20 10.10.10.1:3566 -> 192.168.1.55:23 SYN **S*****
Jan 10 12:38:05 10.10.10.1:4080 -> 192.168.1.252:23 SYN **S*****

-----------------------------------------------------------------------

2) Here's a high udp scan.  This looks like a crafted packet since the port number of the source
is the same.  The scan could have been looking for a listening high port for a trojan horse
application.

Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24118 UDP
Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24119 UDP
Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24120 UDP
Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24121 UDP
Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24122 UDP
Sep 15 12:06:19 10.10.10.1:14962 -> 192.168.1.22:24123 UDP
Sep 15 12:06:20 10.10.10.1:14962 -> 192.168.1.22:24124 UDP
Sep 15 12:06:20 10.10.10.1:14962 -> 192.168.1.22:24125 UDP
Sep 15 12:06:20 10.10.10.1:14962 -> 192.168.1.22:24126 UDP
Sep 15 12:06:20 10.10.10.1:14962 -> 192.168.1.22:24127 UDP


-----------------------------------------------------------------------

3) Here an attacker spoofs the 10.10.10.1 network and tries to echo packets from the character
generator port of several machines.  The attacker either guesses that the x.x.x.1 address is
the routers addresses or has already done some surveillance to determine this information.

Aug 3 04:28:17 10.10.10.1:7 -> 192.168.1.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.2.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.3.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.4.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.5.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.6.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.7.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.8.1:19 UDP
Aug 3 04:28:17 10.10.10.1:7 -> 192.168.9.1:19 UDP


-----------------------------------------------------------------------

4) Here's a Land attack that was scripted to go down a class C network.  You can tell that they
were scripted by the fast speed in which the packets were sent out.

Jan 7 10:01:03 192.168.1.1:139 -> 192.168.1.1:23 SYN **S*****
Jan 7 10:01:03 192.168.1.2:139 -> 192.168.1.2:23 SYN **S*****
Jan 7 10:01:03 192.168.1.3:139 -> 192.168.1.3:23 SYN **S*****

-----------------------------------------------------------------------

5) Here's a scripted surveillance scan for Cisco devices.  They're using port 1999 the
identification port where they can sniff the packets coming back and look into the data portion
for Cisco. 

Aug 13 15:21:38 10.10.10.1:2344 -> 192.168.1.1:1999 SYN **S*****
Aug 13 15:21:38 10.10.10.1:2344 -> 192.168.1.2:1999 SYN **S*****
Aug 13 15:21:38 10.10.10.1:2344 -> 192.168.1.3:1999 SYN **S*****
Aug 13 15:21:38 10.10.10.1:2344 -> 192.168.1.4:1999 SYN **S*****
Aug 13 15:21:39 10.10.10.1:2344 -> 192.168.1.5:1999 SYN **S*****
Aug 13 15:21:39 10.10.10.1:2344 -> 192.168.1.6:1999 SYN **S*****

----------------------------------------------------------------------

6) Here's someone looking for the default Back Orifice port 31337 UDP. 
Either they have planted the trojan horse on this machine or they are scanning this machine
for the program.

Dec 23 05:00:07 10.10.10.1:2732 -> 192.168.1.1:31337 UDP

----------------------------------------------------------------------

7) Here's a single anamolous packet.  The SYN and FIN bits were both set.  This could have been
a crafted packet to try to confuse a tcp/ip stack resulting in a DOS attack.  They might have
been targeting a particular machine that they have already discovered since this was the only
packet to come in at like this. 

10.10.10.1:2145 > 192.168.1.1:3242: SF 3832587:3832587(0) win 512

----------------------------------------------------------------------

8) Here's an icmp request that fragmented the packet.  The problem with this one is the offset of
the second packet overlaps the second one.

10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10947:1024@0+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10947:1024@128)

-----------------------------------------------------------------------

9) Here's a Microsoft scan for port 137,138,and 139.  This has to be a scripted program because
of the speed of the scan.  In addition to just looking for a microsoft device the hacker is also
looking for particular ports that are open.

Dec 27 03:12:52 10.10.10.1:8362 -> 192.168.1.1:137 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.1:138 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.1:139 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.2:137 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.2:138 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.2:139 SYN **S*****
Dec 27 03:12:53 10.10.10.1:8362 -> 192.168.1.3:137 SYN **S*****
Dec 27 03:12:54 10.10.10.1:8362 -> 192.168.1.3:138 SYN **S*****
Dec 27 03:12:54 10.10.10.1:8362 -> 192.168.1.3:139 SYN **S*****

-----------------------------------------------------------------------

10)Here's a fragment attack.  Fragment packets kept coming in but no final fragment packet
arrives. The hacker is trying to overload the machine with outstanding fragment packets.  This
will eat up the memory of the machine as it waits for the transaction to timeout.

10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10947:1024@0+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10947:1024@1024+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10948:372@2309+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10949:64@2743+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10962:312@3475+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10982:128@841+)
10.10.10.1 > 192.168.1.1 icmp: echo request (frag 10991:450@582+)





#####################################################################

Analysis Techniques for Detecting Coordinated Attacks and Probes

#####################################################################

for reference / educational purposes

John Green
Naval Surface Warfare Center
David Marchette
Naval Surface Warfare Center
Stephen Northcutt
Ballistic Missile Defense Organization
Bill Ralph
ATR Corporation

Abstract

Coordinated attacks and probes have been observed against several networks that we protect. We describe some of these attacks and provide insight into how and why they are carried out. We also suggest hypotheses for some of the more puzzling probes. Methods for detecting these coordinated attacks are provided.

1. Introduction

QUOTE
For approximately the last year, SHADOW analysts have been detecting a new class of network traffic. Although the probes and attacks embedded within this traffic consist mostly of known exploits, subsequent analysis reveals that multiple IP addresses are working together toward a common goal. Therefore, we have coined the phrase "coordinated attacks" to describe the activity that has been observed.

Indications of these concerted efforts appear in network traffic logs as multiple external IP addresses targeting a single address of the protected network. Similarly, a coordinated attack can also look as though multiple attackers are working together to execute a distributed scan on many internal addresses or services. It is believed that probes of this nature have been developed in an attempt to elude the scan detection code present in many intrusion detection systems.

In most of the cases observed, the number of cooperating IP addresses is rather small; four or five is common. However, as many as fifteen different coactive, scanning hosts have been uncovered by SHADOW analysts. Due to their distributed nature, these attacks were well below the threshold for a structured attack in terms of targeting, lethality and scope.

"We distinguish two fundamental types of threat. The unstructured threat is random and relatively limited. It consists of adversaries with limited funds and organization and short-term goals. While it poses a threat to system operations, national security is not targeted. This is the most obvious threat today. The structured threat is considerably more methodical and well-supported. While the unstructured threat is the most obvious threat today, for national security purposes we are concerned primarily with the structured threat, since that poses the most significant risk."
Air Force Lt. Gen. Kenneth A Minihan, director of the National Security Agency - brief to the Senate Government Affairs Committee, June 24 1998.



What is a structured attack? Interviews with premier intrusion detection researchers revealed that they consider structured attacks to be on the order of thousands of related exploits, probes, viruses, scans, denials of service, and ruses over a short period of time. Even though this definition doesn’t accurately describe the patterns discussed earlier, we cannot call this activity unstructured. It definitely has structure!

This paper will examine various coordinated attacks and probes, including coordinated traceroutes, NetBIOS scans, Reset scans, SFRP scans and coordinated DNS server exploit attempts. Some of these probes are certainly the work of multiple computers working together; others appear to be fraudulent or decoy mechanisms.


2. Coordinated traceroutes

Coordinated traceroutes serve as a reminder that sites are always vulnerable, even if their firewalls are impenetrable. Information gleaned from this technique can be used to direct a denial of service attack against a site’s external connectivity, effectively isolating the facility. Detection of coordinated traceroutes is simple; look for about five traceroutes within two seconds of one another, often with similar names.

Figure 1 shows an example of this activity. Here, five different sources, each from a different backbone network, are shown probing the same target. Most often, the target is a DNS server, or DNS serving firewall, and packet arrival is usually within tenths or hundredths of seconds of each other.


12:29:30.01 proberA.39964 > target.33500: udp 12 [ttl 1]
12:29:30.13 proberA.39964 > target.33501: udp 12 [ttl 1]
12:29:30.25 proberA.39964 > target.33502: udp 12 [ttl 1]
12:29:30.35 proberA.39964 > target.33503: udp 12 [ttl 1]


12:27:55.10 proberB.46164 > target.33485: udp 12 [ttl 1]
12:27:55.12 proberB.46164 > target.33487: udp 12 [ttl 1]
12:27:55.16 proberB.46164 > target.33488: udp 12 [ttl 1]
12:27:55.18 proberB.46164 > target.33489: udp 12 [ttl 1]


12:27:26.13 proberC.43327 > target.33491: udp 12 [ttl 1]
12:27:26.24 proberC.43327 > target.33492: udp 12 [ttl 1]
12:27:26.37 proberC.43327 > target.33493: udp 12 [ttl 1]
12:27:26.48 proberC.43327 > target.33494: udp 12 [ttl 1]


12:27:32.96 proberD.55528 > target.33485: udp 12 [ttl 1]
12:27:33.07 proberD.55528 > target.33486: udp 12 [ttl 1]
12:27:33.17 proberD.55528 > target.33487: udp 12 [ttl 1]
12:27:33.29 proberD.55528 > target.33488: udp 12 [ttl 1]


12:27:30.55 proberE.21337 > target.33475: udp 12 [ttl 1]
12:27:30.56 proberE.21337 > target.33476: udp 12 [ttl 1]
12:27:30.58 proberE.21337 > target.33477: udp 12 [ttl 1]
12:27:30.59 proberE.21337 > target.33478: udp 12 [ttl 1]


Figure 1. Coordinated traceroute example.
 
Coordinated traceroutes do have a commercial use. Some Internet Service Providers (ISP) use them to calculate the best routes back to clients in an attempt to provide optimum web response. The stimulus for this type activity is a host from the protected network visiting a web server supported by an ISP that uses coordinated traceroutes.

As mentioned above, coordinated traceroutes can be a benign effort to improve the performance of a server. As such they can be viewed as providing a useful service. However, they can also be used to determine all the routes into your protected network. Thus it should be of interest to determine who is performing these traceroutes and why.
 

3. NetBIOS deception

One of the first things that a network analyst learns is that network traffic is not always what it appears to be. Source address spoofing is a classic example of this. Many commonly available exploit tools include this capability. In fact, the latest version of nmap takes spoofing a step further; it includes a decoy option. This option allows the hacker to make an attack appear as though it is coming from multiple sources. Even if an analyst at the targeted site detects the attack, it is very difficult to determine which of the IP addresses were spoofed, and which one was real.


The trace in figure 2 is from a site that receives very few NetBIOS session connection attempts. The traffic shown was detected over a single twenty-four hour period. These source addresses correlate with NetBIOS session connection attempts seen at other sites over several days. The signature of this massive scan is: four connect attempts for each address, the do not fragment option is set, a window size of 8192, and the TTL fields cluster. Perhaps the most interesting signature of this coordinated activity is that the traffic is destined only for IP addresses that are not populated by hosts. The first two traces show all four attempts, the rest have been edited for space.

The source addresses spanned several countries, but certainly could have been spoofed. The scan rate is slow enough that the entire probe could have been generated from a single computer. The fact that the Time To Live (TTL) field is within three hops for all packets is also interesting and points to a single computer. Different operating systems have different TTL defaults. The probes were sent to hosts that do not exist, therefore the TCP three-way handshake was never completed. That would be evidence this was actually a probe. Could this be a hoax?

If this is a hoax, what is the purpose? One possibility is that fake attacks may create fear, uncertainty, and doubt in the same vein as virus hoaxes. Another possibility is an "attacker honey pot". Even a mediocre fake attack will tie up analyst and CIRT resources, and possibly serve as a distraction so that a much lower signal precision attack can get through undetected.

Another hypothesis is that the attacker is only interested in "brand new" systems that are brought online. Since most security patches are available from vendor websites, many administrators bring up vulnerable systems with the intent of downloading and installing the patches at a later date. This process may take several days, leaving new systems and the networks that they reside on vulnerable to attack.

The fact that only non-existent systems are targeted makes these probes particularly puzzling. It also makes them worthy of concern, since it implies that the attackers have a precise map of the protected network.


Trace 1:
 

00:56:22.78 proberD.3506 > 172.20.124.23.139: S 14300153:14300153(0) win 8192 (DF)
00:56:25.69 proberD.3506 > 172.20.124.23.139: S 14300153:14300153(0) win 8192 (DF)
00:56:31.70 proberD.3506 > 172.20.124.23.139: S 14300153:14300153(0) win 8192 (DF)
00:56:43.69 proberD.3506 > 172.20.124.23.139: S 14300153:14300153(0) win 8192 (DF)


Trace 2:


06:49:55.47 proberA.4197 > 172.20.139.137.139: S 596843772:596843772(0) win 8192 (DF)
06:49:58.44 proberA.4197 > 172.20.139.137.139: S 596843772:596843772(0) win 8192 (DF)
06:50:04.44 proberA.4197 > 172.20.139.137.139: S 596843772:596843772(0) win 8192 (DF)
06:50:16.43 proberA.4197 > 172.20.139.137.139: S 596843772:596843772(0) win 8192 (DF)
 
 

Additional traces, only the first packet is shown:


12:57:56.94 proberE.2038 > 172.20.216.29.139: S 294167370:294167370(0) win 8192 (DF)
13:37:51.75 proberI.4186 > 172.20.215.205.139: S 22881687:22881687(0) win 8192 (DF)
13:50:23.64 proberB.3293 > 172.20.53.123.139: S 355997160:355997160(0) win 8192 (DF)
14:11:01.95 proberC.3491 > 172.20.245.182.139: S 57370977:57370977(0) win 8192 (DF)
15:41:59.50 proberG.3278 > 172.20.252.141.139: S 266305199:266305199(0) win 8192 (DF)
22:49:15.39 proberH.3658 > 172.20.124.23.139: S 14035939:14035939(0) win 8192 (DF)


Figure 2. Netbios deception example.
4. Reset scans

If you examine the Internet traffic to your site, there is a very good chance you will find a large number of inbound Resets and SYN/ACKs for which there is no corresponding SYN packet. Generally, these scans originate from a multitude of source addresses and often appear to be coordinated due to their concurrency. Several questions come to mind: "What is going on?" and furthermore, "What are some of the events that cause Reset generation?" Section 4 will explore some of the events that can generate Reset scans, the motivations for Reset scanning, and will also discuss the methods that SHADOW uses to detect them.
 

4.1. Natural function of TCP/IP

Resets are a normal part of TCP/IP communications. If something goes wrong with a TCP connection, a reset may be generated. Typically, in this case only one would be observed between the server and client. If a connection is attempted to a service that does not exist, a reset may be generated. A single SYN attempt/Reset response from a mscan probe is shown in figure 3. Note that the acknowledgement number is the sequence number incremented by one.


13:13:10.670000 www.1880 > mailrelay.6000: S 1393635005:1393635005(0) win 512
13:13:10.680000 mailrelay.6000 > www.1880: R 0:0(0) ack 1393635006 win 0


Figure 3. SYN attempt/Reset response example.

Client systems generally attempt to establish connections multiple times. Four SYN "active open" attempts to the same destination address and source port is commonly seen for most services. Electronic mail and web (TCP port 25 and TCP port 80) active opens often try larger numbers of attempts ranging from twelve to twenty five.

From an intrusion detection standpoint, we generally expect to see outbound Resets as a result of activity caused by inbound traffic. Examining the trace in figure 3, we see that the inbound traffic from www to Mailrelay attempts to initiate an X Windows connection. Mailrelay wants no part of this; so an outbound and Reset to www is generated.

If we detect inbound Resets we expect that these were caused by outbound connections from our systems. In the next two possible causes for the generation of Resets, we will look at situations where we observe a medium to large number of Resets, (or SYN/ACKS) inbound. In these cases, there is no corresponding SYN packet.
 
 

4.2. Second order effect

The inbound Resets (or Syn/Acks) could also be explained as a "second order effect" of a denial of service attack, or scan on another site. For this to be a second order effect, we must not have initiated the connections with SYN packets and our IP addresses are used (spoofed) to attack someone else. This last case is a dominant factor in the generation of large numbers of inexplicable Resets. IRC servers seem to be the primary targets in a large number of these cases. 

A wide variety of Internet addresses have been used for this sport; we have received traces of excessive Resets from all over the globe. Figure 4 illustrates example traffic at two sensor locations: SITE_A and SITE_B. It shows the activity that each site detected on the same day. The time stamps indicate concurrent activity from Irc_victim to multiple destination hosts. This denial of service attack generates Resets from Irc_victim, since the attack was to Irc_victim’s inactive ports.


Excerpts from SITE_A tcpdump at ~02:00:

02:13:23.55 Irc_victim.37762 > 192.168.129.191.18602: R 0:0(0) ack 1940197743 win 0
02:14:00.07 Irc_victim.25013 > 192.168.251.67.26831: R 0:0(0) ack 397924438 win 0
02:14:20.68 Irc_victim.32824 > 192.168.123.30.17807: R 0:0(0) ack 1747849368 win 0
 

Excerpts from SITE_B tcpdump at ~02:00:
 

02:13:21.54 Irc_victim.4723 > 172.20.96.61.7790: R 0:0(0) ack 172384509 win 0
02:14:09.39 Irc_victim.45991 > 172.20.72.145.18363: R 0:0(0) ack 578682865 win 0
02:14:12.35 Irc_victim.58839 > 172.20.46.51.51347: R 0:0(0) ack 1901339874 win 0


Figure 4. Expected behavior for inactive ports.

In contrast, figure 5 depicts the network traffic pattern for active ports. Note the change in the 12:00 hour activity to the active port 6667 with the expected SYN/ACK response from Irc_victim, followed by the RST/ACK segment indicating an aborted connection.


For the truly paranoid, we offer an alternate interpretation of the traces shown in figure 5. A "man in the middle" scan could create this signature. In this case, the attackers must compromise our site, or a node on the route to our site. They must place a sniffer that is tuned to collect Resets and Syn/Acks on a compromised site. They then port scan the target from another location spoofing our address space. The sensor located on the compromised host collects the results and sends them to the attacker. This is unlikely to be the case in attacks against multiple sites.

It is important to point out that this kind of secondary effect will appear as a coordinated attack against the protected network if the attacker targets multiple hosts or networks, and always spoofs our IP addresses in the attack.
 

Sample trace from SITE_A at ~12:00:

12:47:03.65 Irc_victim.6667 > 192.168.140.187.10496: S 157348803:157348803(0) ack 687865857 win 16384 <mss 1460> (DF)
12:47:03.87 Irc_victim.6667 > 192.168.140.187.10496: R 1:1(0) ack 1 win 16384 (DF)
12:48:38.57 Irc_victim.6667 > 192.168.246.165.33026: S 2670541452:2670541452(0) ack 2164391937 win 16384 <mss 1460> (DF)
12:48:39.07 Irc_victim.6667 > 192.168.246.165.33026: R 1:1(0) ack 1 win 16384 (DF)


Sample trace from SITE_B at ~12:00:


12:47:07.43 Irc_victim.irc > 172.20.246.181.36126: S 1105399373:1105399373(0) ack 2367553537 win 16384 (DF)
12:47:07.56 Irc_victim.irc > 172.20.246.181.36126: R 1:1(0) ack 1 win 16384 (DF)
12:47:20.35 Irc_victim.irc > 172.20.64.221.18178: S 1443077754:1443077754(0) ack 1191313409 win 16384 (DF)


12:47:20.35 Irc_victim.irc > 172.20.64.221.18178: R 1:1(0) ack 1 win 16384 (DF)


Figure 5. Expected behavior for active ports.

4.3. Resets for intelligence gathering

Reset scanning works like any other inverse mapping method. This is because the routers are thinking IP, not TCP and the IP address is in the IP layer. When destination IPs or ports are inactive, the routers simply want to be helpful and return an address unreachable message. There are a variety of techniques (including Reset scanning) to locate the hosts, nets, and active service ports that do not exist. The attacker simply has to take the converse of the map to get a first order understanding of what does exist.

Figure 6 is an example from the point of view of the Reset scanner. They know the address of the system(s) they have scanned, so they wait for icmp error messages from the destination network’s router. The results of interest could look like net (or host) unreachable or time exceeded.


20:38:11.783596 router > 192.168.32.192: icmp: time exceeded in-transit [tos 0xc0]
20:38:55.597130 router > 192.168.31.15: icmp: time exceeded in-transit [tos 0xc0]
20:41:41.824191 router > 192.168.52.99: icmp: time exceeded in-transit [tos 0xc0]
20:43:50.750498 router > 192.168.52.99: icmp: time exceeded in-transit [tos 0xc0]
20:44:01.280339 router > 192.168.61.209: icmp: time exceeded in-transit [tos 0xc0]
20:44:27.790505 router > 192.168.59.164: icmp: time exceeded in-transit [tos 0xc0]


Figure 6. Results from a reset scan.

In the early days of this technique, Reset scans were easy to detect due to common "signature acknowledgement numbers"; the TCP header ACK field was always a fixed number, usually 674719802 or 674711610. Figure 7 shows a Reset probe from two attackers that can trivially be detected due to the signature Ack number.
 
 

17:40:45.87 hook.24408 > target1.1457: R 0:0(0) ack 674719802 win 0
17:40:53.03 hook.33174 > target2.1457: R 0:0(0) ack 674719802 win 0
17:41:12.16 hook.36250 > target3.1979: R 0:0(0) ack 674719802 win 0
17:43:37.61 router > hook: icmp: time exceeded in-transit
17:43:43.14 hook.44922 > target4.1496: R 0:0(0) ack 674719802 win 0
17:42:30.40 grin.3532 > target1a.1167: R 0:0(0) ack 674719802 win 0
17:42:40.58 grin.33233 > target2a.1797: R 0:0(0) ack 674719802 win 0
17:44:28.84 grin.52504 > target3a.1634: R 0:0(0) ack 674719802 win 0
17:47:52.58 grin.46657 > target4a.2121: R 0:0(0) ack 674719802 win 0
17:47:52.70 router > grin: icmp: time exceeded in-transit


Figure 7. Example of "signature acknowledgement numbers".


Unfortunately, some of the more recent probes have random acknowledgement numbers. Probes of this type have been observed from at least fourteen different cooperating Internet addresses, primarily ISPs, all within a twenty-four hour period. And of course, how do you sort between the scans and second order effects?

Many people want to label all Resets as a second order effect and just not deal with it. This is foolish; when there is this much smoke, find the fire. These probing systems are working together to map multiple target sites. Reset traces from all over the world provide strong evidence that this activity is a long-term, Internet wide effort. The scan rate from some attacks is as low as 2 packets per day per target site, well below commonly set thresholds for scan detectors.

This begs the question: "Without a signature Ack how can we detect Reset scans?" In this case, the primary signature is the Reset code bit set with no other activity from that source, (such as an active open [SYN] from the source or the target). An obvious solution is to keep track of the state of each TCP connection and alarm: if a Reset, Syn/Ack, or Fin is detected without the active open. However, this solution can be compute intensive for large networks. The answer lies in less expensive mechanisms; namely scan detectors.

Inverse mapping is best detected over a longer time window, such as an hour, or even a day. In this case, we can test for an external host making connections to n internal hosts where n is a small value, (Shadow systems default to 7, but this is configurable). This technique will detect any scan that meets or exceeds the tally trigger over the time window. Figure 8 shows how SHADOW displays detected scans.


Hourly Tally Counter


8 192.168.2.1 hook
7 172.20.20.20 grin
7 10.32.21.12 false_positive.net


Figure 8. SHADOW scan detection output.


The advantage of such a technique is that it will detect any scan, so it will detect scans for which there is no signature. The disadvantages of this approach are threefold: scans below the tally trigger point will be missed, the scan detector has no provision for a focusing filter, collecting low and slow probes on an hourly basis is a manual technique and therefore prone to error.

Some attackers are patient enough to scan at rates as low as two packets per day; in these cases an hour clearly is not a reasonable time window. Figure 9 illustrates example output from a 24 hour scan detection tool called look4scans.pl. This tool was part of the version 1.5 Shadow software release.


10.9.8.7 : Reset.host.net
10.9.8.7 > 192.168.103.90 : R
10.9.8.7 > 192.168.114.15 : R
10.9.8.7 > 192.168.122.80 : R
10.9.8.7 > 192.168.137.149 : R
10.9.8.7 > 192.168.157.224 : R
10.9.8.7 > 192.168.164.44 : R
10.9.8.7 > 192.168.174.161 : R
10.9.8.7 > 192.168.201.148 : R
10.9.8.7 > 192.168.202.85 : R
10.9.8.7 > 192.168.204.79 : R
10.9.8.7 > 192.168.213.156 : R
10.9.8.7 > 192.168.29.38 : R
10.9.8.7 > 192.168.41.157 : R
10.9.8.7 > 192.168.43.145 : R
10.9.8.7 > 192.168.45.174 : R
10.9.8.7 > 192.168.85.28 : R
10.9.8.7 > 172.20.107.109 : R
10.9.8.7 > 172.20.113.214 : R
10.9.8.7 > 172.20.115.6 : R
10.9.8.7 > 172.20.13.168 : R
10.9.8.7 > 172.20.140.69 : R
10.9.8.7 > 172.20.145.25 : R
10.9.8.7 > 172.20.191.30 : R
10.9.8.7 > 172.20.205.137 : R
10.9.8.7 > 172.20.207.56 : R
10.9.8.7 > 172.20.224.98 : R
10.9.8.7 > 172.20.23.185 : R
10.9.8.7 > 172.20.31.98 : R
10.9.8.7 > 172.20.41.248 : R
10.9.8.7 > 172.20.42.114 : R
10.9.8.7 > 172.20.62.140 : R
10.9.8.7 > 172.20.71.217 : R
10.9.8.7 > 172.20.84.178 : R


Figure 9. Example ‘look4scans.pl’ output.

Slow coordinated attacks are particularly difficult to detect using these methods. If the attackers can guess your detection threshold they can ensure that no single IP address sends enough packets to trip that threshold. Unless the attackers are foolish enough to include some other signature in the scan, these will be particularly difficult to detect.


4.4. Resets as an indicator of TCP session hijacking
 

The nmap scanning tool released December 1998 has a sequence number evaluator as part of its most basic functionality, so hijack will be with us for a while yet! The idea is to find an active connection, and predict the sequence numbers on both sides of the connection. Hit the side you don’t want to penetrate with a Reset to break off the connection from their point of view. Assume the connection and attack the other side. The signature for this attack is the correct sequence number and wrong IP address.


4.5. ISS RealSecure kill


We have seen this only twice. If an ISS RealSecure thinks the site it is protecting is under attack, it may generate a connection Reset. In this case, the packet contains the ID Number of the RealSecure engine.
 

4.6. Deception


As stated earlier, several freely available scanners can generate Resets with spoofed addresses simply as a smokescreen. They accomplish no purpose except possibly to consume analyst and CIRT resources.


How big of a problem is this? There are a few areas of concern:


1. If some portion of the inexplicable Resets is related to mapping attempts, then external actors are gaining intelligence about the networks that we are supposed to defend. In this case, the solution is to implement a firewall that can drop these packets.

2. Though we aren’t particularly bothered by the second order effect problem, it is bad from a public perception standpoint if it is widely thought that our sites are attacking other sites, since our address space is being used.
 

5. SFRP scans
 

In the previous scan examples, the attackers came to us. This is not always the case. Scanning can happen when we visit the attacker. In this case, malformed packets with SYN, Reset, FIN and Urgent are detected coming from web servers to the browsing client. The most common pattern is one SFRP (SYN/FIN/Reset/PUSH) packet sent to each browsing client per session. Sometimes SRP’s are also sent, Figure 10 illustrates the pattern.


10:47:36.61 media.com.2048 > target.48579: SFR 2842082:2842590(508) ack 2642669109 win 768 urg 2571 (DF)
11:23:42.97 media.com.2048 > target.47720: SFP 4820865:4821409(544) win 3840 urg 2571 (DF)
13:49:44.33 gm.com.49608 > target.49606: SFP 7051:7607(556) ack 2147789506 win 7768 (DF)
13:49:44.72 gm.com.22450 > target.1591: SFRP 2038:2074(36) ack 116065792 win 0 urg 0 (DF)


Figure 10. TCP stack analysis.

Figure 11 shows related activity that is not from the original site but is within the same general timeframe. The stimulus here is the client visiting the web server. These are examples of what comes back. Each client gets at least one packet and as many as four, (with different combinations), during a visit to a web server.
 
 

12:18:46.25 im.com.5500 > target.1137: SFP 3241821:3242365(544) win 13234 urg 55134 (DF)
13:37:30.33 im.com.22555 > target.22555: SF 8440982:8441538(556) win 10240 (DF)
14:52:57.45 scannernet.30975 > target.16940: SFRP 2029994540:2029995068(528) ack 2029994540 win 16940 urg 16940 <[bad opt]> (DF)
14:53:01.63 scannernet.30975 > target.556: SFRP 2029978156:2029978684(528) ack 2029978156 win 556 urg 556 <[bad opt]> (DF)


Figure 11. Cooperative tcp stack analysis example.

We have a pattern we have never seen before and it occurs during transactions with multiple web servers from multiple domains. During the height of this technique, in October 1998, over twenty web-servers from a very large ISP were exhibiting this behavior.

After tracking this for several weeks, we were still leaning toward considering this benign, perhaps some error in the web-server code. However, two weeks later, probes were observed from the same address family that did not have any stimulus (no one visited a web page). These non-stimulus caused probes were targeting DNS and mail servers. At this point, the activity was considered hostile. Since multiple web-servers were performing these probes in concert, this was also considered a coordinated attack.
 

6. Target based analysis


Until now, every example has shown multiple attackers, multiple targets, and we have focused on the activity of the inbound packets and the analysis of that activity. Now let’s consider a different analysis technique: examining the targets. One of the factors that helped us understand the fact that Reset scanners were working together was that they did not duplicate targets; each system probed was unique. Furthermore, many of the attackers would scan three hosts from one site and twelve from a second and this pattern would continue day after day.

Infrastructure systems such as DNS and email servers are a good starting place for target analysis. In a given week, a large number of the total attacks are usually against these types of systems. In figure 12, the traces show attacks that come from vastly different IP addresses. These IP addresses originate from Australia, Asia and the USA, but all include the same targets, and occurred over a single weekend. "Whoops" isn’t really a name server or email server, though it was erroneously listed as one in a DNS table.

Also, please note that SourceA and SourceB have different IP address numbers. Since this is TCP, the exploit cannot work if they spoof the source address. One of the probe sets could be a decoy; it could be a multi-homed host, or it could be two systems working together. Please note the packet arrival times to see how related the first two scans appear to be and also the static source port. The third trace has a significant difference from the first two; the source port pattern indicates two processes. In the following example, we would assume that the first two traces are related and the third trace is a different actor.

One of the themes of this story is that the events of interest we classify as coordinated attacks are often detects that we had never seen before. Suddenly, we see it from (or to) multiple locations. To detect and classify a coordinated attack, it really helps to have a database of all traffic and techniques to complement your signatures. Without a database of traffic that covers a time window of at least a couple months, there is no way to determine whether this activity has been going on and simply hasn’t been detected, or if it is a new pattern. Recently, we tested a pattern that had been detected by an analyst at another site. We were sure we had never seen it before. Wrong! What really stung us was that one of the attackers had spun this attack off of source port 7 (echo), something a good analyst should never miss. Oh well.


If you can only detect and examine traffic that matches your signature set, then how can you detect a new, or novel attack?


06:10:56.53 SourceA.10053 > NS1.111: S 1935318310:1935318310(0) win 242
06:32:42.15 SourceA.10053 > NS2.111: S 552822870:552822870(0) win 242
06:54:27.32 SourceA.10053 > MAIL1.111: S 944974642:944974642(0) win 242
07:16:12.73 SourceA.10053 > MAIL2.111: S 3045099303:3045099303(0) win 242
07:37:58.16 SourceA.10053 > Whoops.111: S 323776127:323776127(0) win 242
 
06:12:33.28 SourceB.10053 > NS1.domain: S 992750649:992750649(0) win 242
06:34:18.66 SourceB.10053 > NS2.domain: S 3455530061:3455530061(0) win 242
06:56:04.046 SourceB.10053 > MAIL1.domain: S 1895963699:1895963699(0) win 242
07:17:49.44 SourceB.10053 > MAIL2.domain: S 2485794595:2485794595(0) win 242
07:39:34.811723 SourceB.10053 > Whoops.domain: S 3785701160:3785701160(0) win 242
 

08:01:20.23 SourceB.1025 > NS1.imap: S 1471781129:1471781129(0) win 512
08:23:05.64 SourceB.21053 > NS2.imap: S 4110489384:4110489384(0) win 512
08:24:50.96 SourceB.1026 > MAIL1.imap: S 1486592867:1486592867(0) win 512
08:23:05.64 SourceB.21055 > MAIL2.imap: S 1112489384:1112489384(0) win 512
08:44:50.96 SourceB.1028 > Whoops.imap: S 0486592777:0486592777(0) win 512
 

Figure 12. Target based analysis.
 
AttackerB.6667 -> 192.168.229.72.1437, 1 packet
AttackerB.6667 -> 192.168.229.72.1437, 2 packets
AttackerB.6667 -> 192.168.229.82.1437, 1 packet
AttackerB.6667 -> 192.168.229.82.1437, 2 packets
AttackerB.6667 -> 192.168.229.95.1437, 1 packet
AttackerB.6667 -> 192.168.229.95.1437, 2 packets
AttackerB.6667 -> 192.168.229.6.1437, 1 packet
AttackerB.6667 -> 192.168.229.6.1437, 1 packet
AttackerB.6667 -> 192.168.229.79.1437, 1 packet

AttackerB.6667 -> 192.168.229.79.1437, 2 packets
AttackerB.6667 -> 192.168.229.45.1437, 1 packet
AttackerB.6667 -> 192.168.229.45.1437, 2 packets

AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.122.1437, 1 packet
AttackerC.139 -> 192.168.229.122.1437, 1 packet
AttackerC.139 -> 192.168.229.122.1437, 1 packet
AttackerC.139 -> 192.168.229.122.1437, 1 packet
AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.28.1437, 1 packet
AttackerC.139 -> 192.168.229.75.1437, 1 packet
AttackerC.139 -> 192.168.229.75.1437, 1 packet
AttackerC.139 -> 192.168.229.75.1437, 1 packet


Figure 13.
 

Figure 13 shows the traffic from an event that took place over a four-day weekend. In this case, multiple addresses began to target a specific destination port. In the first trace, notice the one packet two packet pattern and the source port of 6667 (IRC). Attacker C has a different pattern or their IDS interprets it differently. For two months different IP addresses were probing this site on the same destination port. No other sites with which we share information have detected this activity.

7. Conclusions
 

The examples shown in this paper represent a change in the kinds of attacks and probes we track. Previously, it had been common for a single attacker to target multiple sites. Now we see indications of multiple attackers working together to target either single sites or multiple sites. We can use all of the analysis techniques we have learned to find differences or similarities in delivery mechanisms. These may help provide clues as to the number of discrete attackers involved, especially when we have data across a fairly large time window, such as a week or longer.

It should be noted that these techniques are starting to be widely used and the attacker community is building decoy techniques into commonly available tools. However, we are not aware of a widely available distributed scanner, or exploit delivery system. Additionally, these coordinated attacks display a significant amount of variability making them difficult to detect with signature-based algorithms.
 

There are three obvious purposes for coordinated attacks and probes: stealth, firepower, and intelligence gathering.


7.1. Stealth


By working from multiple IP addresses the attackers achieve a smaller per-IP signature and are more difficult to detect through conventional means. In addition, stealth is enhanced by the development of new hard-to-detect probing techniques such as Reset scans.


7.2. Firepower


By coordinating multiple attacking IP addresses, the attackers will be able to deliver more exploits to destination hosts in a smaller period of time. Furthermore, the defensive technique of blocking an attacker IP, also known as shunning, will be less effective. A single attacking entity can utilize multiple non-related Internet addresses for the attacks. This is especially true for denial of service attacks; most of these do not rely on a connection being made, so the probability of the address being spoofed is very high. Some of these coordinated probes and scans we detect today may be practice runs for future larger scale attacks. After a new exploit is discovered, there is often a limited "window of opportunity" for its use; usually until countermeasures are developed.


7.3. Intelligence gathering


As discussed in the coordinated traceroute example, by working from different IP addresses on different backbones against the same target, it is possible to obtain data that is impossible to obtain from a single source IP scan or probe. These data may include shortest route data, (i.e. packets from source A arrive faster than from source cool.gif, or even potential backdoors, (i.e. packets from source A can gain access to hosts that source B can’t see). This type of data can be used to optimize future scans, probes, or attacks. It could also be used to isolate a target site by attacking the links it uses to communicate with the outside world.

The SFRP example shows how a network of servers can simply wait for the customer to come to them. The progress in TCP stack analysis is very impressive and we wouldn’t be surprised to see this capability become integrated into commercial server software as one more method of gathering intelligence about the systems that visit the server.


8. Final words


Analysis of the network traffic collected by the SHADOW team indicates that new exploit delivery mechanisms are being developed and refined. These techniques employ multiple attackers and decoy hosts in an attempt to increase stealth, firepower, and reconnaissance.

Much of the network traffic discussed in this paper is definitely the result of coordinated attacks. However, a small portion can also be attributed to deception techniques and second order effects. Therefore, it is extremely important for the analyst to differentiate between the two possible causes of suspicious network traffic, and react accordingly. To this end, we have discussed the motivations for coordinating attacks, and also provided examples of each attack type. Methods for detecting this coordinated activity have been illustrated when possible.



QUOTE
Reference:

SHADOW is a freely available, public domain intrusion detection system. Information and software for the SHADOW System can be downloaded from the following website:

http://www.nswc.navy.mil/ISSEC/CID


################################################################
Moore
##################################################

The World Wide Web Security FAQ
http://www.w3.org/Security/faq/wwwsf6.html

##################################################
--------------------------------------------------------------------------------

[quote]DISCLAIMER
This information is provided by Lincoln Stein (lstein@cshl.org) and John Stewart (jns@digitalisland.net).
The World Wide Web Consortium (W3C) hosts this document as a service to the Web Community; however, it does not endorse its contents. For further information, please contact Lincoln Stein or John Stewart directly[/quote].

--------------------------------------------------------------------------------

Securing against Denial of Service attacks

[quote]Overview
Q1: What is a Denial of Service attack?
Denial of Service (DoS) is an attack designed to render a computer or network incapable of providing normal services. The most common DoS attacks will target the computer's network bandwidth or connectivity. Bandwidth attacks flood the network with such a high volume of traffic, that all available network resources are consumed and legitimate user requests can not get through. Connectivity attacks flood a computer with such a high volume of connection requests, that all available operating system resources are consumed, and the computer can no longer process legitimate user requests. The high-profile attacks of the week of February 6th, 2000 were primarily bandwidth attacks, and all of the targets were high-profile internet web sites. [/quote]
A complete description of Denial of Service attacks is available from CERT on http://www.cert.org/tech_tips/denial_of_service.html.

Q2: What is a Distributed Denial of Service attack?
[quote]A Distributed Denial of Service (DDoS) attack uses many computers to launch a coordinated DoS attack against one or more targets. Using client/server technology, the perpetrator is able to multiply the effectiveness of the Denial of Service significantly by harnessing the resources of multiple unwitting accomplice computers which serve as attack platforms. Typically a DDoS master program is installed on one computer using a stolen account. The master program, at a designated time, then communicates to any number of "agent" programs, installed on computers anywhere on the internet. The agents, when they receive the command, initiate the attack. Using client/server technology, the master program can initiate hundreds or even thousands of agent programs within seconds. [/quote]

Q3: How is a DDoS executed against a website?
[quote]A website DDoS is executed by flooding one or more of the site's web servers with so many requests that it becomes unavailable for normal use. If an innocent user makes normal page requests during a DDoS attack, the requests may fail completely, or the pages may download so slowly as to make the website unusable. DDoS attacks typically take advantage of several computers which simultaneously launch hundreds of thousands of requests at the target website. In order not to be traced, the perpetrators will break into unsecured computers on the internet, hide rogue DDoS programs on them, and then use them as unwitting accomplices to anonymously launch the attack. [/quote]

Q4: Is there a quick and easy way to secure against a DDoS attack?
[quote]No. From a simplistic perspective, the best solution is to secure computers from being hijacked and used as attack platforms. This cuts the problem off before it can ever manifest. Thus many experts suggest that we "pull together as a community" to secure our internet computers from becoming unwitting accomplices to such malicious intruders. Unfortunately, for every business that has the knowledge, budget, and inclination to make such changes, there are many more which lack such resources.
Plus, the attackers are most likely going to use non-commercial computers as attack platforms, because they are usually easier to break into. University systems are a favorite, because they are often understaffed or the systems are set to minimum security levels to allow students to explore the systems as part of their education. Further, this is not just a national problem. Any internet server in the world could be used as an attack platform.

Still, the simplest and most effective solution for preventing DDoS is through a global cooperative effort to secure the internet. The first step in the process, therefore, is concerned with scanning your internet computers to make sure they are not being used as unwitting DDoS attack platforms. This is not just good internet citizenry, however, because this also serves to document and verify that your internet computers are not suspect when DDoS attacks occur. [/quote]

Q5: Can the U.S. Government make a difference?
[quote]Certainly. The government could impose many types of restrictions on the internet that could greatly limit such types of attacks, at least from U.S.-based computers. Getting on the web could require the equivalent of a "Driver's License", having a website could require the equivalent of a "Commercial Permit", and all ISP's could be tightly regulated, much as the public utilities (Water, Power, etc.) are today. However the government is treading a fine line between limiting criminal activity and limiting economic growth, education, freedom of information, and general personal freedoms. For the time being, the U.S. government appears to be looking for approaches that are consistent with a non-intrusive approach.
For example, President Clinton proposed that we develop an information security "cyber-corps" of recent college grads to fight DDoS and other cybercrimes. While this is a sensible proposal, will there be a rush of computer science grads who will want to join such a group? Computer science students are by and large interested in science, not in law enforcement, so if Clinton's proposal goes through, it will be interesting to see if the government can attract the best of the best to join the "cyberpolice".

It should be noted, however, that in all likelihood a more intrusive government role is inevitable if uncontrollable attacks continue. If the government tries to be both helpful and non-intrusive, they may be simply ignored by commercial ventures. For example, during the week of February 6, 2000, a report from Federal Computer Week revealed "that only 2,600 individuals had downloaded a free security tool from the FBI's Web page. That tool, which detects denial-of-service code, has been available since December." [/quote]

Step by Step

Q6: How do I check my servers to see if they are active DDoS hosts?
[quote]Acquire one or more filesystem scanning tools to determine if any of the known DDoS tools are present on your server file system.
Compare the available tools from security tool vendors. Like virus software, DDoS tools become obsolete as new DDoS exploits are invented or existing ones are modified to evade detection. Select a tool that has been recently updated to handle the latest DDoS attack methods.
The FBI offers a tool on their website called "find_ddos" that will search the file system for the Trinoo, TFN, TFN2K and Stacheldraht DDoS tools. It is freely available on http://www.fbi.gov/nipc/trinoo.htm. One may be interested in the fact that the FBI does not make the source code for this program available.
Note that the FBI tool is not guaranteed to catch every DDoS binary. If the perpetrator has installed a root package, the find_ddos program may or may not be able to overcome it. The readme file says, "The tool was written in C so that it will have minimal reliance on system binaries, so it will not be impacted by most 'root kits'. However, it is susceptible to a kernel loadable module-based root kit."
For more information about how root kits work, see http://staff.washington.edu/dittrich/misc/...qs/rootkits.faq.
An alternative scanning tool is freely available on http://www.nessus.org.
Many commercial tools are also available.
Use manual methods to double-check for DDoS activity originating from your network (techniques from Kurt Seifried, seifried@securityportal.com).
Set up a filter on the firewall that sits between the web server and the internet connection or upstream connection to your ISP. Look for "spoofed" packets, i.e., packets that do not originate from your network. This is known as egress filtering. If spoofed packets are being generated on your network, there is a good chance that a DDoS program is generating them. Trace the packets back to their source, take the computer offline and clean the computer.
Block ports (like 37337) that are typically used to remotely control compromised machines.
Scan your network for open ports on a regular basis using tools such as nmap or saint - any changes should be investigated and appropriate action taken. [/quote]

Q7: What should I do if I find a DDoS host program on my server?
[quote]Recognize that the presence of a rogue (Trojan Horse) program on your system indicates that a vulnerability exists which has been exploited. Other subtle and not so subtle changes could have been made to the system, so a complete analysis of your security vulnerabilities is required. While your system may not yet be displaying any overt problems, this is no reason to soften the incident response approach.
Execute your organization's incident response policy. If no policy has yet been put in place, then perform the following emergency steps, at minimum:
Write everything down, starting from the first suspicion of an incident. Depending on the severity of the compromise, this will help you both technically and legally.
Do not broadcast the information regarding the compromise to your organization. This can not be helpful, and could lead to media involvement. Only inform those individuals who can directly assist in helping to fix the problem, your manager, and law enforcement officials.
Contact the strongest security experts in your organization for assistance. If none are available, ask management to request immediate assistance from a consulting firm that is experienced in incident handling for the operating systems and system software that you are running.
Physically remove the compromised computer from the network (unplug the network cable). If the computer is mission-critical, then deploy a hot-backup server if available. If no hot-backup is available, then downtime is unavoidable.
Backup the compromised computer's file system. Before beginning the backup, dump any dynamic data tables maintained by your operating system to standard files so that they can be analyzed later. For example, the lists of currently executing processes, of currently logged-in users, and of current network connections should be dumped to flat files. Then make two backups of the system using two different backup programs.
Shut down the compromised computer.
Re-start the computer.
Reformat the drives used by the system software.
Reinstall the operating system.
Apply all operating system patches.
Perform system "hardening" - this involves establishing operating system-specific settings to negate commonly known vulnerabilities.
Restore the file system - do not overwrite any system files, and examine any password files manually before the restore.
Put the computer back on the network.
Check all other computers on the network to see if the same vulnerability has been exploited elsewhere. A comprehensive incident handling approach is currently available on http://www.cert.org/tech_tips/root_compromise.html. [/quote]

Q8: How can I prevent my servers from being used as DDoS hosts in the future?
[quote]Recognize and understand the vulnerabilities of internet servers:
Unless special measures have been taken, internet servers have host names and IP addresses that can be easily looked up by anyone on the internet.
Many organizations do not put firewalls in front of their internet servers, leaving them largely unprotected from many of the probes and attacks that firewalls can easily stop.
By default, servers listen for service requests on standard, well known ports, and they naturally attempt to process all requests.
Servers are designed to run unattended, so there is rarely a "user" present who could look for unusual activity.
Servers often need to be administered remotely, from off-site, so they are designed to accept remote connections from users with very powerful permissions.
Many servers will reboot automatically after a shutdown, which is exactly what certain types of exploits are looking for.
If your system has already been compromised, then backup the filesystem, re-install the operating system and restore the filesystem.
Install operating system updates provided by OS vendor.
If the update is security-related, then it is especially crucial to install it.
Be sure to read the vendor's documentation carefully. Some updates are less well-tested than others, and an update can actually harm your system if it contains defects.
Secure the servers.
Turn off all unnecessary server services. Many of the services offered by your operating system are not required by your web server, for example RPC-based services. Adopt the attitude of "deny first, then allow". Assume a service should be turned off, unless it is absolutely required.
First determine which of the program-based services can be turned off, such as FTP, telnet, etc. These services are easily found as executable programs in the file system.
Many systems have been compromised by exploitation of buffer overrun bugs in the RPC services "statd", "cmsd" and "ttdbserverd". These attacks are described in CERT Incident Note 99-04 available on http://www.cert.org/incident_notes/IN-99-04.html.
Next check your operating system's documentation to see if it is providing services at the kernel level which are not visible as separate programs. For example, the netmask service may be provided at the kernel level. In this case, determine what parameters can be set, if any, to turn off kernel level services that are not required.
Contact your operating system vendor to find out if there are additional kernel level services that are not in the system documentation, and, if so, how to disable them.
Once all unnecessary services have been disabled, make cryptographic checksums of the entire system, which can be used later if there has been a suspected breach.
For UNIX-based systems, Tripwire will handle this, available from TSS.
More information on cryptographic checksums is available on http://www.cert.org/security-improvement/p...tices/p043.html
Configure the web server software.
Verify that you have the latest version of the web server software installed. If your version is old, get the new one and install it before continuing.
Turn off all unnecessary services offered by your web server software. For example, Java support, CGI support, and Server-side Script support should be turned off if they are not required.
Limit physical access to the server.
Take appropriate action to ensure that the server is only accessible to the designated system administrator(s). All the security in the world can be defeated by a simple floppy disk if the perpetrator has physical access to the server.
A comprehensive treatment on server-side security is currently available on http://www.cert.org/security-improvement/m...odules/m07.html. [/quote]

Q9: How can I prevent my personal computer from being used as a DDoS host?
[quote]Recognize and understand the vulnerabilities of internet clients:
Internet clients, i.e., personal computers connected to the internet, can also be compromised and used as agents for DDoS attacks.
Personal computers with full-time connections to the internet are particularly useful to DDoS perpetrators.
The easiest way and most common way to compromise a personal computer is through a voluntary file download initiated by the user - malicious programs posing as screen savers, games, and images are common culprits.
The sophistication of the new personal computer operating systems (e.g., Windows 98, Windows NT Workstation, Linux) which enable background processing and multi-processing, make them viable agents for distributed denial of service attacks.
If your system has already been compromised, then backup the filesystem, re-install the operating system and restore the filesystem.
Install operating system updates provided by OS vendor.
If the update is security-related, then it is especially crucial to install it.
Be sure to read the vendor's documentation carefully. Some updates are less well-tested than others, and an update can actually harm your system if it contains defects.
Secure the clients/personal computers.
All internet users on your network, particularly those with fulltime internet connections, must be informed that their computers could be used as attack agents, and they must be equipped with the latest detection software.
The new anti-virus updates are now able to detect many rogue DDoS programs. The latest versions of these programs must be downloaded and installed.
Norton's program is available on http://www.symantec.com/avcenter/venc/data...dos.trinoo.html
NAI offers similar support on http://vil.nai.com/vil/DoS98506.asp, as do many other vendors.
Note that if a rogue program is already operating on the client system, these detection programs may not work.
In the case of Norton, enable real-time protection, then reboot the computer to check for DDoS agent programs already in operation.
A detailed description of client-side DDoS is available on http://www.jmu.edu/info-security/engineeri...es/wintrino.htm. [/quote]

Q10: What is a "smurf attack" and how do I defend against it?
[quote]smurf is a simple yet effective DDoS attack technique that takes advantage of the ICMP (Internet Control Message Protocol). ICMP is normally used on the internet for error handling and for passing control messages. One of its capabilities is to contact a host to see if it is "up" by sending an "echo request" packet. The common "ping" program uses this functionality. smurf is installed on a computer using a stolen account, and then continuously "pings" one or more networks of computers using a forged source address. This causes all the computers to respond to a different computer than actually sent the packet. The forged source address, which is the actual target of the attack, is then overwhelmed by response traffic. The computer networks that respond to the forged ("spoofed") packet serve as unwitting accomplices to the attack. The basic characteristics and defense strategies against smurf follow. Further information is available from CERT. A complete description of smurf by Craig Huegen is available on http://users.quadrunner.com/chuegen/smurf.txt.
Attack Platforms: In order for smurf to work, it must find attack platforms that have IP broadcast functionality enabled on their routers. This functionality allows smurf to send a single forged ping packet and have it broadcast to an entire network of computers. To prevent your system from being used as a smurf attack platform, disable IP-directed broadcast functionality on all routers. Generally speaking, this functionality will not be missed.
The attacker may still be able to launch a smurf attack from inside your LAN, in which case disabling IP broadcast functionality at the router will have no effect. To protect against such an attack, many operating systems provide settings to prevent computers from responding to IP-directed broadcast requests. Check with your O/S provider for more information and review Appendix A of the CERT Advisory number CA-98.01 available on http://www.cert.org/advisories/CA-98.01.smurf.html.
In order for the attacker to successfully take advantage of you as an attack platform, your routers must allow packets to exit the network with source addresses that do not originate from your internal network. It is possible to configure your routers to filter out packets which do not originate from your internal network. This is known as network egress filtering.
ISP's should employ network ingress filtering, which drops packets which do not originate from a known range of IP addresses. Ingress filtering is described in detail in RFC 2267.
Targets: the easiest way to frustrate a smurf attack is to filter for echo reply packets at the border routers and drop them. This will prevent the packets from hitting the web server and the internal network. Another option, for those using Cisco routers, is CAR (Committed Access Rate).
Dropping all echo reply packets will prevent flooding of your network, but it will not prevent traffic jams in the pipe from your upstream provider.
If you are the target of an attack, ask your ISP to also filter out and drop echo reply packets.
If you do not want to completely disable echo reply, then you can selectively drop echo reply packets that are addressed to your high-profile, public web servers.
CAR is a technology developed by Cisco that allows you to specify the maximum amount of bandwidth that can be used by any particular packet type. Using CAR you can precisely specify the maximum amount of bandwidth that can be used by echo reply packets. For more information, see http://www.cisco.com/warp/public/707/newsflash.html. [/quote]

Q11: What is "trinoo" and how do I defend against it?
[quote]trinoo is a complex DDoS tool that uses "master" programs to automate the control of any number of "agent" programs which launch the actual attack. The attacker connects to the computer hosting the master program, starts the master, and the master takes care of starting all of the agent programs based on a list of IP addresses. The agent programs then attack one or more targets by flooding the network with UDP packets. Prior to the attack, the perpetrator will have compromised the computer hosting the master programs and all the computers hosting the agent program in order to install the software. The basic characteristics of and suggested defense strategies against the trinoo DDoS attack follow. A complete description of the trinoo was developed by Dave Dittrich and is available on http://staff.washington.edu/dittrich/misc/...trinoo.analysis.
trinoo uses UDP protocol for all communications between the master program and the agents. Intrusion Detection Software can look for flows that use UDP protocol (type 17).
trinoo master programs listen on port 27655. The attacker will connect via TCP, typically via Telnet, to the computer hosting the master program to launch it. Intrusion Detection Software can look for flows that use TCP (type 6) to connect to port 27655.
All communications from master to agents must contain the string "l44" (that's the letter l, not the number 1) and will be directed to the agent's UDP port 27444. Intrusion Detection Software can check for connections to UDP port 27444. If packets containing the string l44 are being sent there, the computer receiving the packets is probably a DDoS agent.
Communications between master and agent are password protected, however currently the password is not sent in encrypted format, so it can be "sniffed" and detected. Using the password, and the script trinotavailable from Dave Dittrich's website, it is possible to positively verify the presence of the trinoo agent. Once an agent is positively identified, the trinoo network can be dismantled:
Use the "strings" command on the agent daemon to extract the list of master IP addresses.
Contact all installations serving as trinoo masters to notify them of the incident.
On the master computer, identify the file (by default named "...") containing the list of agent IP addresses and extract the list.
Disable the agents by sending them a forged trinoo command to shut down. Note that the agents may restart regularly via an entry in the crontab file (on UNIX systems), so the agents may need to be shut down over and over again until the owner of the agent system can fix the crontab file.
Check for an active TCP connection to the master program. This indicates live communication between the attacker and the trinoo master program. While the attacker is in all likelihood using a stolen account to initiate the attack, it still may be possible to find the attacker (given high levels of cooperation between the ISP, the telephone company, and law enforcement).
If you are under trinoo attack, your system will be flooded with UDP packets. trinoo sends the packets from the same source address to random ports on the targeted host. Detection involves finding multiple UDP packets with the same source IP address, the same destination IP address, the same source port, but different destination ports.
An automated program to detect and eradicate trinoo can be found on http://www.fbi.gov/nipc/trinoo.htm. [/quote]

Q12: What are "Tribal Flood Network" and "TFN2K" and how do I defend against them?
[quote]Tribe Flood Network, like trinoo, uses a master program to communicate with attack agents located across multiple networks. TFN launches coordinated Denial of Service Attacks that are especially difficult to counter as it can generate multiple types of attacks and it can generate packets with spoofed source IP addresses. Some of the attacks that can be launched by TFN include UDP flood, TCP SYN flood, ICMP echo request flood, and ICMP directed broadcast. The basic characteristics of and suggested defense strategies against the TFN DDoS attack follow. A complete description of the TFN was developed by Dave Dittrich and is available on http://staff.washington.edu/dittrich/misc/tfn.analysis. A TFN incident analysis from CERT is also available.
To initiate TFN, the attacker accesses the master program and sends it the IP address of one or more targets. The master program proceeds to communicate with all of the agent programs, instructing them to initiate the attack.
Communications between TFN master programs and agent programs use ICMP echo reply packets, where the actual instruction to be carried out is embedded in the 16-bit ID field in binary format. The use of ICMP (Internet Control Message Protocol) makes packet protocol filtering possible.
TFN agents can be defeated by configuring your router or intrusion detection system to disallow all ICMP echo and echo reply packets onto your network. However this will break all internet programs (such as "ping") that utilize these functions.
The TFN master program reads a list of IP addresses containing the locations of the agents programs. This list of addresses may be encrypted, using "Blowfish" encryption.
If it is not encrypted, then the agents can be identified from the list.
The TFN agent programs have been found on systems with the filename td and the master programs with the name tfn. They can be positively identified by running the UNIX strings command. See David Dittrich's research for details on the output of strings.
TFN agents do not check where the ICMP echo reply packets come from. Therefore it is possible to forge ICMP packets to flush out these processes.
TFN2K is a more advanced version of TFN, that "fixes" some of the weaknesses of TFN. A CERT incident analysis is available.
Under TFN2K communications between master and agent may use any one of several protocols - TCP, UDP or ICMP - making protocol filtering impossible.
TFN2K is capable of sending corrupt packets to cause a system to crash or become unstable.
TFN2K can defeat egress filtering and ingress filtering by spoofing IP source addresses to make packets appear to come from a neighboring machine on the LAN.
Because this attack tool has just recently been identified, no research (that I could find) has found any significant weaknesses in the program. Until TFN2K can be analyzed more completely, the best defense is to:
Harden systems and networks to prevent your systems from being used as DDoS hosts.
Set up egress filltering on the border routers, as perhaps not all TFN2K source addresses will be spoofed using internal network addresses.
Ask your upstream provider to deploy ingress filtering. [/quote]

Q13: What is "stacheldraht" and how do I defend against it?
[quote]Stacheldraht, (German for "barbed wire"), developed by Mixter, is also based on the TFN and trinoo client/server model where a master program communicates with potentially many thousands of agent programs. The perpetrator connects to the master program to initiate the attack. Stacheldraht adds the following new features: encrypted communication between the attacker and the master program, as well as automated updates of the agent programs using rcp (remote copy).

Stacheldraht launches coordinated Denial of Service Attacks that are especially difficult to counter as it can generate multiple types of attacks and it can generate packets with spoofed source IP addresses. Some of the attacks that can be launched by Stacheldraht include UDP flood, TCP SYN flood, ICMP echo request flood, and ICMP directed broadcast. The basic characteristics of and suggested defense strategies against the Stacheldraht DDoS attack follow. A complete description of Stacheldraht was developed by Dave Dittrich and is available on http://staff.washington.edu/dittrich/misc/...ldraht.analysis.

To initiate Stacheldraht, the attacker accesses the master program and sends it the IP address of one or more targets. The master program proceeds to communicate with all of the agent programs, instructing them to initiate the attack.
Communications between Stacheldraht master programs and agent programs are primarily carried out using ICMP echo and echo reply packets.
Stacheldraht agents can be defeated by configuring your router or intrusion detection system to disallow all ICMP echo and echo reply packets onto your network. However this will also break all internet programs (such as "ping") that utilize these functions.
The agent program reads a list containing the IP addresses of valid master programs. This list of addresses is encrypted, using "Blowfish" encryption. The agent attempts to contact each of the master programs on the list. If it is successful, then the agent program performs a test to determine if the system it is installed on will allow it to alter ("spoof") packet source addresses. These two activities can be detected by configuring intrusion detection systems or sniffers to look for their signatures:
The agent will send each master an ICMP echo reply packet with an ID field containing the value 666 and data field containing the string "skillz". If the master receives the packet, it will reply with an ID field containing the value 667 and data field containing the string "ficken". The agent and master periodically "touch base" by exchanging these packets. By monitoring for these packets, Stacheldraht can be detected.
Once the agent has found a valid master program, it will execute a spoofing test by sending the master an ICMP packet with a spoofed source address. It uses the false address "3.3.3.3". If the master receives the spoofed packet, it will reply to confirm that source address spoofing is working with the string "spoofworks" in the ICMP packet data field. By monitoring for these values, Stacheldraht can also be detected.
Stacheldraht agents do not check where ICMP echo reply packets come from. Therefore it is possible to forge ICMP packets to flush out these processes.
The Stacheldraht agent programs, as well as TFN and trinoo can be detected using a C program written by David Dittrich and available on http://staff.washington.edu/dittrich/misc/...c/ddos_scan.tar. [/quote]


Q14: How should I configure my routers, firewalls, and intrusion detection systems against DDoS attacks?
[quote]Against Smurf
To determine if you are an attack platform:
monitor for packets which do not originate from your network.
monitor for high volumes of echo request and echo reply packets.
To prevent being used as an attack platform:
disable IP-directed broadcast functionality on all routers.
filter out packets which do not originate from your internal network.
To mitigate attacks:
filter for echo reply packets at the border routers and drop them.
for Cisco routers, use CAR to specify the maximum amount of bandwidth that can be used by echo reply packets.
Against trinoo
To determine if you are an attack platform:
UDP protocol is used for all communications between the master program and the agents. Filter for flows that use UDP protocol (type 17).
attackers connect to the master program over TCP at port 27655. Filter for flows that use TCP (type 6) to connect to port 27655.
master to agent communications must contain the string "l44" (that's the letter l, not the number 1) and will be directed to the agent's UDP port 27444. Filter for connections to UDP port 27444 containing the string l44.
To prevent being used as an attack platform:
filter out packets which do not originate from your internal network.
To mitigate attacks:
theoretically, you could filter for sequences of UDP packets with the same source IP address, the same destination IP address, the same source port, but different destination ports and drop them. Whether current firewall technology is up to this task is not known to the author.
Against TFN and TFN2K
To determine if you are an attack platform:
monitor for packets which do not originate from your internal network.
To prevent being used as an attack platform:
disallow all ICMP echo and echo reply packets onto your network (note that this will break all internet programs that utilize these functions).
filter out packets which do not originate from your internal network.
To mitigate attacks:
(under research)
Against Stacheldraht
To determine if you are an attack platform:
filter for ICMP echo reply packets with an ID field containing the value 666 and data field containing the string "skillz" or ID field containing the value 667 and data field containing the string "ficken".
filter for ICMP packet source address "3.3.3.3" and the string "spoofworks" in the ICMP packet data field.
To prevent being used as an attack platform:
disallow all ICMP echo and echo reply packets onto your network (note that this will break all internet programs that utilize these functions).
filter out packets which do not originate from your internal network.
To mitigate attacks:
(under research)

Lincoln D. Stein (lstein@cshl.org) and John N. Stewart (jns@digitalisland.net)

[/quote]
#################################################################
Moore
#####################################################################


Low-Level Enumeration With TCP/IP


#####################################################################

by Randy Williams <dolph -at- woh.rr.com>
Dec 19 2003 10:41PM GMT


Copyright © 2003, Randy Williams

We've all used most of the popular stealth scanning techniques out there right now. Tools such as nmap are excellent for enumerating remote hosts with increasingly complex techniques. The only problem being most of the nmap users out there do not take the time to find out exactly what is going on behind the scenes to make these scans work. In the following paragraphs I will attempt to explain the theory and concept behind many of today's advanced scanning techniques, and try to show you what is going on behind the scenes with them.

Syn Scanning
I know. Most of you are thinking syn scans are just about on the bottom of scans in a technical sense, and indeed you are correct. This section is being offered in this text as a step for beginners to be able to better comprehend some of the later subjects of the article.

Syn scanning, a technique that emerged into the hacking community several years ago, is still widely in use across the internet today. While it has been replaced by more stealthy and firewall negating scans, it is still the best balance of stealth and speed. The syn scan, also called the "half open" scan, is the ability to determine a ports state without making a full connection to the host. As such, the majority of systems do not log the attempt, and discard it as a communications error. To understand how this vulnerability is exploited by scanning software, you must first understand the concept of the "three way handshake" technique that is used to establish all tcp connections between systems.

Standard tcp communications are controlled by flags in the tcp packet header. These flags control what happens to the connection between the hosts, and helps give order to the system. The flags are as follows:

Synchronize - also called "SYN", used to initiate a connection between hosts.
Acknowledgement - also called "ACK", used in establishing a connection between hosts
Push - "PSH", Instructs receiving system to send all buffered data immediately
Urgent - "URG", states that the data contained in the packet should be processed asap
Finish - also called "FIN" tells remote system that there will be no more transmissions
Reset - also called "RST", also used to reset a connection.

As far as syn scanning is concerned, we are only worried about three of these flags, syn, ack, and rst. Tcp is a connection based protocol, which means before any application later data can be exchanged, a connection must first be established. This connection is established with what is called a "three way handshake". The three way handshake is illustrated below:


[quote]192.168.1.2:2342 ------------------syn-----------------------> 192.168.1.3:80
192.168.1.2:2342 <----------------syn/ack---------------------192.168.1.3:80
192.168.1.2:2342-------------------ack-------------------->192.168.1.3:80
    Connection Established[/quote]

The above diagram shows what a connection initiation between a host and a http server would look like. The initiating host ( 192.168.1.2 ) initiates a connection to the server ( 192.168.1.3 ) via a packet with only the syn flag set. The server, then replies with a packet with both the syn and the ack flag set. For the final step, the client responds back the server with a single ack packet. If these three steps are completed without complication, then a tcp connection has been established between the client and server.

So how is the three way handshake exploited by stealth scans? Simple, you simply don't complete the third step. By examining each packet as it enters the interface, you can guess the remote port's state, and terminate the connection before it is even established. Take the example below:


[quote]192.168.1.2:2342 -------------------------syn------------------->192.168.1.3:80
192.168.1.2:2342<---------------------syn/ack------------------192.168.1.3:80
192.168.1.2:2342-------------------------rst-------------------->192.168.1.3:80[/quote]

Those of you with little tcp/ip experience have no clue what the point of that was. Just hang with me and you'll begin to see. The initiation begins the same as in the previous example, the client sends a single syn packet to the server on the appropriate port. It is in the server's response that shows the idea behind stealth scanning. If the server responds with a syn/ack packet, we can very safely assume that the port is in state "open". If the server responds with an rst packet, then the remote port is in state "closed" As seen in the example, the server did indeed respond with the syn/ack packet, knowing that this means the port is open, we then respond with a rst packet, to close the initiation before a connection can ever be established.

This scan type also comes with a risk. If a host is scanned to long, it is possible to "syn flood" the remote host. This is a result of the scan filling up the servers connection table, causing it to stop responding to legitimate traffic. However, this side effect has been remedied in modern version of the majority of operating systems in use. The developers simply coded the kernel to limit the amount of connection attempts that could be made from one ip address. While this eliminates the danger of inadvertently disabling the host, is does hold another hazard for the scanner. If you were to scan to many ports on a given system, you will eventually reach the threshold of half open connections allowed on the host, consequently ending your scan. To deal with this problems, the hacking community simply began limiting the scan to only ports that will be relevant for their attack, instead of the large range of ports that would trigger the os's ip filtering methods.

Xmas, FIN, and NULL scanning
While Xmas, FIN, and NULL scans are among the most undetected by intrusion detection systems, they are also among the most unreliable. Unreliable in the fact that a multitude of different conditions could result in the scanning software reading the port as open, when it is in fact not. Illustrations for the Xmas scan are shown below:

Xmas scan directed at open port:


[quote]192.5.5.92:4031 -----------------------FIN/URG/PSH--------------->192.5.5.110:23
192.5.5.92:4031 <---------------------NO RESPONSE---------------192.5.5.110:23[/quote]

Xmas scan directed at closed port:


[quote]192.5.5.92:4031 ----------------------FIN/URG/PSH--------------->192.5.5.110:23
192.5.5.92:4031<--------------------------RST/ACK-----------------192.5.5.110:23[/quote]

As you can see, the xmas tree scan simply sets the initial tcp packets control flags to FIN ( Finish ), URG ( Urgent ), and PSH ( Push ). If a system's tcp/ip implementation is developed according to RFC 793, then the above packet sent to an open port will not elicit a response from the host. Where as if the port is in state closed, the remote host will reply with a RST/ACK. Given this, we can assume any port scanned on an active host that does not return a response to the client system is in state open.

One disadvantage to this technique was partially discussed in the above paragraph, the system's tcp/ip implementation MUST correspond with RFC standard 793. As such, this method will not work against any current version of Microsoft Windows. Xmas scans directed at any Microsoft system will show all ports on the host as being closed. This is because Microsoft followed their usual habit of negating inter-compatibility standards and go about their merry way with their coding. When a Microsoft system receives an xmas packet, it will respond with a RST/ACK, regardless of whether or not the port is open or closed. Since an xmas scan deems that a response from the remote host indicates a closed port, a Microsoft system is invulnerable to the xmas tree scan, as it will show all ports closed regardless of their state.

FIN and NULL scans
Both the FIN and NULL scans work on exactly the same principle as the Xmas scan, with the exception of the initiating packet structure. As you may have guessed, the initiation of the FIN scan is simply a tcp packet with only the FIN flag set, and a NULL scan begins with a packet that has no flags set. The actual process of determining the ports state is identical to that of the Xmas scan. For those still interested, examples of both the FIN and the NULL scans are below:

FIN scan directed at open port:



[quote]192.5.5.92:4031--------------------------------FIN--------------------------->192.5.5.110:23
192.5.5.92:4031<---------------------NO RESPONSE-----------------------192.5.5.110:23[/quote]

FIN scan directed at closed port:


[quote]192.5.5.92:4031-------------------------------FIN--------------------------->192.5.5.110:23
192.5.5.92:4031<---------------------------RST/ACK-----------------------192.5.5.110:23[/quote]

NULL scan directed at open port:


[quote]192.5.5.92:4031----------------------NO FLAGS SET--------------------->192.5.5.110:23
192.5.5.92:4031<---------------------NO RESPONSE-----------------------192.5.5.110:23[/quote]

NULL scan directed at closed port:


[quote]192.5.5.92:4031-----------------------NO FLAGS SET------------------->192.5.5.110:23
192.5.5.92:4031<---------------------------RST/ACK-----------------------192.5.5.110:23[/quote]

As you can see, the process of determining closed and open ports is identical to that of the Xmas scan. So in the light, it also falls prey to the same limitations that its predecessor does, it cannot be used against non RFC compliant systems, such as Microsoft Windows. The positive aspect of this limitation is that even though it cannot be used to determine a remote operating system, and can be used to determine what the remote operating system is not. For example if you were to scan a host that you know to be active, and the result is that of all remote ports being closed, it can safely be assumed that the remote system is non RFC compliant, so more than likely, is Windows.

Another problem that lies within these types of scans is that the majority of firewalls in use on the internet today will not send back the standard RST/ACK when an Xmas, FIN, or NULL packet hits a filtered port. It simply drops the packet and continues on with its business. The problem being that these scans take the absence of a response to mean that the port is open and listening. So any of these scans directed at a firewalled system will result in the scan showing all attempted ports as being open. Obviously not very effective as far as enumeration goes. Never the less, these three scans remain a powerful, and extremely stealth way to enumerate a remote system's ports.

Idle or "Zombie" Scans
Idle scanning is the newest and most stealth of all the port scanning techniques today. Also called "zombie" scanning, this method is unique in the fact that it offers completely blind scanning of a remote host. No packets will with the attackers ip will ever reach the victim system. This is accomplished by using a flaw that exists in the majority of operating system's IP ID generation for ip communications on the internet. The problem being that most system's IP ID's are incremented by one after every transmission made. An attacker can easily use this predictability to gain a surprisingly accurate idea of what is going on between the remote host and any other systems it comes in contact with. Below is the output of an hping command:

Hping2 output:


[quote][root@illiterate /]# hping2 -1 192.5.5.254
HPING 192.5.5.254 (eth0 192.5.5.254): icmp mode set, 28 headers + 0 data bytes
len=28 ip=192.5.5.254 ttl=255 id=5819 icmp_seq=0 rtt=0.7 ms
len=28 ip=192.5.5.254 ttl=255 id=5820 icmp_seq=1 rtt=0.3 ms
len=28 ip=192.5.5.254 ttl=255 id=5821 icmp_seq=2 rtt=0.3 ms
len=28 ip=192.5.5.254 ttl=255 id=5822 icmp_seq=3 rtt=0.2 ms[/quote]

The hping2 output shows that the system in question's IP ID is in fact incremented by one after every transmission made. Knowing that the system has a predictable IP ID. We can then use hping again to gain an idea about the remote machines traffic that is not our own. Examine the following hping output:

Hping2 output:


[quote][root@illiterate /]# hping2 -1 192.5.5.254
HPING 192.5.5.254 (eth0 192.5.5.254): icmp mode set, 28 headers + 0 data bytes
len=28 ip=192.5.5.254 ttl=255 id=6241 icmp_seq=0 rtt=0.5 ms
len=28 ip=192.5.5.254 ttl=255 id=6242 icmp_seq=1 rtt=0.3 ms
len=28 ip=192.5.5.254 ttl=255 id=6425 icmp_seq=2 rtt=0.4 ms
len=28 ip=192.5.5.254 ttl=255 id=6427 icmp_seq=3 rtt=0.2 ms
len=28 ip=192.5.5.254 ttl=255 id=6428 icmp_seq=4 rtt=0.3 ms
len=28 ip=192.5.5.254 ttl=255 id=6429 icmp_seq=5 rtt=0.1 ms
len=28 ip=192.5.5.254 ttl=255 id=6433 icmp_seq=6 rtt=0.2 ms[/quote]

Looking at the output above, we can see that the machine in question was interacting with hosts other than our own. After the second ping, the IP ID incremented by three, knowing that this host uses predictable IP ID's, we can see that sometime between our second and third pings, the remote host sent two other packets to an unknown location. This anomaly is seen again between the third and fourth packets, and also between the sixth and seventh.

So how do we use IP ID predictability to blindly scan another host? We make sure that we know what our zombie is sending, and where it is sending it to. The following is an example of how to check the status of a single port on a remote system using a zombie host to hide our scan. Using the nmap -sI option will indeed give you the same effect and faster, but I believe using hping will better help you understand what is happening.

Use Hping2 to check the current IP ID of the zombie:


[quote] [root@illiterate /]# hping2 -1 192.168.0.15
HPING 192.168.0.15 (eth0 192.168.0.15): icmp mode set, 28 headers + 0 data bytes
len=28 ip=192.168.0.15 ttl=255 id=3723 icmp_seq=0 rtt=0.3 ms[/quote]


From the hping output above, we can see that the current ID is 3723. Now we spoof a SYN packet from the machine we wish to scan, lets say it's IP is 192.168.0.100 and we wish to check port 25 (smtp):


[quote][root@illiterate /]# hping2 -S 192.168.0.100 -p 25 -a 192.168.0.15 -s 139 -c 1
HPING 192.168.0.100 (eth0 192.168.0.100): S set, 40 headers + 0 data bytes

--- 192.168.0.15 hping statistic ---
1 packets transmitted, 0 packets received, 100% packet loss[/quote]

So we've used hping2 to check the initial IP ID of the zombie, and then used hping2 again to send a spoofed packet from our zombie's ip and known port to our target on the port in question. Don't let the fact that the syn packet did not return us a response, its not supposed to. If our targets port is open, it will respond to the zombie with a single SYN/ACK packet.


[quote][root@illiterate /]# hping2 -1 192.168.0.15
HPING 192.168.0.15 (eth0 192.168.0.15): icmp mode set, 28 headers + 0 data bytes
len=28 ip=192.168.0.15 ttl=255 id=3725 icmp_seq=0 rtt=0.4 ms[/quote]

Now we use hping2 one last time to probe for the IP ID after the spoofed packet has been sent. If the target port on 192.168.0.100 is open, then the new IP ID should be two more than the original probe. This is a result of the target receiving the initiating SYN packet from what it believes was our zombie host, 192.168.0.15, and responding according to RFC standards with a SYN/ACK to the remote port. Upon receiving this SYN/ACK request with no prior knowledge of an initiation, the zombie then responds back with a single RST packet, incrementing it's IP ID by one, and then one more when responding to the second echo request. So looking at the previous hping echo request, we can see that the ID is in fact two larger than the original probe, so we can assume the port on 192.168.0.100 is in state open.

If the remote port on our target had been closed, it would have responded to the spoofed packet with a single RST packet, and following RFC standards, the zombie host would not render a response, thus having no increment in the IP ID.

As you may have guessed by now, time is of the essence in this scan. Should this scan be directed at a high traffic commercial web site, there would be too many transmits between our ID probes, thus, our probes and spoofed packets must be nearly simultaneous. This can be accomplished by setting the delay for hping's IP ID probes to an extremely low number, and logging the results to a text file for later review. ( or using nmap -sI )

Hping2 fast probing and logging example:


[quote] [root@illiterate /]# hping2 -i u15000 192.168.0.15 > hpinglog &[/quote]

The example above will probe the zombie host fifteen times every second, and put it into the system background, if the port on the target system is open, you will find the extra increment in the log file.

While using hping as a tool for tcp idle scans is possible and effective, you are clearly better off just letting nmap handle all of the dirty work for you, or code your own implementation of this system if you are on that level.

Using Ordinary SYN Packets to Enumerate a Firewall
The past few years have seen a major spike in the use of firewalls deployed to protect both corporate networks and home users. While these firewalls are a relatively easy and cost effective defense mechanism, determined hackers will not have a great deal of trouble finding a way through.

This section of the text will once again stress the use of Antirez's hping2 utility, if you do not have a copy of this excellent packet building tool I suggest you get one right now. http://www.hping.org. Before we get into mapping out ip trust relationships and actually slipping by the firewall, first we must learn to identify one. This is not done by checking to see if a port is closed, it is done by checking to see how a port is closed. If you remember back to the SYN scan section, you can recall that an open port will respond to a SYN packet with a single SYN/ACK, and a closed port will respond with a single RST. Firewalls however, do not follow this rule. Examine the following iptables entries:


[quote][root@dolphbox /]# /sbin/iptables -A INPUT -s 0/0 --proto tcp --dport 25 -j DROP
[root@dolphbox /]# /sbin/iptables -A INPUT -s 0/0 --proto tcp --dport 23 -j ACCEPT
[root@dolphbox /]# /sbin/iptables -A INPUT -s 0/0 --proto tcp --dport 20 -j ACCEPT[/quote]

In the proceeding example we can see that we deny all access to the stmp server, port 25. The next two lines instruct our firewall to accept all traffic to both the telnet server, port 23, as well as tcp port 20, which is currently closed, and not operating a service. Now examine the following hping2 results when we attempt to initiate a connection to the denied stmp service:


[quote][root@getem /]# hping2 -S 192.5.5.254 -p 25
HPING 192.5.5.254 (eth0 192.5.5.254): S set, 40 headers + 0 data bytes

--- 192.5.5.254 hping statistic ---
3 packets transmitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
[root@getem /]#[/quote]

The SYN packet from hping2 hit the firewall, was caught by the rules, and dropped accordingly by the kernel. Now the same packet but to accepted open port 23:


[quote][root@getem /]# hping2 -S 192.5.5.254 -p 23
HPING 192.5.5.254 (eth0 192.5.5.254): S set, 40 headers + 0 data bytes
len=44 ip=192.5.5.254 ttl=64 DF id=0 sport=23 flags=SA seq=0 win=32767 rtt=0.8 ms

--- 192.5.5.254 hping statistic ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.8/0.8/0.8 ms
[root@getem /]#[/quote]

This time, our SYN packet was caught by the firewall, and passed on to the listening telnet service as shown in rule two. The telnet server, responds accordingly with a SYN/ACK. Now check the final test, another SYN packet directed at firewall accepted, but locally closed port:


[quote][root@getem /]# hping2 -S 192.5.5.254 -p 20
HPING 192.5.5.254 (eth0 192.5.5.254): S set, 40 headers + 0 data bytes
len=40 ip=192.5.5.254 ttl=255 DF id=0 sport=20 flags=RA seq=0 win=0 rtt=0.5 ms

--- 192.5.5.254 hping statistic ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.5/0.5/0.5 ms
[root@getem /]#[/quote]

In the final example, the firewall examines the packet, and passes it on the local port 20, the only problem being that there is no service running on port 20, so our kernel catches this attempt to a closed port, and responds back according to RFC 793 with an RST/ACK packet.

Now how does this information tell us that a firewall is in place on the remote system? If you look back to the first connection initiation attempt, you will notice that the SYN packet directed at the firewall denied port elicited absolutely no response back to the scanning system at all. This is because as a standard firewalls do not respond to restricted packets. When a host is known to be active, but makes no response what so ever to a SYN packet, then the odds are that the host is using a firewall or other packet filtering software. This can be further proven by the other two examples, where an open port responds with a SYN/ACK, and a port excepted by the firewall, but not running a service, responds with an RST/ACK .

Enumerating IP Trust Relationships
An essential element for successful deployment of a firewall is that the hosts behind the firewall be able to reach the resources that they need. As such users behind the firewall may be able to reach systems and services that people on the outside cannot. The ability of only certain hosts being able to reach crucial systems is called an "IP Trust Relationship". The ability of an attacker to map and understand these systems is often a must for successful penetration of the network.

For this example, we will be using three hosts on local network 192.168.1.0.


192.168.1.0 Network

192.168.1.2 Attacking Host
192.168.1.4 Legitimate Web Server
192.168.1.7 Legitimate Server: Telnet, smtp, and dns

Our attacker is curious about the relationship between the two known servers on the network. Obviously the best place to start would be to a simple port scan on both hosts.


[quote]root@hollabox[/]# nmap -sS 192.168.1.7

Starting nmap V. 3.10ALPHA4 ( www.insecure.org/nmap/ )
Skipping host 192.168.1.7 due to host timeout

Nmap run completed - 1 IP address (1 host up) scanned in 75.571 seconds
root@hollabox[/]#[/quote]

Looking at the nmap output above, we see that the host was in fact up, but did you respond to any of our SYN probes. If you recall back to the first section on SYN scans, you will remember that a normal system will always generate a response to a SYN packet, whether the port is in state open or closed. This system however, did not, so we can assume it is behind some sort of firewall. Now for the second system.


[quote]root@hollabox[/]# nmap -sS 192.168.1.4

Starting nmap V. 3.10ALPHA4 ( www.insecure.org/nmap/ )
Interesting ports on 192.168.1.4:
(The 1604 ports scanned but not shown below are in state: filtered)
Port  State  Service
80/tcp  open  http[/quote]

Nmap run completed - 1 IP address (1 host up) scanned in 158.102 seconds
root@hollabox[/]#

We see the same firewall effect on the second system, except that this system does have a service accessible by the attacker, http.

Knowing that we have at least one port accepting traffic from systems outside the firewall, we can gain a better prospective of what is happening behind the network firewall. To accomplish this we will use the idle scan technique discussed in a previous section, only this time we will implement it using nmap.


[quote]Nmap -sI 192.168.1.4:80 192.168.1.7
WARNING: Many people use -P0 w/Idlescan to prevent pings from their true IP.  On the other hand,
timing info Nmap gains from pings can allow for faster, more reliable scans.

Starting nmap V. 3.10ALPHA4 ( www.insecure.org/nmap/ )
Interesting ports on 192.168.1.7:
(The 1600 ports scanned but not shown below are in state: closed)
Port  State  Service
23/tcp  open  telnet
25/tcp  open  smtp
53/tcp  open  domain[/quote]

Nmap run completed - 1 IP address (1 host up) scanned in 152.305 seconds
root@hollabox[/]#

We can clearly see that this scan is quite different from the original scan directed at 192.168.1.7. This is because the idle scan shows us what ports are open from 192.168.1.4's prospective. The output above shows that the networks web server has complete tcp/ip trust from the ftp server.

Using this information, an attacker could then implement a number of trust based attacks against either one of these systems. However, these attacks are outside the scope of this particular paper.

The End
I hope the techniques and knowledge contained in this paper will help its readers to better understand tcp/ip, and the many ways that it can be, and is abused on the internet today. However, I cannot be held responsible for any kind of misuse that a reader does with the information contained here. This article was written to help the reader to know what kind of attacks are out there, in order to better prepare their own network for them.

And at long last____..the end.

#########################################################################
Moore
####################################################################

Detection of SQL Injection and Cross-site Scripting Attacks

by K. K. Mookhey and Nilesh Burghate
last updated March 17, 2004

--------------------------------------------------------------------------------

http://www.securityfocus.com/infocus/1768

--------------------------------------------------------------------------------

1. Introduction
In the last couple of years, attacks against the Web application layer have required increased attention from security professionals. This is because no matter how strong your firewall rulesets are or how diligent your patching mechanism may be, if your Web application developers haven't followed secure coding practices, attackers will walk right into your systems through port 80. The two main attack techniques that have been used widely are SQL Injection [ref 1] and Cross Site Scripting [ref 2] attacks. SQL Injection refers to the technique of inserting SQL meta-characters and commands into Web-based input fields in order to manipulate the execution of the back-end SQL queries. These are attacks directed primarily against another organization's Web server. Cross Site Scripting attacks work by embedding script tags in URLs and enticing unsuspecting users to click on them, ensuring that the malicious Javascript gets executed on the victim's machine. These attacks leverage the trust between the user and the server and the fact that there is no input/output validation on the server to reject Javascript characters.

This article discusses techniques to detect SQL Injection and Cross Site Scripting (CSS) attacks against your networks. There has been a lot of discussion on these two categories of Web-based attacks about how to carry them out, their impact, and how to prevent these attacks using better coding and design practices. However, there is not enough discussion on how these attacks can be detected. We take the popular open-source IDS Snort [ref 3], and compose regular-expression based rules for detecting these attacks. Incidentally, the default ruleset in Snort does contain signatures for detecting cross-site scripting, but these can be evaded easily. Most of them can be evaded by using the hex-encoded values of strings such as <script%3E instead of <script>.

We have written multiple rules for detecting the same attack depending upon the organization's level of paranoia. If you wish to detect each and every possible SQL Injection attack, then you simply need to watch out for any occurrence of SQL meta-characters such as the single-quote, semi-colon or double-dash. Similarly, a paranoid way of checking for CSS attacks would be to simply watch out for the angled brackets that signify an HTML tag. But these signatures may result in a high number of false positives. To avoid this, the signatures can be modified to be made accurate, yet still not yield too many false positives.

Each of these signatures can be used with or without other verbs in a Snort signature using the pcre [ref 4] keyword. These signatures can also be used with a utility like grep to go through the Web-server's logs. But the caveat is that the user input is available in the Web server's logs only if the application uses GET requests. Data about POST requests is not available in the Web server's logs.



2. Regular Expressions for SQL Injection
An important point to keep in mind while choosing your regular expression(s) for detecting SQL Injection attacks is that an attacker can inject SQL into input taken from a form, as well as through the fields of a cookie. Your input validation logic should consider each and every type of input that originates from the user -- be it form fields or cookie information -- as suspect. Also if you discover too many alerts coming in from a signature that looks out for a single-quote or a semi-colon, it just might be that one or more of these characters are valid inputs in cookies created by your Web application. Therefore, you will need to evaluate each of these signatures for your particular Web application.
As mentioned earlier, a trivial regular expression to detect SQL injection attacks is to watch out for SQL specific meta-characters such as the single-quote (') or the double-dash (--). In order to detect these characters and their hex equivalents, the following regular expression may be used:

2.1 Regex for detection of SQL meta-characters
/(\%27)|(\')|(\-\-)|(\%23)|(#)/ix


Explanation:
We first detect either the hex equivalent of the single-quote, the single-quote itself or the presence of the double-dash. These are SQL characters for MS SQL Server and Oracle, which denote the beginning of a comment, and everything that follows is ignored. Additionally, if you're using MySQL, you need to check for presence of the '#' or its hex-equivalent. Note that we do not need to check for the hex-equivalent of the double-dash, because it is not an HTML meta-character and will not be encoded by the browser. Also, if an attacker tries to manually modify the double-dash to its hex value of %2D (using a proxy like Achilles [ref 5]), the SQL Injection attack fails.

The above regular expression would be added into a new Snort rule as follows:

alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg:"SQL Injection - Paranoid"; flow:to_server,established;uricontent:".pl";pcre:"/(\%27)|(\')|(\-\-)|(%23)|(#)/i"; classtype:Web-application-attack; sid:9099; rev:5;)


In this case, the uricontent keyword has the value ".pl", because in our test environment, the CGI scripts are written in Perl. Depending upon your particular application, this value may be either ".php", or ".asp", or ".jsp", etc. From this point onwards, we do not show the corresponding Snort rule, but instead only the regular expressions that are to be used for creating these rules. From the regular expressions you can easily create more Snort rules.

In the previous regular expression, we detect the double-dash because there may be situations where SQL injection is possible even without the single-quote [ref 6]. Take, for instance, an SQL query which has the where clause containing only numeric values. Something like:

select value1, value2, num_value3 from database
where num_value3=some_user_supplied_number

In this case, the attacker may execute an additional SQL query, by supplying an input like:

3; insert values into some_other_table

Finally, pcre modifiers 'i' and 'x' are used in order to match without case sensitivity and to ignore whitespaces, respectively.

The above signature could be additionally expanded to detect the occurrence of the semi-colon as well. However, the semi-colon has a tendency to occur as part of normal HTTP traffic. In order to reduce the false positives from this, and also from any normal occurrence of the single-quote and double-dash, the above signature could be modified to first detect the occurrence of the = sign. User input will usually occur as a GET or a POST request, where the input fields will be reflected as:

username=some_user_supplied_value&password=some_user_supplied_value

Therefore, the SQL injection attempt would result in user input being preceded by a = sign or its hex equivalent.

2.2 Modified regex for detection of SQL meta-characters
/((\%3D)|(=))[^\n]*((\%27)|(\')|(\-\-)|(\%3B)|(wink.gif)/i

Explanation:
This signature first looks out for the = sign or its hex equivalent (%3D). It then allows for zero or more non-newline characters, and then it checks for the single-quote, the double-dash or the semi-colon.

A typical SQL injection attempt of course revolves around the use of the single quote to manipulate the original query so that it always results in a true value. Most of the examples that discuss this attack use the string 1'or'1'='1. However, detection of this string can be easily evaded by supplying a value such as 1'or2>1--. Thus the only part that is constant in this is the initial alphanumeric value, followed by a single-quote, and then followed by the word 'or'. The Boolean logic that comes after this may be varied to an extent where a generic pattern is either very complex or does not cover all the variants. Thus these attacks can be detected to a fair degree of accuracy by using the next regular expression, in section 2.3 below.

2.3 Regex for typical SQL Injection attack
/\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix

Explanation:
\w* - zero or more alphanumeric or underscore characters
(\%27)|\' - the ubiquitous single-quote or its hex equivalent
(\%6F)|o|(\%4F))((\%72)|r|(\%52) - the word 'or' with various combinations of its upper and lower case hex equivalents.

The use of the 'union' SQL query is also common in SQL Injection attacks against a variety of databases. If the earlier regular expression that just detects the single-quote or other SQL meta characters results in too many false positives, you could further modify the query to specifically check for the single-quote and the keyword 'union'. This can also be further extended to other SQL keywords such as 'select', 'insert', 'update', 'delete', etc.

2.4 Regex for detecting SQL Injection with the UNION keyword
/((\%27)|(\'))union/ix
(\%27)|(\') - the single-quote and its hex equivalent
union - the keyword union

Similar expressions can be written for other SQL queries such as >select, insert, update, delete, drop, and so on.

If, by this stage, the attacker has discovered that the Web application is vulnerable to SQL injection, he will try to exploit it. If he realizes that the back-end database is on an MS SQL server, he will typically try to execute one of the many dangerous stored and extended stored procedures. These procedures start with the letters 'sp' or 'xp' respectively. Typically, he would try to execute the 'xp_cmdshell' extended procedure, which allows the execution of Windows shell commands through the SQL Server. The access rights with which these commands will be executed are those of the account with which SQL Server is running -- usually Local System. Alternatively, he may also try and modify the registry using procedures such as xp_regread, xp_regwrite, etc.

2.5 Regex for detecting SQL Injection attacks on a MS SQL Server
/exec(\s|\+)+(s|x)p\w+/ix

Explanation:
exec - the keyword required to run the stored or extended procedure
(\s|\+)+ - one or more whitespaces or their HTTP encoded equivalents
(s|x)p - the letters 'sp' or 'xp' to identify stored or extended procedures respectively
\w+ - one or more alphanumeric or underscore characters to complete the name of the procedure



3. Regular Expressions for Cross Site Scripting (CSS)
When launching a cross-site scripting attack, or testing a Website's vulnerability to it, the attacker may first issue a simple HTML formatting tag such as <b> for bold, <i> for italic or <u> for underline. Alternatively, he may try a trivial script tag such as <script>alert("OK")</script>. This is likely because most of the printed and online literature on CSS use this script as an example for determining if a site is vulnerable to CSS. These attempts can be trivially detected. However, the advanced attacker may attempt to camouflage the entire string by entering its Hex equivalents. So the <script> tag would appear as <script%3E. On the other hand, the attacker may actually use a Web Application Proxy like Achilles and reverse the browser's automatic conversion of special characters such as < to %3C and > to %3E. So the attack URL will contain the angled brackets instead of their hex equivalents as would otherwise normally occur.
The following regular expression checks for attacks that may contain HTML opening tags and closing tags <> with any text inside. It will catch attempts to use <b> or <u> or <script>. The regex is case-insensitive. We also need to check for the presence of angled brackets, as well as their hex equivalents, or (%3C|<). To detect the hex conversion of the entire string, we must check for the presence of numbers as well as the % sign in the user input, in other words, the use of [a-z0-9%]. This may sometimes result in false-positives, but most of the time will detect the actual attack.

3.1 Regex for simple CSS attack
/((\%3C)|<)((\%2F)|\/)*[a-z0-9\%]+((\%3E)|>)/ix

Explanation:
((\%3C)|<) - check for opening angle bracket or hex equivalent
((\%2F)|\/)* - the forward slash for a closing tag or its hex equivalent
[a-z0-9\%]+ - check for alphanumeric string inside the tag, or hex representation of these
((\%3E)|>) - check for closing angle bracket or hex equivalent

Snort signature:

alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg:"NII Cross-site scripting attempt"; flow:to_server,established; pcre:"/((\%3C)|<)((\%2F)|\/)*[a-z0-9\%]+((\%3E)|>)/i"; classtype:Web-application-attack; sid:9000; rev:5;)


Cross-site scripting can also be accomplished by using the <img src=> technique. The existing default snort signature can be easily evaded. The one supplied in section 3.2 will be much tougher to evade.

3.2 Regex for "<img src" CSS attack
/((\%3C)|<)((\%69)|i|(\%49))((\%6D)|m|(\%4D))((\%67)|g|(\%47))[^\n]+((\%3E)|>)/I

Explanation:
(\%3C)|<) opening angled bracket or hex equivalent
(\%69)|i|(\%49))((\%6D)|m|(\%4D))((\%67)|g|(\%47) the letters 'img' in varying combinations of ASCII, or upper or lower case hex equivalents
[^\n]+ any character other than a new line following the <img
(\%3E)|>) closing angled bracket or hex equivalent


3.3 Paranoid regex for CSS attacks
/((\%3C)|<)[^\n]+((\%3E)|>)/I

Explanation:
This signature simply looks for the opening HTML tag, and its hex equivalent, followed by one or more characters other than the newline, and then followed by the closing tag or its hex equivalent. This may end up giving a few false positives depending upon how your Web application and Web server are structured, but it is guaranteed to catch anything that even remotely resembles a cross-site scripting attack.

For an excellent reference on types of cross-site scripting attacks that will evade filters, see the Bugtraq posting http://www.securityfocus.com/archive/1/272037. However, note that the last of the cross-site scripting signatures, which is the paranoid signature, will detect all these attacks.

4. Conclusion
In this article, we've presented different types of regular expression signatures that can be used to detect SQL Injection and Cross Site Scripting attacks. Some of the signatures are simple yet paranoid, in that they will raise an alert even if there is a hint of an attack. But there is also the possibility that these paranoid signatures may result in false positives. To take care of this, we've then modified the simple signatures with additional pattern checks so that they are more accurate. We recommend that these signatures be taken as a starting point for tuning your IDS or log analysis methods, in the detection of these Web application layer attacks. After a few modifications, and after taking into account the non-malicious traffic that occurs as part of your normal Web transactions, you should be able to accurately detect these attacks.



References
1. SQL Injection http://www.spidynamics.com/papers/SQLInjec...nWhitePaper.pdf
2. Cross Site Scripting FAQ http://www.cgisecurity.com/articles/xss-faq.shtml
3. The Snort IDS http://www.snort.org
4. Perl-compatible regular expressions (pcre) http://www.pcre.org
5. Web application proxy, Achilles http://achilles.mavensecurity.com
3. Advanced SQL Injection http://www.nextgenss.com/papers/advanced_s...l_injection.pdf
7. Secure Programming HOWTO, David Wheeler www.dwheeler.com
8. Threats and Countermeasures, MSDN, Microsoft http://msdn.microsoft.com


QUOTE
About the authors
K. K. Mookhey is Founder & CTO of Network Intelligence India Pvt. Ltd. (www.nii.co.in), which provides information security consulting services including security audits, penetration testing, security design, application audits, and security training. He has written a number of articles and whitepapers on information security, and is also responsible for NII's research initiatives.
Nilesh Burghate is an Information Assurance Consultant with NII, and his interests include penetration testing, IDS signature writing, intrusion analysis and detection and forensics. The results from his team's research efforts provide direct input to NII's Security Alerting service.


######################################################################
Moore
####################################################################

Firewalled IIS Servers

####################################################################

March 1st, 2004
The Report

http://www.securityspace.com/s_survey/data...alled_cloc.html

This report describes systems that we've detected via conventional HTTP requests as being IIS servers that have been firewalled behind some kind of NAT (Network Address Translation) device.

What is NAT?

The IETF (Internet Engineering Task Force) describes NAT being used for the following:

IP V4 Network Address Translation (NAT) has become an increasingly common function in the Internet for a variety of reasons. NATs are used to interconnect a private network consisting of unregistered IP addresses with a global IP network using limited number of registered IP addresses. NATs are also used to avoid address renumbering in a private network when topology outside the private network changes for variety of reasons. And, there are many other applications of NAT operation.
In other words, in the context of the web servers a browser visits, the IP address we visit, may appear to be one thing, while the server that is actually providing the data may be residing on a completely different IP address, with a device in between (often a firewall) translating traffic to allow communications to work.

When NAT is employed, administrators will typically use one of 3 ranges of IP addresses, known as private, or non-routable addresses. These ranges are designated for private use, and as such cannot be reached directly from the internet. A separate device, such as a firewall, can be configured to send traffic incoming to a specific port (e.g. http port 80) to an internal private address, making it appear as if the webserver is operating on a public address.

The 3 blocks of private addresses, as specified in IANA (Internet Assigned Numbers Authority) are:

10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

How We (Or anyone else) Can Detect NAT Usage

When a browser requests a web page, it uses the HTTP protocol. HTTP requests consist of instructions on what page to retrieve along, while HTTP responses consist of information about the server and document being returned, along with the actual document (be it HTML, text, gif or otherwise).
For example, the following session shows captures a request to a typical web server:

QUOTE
    $ telnet www2.securityspace.com 80
    Trying 216.201.108.18...
    Connected to www2.securityspace.com.
    Escape character is '^]'.
    GET /sample.html HTTP/1.0

Having issued the request to retrieve the page sample.html, the server responds with the HTTP header and an HTML page.

    HTTP/1.1 200 OK
    Date: Fri, 04 May 2001 20:08:11 GMT
    Server: Apache/1.3.12 (Unix)
    Connection: close
    Content-Type: text/html

    <HTML>
    <HEAD></HEAD>
    <BODY>Sample Page</BODY>
    </HTML>
    Connection closed by foreign host.
    $

Now let's consider the exact same response received from a poorly configured IIS server:


    HTTP/1.1 200 OK
    Server: Microsoft-IIS/4.0
    Content-Location: http://10.1.1.1/sample.html
    Date: Wed, 11 Apr 2001 07:22:38 GMT
    Content-Type: text/html
    Accept-Ranges: bytes
    Last-Modified: Tue, 09 Jan 2001 21:41:34 GMT
    ETag: "b43f97ef847ac01:4096"
    Content-Length: 55

    <HTML>
    <HEAD></HEAD>
    <BODY>Sample Page</BODY>
    </HTML>
    Connection closed by foreign host.
    $


The above example shows that the IIS server is returning a header field called Content-Location, and that this field is showing the location of the document being requested from the webserver's perspective. In this case, it happens to reveal that the web server resides on a private class A address of 10.1.1.1, providing pretty good proof that there is a NAT device between the webserver and the internet at large, and that the device is probably a firewall of some sort.


####################################################################
Moore
#######################################################

The IUCC/IDC Internet Telescope

#######################################################

http://noc.ilan.net.il/research/telescope/


An Internet Telescope is a tool that monitors the backscatter of spoofed IP traffic destined to what is known as "Internet dark address space".

Imagine an attack on some IP address but with the attack originating from totally random, spoofed IP addresses. When the victim attempts to reply to some of these attack packets (SYN, ICMP, etc.) the response will go back to what it assumes is the originating IP address.

Some of those replies will go back to "Internet dark address space". Dark IP address is space that is globally routable, but currently there are no computers in this network.

In other words, there should never be any packets destined to this particular network. If this is not clear, one can watch a 90 second video from CAIDA that describes this method of using backscatter detection.

Attacks seen

The packets that are received by the telescope can be roughly categorized into 4 categories:

Host/Port scanning: Host/Port scanning are usually programs that are used by hackers to learn about the computers and ports that are open in the network (and possibly available for compromise). In this case the Telescope would capture the packets of the scanners. A worm attack is a program that exploits a bug in the operating system to install a virus, that in turn, will try to spread and infect other machines on the network. The Telescope would capture the packets sent by an infected machine in their attempt to infect a new machine in the Telescope "dark space" network.

Backscatter from spoofed DDOS attacks throughout the world: A Denial of Service attack, is an attack where a hacker tries to consume network resources, by sending lots of traffic to a specific victim.

The Telescope can monitor which networks in the global Internet are under attack by spoofed, random packets. We can understand this better with an example. Consider the case where victim Y, somewhere in the Internet, is under a spoofed TCP SYN attack.

The victim responds with SYN-ACK to the spoofed source address. Since the source was randomly spoofed, it most probably would also send a SYN-ACK response to the Riverhead-IUCC monitor network. Hence, the monitor should capture a SYN-ACK packet from the victim.

Since, the monitor network is a /16 (of which there are 65,536 such /16s networks in the Internet), we end up capturing 1/65536th of the volume of the spoofed attack (assuming the spoofing was indeed random). The rate of the attack seen by the telescope is actually a lower bound on the actual attack rate.

This is because the telescope receives the rate that the victim can still handle (i.e., we see SYN-ACK packets only to the part of traffic that the victim can still handle and provide an answer to the SYN received; if the computer is overloaded then SYN packets will be ignored by the victim).

This method was first introduced by Inferring Internet Denial-of-Service Activity David Moore, Geoffrey Voelker, Stefan Savage, (USENIX Security, 2001).

Configuration Mistakes: a flow that lives for a very short time, and that cannot be categorized to one of the above categories is basically labeled as configuation mistakes of one of the computers in the Internet.

Other: a long flow that could not be categorized to any of the above groupings.


Attacks not seen

By far, not all DDOS attacks can be seen by a Network Telescope. Those that cannot be seen are:

Bogon attacks: A bogon attack is an attack that comes with a source IP that should never appear in the Internet global routing tables. A list of bogons is available from Team CYMRU. IUCC filters out some but not all of the bogons so in general, the Network Telescope will not see bogon attacks.

uRPF filtering: Even spoofed attacks may not reach a Network Telescope if they are stopped along the way via a method known as Reverse Path Forwarding filtering. See slide 118 for further details.

Non-spoofed attacks: An attacker can always attack a victim directly, using any number of attack tools to try to overwhelm the resources of the victim. In general, these type of attacks would be easy to backtrack and to determine who the attacker was, so we assume most attacks are no longer of this type.

Botnet attacks: Since attacking with an identifable IP would lead to backtracking, attackers now use what is known as a BOTNET or zombies attack.
By infecting many PCs and using them as a proxy for launching their attack, attackers are able to hide their identity. Since a botnet attack is in general not spoofed, a Network Telescope would not see such an attack. There have been cases of botnet attacks with spoofed IP addresses but the attacker then takes the chance that some of the attack packets might be filtered by uRPF checking.

It is assumed, that most attacks these days on the Internet are launched by botnets.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.