Home > Articles > Security > Network Security

This chapter is from the book

Static Packet Filter

A packet-filtering firewall examines each packet against a set of rules. If the rules allow this type of packet through, then it is passed through, otherwise it is dropped or rejected depending on the specifications of the rule. When you choose to drop a connection, the firewall simply ignores the request to communicate. Like when you simply allow your phone to ring until the caller gives up, this leaves the remote host wondering if anything even exists at that location. Rejecting the connection request, on the other hand, is more like if you pick up the phone but immediately put it back down. The firewall, in this case, sends a reset packet to the remote host. The remote host then knows that there is something at the requested address, but that the specific type of connection is denied.

A packet filter must be set up with rules for every type of connection. To make life easier, you define a default final rule that says drop everything. Then you place the rules for allowed traffic above that rule. This way, you stop any traffic that you have not specifically allowed. As an example, let's consider that you have hired a doorman for a party you want to give. You supply the doorman with a list of people who are allowed to enter your party; if a person's name is not on the list, they are not allowed in. This is a much more effective method than trying to supply the doorman with a list of all the people you do not want at your party. If nothing else, the list will be shorter this way.

With a static packet filter, you must be sure to allow traffic back in for any type of traffic you allow out (or vice versa). If you allow your users to connect to Web sites (to port 80), but don't allow traffic from those Web sites (from port 80) back in, nothing will really be accomplished. This requirement can lead to complicated rule sets.

If a static packet-filtering firewall has more complicated rule sets, why would you use one? Simply, it processes traffic more quickly than other methods. If you have a large amount of traffic traveling through your firewall, you may need the speed provided by this type of filter.

How Static Packet Filters Are Implemented in Personal Firewalls

On the Linux platform, ipchains is the most prevalent choice for static packet filters. In a Red Hat Linux 7.2 install, for example, ipchains is set to a medium level of protection by default, and the tool GNOME Lokkit is provided to allow the average user to make minor configuration choices. Lokkit is really designed as a tool for the uncomplicated requirements of a cable modem or DSL connection.

How exactly does ipchains handle packets? I'm glad you asked. There are three lists of rules, or chains, that the ipchains firewall uses to determine how to handle a packet. The first, the input chain, handles traffic coming in to the network card. If the packet is allowed by the input chain rules, it is routed as necessary. If the packet is destined for another host, it will be compared against the rules in the forward chain. If it passes this step, it will be passed to the output chain for evaluation against the rules before being sent out from the ipchains firewall host to its destination.

That description really only applies if you are using an ipchains computer to protect hosts behind it. In our case, we're simply looking at using ipchains to protect the local computer. So, we really only use two chains: input and output. The input chain in our case will apply to all traffic coming into our computer from the Internet. There is only one host that the traffic can be for, our local computer, so it will not be compared against any of the other chains. When we try to send packets out from our computer to the Internet, they will be compared to the rules in the output chain. It really is quite simple.

So, what does this default configuration look like? Well, as I said, the default is "medium." According to the documentation, it will not allow remote connections to the system. Let's take a look at the rules generated and see if we can sort out what they mean. You can get a listing of your chains like the one below by issuing the command ipchains –nL –-list-numbers.

Chain input (policy ACCEPT):
Num   target        prot  opt       source     destination  ports
1     REJECT        tcp   -y----    0.0.0.0/0  0.0.0.0/0    * -> 0:1023
2     REJECT        tcp   -y----    0.0.0.0/0  0.0.0.0/0    * -> 2049
3     REJECT        udp   ------    0.0.0.0/0  0.0.0.0/0    * -> 0:1023
4     REJECT        udp   ------    0.0.0.0/0  0.0.0.0/0    * -> 2049
5     REJECT        tcp   -y----    0.0.0.0/0  0.0.0.0/0    * -> 6000:6009
6     REJECT        tcp   -y----    0.0.0.0/0  0.0.0.0/0    * -> 7100
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):

The first line, "chain input (policy ACCEPT)," states that the default behavior for the chain input is to accept packets. The only items that won't be accepted are those explicitly denied, then, by the rules in this chain (Table 3–3).

The remaining rules block traffic destined for specific ports on the internal host. Rule one stops any requests to connect via TCP to well-known ports, rule two blocks TCP requests for nfs (network file system), rule five takes out the TCP ports used by Xwindows, and finally rule six blocks TCP for xfs (SGI's journaling file system). Rules three and four simply mirror rules one and two but for UDP.

TABLE 3–3 Input Chain Rules

Action Source IP Source port Destination IP Destination port Protocol Service

Reject Any Any Any 0-1023 TCP All well-known service ports

Reject Any Any Any 2049 TCP nfs

Reject Any Any Any 0-1023 UDP All well-known service ports

Reject Any Any Any 2049 UDP nfs

Reject Any Any Any 6000-6009 TCP Xwindows

Reject Any Any Any 7100 TCP Xfs

Allow Any Any Any Any Any Anything not defined by rules above is allowed


The output chain handles outgoing traffic, from the client to the world. The default policy for the output chain is ACCEPT, so all traffic initiated by the internal host is allowed.

I would like to point out that none of these rules are set to log information; if they were, we would see an "l" listed in the options field. As we will learn in a later chapter, firewall logs are important for troubleshooting your firewall.

There are two other preconfigured choices you can make when installing or by using the GNOME Lokkit program: High security and Disable firewall. High security disables nearly all network connections, allowing DNS replies and DHCP only so that network interfaces can be activated. Services such as streaming media and instant messaging require a proxy to work when the high security option is chosen. Disable firewall is exactly what it sounds like. You pretty much would only do this if you were running some other firewall software.

Products That Use This Method

As discussed, ipchains is a static packet filter on Linux. The product meets the needs of many unsophisticated users. Even Red Hat suggests that you switch to iptables if you have needs more complicated than those that can be defined using Lokkit.

We generally find static packet filters in hardware devices. As noted earlier in this chapter, the Linksys cable/DSL router has the ability to set up static packet filters. Again, the configuration is simplified for the end user. In fact, unlike ipchains, limited customization is available on the Linksys device.

If static packet filters are so easy to use, straightforward, and fast, why aren't they used more often? As flexible as static packet filters are, they do require more knowledge on the part of the end user to configure them properly. Most of the products that are being targeted at home users really try to make things simple for the user. In order for a static packet filter to be simple, it must be less configurable. It's just so easy to use other methods that most products are leaving static filtering behind.

Advantages

A static packet filter works at the Network layer of the OSI model. This makes it fast—little processing of the packet is required, therefore there is little wasted time and overhead. So, on devices where processing power is limited, this is a valuable method.

Static packet filters are transparent to the user. They do not require any special software or configuration on the client computers. You simply request the Internet services you wish to access and the packet filter decides on how to handle the traffic. Of course, if the packet filter blocks traffic, you need to be able to figure that out. Imagine the frustration of trying to surf to your favorite Web site and never getting there. Why?

A static packet filter can be very flexible. A product like ipchains allows a great level of user control, if you're willing to learn how to use the product. The configuration options on my Linksys router, on the other hand, are quite limited. It's really not designed for complex networks.

You'll probably find that the packet filters on the hardware devices for home users are best for blocking large ranges of traffic, not fine-tuning for specific tasks. Ipchains shows that it is possible for a static packet filter to perform complex tasks, it's just that manufacturers are taking away the flexibility to make things easier for you.

Disadvantages

Rule sets can become quite complex. For every outgoing packet, you need rules to allow the return traffic. Remember the ephemeral ports discussed in Chapter 2? You would need to allow all traffic in to those ports for traffic that comes from a source port that you wish to use. I would add the further complication that you want to check for the TCP flags that are set on incoming packets. If you see a packet from port 80 to port 1025 on your computer, it should be part of an established TCP session. That means you should see the ACK bit set. If you don't, you probably don't want that packet in. Of course, examining flags isn't foolproof either. What's to stop me from crafting a packet with the ACK bit set just so I can get it past your static packet filter firewall?

Rules that allow traffic to all ports above 1024, the ephemeral ports, are risky for other reasons as well. Some applications have begun to use ports above 1024; Microsoft SQL Server comes to mind. Recently there was a worm discovered that connects to MS SQL Server on its default listening port of 1433. If you allowed all traffic in to 1433, you could inadvertently become infected with this worm. Oh, you think you're safe because you don't run MS SQL server on your home computer. Sorry, turns out that Microsoft released the MS SQL Desktop Edition with Access 2000 and it is vulnerable to this same worm.1 So, maybe you are more vulnerable than you thought.

With the broad rules defined by the preconfigured tools provided by most products, we're blocking or allowing based on all possible IP addresses. If you start to fine-tune your rules—targeting specific hosts that are allowed or denied—you run into the possibility of someone spoofing an IP address. Let's say you set up an FTP site to allow your mother to grab files from your computer. You know her IP address is 172.16.1.1, so you set up a rule that allows connections to the FTP service from 172.16.1.1 only. What's to stop me, your mean stepsister, from lying and saying my IP address is 172.16.1.1? OK, sure, I won't get any data back from your system (that will go to Mom), but I could send through something that would cause your server to crash. So, in short, I spoof my IP address (fake it) and get past your firewall where I can then wreak havoc. Or at least give you a headache. This would be a little like me giving your mailing address to an aggressive salesperson—when they send reams of marketing material, it will go to you, not me. You'll be drowning in junk mail and I'll be sipping margaritas in the sun. Well, a girl can dream.

Fragmentation

When a TCP packet is too long to traverse a section of the network, the packet is broken down into pieces to send. The original packet is reassembled at the destination. Only the first fragment contains the TCP header with the port information. The remaining fragments contain only the IP header.

Since only the first fragment contains source and destination port information, this is the only packet that a static packet filter rule could evaluate. How should the remaining fragments be handled? The decision made when designing static packet filters was to allow the remaining fragments through. If the first fragment was allowed, the destination host has all the information necessary to reassemble the packet. If the first packet was dropped, there is no harm to the destination because it can never reassemble the packet.

There is only one flaw in this logic. The destination host will hold on to the later fragments, waiting for the first fragment, for a certain amount of time. So, I could deliberately send volumes of fragmented packets to a host and tie up its resources waiting for the first fragment that will never come. If I send enough fragmented packets, I could effectively cause a denial of service (DOS) attack. Special defenses must be built in to static packet filters to counter this attack.

Where Static Packet Filters Fit in the Design of a Secure Environment

Generally speaking, a static packet filter provides an effective first layer of defense. You could use a static packet filter on a hardware device like a router to remove broad types of traffic. You might allow all traffic to and from port 80, but deny all traffic to and from other ports like 137 and 139 that you simply never want to travel across the Internet. Ports 137 and 139 are used by Microsoft Windows for sharing folders and files.

A basic rule set to allow Web, email, and DNS (so that you can use host names instead of IP addresses) would look something like this:

1  Allow internal:anyňany:80 tcp
2  Allow internal:anyňany:53 udp
3  Allow internal:anyňmailserver:25 tcp
4  Allow any:80ňinternal:1024-65535 tcp
5  Allow any:53ňinternal:1024-65535 udp
6  Allow mailserver:25ňinternal:1024-65535 tcp
7  Deny any:anyňany:any any

The first three rules allow the outgoing traffic for Web, DNS, and email. The next three rules allow for the return traffic. The final rule denies anything that hasn't been explicitly allowed by the earlier rules. Since the rules are processed top to bottom, the first rule to match the packet is applied.

Static packet filtering can provide an adequate, simple personal firewall. We are not seeing this strategy used by many personal firewall products, though. If you have decided you need a router and NAT to provide Internet access to multiple hosts, it makes sense to also make use of any packet-filtering functions that may be included (Figure 3–5). Given the proliferation of more sophisticated personal firewall methods, I wouldn't settle for a static packet filter as my only means of defense.

Figure 5FIGURE 3–5 Network design with a static packet filter. Best combined with NAT on a hardware device. Here a router provides both NAT and some basic packet filtering. The hosts behind this device are simply allowed to access the Web, DNS, and email.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020