A firewall can distinguish desired from undesired network traffic using various methods, but not every product supports all of them.
Packet Filter Firewall
→ Main article: Packet filter
The task of a packet filter firewall includes blocking or allowing through network packets based on their network address. To do this, it evaluates the header information of the network packets.
Simple (stateless) packet filtering works on a firewall router with static rules and considers each network packet individually. It therefore does not establish any relationships with the previous network packets. In contrast, there is an advanced form of (stateful) packet filtering that captures such relationships by relying on the technique of stateful inspection. This further restricts access to the source system that requested a communication. A corresponding firewall is also classified as a pure packet filter firewall, at least as long as no (possible) proxy filters are installed on it.
Network addressing as the basis for packet filtering
Each network card has a unique, retrievable serial number called a MAC address. It is composed of a manufacturer identification number and an adjacent serial number.
Since these numbers are unique, they can be used for a simple but generally valid type of addressing in a network. Simple because, for example, a computer can be addressed in an unbranched network, but the MAC address cannot specify the computer's program for which the network packet is intended. Unbranched because the MAC address, due to its structure, is not suitable for being broken down into further sub-areas. An assignment of the addressee to a specific subnet is therefore not possible with the MAC address. In other words, MAC addresses can be used like house numbers, but cannot be assigned to a street or an inhabitant of the house.
The solution is provided by higher communication protocols that are placed over the MAC address. A network packet is therefore figuratively packaged several times, with the MAC address representing the outer packet and the other packets being inserted layer by layer in this packet. Within a TCP/IP network, the IP address forms the next higher protocol, i.e. the next packaging. It is several blocks of digits, comparable to a house address containing a street number and a house number (which part of the IP address symbolically represents the street number, more precisely the network ID, and which part represents the house number, more precisely the computer ID, is defined by the subnet mask). In such a network, the next higher protocol, i.e. the packaging after the IP address, represents the port. The port is comparable to a room number or a name tag. It determines for whom exactly "in the house" the packet is intended (more precisely: which program should receive the packet).
A firewall can evaluate all of this "packaging" and filter the network packets accordingly by deciding which requests are allowed and which are not based on a "who is allowed to access what" set of rules. However, this is usually only done from OSI layer 3, i.e. the IP address, since the MAC address information of the network packets changes when they pass through a router on their way through the network, for example.
Address filtering is the basic form of all other types of firewall. Filters that serve purely to filter network addresses, i.e. packet filters, are therefore also found on all other firewalls.
Firewall Router
A firewall router is classified as a packet filter firewall and is software installed on a router where it restricts the network connection. This type of firewall can appear in one-way transparent mode (router in NAT mode) or two-way transparent mode (router without NAT).
It is mainly associated with firewall devices that use static (stateless) packet filters, although strictly speaking a stateful inspection firewall can also be based on a router. Other types of firewall thus differ from a firewall router in that they at least offer a more precise form of packet filtering (stateful inspection) or are based on a different concept from the router, usually offering an extended form of filtering in addition to the packet filter (such as proxy firewall and personal firewall).
The firewall router is very fast compared to other types of firewalls with the same hardware.
OSI layers
The OSI layer model describes the design basis of communication protocols in computer networks. According to this layer model, a packet filter accesses OSI layer 3 (IP address) and 4 (port) from the header information of a network packet.
Example of a set of rules
→ Main article: Firewall rules
In the following exemplary filter rules, it should be noted that the filtering is not based on the content of the named protocols, but on the TCP or UDP ports belonging to the corresponding network service:
- Mail services (SMTP - TCP port 25, POP3 - TCP port 110 and IMAP - TCP port 143) are allowed from the Internet to the mail server in the DMZ.
- The mail server is allowed to send mails from the DMZ to the Internet via SMTP and to make DNS requests.
- Administration services (SSH, Remote Desktop, Backup - TCP port 22) to the mail server are allowed from the local network.
- All other packets in or out of the DMZ are written to a log file and then discarded.
The filtering decisions are made individually and independently for each packet. This type of filtering is implemented in many routers and Layer 3 switches today.
stateful inspection
→ Main article: Stateful packet inspection
In contrast to the static (stateless) packet filter, the firewall rule is specified dynamically for each connection request in order to restrict access to an established connection more precisely. In doing so, the firewall directly relates the return channel (destination to source system) to the previously established connection (source to destination system) and restricts access accordingly so that only the involved communication partners can access the connection. This is the basic function that all stateful inspection firewalls are capable of.
Special filters of numerous stateful inspection firewalls can also view the user data of a communication. This is useful, for example, for network protocols that use the user data to negotiate a second connection between the communication partners (see active FTP). The insight into the payload data allows the filter to further specify the address filtering of the packets, but unlike a proxy filter, it is not able to influence the connection itself (it cannot change the data).
Depending on the product, the stateful inspection firewall can also detect after a connection has been established whether and when the PC to be protected (more precisely, the client) communicates with the target system, with the firewall only allowing responses if this is the case. If the target system sends data that was not requested by the client, the firewall blocks the transfer even after the connection between client and target system has been established.
OSI layers
A packet filter based on the stateful inspection technique accesses OSI layer 3 (IP address), 4 (port) and possibly 7 (user data) of a network packet.
Possible functions
Depending on the configuration of the device on which the firewall software is installed and the firewall product, a stateful inspection firewall can provide the following features, among others:
- Protection against SYN flooding, e.g. through SYN cookies
- Discarding of faulty packets (e.g. conflicting TCP flags like SYN bits, ACK bits and sequence numbers)
- Protection against Ping of Death, Smurf attacks, Teardrop attacks or Land attacks
Proxy Firewall (also Application Layer Firewall)
In addition to the pure traffic data such as source, destination and service, the filters of a proxy firewall (also known as an application layer firewall) typically also consider the user data, i.e. the content of the network packets. In contrast to stateful inspection technology, which sometimes also accesses the user data depending on the product, the typical proxy filter does not simply pass on the network request of the source system to the target system. Rather, it establishes its own connection to the target system. Since it communicates with the target system on behalf of the requesting client, it can analyze the packets coherently and influence the connection. It is thus able to filter requests with regard to the communication flow of the user data and can decide which responses from the target system it passes on to the requesting client. In doing so, it can change the packet content as desired.
Technically, such a filter works as a communication partner intervening in the traffic, terminating the connections on both sides (they are two independent connections) instead of passing the network packets. The filter itself is a computer network utility that mediates in traffic, and is therefore also called a proxy server: As an active mediator, it behaves like a server to the requesting client and like a client to the other side, the destination system. Since it must know the communication protocol, it has its own filter for each higher communication protocol (HTTP, FTP, DNS, SMTP, POP3, MS-RPC, etc.) (this is why they are also called dedicated proxies). Among other things, they can prohibit unwanted protocol options, for example by not allowing BDAT, VRFY, etc. in an SMTP transaction. There can even be several dedicated proxies for one and the same protocol, for example, to filter different web services under HTTP; for example, one for each web application used in a company.
The generic proxy, also called circuit level proxy, is an exception. It is used as a protocol-independent filter on the proxy firewall, where it implements a port- and address-based filter module that also supports (possible) authentication for establishing the connection. The filter is not able to view the communication, to conduct it itself and to influence it, since it does not know the communication protocol.
See also: Web Application Firewall
OSI layers
A dedicated proxy as a filter that specializes in a specific protocol works as an intermediary utility and therefore accesses OSI layer 7 (application layer) (like any utility or application program). The circuit level proxy as a generic (protocol-independent) filter, on the other hand, uses OSI layer 3 (IP address), 4 (port) and, if necessary, 5 (for authentication for establishing the connection).
Note: Contrary to popular misunderstanding, the basic task of an application layer firewall is not to grant or deny certain applications (programs) access to the network. The name Application was merely derived from the application layer of OSI layer 7, which stands for the fact that a corresponding filter can look into the user data of the network packets. The task of restricting network access to applications that have authenticated themselves to the firewall usually falls (if at all) to the generic proxy filter, i.e. the filter that does not even use the application layer.
Borders: Tunneling Through
→ Main article: Tunnel (computer network)
In principle, any service can work on any port number. If TCP port 80 is enabled for HTTP in the set of rules, another protocol can still run over it. Only both communication partners (the client in the internal network as well as the service on the server from the external network) must be configured accordingly. An attempt to prevent this using the firewall can be made with application layer firewalls. They can examine the structure of the user data and block all packets that do not correspond to the protocol of the released service. However, each protocol is supposed to transmit data, so in this case the data just needs to be converted accordingly. If the software embeds the data to be transmitted in HTTP without violating the standard of the protocol, this firewall is also powerless against it (the remote station, the service on the server, must understand this type of conversion, however). A tunnel performs such a conversion. Manipulated data can, for example, be data streams packaged in image data.
Tunnels therefore provide a method to bypass the control of a firewall. Tunnels are also used to transport insecure network protocols using a secured and encrypted network protocol to prevent eavesdropping and tampering. This can be done, for example, through an SSH or VPN tunnel within a legitimately enabled connection.
Both OpenVPN and many SSH clients (e.g. PuTTY) are also able to establish a tunnel via an HTTP proxy, which should actually only forward websites. In addition, there is special tunnel software for protocols such as DNS or ICMP.
Skype in particular is an example of how well most firewalls can be bypassed from the inside out. As long as users from the internal network are able to access websites, the firewall administrator has technically little chance to prevent tunneling through due to the encryption. Thanks to whitelists that restrict access to certain servers, firewalls can at least make tunneling through much more difficult. Organizations sometimes augment the technical measures with organizational security measures, such as a ban on deliberate tunneling in the security policy that the employee must sign.
Transparent piercing of a firewall is also called firewall piercing.