We saw in Chapter 7 that the service access policy defines the TCP/IP protocols and services that are allowed or
In essence, a
packet-filtering rule
consists of two
The selection criteria of a packet-filtering rule use information typically found in headers to decide whether a particular IP packet should be selected or not, and whether the appropriate action specified in the action field of the packet-filtering rule should be taken.
The action field of a packet filter rule specifies the action to be taken if an IP packet meets the selection criteria and is selected by that rule. Two types of action are usually permitted:
BLOCK (or DENY) implies that the selected IP packet should be rejected and discarded.
PERMIT (or ALLOW) implies that the selected IP packet should be accepted and forwarded toward its destination IP address.
With regard to source and destination IP address, a selection criterion can work either with full IP addresses or address masks. Therefore, an address selection usually is accomplished by specifying two
It is worth mentioning that most packet-filtering
Suppose the IP packet is not selected by any of the rules, up to the last one. The last rule, however, specifies to discard all packets. So, the last rule takes effect, and the packet is discarded. Consequently, the default action for packet filtering in this case would be to discard the packet, unless
Packet filtering can be used in a variety of ways to block IP traffic from or to specific sites and network segments. For example, a site may wish to block connections from certain IP addresses that it considers to be untrustworthy or
As an example of a packet-filtering scenario, consider a service access policy that
|
|
|
No. |
Type |
Source Address |
Dest. Address |
Source Port |
Dest. Port |
Action |
|---|---|---|---|---|---|---|
|
|
||||||
|
1 |
TCP |
* |
123.4.5.6 |
> 1023 |
23 |
Permit |
|
2 |
TCP |
* |
123.4.5.7 |
> 1023 |
25 |
Permit |
|
3 |
TCP |
* |
123.4.5.8 |
> 1023 |
25 |
Permit |
|
4 |
TCP |
129.6.48.254 |
123.4.5.9 |
> 1023 |
119 |
Permit |
|
5 |
UDP |
* |
123.4.*.* |
> 1023 |
123 |
Permit |
|
6 |
* |
* |
* |
* |
* |
Deny |
|
|
The first rule allows TCP traffic from any source IP address and port number greater than 1,023 on the Internet to the destination address of 123.4.5.6 and port number 23 on the intranet. This port number is associated with the Telnet server, and all Telnet
In Chapter 2, we
The question on how to filter TCP/IP application protocols and services depends on the
In short, there are many TCP-based application protocols and services that can be effectively addressed with packet filters and screening routers. Examples include FTP, Telnet, SMTP, DNS, HTTP, and NNTP.
In regard to FTP, it is worth mentioning that two TCP connections are actually used between a client and a server: a control connection (port 21 on the server side) and a data connection (port 20 on the server side). It is up to the client to establish the control connection, whereas it is up to the server to establish backward the data connection. In an intranet environment, the data connection can
With regard to DNS it is also worth mentioning that the service can be based on TCP or UDP, and that it is usually provided at port 53 (in either case). The UDP-based service is usually used for queries, while the TCP-based service is used for server-to-server zone transfers. One implementation characteristic of the Berkeley Internet
Not all systems require general access to all services. For example, restricting Telnet or FTP access from the Internet to only those systems that actually require it can improve the overall security at almost no cost to
Unfortunately, there are also some TCP/IP protocols and services that cannot be addressed effectively with packet filters and screening routers:
Protocols and services that are layered on top of UDP are generally hard to handle with packet filters. This is because UDP is a connectionless transport layer protocol that does not establish and make use of connections. Each UDP is sent individually and there is no possibility to decide whether the application it actually belongs to is used inbound or outbound. This makes it very difficult to intelligently filter IP packets. Unfortunately, UDP is used by an increasingly large number of applications and application protocols,
Similarly, protocols and services that use dynamically assigned port
Obviously, protocols and services that combine the use of UDP and dynamically assigned port numbers are particularly hard to handle using packet-filtering techniques only.
We have mentioned the sequence number guessing and related IP spoofing attacks several times throughout the previous chapters of this book. We now have a brief look at the way a firewall and its packet-filtering component can be configured to protect against them. Remember that these attacks usually exploit the weakness that the source address of an IP packet header must not be
To protect against this kind of attack, the packet-filtering rules must be designed to discard any packet arriving at an inbound network interface that contains an internal source IP address. The reason is that a packet originating from the outside with the source IP address of an internal machine implies that the packet is somehow fraudulent. Consequently, the packet-filtering rules must specify to discard the packet. Suppose the network or firewall administrator has
|
Team-Fly
|