War10ck Cyber
War10ck Cyber
War10ck Cyber
War10ck
WCS
WAR10CK
9. Sniffers
Sniffers are almost as old as the Internet itself. They are one of the first tools that allowed system
administrators to
analyze their network and pinpoint where a problem is occurring. Unfortunately, crackers also run
network and steal various kinds of data. This paper discusses what a sniffer is, some of the more
ways to protect your network against them. It also talks about a popular tool called Antisniff, which
allows you to
packets are destined for will respond. All of the other machines on that network still see the packet,
the intended receiver, they will disregard it. When a computer is running sniffer software and it’s
network interface is in
promiscuous mode (where it listens for ALL traffic), then the computer has the ability to view all of
the network.
If you are an Internet history buff and have been wondering where the term sniffer came from.
1
WAR10CK
was originally sold by Network General. It became the market leader and people starting referring to
all network
analyzers as “sniffers.” I guess these are the same people who gave the name Q-Tip to cotton swabs.
security administrator could use multiple sniffers, strategically placed throughout their network, as
an intrusion detection
system. Sniffers are great for system administrators, but they are also one of the most common
Crackers install sniffers to obtain usernames, passwords, credit card numbers, personal information,
and other
information that could be damaging to you and your company if it turned up in the wrong hands.
information, crackers will use the passwords to attack other Internet sites and they can even turn a
Defeating Sniffers
one of the most obvious ways of protecting your network against sniffers is not to let them get
place. If a cracker cannot gain access to your system, then there is no way for them to install a sniffer
2
WAR10CK
world, we would be able to stop here. But since there are an unprecedented number of security
and most companies don’t have enough staff to fix these holes, then crackers are going to exploit
vulnerabilities and
install sniffers. Since crackers favour a central location where the majority of network traffic passes
then these are going to be their prime targets and should be watched closely. Some other possible
“victims” where
crackers like to install sniffers are next to servers where personal information can be seen (i.e.
Webservers, SMTP
servers).
A good way to protect your network against sniffers is to segment it as much as possible using
of regular hubs. Switches have the ability to segment your network traffic and prevent every system
being able to “see” all packets. The drawback to this solution is cost. Switches are two to three times
hubs, but the trade-off is definitely worth it. Another option, which you can combine with a switched
environment, is to
use encryption. The sniffer still sees the traffic, but it is displayed as garbled data. Some drawbacks
of using encryption
are the speed and the chance of you using a weak encryption standard that can be easily broken.
will introduce delay into your network. Typically, the stronger the encryption, the slower the
communicate. System administrators and users have to compromise somewhere in the middle. Even
3
WAR10CK
administrators would like to use the best encryption on the market, it is just not practical in a world
as a profit taker, not a profit maker. Hopefully the new encryption standard that should be out
Encryption Standard), will provide strong enough encryption and transparency to the user to make
everybody happy.
Some form of encryption is better than no encryption at all. If a cracker is running a sniffer on your
that all of the data that he (or she) is collecting is garbled, then most likely they will move on to
use encryption. But a paid or determined hacker is going to be able to break a weak encryption
standard, so it is better to
play it smart and provide the strongest encryption as long as it will not have everybody giving you
AntiSniff
In 1999, our buddies at L0pht Heavy Industries released a product called Antisniff. This product
network and determine if a computer is running in promiscuous mode. This is a helpful tool because
if a sniffer is
detected on your network, then 9 times out of 10, the system has been compromised. This
Science Department at California State University – Stanislaus. Here is what they posted on their
4
WAR10CK
program has been found running on the Computer Science network. Sniffer programs are used to
capture passwords. In
order to protect yourself please change your password. Do not use a word out of a dictionary, put a
number on the end of a word or use proper names. Be inventive, use special characters and have 8
there are hundreds of similar postings on internal websites throughout the world that don’t make it
Antisniff also helps you find those system administrators who run a sniffer to find out what is wrong
network, but forget to ask for authorization beforehand. If you need to run a sniffer, then you should
get permission in
writing. If your Security Administrator is running Antisniff, then there is a good chance they will find
explain why you are running a sniffer without authorization. Hopefully your security policy has a
At the time of this writing, Antisniff version 1.021 is the current release. There is a nice GUI available
for Windows
95/98/and NT machines. A command line version is also available for Solaris, OpenBSD, and Linux.
only works in a “flat non-switched” environment. If your network is designed with routers and
does not have the same functionality as in a non-switched environment. You can only use it on local
cross a router or switch. According to Lopht’s website, the next major release of Antisniff will have
5
WAR10CK
if a computer is running in promiscuous mode over routers and switches. The next release of
more beneficial to system administrators because the price of switches are coming down and most
companies are
upgrading to switches to obtain 100/Full Mbps speeds. Even though you have a totally switched
not out of the water. There are still firewalls, proxies, webservers, ftp servers, etc. where crackers
install a sniffer and capture data locally. The only difference is, you have taken away their ability to
network.
Antisniff can also be used by blackhats to find intrusion detection systems. If they know where your
intrusion detection
systems are, then they can become stealth attackers, causing you much pain because you just spend
$150,000 on a new
so is the attention of
Why Linux?
Majority of servers around the globe are running on Linux / Unix-like platforms
6
WAR10CK
There are many types of Linux -Distributions /Distros / Flavors such as Red Hat, Mandrake, Yellow
Dog, Debian
etc.
Easy to modify.
Linux is an operating system that can be downloaded free and "belongs" to an entire community of
corporate entity. With more and more people looking for an alternative to Windows, Linux has
recently grown in
popularity and is quickly becoming a favorite among major corporations and curious desktop users.
users a choice of operating systems, it also proves itself valuable with its power, flexibility, and
reliability.
Linux supports most of the major protocols, and quite a few of the minor ones. Support for Internet,
Novell, Windows,
and Appletalk networking have been part of the Linux kernel for some time now. With support for
Simple Network
Management Protocol and other services (such as Domain Name Service), Linux is also well suited to
serving large
networks. Since Linux was developed by a team of programmers over the Internet, its networking
high priority. Linux is capable of acting as client and/or server to any of the popular operating
Linux is an implementation of the UNIX design philosophy, which means that it is a multi-user
7
WAR10CK
advantages, even for a system where only one or two people will be using it. Security, which is
sensitive information, is built into Linux at selectable levels. More importantly, the system is
designed to multi-task.
Whether one user is running several programs or several users are running one program, Linux is
traffic.
Another huge advantage of an open system is a large number of software authors and beta testers.
software testing and refinement process faster and better. Because there is not a lot of commercial
most software written for Linux is written because the authors want to do it and there need be no
compromise of quality.
Linux is "Free" in two senses. In one sense, the Linux consumer is free to modify the system and do
anything he or she
wishes with it. In another sense, acquiring Linux does not necessarily require any cash outlay at all.
There are two very popular methods for acquiring and distributing Linux: FTP and CD-ROM. Most of
distributions (Red Hat, Debian, Slackware, Caldera) are available for free download from several
Linux is one of the more stable operating systems available today. This is due in large part to the fact
written by programmers who were writing for other programmers and not for the corporate system.
8
WAR10CK
two mature program packaging standards in the Linux world - SuSE and Mandrake. Debian and Red
own packaging systems; both will check dependencies, both can upgrade an entire running system
makes it easy to upgrade parts or all of a system, as well as add new software, or remove unwanted
software.
Scanning Networks
Once the IP address of a target system is known, an attacker can begin the process of port
holes in the system through which the attacker can gain access.
A typical system has 2^16 -1 port numbers and one TCP port and one UDP port for each number.
Each one of these ports are a potential way into the system.
Scanning helps one to know what services are running on a machine. This will show the open ports
listening for connections. Once the targets are identified, an intruder is able to scan for listening
ports.
Port scanning is the process of connecting to TCP and UDP ports on the target system to determine
running or in a listening state. Identifying listening ports is essential to determine the type of
1. TCP connect scan: This type of scan connects to the target port and completes a full three-way
handshake (SYN,
9
WAR10CK
2. TCP SYN scan: This is also called half-open scanning because it does not complete the three-way
handshake,
rather a SYN packet is sent and upon receiving a SYN/ACK packet it is determined that the target
machines port is
in a listening state and if an RST/ACK packet is received , it indicates that the port is not listening.
3. TCP FIN scan: This technique sends a FIN packet to the target port and based on RFC 793 the
4. TCP Xmas Tree scan: This technique sends a FIN, URG and PUSH packet to the target port and
the target system should send back an RST for all closed ports.
5. TCP Null scan: This technique turns off all flags and based on RFC 793, the target system should
6. TCP ACK scan: This technique is used to map out firewall rule sets. It can help determine if the
firewall is a simple
packet filter allowing only established connections or a stateful firewall performing advance packet
filtering.
7. TCP Windows scan: This type of scan can detect both filtered and non-filtered ports on some
systems due to
8. TCP RPC scan: This technique is specific to UNIX systems and is used to detect and identify Remote
Procedure Call
9. UDP scan: This technique sends a UDP packet to the target port. If the target ports responds with
10
WAR10CK
an "ICMP port
unreachable" message, the port is closed, if not then the port is open. This is a slow process since
UDP is a
connectionless protocol; the accuracy of this technique is dependent on many factors related to
utilization of
UDP Scan
Fingerprint
Nmap is covered under the GNU General Public License (GPL) and can be downloaded free of charge
from
http://www.insecure.org/nmap. It comes as tarred source as well as RPM format. The usage syntax
of Nmap is fairly
simple. Options to nmap on the command-line are different types of scans that are specified with
for example, is "-sP". Options are then specified, followed by the hosts or networks to be targeted.
Nmap's functionality is
11
WAR10CK
Nmap is flexible in specifying targets. The user can scan one host or scan entire networks by pointing
Nmap to the
network address with a "/mask" appended to it. Targeting "victim/24" will target the Class C
network, whereas
"victim/16" will target the Class B. Nmap also allows the user to specify networks with wild cards, as
in 192.168.7.*, which
is the same as 192.168.7.0/24, or 192.168.7.1,4,5-16 to scan the selected hosts on that subnet.
Users are able to sweep entire networks looking for targets with Nmap. This is usually done with a
"-sP" flag. A TCP "ping" will send an ACK to each machine on a target network. Machines that are
respond with a TCP RST. To use the TCP "ping" option with a ping scan, the "-PT" flag is included to
target network.
Nmap has been covered in detail in module three and readers are advised to refer to that to learn
(http://packetstorm.linuxsecurity.com/Crackers/)
It will find any passwords that match words in the dictionary file the user provides, but it won't
apply any
12
WAR10CK
Xcrack (http://packetstorm.linuxsecurity.com/Crackers/)
Xcrack is a simple dictionary based password cracking tool. It will find any passwords that match
file the user provide. It does not generate permutation combination of the words provided in the
dictionary to arrive at
the right password. For this reason, it is a comparatively faster tool, though efficacy might be less.
Assistant)
http://www-arc.com/sara
The Security Auditor's Research Assistant (SARA) is a third generation Unix-based security analysis
tool that
Getting SARA up and running is a straight forward compilation process, and the rest is done via a
browser.
SARA (Security Auditor's Research Assistant), a derivative of the Security Administrator Tool for
Analyzing Networks
(SATAN), remotely probes systems via the network and stores its findings in a database. The results
When no primary_target(s) are specified on the command line, SARA starts up in interactive mode
13
WAR10CK
When primary_target(s) are specified on the command line, SARA collects data from the named
hosts that it discovers while probing a primary host. A primary target can be a host name, a host
address, or a network
number. In the latter case, SARA collects data from each host in the named network.
SARA can generate reports of hosts by type, service, and vulnerability by trust relationship. In
that explain the nature of vulnerabilities and how they can be eliminated.
By default, the behavior of SARA is controlled by a configuration file (config/sara.cf). The defaults
Linux Rootkits
One way an intruder can maintain access to a compromised system is by installing a rootkit.
A rootkit contains a set of tools and replacement executables for many of the operating system's
critical
components, used to hide evidence of the attacker's presence and to give the attacker backdoor
access to the
system.
Rootkits require root access to to install, but once set up, the attacker can get root access back at
any time.
Conventionally, UNIX and Linux have been known to have rootkits built, as the intruder is aware of
14
WAR10CK
A brief review: Rootkits appeared in the early 90's, and one of the first advisories came out in Feb
from CERT-CC addressed "Ongoing Network Monitoring Attacks" CA-1994-01 revised on September
have increased in popularity since then and are getting increasingly difficult to detect. The most
used for SunOS and Linux operating systems. Rootkits contain several different programs. A typical
Ethernet Sniffer, which is designed to sniff out passwords. Rootkits can also include Trojan programs
used as backdoors
such as inetd or login. Support programs such as ps, netstat, rshd, and ls to hide the attacker
directories or processes.
Finally, log cleaners, such as zap, zap2, or z2, are used to remove login entries from the wtmp, utmp,
Some rootkits also enable services such as telnet, shell, and finger. The rootkit may also include
other files in the /var/log and var/adm directories. Using the modified programs of ls, ps, and df
intruder can "hide" his/her files and programs from the legitimate system administrator.
The intruder next uses programs within the rootkit to clean up the extensive log files generated from
the initial
vulnerability exploitation. The intruder then uses the installed backdoor program for future access to
the compromised
system in order to retrieve sniffer logs or launch another attack. If a rootkit is properly installed and
the log-files are cleaned correctly, a normal system administrator is unaware that the intrusion has
15
WAR10CK
The most severe threat to system security that can be caused by a rootkit comes from those that
Kernel Module) trojans. Loadable Kernel Modules are a mechanism for adding functionality to an
operating-system kernel
without requiring a kernel recompilation. Even if an infected system is rebooted, the LKM process
during boot-up just like any other kernel module. Loadable Kernel Modules are used by many
The LKM rootkits facilitate the subversion of system binaries. Knark, Adore, and Rtkit are just a few
available today. As they run as part of the kernel, these rootkits are less detectable than
conventional ones.
The goal of backdoor is to give access to the hacker despite measures by the compromised system's
administrator, with
least amount of time and visibility. The backdoor that gives local user root access can be: set uid
programs, trojaned
Set uid programs. The attacker may plant some set uid shell program in the file system, which when
Trojaned system programs. The attacker can alter some system programs, such as "login" that will
Cron job backdoor. The attacker may add or modify the jobs of the cron while his program is running
16
WAR10CK
root access.
The backdoor that gives remote user root access can be: ".rhost" file ssh authorized keys, bind shell,
trojaned service.
".rhosts" file. Once "+ +" is in some user's .rhosts file, anybody can log into that account from
anywhere without
password.
ssh authorized keys. The attacker may put his public key into victims ssh configuration file
"authorized_keys", so
Bind shell. The attacker can bind the shell to certain TCP port. Anybody doing a telnet to that port
will have an
interactive shell. More sophisticated backdoors of this kind can be UDP based, or unconnected TCP,
or even ICMP
based.
Trojaned service. Any open service can be trojaned to give access to remote user. For example,
program creates a bind shell at certain port, or trojaned ssh daemon give access to certain password.
After the intruder plants and runs the backdoor, his attention turns to hiding his files and processes.
be easily detected by the system administrator - especially if the system is running tripwire.
Let us see how a LKM rootkit helps achieve the attacker's needs.
In the case of LKM trojaned rootkits, the attacker can put LKM in /tmp or /var/tmp, the directory
administrator cannot monitor. Moreover, he can effectively hide files, processes, and network
17
WAR10CK
modify the kernel structures, he can replace the original system calls with his own version.
To hide files. Commands like "ls", "du" use sys_getdents() to obtain the information of a directory.
To hide processes. In Linux implementations, process information is mapped to a directory in /proc
file system. An
attacker can modify sys_getdents() and mark this process as invisible in the task structure. The
normal
To hide network connections. Similar to process hiding, the attacker can try to hide something
inside
/proc/net/tcp and /proc/net/udp files. He can trojan the sys_read () so that whenever the system
files and a line matching certain string, the system cTo redirect file execution. Sometimes, the
intruder may want to replace the system binaries, like "login", without
changing the file. He can replace sys_execve () so that whenever the system tries to execute the
"login" program,
To hide sniffer. Here we refer to hiding the promiscuous flag of the network interface. The system
call to Trojan in
To communicate with LKM. Once the hacker has his LKM installed, he will attempt to modify some
system calls
such that when a special parameter is passed, the system call will be subverted.
To hide LKM. A perfect LKM must be able to hide itself from the administrator. The LKM's in the
18
WAR10CK
in a single linked list. To hide a LKM an attacker can just remove it from the list so that command
such as "lsmod"
To hide symbols in the LKM. Normally functions defined in the LKM will be exported so that other
them. An attacker can use a macro and put it at the end of LKM to prevent any symbols from being
exported.
o LSOF (ftp://vic.cc.pudue.edu/pub/tools/unix/lsof)
o Netcat (http://www.atstake.com/research/tools/index.html)
Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or
UDP
protocol.
o Hping2 (http://www.kyuzz.org/antirez/hping/)
hping2 is a network tool able to send custom ICMP/UDP/TCP packets and to display target replies
like
o Nemesis (http://www.packetninja.net/nemesis/)
The Nemesis Project is designed to be a command-line based, portable human IP stack for
Unix/Linux
Physical Security
o It is ideal to restrict physical access the computer system so that unauthorized people don't get to
misuse
the system.
Password Security
o Ensure that system does not accept null password or other defaults
Network Security
$ cat: ALL: ALL" >> /etc/hosts.denyall will not reveal the network connection.
o Ensure that only essential services are running. Stop unused services like sendmail, NFS etc
$ chkconfig --list
o Verify system logs at regular intervals to check for suspicious activity - (System logs in
/var/log/secure)
o Update packages as and when available at the Update site of the vendor.
20
WAR10CK
21