next up previous contents
Next: 7.2 Practical Up: 7. Network Security Solutions Previous: 7. Network Security Solutions

Subsections

7.1 Theory

7.1.1 Firewalls

Firewalls are a means of preventing unauthorized and unwanted access to our networks. A firewall is analogous to a moat that is dug around a castle to protect those on the inside. The security intrinsic in the design of the firewall (and the moat) is that there is a single access point into and out of the network[31]. All traffic going inside and outside the network can therefore be checked and policed. These checks can be conducted in one of two ways, or both combined. The first method checks at a packet level on a host and network basis. The second method checks at the application level. The packet level check is called packet filtering while the other is called application gatewaying/proxying. Let us continue to discuss them in greater detail.

7.1.1.1 Packet Filtering

As introduced, packet filters work at a packet level. They have no concept of users or actual information. All they know about are packet types, where they originate and where they are destined. Blocking using packet filters is therefore a matter of ``not allowing host X to send ICMP message'' for example. Packet filtering is typically performed using some form of router. The router is placed between the outside world, and the network(s) to be protected.

 
Figure 7.1: Packet Filtering
\resizebox*{9cm}{!}{\includegraphics{filtering.ps}}


Figure 7.1 illustrates part of the working mechanism of packet filtering. A host from outside our network, SRC, uses the ``ping'' program to find out if the firewall itself or host behind it is operational. The packet filter denies the ICMP message. Telnet connections are allowed however. Host SRC tries to connect to DST inside the network. Since telnet connections from anywhere are allowed, the packet filter lets the packets through. The firewall simply acts as a police-man, examining every (incoming in our case) packet to see if it should be allowed through the ``border''.

Working at a packet level is advantageous in that it allows discrimination by source and destination addresses. Packet filters can be used to protect against most network attacks such as Blind IP spoofing and ICMP tunnelling. Not only can filtering be done on source and destination address fields but also on the source and destination ports. Different packet types can be individually discriminated. For example, telnet access could be denied to everyone outside of our network to all our servers except for a single secure host. In so doing, we not only protect networks or hosts themselves, but also provide some protection for the services that run on those servers.

As mentioned previously, the filtering router is placed between the dangerous and the protected networks. A single access router can therefore be used to protect the entire network. Another advantage of packet filtering is that it is completely user independent. Users do not have to install new custom software in order to be able to work with the firewall.

Packet filters have some disadvantages, however, three of which are listed below:

7.1.1.2 Application Proxying

This method of filtering works at the application level. Services are restricted based on authentication and authorization. There are two levels at which the authentication can be done. One form of authentication is based on the source address of connection. After the source address has been seen to be from an authorised host, the authentication procedure begins. This stage of the procedure is the part that requires a login name and password pair.

 
Figure 7.2: Application Proxying
\resizebox*{9cm}{!}{\includegraphics{appproxy.ps}}


Let us consider figure 7.2 in order to describe how application proxies work. CLIENT wants to connect to SERVER's telnet port. The connection is not allowed unless it goes through the application gateway. CLIENT authenticates himself on the application proxy. When authenticated connection is made on CLIENT's behalf to SERVER, all communication from SERVER is forwarded to CLIENT and vice versa as shown by label 1. From CLIENT's perspective it appears to be speaking directly to SERVER as shown with ``Virtual Communication'' above and the label 3. SERVER does not know about CLIENT and from its perspective, it looks like it is communicating only with the application proxy. The part of the circuit that is between the application proxy and SERVER, label 2, is both a real connection and an illusion. The illusion is SERVER thinking it is communicating only with the application proxy. The way the communication works is what is represented by the solid lines and marked ``Actual Communication''.

Application proxies are also useful in control access to resources outside the network. They can be used to restrict internal network user access to the Internet for example. Users who require access for business purposes would be awarded accounts on the application proxy. Whenever they needed to access the Internet, they would have to enter their login name and password pair. Users without valid accounts on the application proxying host would be denied the service.

With application proxies, it is possible to user-level charging. All traffic inbound and outbound is logged against a particular username. This offers an advantage over packet filtering methods, which can only do host-level charging. On multi-user machines, some users may use more resources than others. To fairly charge each user for his use of the resource, an application gateway is useful.

Proxying also has some disadvantages. Here too we will discuss only three.

7.1.2 Backdoors and Trojans

Access to backdoors and trojans is from outside the host to some port on the host. To prevent such backdoors and trojans, a method must be found to block ports and/or kill unknown programs bound to a local port. The blocking of ports > 1024 except for those really needed is a quick and dirty solution that will work. It however is not a perfect solution as it will also break something. When connecting to a service outside the host, a socket is created on a port (usually) > 1024 and used to connect to that host. By blocking ports > 1024, we may no longer be able to connect to other hosts' services. The backdoor is generally made use of from an outside host. We can therefore get around blocking our own outgoing packets by blocking connection originating from some other host to a port number on the local host > 1024.

Killing unknown programs bound to a local port is easily bypassed by using the execl() system call and is therefore inefficient and also ineffective. So far we have discussed solutions to access problems to backdoors but not trojans. Our solution for backdoors may not work since we mentioned that trojans are usually set up while in a privileged state. This means that the intruder can put his trojan on a port < 1024 and our filters will be ineffective in protecting us against it. The fundamental point to be noted still remains that by restricting access to the backdoor the trojan has set up, we may filter out unauthorized access. All that is needed to make our blocking solution work is to change our blocking specification to ``every service we do not require''. This would also block ports < 1024 and would therefore protect us against backdoors AND trojans.

7.1.3 Packet Sniffing

We mentioned that packet sniffing is possible because of the normal working operations of Ethernet. The part of the operation of Ethernet that makes it possible and easy to carry out such an attack is the configuration of the network. Most Ethernet networks are either in a bus or star configuration.

 
Figure 7.3: Bus and Star configurations of Ethernet
\resizebox*{6cm}{!}{\includegraphics{bus.ps}} \resizebox*{5cm}{!}{\includegraphics{star.ps}}


As can be seen from figure 7.3, all the hosts share the medium. In the case of the star conformation, the hub broadcasts all packets to all other hosts/ports connected to it. This is what introduces the problem. Our first solution lies in the conformation of the network and our second in the kind of data being sent down the line. The first solution is to use a switched network; the second is to encrypt data going down the ``wire''.

7.1.3.1 Switched Network

The switched network is just a variation of the star topology but instead of a hub in the centre, there is a switch. There is still a central ``device'' in the centre connecting all the different hosts on different ports. The difference here is that the central device has some added intelligence in that it knows the ethernet addresses of the hosts that are connected to its ports. Information destined for a particular host (say 1) from another (say 4) is not broadcast to everyone but goes from the source host and is transmitted only to the destination host. Another advantage of the switch is that it allows multiple conversations to carry on at the same time compared to the ``one at a time'' rule of the bus and hub.

7.1.3.2 Encryption

This solution is the cheaper one to implement but is probably harder to implement than our first. Encryption can happen at two levels, application or link layer. Link layer encryption is the more secure of the two options but would require the abandonment of the standard TCP/IP. All information going through the medium using a link layer encryption protocol would be encrypted. Application level encryption uses applications to provide encryption. A program called ssh (Secure Shell) provides application level encryption. The application level encryption is provided by providing a tunnel through which applications can have secure communication. Applications not running through the secure tunnel do not have their data encrypted. This means for example that one could telnet (insecure and sends cleartext passwords) through an ssh tunnel and the communication be uncompromised.

7.1.4 Port Scanning

7.1.4.1 Normal Scanning

A solution that has been in wide use has been to log port scans. What would then be done would be to mail the administrator of the host doing the scan asking him to investigate and generally bring it to a halt. This solution worked quite well for a while. The first reason is that the scans themselves were easy to log. The second was that the administrators on the other end were usually quite helpful. In any case, the above solution had to work as there was no other devised!

7.1.4.2 Stealth Scanning

When thinking of a solution for this type of scanning, one has first to consider how to detect it. After SYN-flag scanning became popular, programs such as ``SYNlog'' were distributed to log SYN-flag scans. As far as we are aware, there is no method that has been devised to log ACK and FIN based scanning techniques. As noted in the statement of the problem of stealth scanning however, those types of scanning are based on bugs in networking software. A solution to them remains to correct the bug in the networking software of most operating systems.

7.1.4.3 Global Solution

From the discussions above, one of the global ``solutions'' seems to be the logging and reporting of port scans. There is however a better solution to the problem. A kernel patch (ktcpd-strobemasker-1.4) that not only logs but also does not report on the ports that are open. This means that the port scan fails because it appears that there are no open ports on the host being scanned. This is a good solution since it discourages the intruder from further port scanning.

7.1.5 Denial of Service

In Linux, the ping of death vulnerability was fixed with a kernel patch. Port flooding is another problem that needed a solution. With normal port flooding, as with normal port scanning, detection is easy. As with port scanning again, the logs were mailed to the administrator of that system. The problem of SYN flooding was also ``fixed'' in this manner, using SYNlog to log the packets.

The Linux kernel was modified to include SYN and RST cookies. These are cryptographic challenges presented to the user who wants to login when a portscan is in process. Both cookies prevent the ``Denial of Service'' part of the attack. The kernel patch presented above as a global solution to port scanning also solves the problem of port flooding. In addition to not showing ports and logging the connections, it detects when the host is being flooded and ignores connections from that host for a configurable amount of time.

7.1.6 IP Spoofing, Hijacking and Associated Problems

7.1.6.1 Trust

A solution to the problem of trust remains not to trust. In a networking environment, the solution is clearly unacceptable. A solution along the same lines but a little less brutal is to trust only those who are known to be trustworthy. Although this solution sounds reasonable, the complication is to find out who can be trusted. The solution is complicated even further by security problems. Although we know we can trust the administrator of host A, if the host has been compromised or faked, we can no longer trust anyone from that host. Since we can never know until discovery that a host that we trust has been compromised, the above solution does not hold much water either. The best solution to the problem seems to trust cautiously or reasonably. That is, to trust in a way that is not fatally wounding/damaging. In other words, trust is extended if and only if it will not be fatally damaging if the person we trust turns out to be an intruder.

7.1.6.2 IP Spoofing

In the problems section of IP spoofing we introduced the problems of stealing of IP addresses and session hijacking. We noted that stealing IP addresses is possible with ARP. We also noted that ARP itself is vulnerable to attack. One of the solutions we have to find is how to get arp to be less vulnerable to attack. This would make stealing of IP addresses a lot harder, tending towards impossible. A solution to session hijacking, although theoretically fixed by fixing ARP, still needs defining. The solution lies in encryption. There also exists a solution to both of the above-mentioned problems.

ARP provides a dynamic solution to finding out who owns a particular IP address. The solutions to ARP spoofing may include:

1.
Making the protocol a state machine and only accepting responses to queries it has sent out
2.
Abandoning it
3.
Hardcoding ethernet-to-IP address maps of servers and trusted hosts.
The first two of the possible solutions are undesirable. Part of the protocol's dynamic nature is dependent on the fact that it can ``learn'' addresses and update its tables without having to have sent out a request for each address. The protocol was devised to avoid keeping tables of ethernet-to-IP address mappings of all hosts we will want to talk to. Abandoning the protocol is therefore also inadvisable. Our third option for a solution seems to be the best one. It should be noted that the addresses we will hardcode will be permanent. This however does not prevent an unlearned address from being learned. The basic fact here remains that the hosts that are trusted and have a high potential of being spoofed are hardcoded, while for the rest of the hosts, the protocol works the same. To prevent ARP spoofing altogether, all addresses would have to be hardcoded. The above has already been established as an undesirable.

Encryption is a step in the right direction towards solving the problem of session hijacking. To take the session over, the intruder would have to know which encryption system is in use for that connection. For software packages such as ssh, finding the algorithm for the encryption used is not hard as it is included in the ssh package. It should be apparent that even with this basic form of encryption in place, we are still vulnerable to session hijacking attacks. A better form of implementing encryption would be a challenge based system. It would work something like the following (all data exchange is encrypted) :

% Text(A) means that we encrypt A with Text.                           

 HOSTA                   HOSTB                   DIRECTION       ALGORITHM

1: B-Host-Key(I'm A)                              ---->          RSA

2:                        A-Host-Key(Prove it)    <----          RSA

3: B-Host-Key(password)                           ---->          RSA

4:                        A-Host-Key(Our Key)     <----          RSA

5: Our-Key(Command)                               ---->         IDEA

6:                        Our-Key(Response)       <----         IDEA

HOSTA wants to connect to HOSTB, and, using HOSTB's host key to encrypt the message, claims to be HOSTA (1). HOSTB responds by challenging HOSTA to prove this (2). The challenge is encrypted with HOSTA's host key. HOSTA responds with his password (3). HOSTB checks that it is valid and creates a session key. The session key is encrypted with HOSTA's host key and sent to HOSTA (4). When HOSTA gets the key, it changes to the IDEA algorithm and encrypts all subsequent messages to HOSTB with the session key (5). HOSTB also encrypts its responses with the session key (6). The process works similarly to public key cryptography.

The solution that would complicate both ARP spoofing and session hijacking is switching. Let us consider figure 7.4.

 
Figure 7.4: Packet Switched Network
\resizebox*{9cm}{!}{\includegraphics{star2.ps}}


Consider a conversation between the hosts numbered 1 and 2 in figure 7.4. If host 3 wanted to look in on what was being said, it could not because the switch isolates the connections. For ARP spoofing, an intelligent switch is needed. When host 3 pretends to be host 2, the switch should identify that host 2 is not on that port and not allow host 3's message. This is also the case with session hijacking. When host 3 pretends to be host 2, at the right time and with the right sequence numbers to oust host 2, the switch will not let the message through to host 1 as host 2 is not on the port host 3 is on. Although the above solution solves the problem rather efficiently, hardcoding of addresses may be needed. This is undesirable for a dynamic network.

7.1.6.3 Blind Spoofing

There is a simple solution to the problem of blind spoofing. Let us have another look at the diagram representing what we try to accomplish with blind spoofing, figure 7.5.

 
Figure 7.5: A Blind Spoofing Attack
\resizebox*{9cm}{!}{\includegraphics{blind.ps}}


The solution to the problem is based on the fact that there is a router between the network we are on and the network we are trying to get into. The router in the above diagram seems to have two interfaces, one connecting the network to be exploited and the one we are on. Currently, the router allows us to send packets to Server pretending to be real. The solution lies in the router not allowing us to pretend to be real. Since we are on a different interface, and perhaps different subnet, to real, the router can very easily determine from which side the traffic is originating. When pretending to be real, we would then be stopped since we are not connected to the right interface or subnet.

7.1.6.4 Network File System

NFS has very weak authentication. This, and the fact that it is very susceptible to misconfigurations makes it very dangerous. For some, its usefulness and ease of working is unmatched. Solutions are therefore needed for the security problems.

The first solution is to export file systems as read only. If this curbs the use of NFS, then read-write access may be preserved but only by unprivileged users. The exported file system should fall in a directory or partition where privileged accounts have no taps. By this we mean, for example, that no privileged account home directories should be in the exported file system. It may therefore also be useful to take all administrators' home directories and keep them off the exported file system, since they may have sensitive information. This solution curbs the security problems that arise from using the protocol and not its vulnerability to IP spoofing attacks.

The second solution is one commonly referred to as ``throwing money at the problem''. It involves the use of some equipment to prevent NFS requests from dangerous parts of the network. This equipment is usually a router or a PC that plays the role of a router. The effect is that all trusted hosts fall on the same segment (usually the backbone) and are allowed to send NFS requests and responses to each other. Every other host that is outside that segment or subnet of the network is not allowed to send NFS to hosts in that segment. The scenario described above is shown in figure 7.6.

 
Figure 7.6: Routers blocking NFS traffic to backbone servers from outside the backbone
\resizebox*{9cm}{!}{\includegraphics{blocknfs.ps}}


The final solution we will discuss to the problem is to provide another form of authentication for NFS clients. If for example, a directory is exported read-only, NFS's current form of authentication is sufficient. If however, a [root] read-write directory is exported, a new way of authentication is needed. Each host that is allowed to mount this exported file system would have an entry in a password file. When the host tries to mount the file system, it also opens a random port. This random port is then connected to the NFS server's password-server-port. The client enters his password and if it is correct, the server's password daemon will send a message to its NFS server to allow the connection. For added security, the connection to the password-server-port of the NFS server would be tunnelled using ssh. This potential solution to the problem breaks the NFS protocol. This breach of protocol seems reasonable in light of the security it provides.

7.1.6.5 Network Information System

The solutions to ARP spoofing and the final proposed solution to NFS spoofing are applicable to NIS. As discussed in the statement of the problem with NIS, the scenarios for NFS and NIS spoofing are not the same. With NFS, depending on how the file system is exported, the client or the server can be compromised and the same effect achieved. On the other hand, NIS server spoofing is the main method of defeating NIS. By hardcoding the Ethernet address of the NIS server, clients would quickly note a faked NIS server. The intelligently switched network environment that provides a layer of protection for ARP provides a working solution for NIS too.

The final proposed solution for NFS spoofing above suggests another way in which potential NIS server spoofs may be prevented. The way the solution was proposed has been changed in order to fit in with the NIS requirements. In this solution, each client keeps a password file with the server's name and password in it. The password-server-port is thefore on the NIS clients. When the NIS clients requests the password map from the NIS server, the NIS server opens a random port and connects to the password-server-port on the NIS client. The NIS server then sends its password to the NIS client/password-server. If the password is correct, the NIS client is told to accept the password map as valid. When an intruder machine pretends to be the NIS server, we assume it will not know about the password-server and/or the password for the legitimate NIS server. As with the NFS version of this solution, the authentication connection can be (and should be) tunnelled for extra security.

7.1.6.6 The r* family of commands

A solution to the threats posed by the r* family of commands may be to use them in an ssh tunnel. Although this sounds like a very good idea, it is a redundant solution. Ssh provides for all the functions that were performed by r* commands. The best solution for prevention of spoofing attacks on r* commands is to disable them and to use ssh.

7.1.6.7 Route Spoofing

The proposed ARP spoofing solutions are also applicable to route (especially ICMP-route) spoofing. Hardcoding the ethernet addresses of routers on directly connected networks would help in preventing route spoofs. When a routing message from a fake host is received by a host, its Ethernet address will differ from that stored for the router in the permanent table. The message will then be ignored. If the legitimate router sends routing information however, the Ethernet address on the packet and that in the table will match. The host will then honour the routing information message. It should be obvious that this is a minor extension from hardcoding trusted host ARP entries. If ARP hardcoding is already in effect, the only check that will be required would be verification that the sending host is a default router. The check is implemented by default. All that is required therefore is ARP hardcoding.

The second solution proposed for ARP spoofing involved the use of an intelligent switch. The same solution could be deployed in this case. In the same way that in the case of ARP it stopped hosts faking ARP entries, it would stop hosts faking route information. Again, the same solution is applicable for both the ARP spoof and the route spoof.

7.1.6.8 DNS Spoofing

The issue of DNS spoofing is mainly dependent on how secure the host and its software is. By ensuring the security of those two components, DNS spoofing becomes a smaller issue. Ensuring that there are no user accounts on the DNS server lowers the risk of host security attacks. Running the DNS software as an unprivileged user lowers the risk of software vulnerabilities. DNS is a distributed system and this is one of the complications when trying to prevent attacks. However, its distributedness also gives rise to a possible solution to DNS spoofing. The solution is based on the fact that most servers only keep one of the two maps used for resolving addresses. On most servers, the forward resolve (hostname to IP-address) maps are kept in one place and the reverse lookup tables kept elsewhere. A DNS system set up in this way needs two different DNS servers to be compromised for the attack to work properly. A solution, counting on the fact that an intruder will not compromise both DNS servers, checks each query.

If the client wishes to find the address for foo.bar.com, the fake DNS server may return the address 1.1.1.1. When the client gets this response, he asks for the reverse lookup. In other words, asks for the name associated with 1.1.1.1. The nameserver authoritative for that address (vs name) space will respond with the correct name of that host. If there is an inconsistency, the response from the first DNS is regarded as a fake. Programs using this form of checking are very effective in identifying potentially faked DNS responses to their queries. These programs include TCP wrappers, by Wietse Venema [34].

7.1.7 ICMP Tunnelling

To this problem, there is no easy solution. As mentioned in our statement of the problem of ICMP tunnelling, there are currently no efficient checks for testing the payload sections of ICMP packets. A solution to this problem may be to implement such checks for the payload. This solution however would make the ICMP messaging system slow and inefficient. It is also not clear how an efficient check for the payload may be implemented. If an integrity check is implemented, the data that may be tunnelled may be modelled so that it passes the check. The problem of ICMP tunnelling has been around for a long time. It may therefore be fair and logical to assume that the use of a payload checker is an improbable solution.

The second solution to the problem is harsh but effective. Instead of trying to find out what is inside an ICMP packet, this approach denies all ICMP traffic. All ICMP packets have the payload section and so to allow any type of ICMP packet would be opening a gate for ICMP tunnelling. The global ICMP block stops the problem of ICMP tunnelling but also blocks such programs as ``ping''. Our illustration of the problem of ICMP spoofing included a firewall. A solution that may not be as brutal as closing off all ICMP traffic would be to allow it only to the firewall, and not past it. People legitimately interested in whether the network behind the firewall is functional or not would probe the firewall. If the firewall is working, it is very probable that the network behind it is also operational. If the firewall has user accounts and its security is questionable, the blanket ICMP block may be the best solution.


next up previous contents
Next: 7.2 Practical Up: 7. Network Security Solutions Previous: 7. Network Security Solutions
Shaun Bangay
1998-11-19