Week 05 Slides
Week 05 Slides
Computer Security I
<MEETING TIME AND INSTRUCTOR>
WEEK 5
1
Ch. 9: Firewalls and
Intrusion Prevention
Systems
Why we need firewalls (1)
Being connected to the internet is no longer optional for organizations.
Why we need firewalls (2)
Host-based Security is Not Enough.
◦ Keeping defenses up-to-date on a diversity of hosts is not easy (people bring their laptops to
work)
◦ Need centralized, network-based intrusion prevention.
What is a firewall?
A network appliance installed between the premises network and the Internet, to establish a
controlled link and to erect an outer security wall or perimeter.
What must a firewall do?
Firewall design goals:
1. It must be the only point of access to the network; all traffic from inside to outside, and vice
versa, must pass through the firewall.
2. It must allow only authorized traffic to pass, as defined by the local security policy.
3. The firewall must itself be secure against penetration.
Limitations of firewalls
What they can’t do:
Protect against attacks that bypass the firewall
◦ “Dial-in” capability, improperly secured VPNs
◦ Wireless networks that inadvertently enable communication between systems on different sides of the
firewall
This allows firewalls to limit incoming traffic to servers to known protocols and ports.
However, clients will connect from a random “high port”, between 1024 and 65535.
◦ The firewall must allow this traffic for the protocols to work
◦ But it can potentially allow attack traffic as well.
Packet Filter Firewall Rule Tables
Each row is a rule.
Packets are matched against each rule from top to bottom.
At the first rule that matches, that row’s action (permit or deny) will be taken, and matching will
stop.
This means that the order in which rules are written is important.
13
Sample packet filtering rules
Subset of rules relating to SMTP traffic, which uses port 25 for incoming connections.
Allows all incoming and outgoing high port traffic
This also prevents some kinds of source address spoofing – how?
Packet filtering policies and rules
The way a table of firewall rules is set up indicates one of two types of default policy:
Default-discard: reject every packet unless there is a rule to permit it
◦ A more secure default: can stop attacks that have not been anticipated
◦ Could interfere with normal work and be seen as too restrictive
(however, “allow” rules can be written broadly enough to cover most expected traffic.)
◦ What will a table implementing a default-discard policy look like?
Source port and flag fields ensure that incoming packets at a high port are responses to SMTP
protocol messages.
Note: All TCP headers after the first packet in a session have the ACK bit set.
Does this prevent all unwanted high port traffic?
Limitations of packet filtering
The weaknesses of packet filtering stem from its only analyzing lower-layer
traffic data, and from analyzing each packet in isolation (statelessly).
◦ Cannot associate packets to “understand” traffic patterns consisting of multiple
packets
◦ Cannot prevent attacks that exploit upper-layer vulnerabilities
◦ Hard to generate logs with useful information
IP Fragmentation Attack (tiny fragment
attack)
A way of “sneaking traffic past the firewall rules”
In the course of being routed, an IP packet may be broken up into
multiple packet fragments (to be reassembled at the destination)
If the fragments are very small, the transport (TCP) header may not be
included in the first fragment.
Packet filters traditionally examine only the first fragment, for
efficiency’s sake.
An attacker may purposefully cause fragments to be very small, so the
transport header information will not be in the first fragment and
will not be scanned.
Solution: drop all packets that don’t contain a predefined minimum
amount of the transport header (enough to test against the rules
properly)
Firewall Type 2: Stateful inspection
Traditional stateless packet filters consider each packet in isolation – no memory.
Stateful inspection keeps track of established TCP sessions with a table.
Typical configuration: table records outgoing connections established by clients on the LAN;
incoming high port traffic is allowed only when it corresponds to an existing connection.
Stateful Inspection Example
20
Type 3: Application-level Gateway
Active intervention in traffic: Proxy with
authentication service
1. Client contacts the gateway, asking to use a
certain application protocol (FTP, HTTP) with a
remote host
2. Client provides authentication information to
gateway
3. If accepted, gateway contacts the remote host
and relays the TCP data
Generally more secure: only traffic for supported
applications by authenticated users can get
through
Disadvantages: processing overhead, may be seen
as restrictive.
Type 4: Circuit-level Gateway
A proxy at the transport layer
For determining which TCP connections are
allowed.
Sets up two TCP connections, one between the
client and the gateway and another between the
gateway and the remote host.
Allows less fine-grained control than application-
level gateways, but is more flexible.
◦ Internal hosts are not limited to specific
application-layer protocols
◦ (though client software must be configured to
connect through the proxy server)
The common factor in these is that they protect more than one host.
Host-based (Server-based) firewalls
Having each host or server on the network have its own firewall gives an additional layer of
security as well as flexibility.
◦ Can have additional restrictions tailored to the security needs of the server, without affecting the rest of
the network.
Packet filtering is built in to the Linux kernel through the netfilter framework, and managed by
iptables (and more recently, the firewalld service)
◦ Stateless or stateful
In BSD Unixes the most prevalent firewall is called pf (for packet filter), also has stateful features
Having host-based firewalls in addition to standalone firewalls is a Good Idea™.
Personal Firewalls
A software feature of end-user operating
systems
Much less complex than server-based or
standalone firewalls – primarily for
preventing unauthorized remote access
Typically default to block all incoming
connections, except for specifically allowed
application protocols.
Windows Firewall Profiles
When you connect to a new network, Windows
asks you which kind it is—home, work, or public.
This information is used to turn on a specific
firewall policy.
Three basic policies, set separately for each
network interface:
Public: most restrictive, very few inbound
connections allowed
Private: assumes network is isolated from the
internet, allows more inbound connections
Domain: least restrictive – for when the
machine is connected to an organization domain
whose security is managed independently
Firewall location and
network configuration
Term: Bastion Host
A term for any system identified as a critical strong point in the network’s security.
◦ As the word ‘bastion’ implies, it must be able to withstand attacks.
◦ Are the most exposed systems on the network
29
Simplest firewall configuration
Single firewall at perimeter to protect the network
◦ If firewall is in the router it’s called a screening router
◦ If firewall is between external and internal router it’s single bastion inline
Don’t want the more public-facing machines, if compromised, to be used to attack the more
sensitive machines
Solution: different network zones in which different rules apply.
One of the most commonly used types of zones is the DMZ “Demilitarized zone”
◦ Named because it’s the portion of the internal network with the most exposure to the Internet
◦ Web servers, VPN servers, etc. are typically placed in the DMZ network.
◦ Sensitive information should not placed on hosts in the DMZ, and their privileges should be minimized
Zones can be implemented with multiple firewalls, or a single firewall with multiple NICs. We’ll
see different layouts, or topologies, for security zones on a network.
Double Bastion
Inline
Two firewalls, for the DMZ
network and the more
protected internal network
Internal firewall provides
additional layer of defense for
internal hosts
The two firewalls are in-line, so
traffic must pass through the
external firewall to even reach
the internal firewall.
DMZ
Other
configuration:
Single Bastion T
Firewall has a third network
interface (making a T shape)
Essentially acting as two
separate firewalls for the DMZ
and internal networks.
33
Double Bastion T
A Real Firewall Configuration
We’ll look at the configuration dialogs for a SonicWall™ firewall that has five
interfaces.
35
Distributed Firewalls
If there are
◦ One or more stand-alone firewall,
◦ Host-based firewalls,
41