Bypassing Firewalls Tools and Techniques
Bypassing Firewalls Tools and Techniques
Bypassing Firewalls Tools and Techniques
Abstract
This paper highlights a very important problem with network perimeter fire-
walls. The threat discussed is not exactly new, but neither is it widely recognised—
even amongst network security professionals.
Most commercial firewalls claim to be application layer devices, but they de-
rive very little useful information about the context of the application traffic that
passes through them. Malicious applications can misuse even the simplest pro-
tocols in a way that totally bypasses the firewall’s controls. This paper describes
the methods of simple protocol tunnels, and shows how they can be applied. It
also considers ways to counter this threat, and suggests that architectures based on
military security principles and IPSec can improve security dramatically.
1 Introduction
Firewalls are regarded as the primary defence mechanisms when connecting private
networks to the Internet. There are various types, but firewalls essentially control ac-
cess at the application and transport layers, often using application layer information
to make access control decisions. A firewall is there to stop unwanted traffic from the
Internet entering the protected network. In a similar way, it can also control traffic
flowing out on to Internet.
A firewall is a perimeter security mechanism. It has no control over what occurs on
the internal network. It simply screens any connections made between the inside and
the outside. The only information the firewall has about a particular connection, are the
source and destination addresses and port numbers. This is not enough to reason about
the information that is being communicated. Indeed, it is very easy to fool a firewall
1
into allowing a protocol that it is supposed to be blocking—either by changing the port
numbers associated with that protocol, or by using a protocol tunnel.
The remainder of this paper introduces protocol tunnelling and shows how easily
it can be used to bypass a firewall. It then goes on to consider how this threat can be
countered. The reader will notice that this discussion does not suggest ways of strength-
ening the firewall. It focuses instead on in-depth mechanisms, which complement the
perimeter firewall. These mechanisms are based on a combination of military-style
trusted systems, and on IPSec network security.
2 Protocol Tunnelling
A protocol tunnel encapsulates one protocol inside another. Tunnelling is a general
technique which can be used to carry a protocol across a foreign network. It is of-
ten used to join two isolated networks with a private bridge across a public network,
forming a VPN (Virtual Private Network). Most commonly, IP traffic is encrypted and
encapsulated in a TCP stream, which is carried across the public Internet between two
remote sites.
Any protocol can be exploited for tunnelling. The only requirement is that the
protocol is permitted by any firewall that sits between the tunnel end points. Protocols
like SMTP and HTTP generally satisfy this requirement. Others, like ICMP-ECHO
(the “ping” protocol), are also allowed by most configurations.
2
in conjunction with other software (such as SSH and Telnet) to provide unrestricted
access through a firewall. Users at sites with restrictive firewall policies can enable
protocols that are blocked by tunnelling them through HTTP.
The obvious problem caused by tools such as this is that the firewall policy no
longer dictates the overall security policy. Although users must take a conscious deci-
sion to invoke applications like htc and hts1 , it is ultimately the users who can decide
which particular protocols will cross the firewall.
1. If the client has messages to send, it makes an HTTP POST request to the server.
The messages are encoded and sent in the body of the request3. Otherwise,
2. if the client has no messages to send, it makes an HTTP GET request to the
server.
3. If the server has any messages to send, they are encoded and returned in the body
of the response.
1 These are GNU httptunnel’s client and server applications.
2 The name belies the fact that the software is actually rather complicated.
3 The client could instead use HTTP GET and encode the messages in the URL of the request.
3
Server Client
application application
HTTP
Request
Server Client
Response
libtunnel
The client can be configured to use a proxy, which allows it to work across an
application-layer gateway. In addition, the server can manage tunnels to multiple
clients simultaneously. The applications at each end of a tunnel use a simple API
[12] to read and write messages, and also to control some of the tunnel characteristics.
The Simple Tunnel library has been used in some example applications. One of
these is a remote socket library, called librsocket. It uses the messaging provided by
libtunnel to tunnel system calls to the network stack of the client. The librsocket API
[10] is very much like the standard socket API [11]. It was chosen because it is fairly
simple, very useful, and implemented on a wide range on platforms. But almost any
API on any machine can be tunnelled in the same way. The technique gives the attacker
full access to the resources of a remote host.
While protocol tunnelling is a very powerful tool to use against firewalls, an at-
tacker from outside must install client software on a machine behind the firewall. It is
fortunate for the attacker that there are a great many ways this could be done, either by
exploiting software vulnerabilities, or by social-engineering attacks. Some examples
might be;
Remote exploit. A remotely exploitable bug in a program, which lets the attacker ex-
ecute arbitrary code, may be used to bootstrap installation of a tunnel client.
Trojan execution. A user might be tricked into running a tunnel client, thinking it was
something else.
4
Viral infection. A virus which can infect executable programs may contain a tunnel
client. Even a macro virus might be made to carry a tunnel client, if the macro
has access to networking functions.
This list of attacks is certainly not exhaustive, but it should illustrate that the job of
installing malicious client software is not particularly hard. Within each category of at-
tack, there are scores of real examples—the reader will find many of these documented
in the archives of bugtraq4 and CERT5 .
To demonstrate a Trojan Horse attack, librsocket was used to build a special version
of the Mozilla browser. In the Macintosh version of this Trojan, this change required
the addition of a single line of code to the Mozilla source, and relinking with librsocket.
The resulting browser behaved in every way like a normal web client, except that it
also made regular connections to the tunnel server. Whenever a user ran the Trojan
browser, they unwittingly opened up the network stack of their machine for use by the
“attacker”.
5
3.1 Domains
Carroll and Landwehr [9] argue that the key characteristic of secure systems is their
ability to maintain domains for storage and processing. A domain is a set of informa-
tion, and authorisations for using that information. This notion stems from military
security. It is not critical how domains are maintained, only that they can be prevented
from interfering with each other, and from interacting with each other in ways that
would violate the security policy.
The mechanisms to support “maintaining domains” can be implemented both in
hardware and in software. Software controls can exist both at the system level and
within applications. What is critical however, is that the controls work properly. This
may seem obvious—but any flaws in low level mechanisms can completely undermine
those at higher levels.
There are various examples of how these ideas can be applied to networked sys-
tems. Dalton and Clarke [2] have suggested how to allow secure access to LAN ser-
vices from Internet hosts. Choo [1] shows how to extend this idea, by segregating the
internal network in to VPNs running at different sensitivity levels. These, and other
related schemes [3, 13], make extensive use of trusted systems like the CMW (Com-
partmented Mode Workstation).
A CMW adheres to the U.S. government criteria laid down in [4]. It it designed to
enforce military security policy regarding the use of classified information. The CMW
differs from a “conventional” workstation in several ways, including;
Privilege and authority. Rather than have a single “super-user”, the CMW has a set
of privileges and authorities which can be assigned to individual users and pro-
7 It can be overridden, but only with the correct privilege.
6
grams. In a normal Unix system, common programs like ping and xterm need to
run as root because they perform privileged operations. The ping program, for
example, needs to open a raw network socket in order to send ICMP datagrams.
On a CMW, ping only requires the privilege to open a raw socket.
Authority is a concept which gives different users the ability to run certain dan-
gerous programs. Any user can run the ping program, but only the user with the
right authority can mount or unmount filesystems. Authority allows administra-
tion of the system to be delegated to a number of different users, none of which
have complete control of the system.
Audit capability. Logging provides a way of to audit the operation of the system. A
CMW kernel logs all the system calls that processes make to it. This logging
cannot be disabled. In addition, the CMW provides a way for applications to log
their own actions in a secure way.
The object oriented Java programming language is another technology that sup-
ports “maintaining domains”. In present day implementations, Java does this entirely
within one application—the Java Virtual Machine (JVM). Because of this, the Java en-
vironment is vulnerable to faults in the underlying machine architecture. Java objects
are prevented from interfering with one another but, very often, faults in applications
that co-exist with the JVM can interfere with Java objects. Thus, security in Java still
depends on trusted underlying systems.
7
O/S IPSec
Network
Card
Host
8
entirely from the network side, from trusted hosts on the network.
4 Concluding Remarks
This work has demonstrated a particular weakness of all firewall designs. They can
offer protection against certain types of network attack, but not against others. In
particular a firewall cannot enforce an information security policy on the network it
protects.
As information, and the flow of information, becomes increasingly critical to organ-
isations, they will need to take additional measures to protect that information. These
need to be defence-in-depth measures, which compliment the protection offered by
the firewall. This work has highlighted technology which can provide these defences.
Most of this technology is taken from military information security. The challenge now
is to understand how it can be applied usefully in a business environment.
References
[1] T. Choo. Vaulted vpn: Compartmented virtual private networks on trusted oper-
ating systems. Technical report, HP Laboratories, 1999.
[2] C. Dalton and D. Clarke. Secure partitioned access to local network resources
over the internet. Technical report, HP Laboratories, 1998.
[3] C. Dalton and J. Griffin. Applying military grade security to the internet. Tech-
nical report, HP Laboratories, 1997.
[6] Jake Hill. Using a protocol tunnel to subvert a firewall. Technical report, BT
Laboratories, 1999.
9
[10] Manpage for rsocket(3N). Distributed with libtunnel.
10