Firewalls
Firewalls
References
1. Mark Stamp, Information Security: Principles and Practice, Wiley
Interscience, 2006.
2. Robert Zalenski, Firewall Technologies, IEEE Potential, 2002, p 24 –
29.
3. Avishai Wool, A Quantitative Study of Firewall Configuration Errors,
IEEE Computer, June 2004, p 62 – 67.
Access Control
Coming up: Firewall as Network
4. Steven Bellovin and William Cheswick, Network Firewalls, IEEE
Communications Magazine, Sept 1994, p 50 – 57.
5. William Arbaugh, Firewalls: An Outdated Defense, IEEE Computer,
June 2003, p 112 – 113.
6. Charles Zhang, Marianne Winslett, Carl Gunter, On the Safety and
Efficiency of Firewall Policy Deployment, IEEE Symposium on
Security and Privacy, 2007.
7. Mohamed Gouda and Alex Liu, A Model of Stateful Firewalls and its
Properties, Proc of the 2005 International Conference on
Dependable Systems and Networks, 2005. 2
Firewall as Network Access
Control
• Access Control
• Authentication
• Authorization
• Single Sign On
• Firewall
3
Firewall
Internal
Internet
• Defense in depth
2
Coming up: Security Strategies -
• Use multiple mechanisms
• Best if each is independent: minimal overlap
• Choke point
• Facilitates monitoring and control
6
[2]
Security Strategies - 2
• Weakest link -
• Fail-safe
• If firewall fails, it should go to fail-safe that denies access to avoid
intrusions
3
Coming up: Security Strategies -
• Default deny
• Default permit
• Universal participation
• Everyone has to accept the rules
7
[2]
Security Strategies - 3
• Diversity of defense
• Inherent weaknesses
• Multiple technologies to compensate for inherent weakness of
one technology
• Common heritage
4
Coming up: Security Strategies -
• If systems configured by the same person, may have the same
weakness
• Simplicity
• Security through obscurity
8
[2]
Security Strategies - 4
• Configuration errors can be devastating
• Testing is not perfect
• Ongoing trial and error will identify weaknesses
• Enforcing a sound policy is critical
11
[2]
Types of Firewall - 3
• Proxy
• Intermediate connection between servers on internet and
internal servers.
• For incoming data
• Proxy is server to internal network clients
• Very secure
12
• Less efficient versus packet filters
[2]
Types of Firewall - 4
• Network Address Translation
• Hides internal network from
external network
• Private IP addresses –
expands the IP address space
Example
Coming up: Packet Filter -
• Disadvantages
• Can be compromised by many attacks
• Source spoofing
14
Packet Filter - Example
[2]
Example
Packet Filter - Example
[2]
Example
Packet Filter - Example
Example
Coming up: Packet Filter -
• Attack succeeds because of rules B and D
• More secure to add source ports to rules
17
Packet Filter - Example
[2]
Example
Packet Filter - Example
Example
Coming up: Packet Filter -
• These packets would be admitted. To avoid this add an ACK bit to
the rule set
19
[2]
Packet Filter - Example
Scanning
Coming up: TCP Ack for Port
• Attack fails, because the ACK bit is not set. ACK bit is set if the connection
originated from inside.
• Incoming TCP packets must have ACK bit set. If this started outside, then 20
no matching data, and packet will be rejected.
• Note: This rule means we allow no services other than request that we
originate.
TCP Ack for Port Scanning
• Attacker sends packet with ACK set (without prior
handshake) using port p
• Violation of TCP/IP protocol
Filter
Coming up: Stateful Packet
• RST confirms that port 1209 is open
• Problem: packet filtering is stateless; the firewall should track the
entire connection exchange
22
[1]
Stateful Packet Filter
• Remembers packets in the TCP
connections (and flag bits) application
• Adds state info to the packet filter
firewalls. transport
Scanning
Coming up: Firewalk – Port
• Pros
• Complete view of the connections and app data
• Filter bad data (viruses, Word macros)
• Incoming packet is terminated and new packet is sent
to internal network
• Con
• Speed 24
[1]
Firewalk – Port Scanning
• Scan ports through firewalls
• Requires knowledge of
• IP address of firewall
• IP address of one system in internal network
Firewall
Coming up: Firewalk and Proxy
• Number of hops to the firewall
• Set TTL (time to live) = Hops to firewall +1
• Set destination port to be p
• If firewall does not pass data for port p, then no
response
• If data passes thru firewall on port p, then time
exceeded error message
25
[1]
Lets try it Applications->Utilities->Network Utility
Firewalk and Proxy Firewall
Packet
filter
Trudy Router Router Router
Defense in Depth
Coming up: Firewalls and
Dest port 12344, TTL=4
Dest port 12345, TTL=4
Time exceeded
DMZ
FTP server
Policy Verification
Coming up: Research: Firewall
WWW server
DNS server
Intranet with
Packet Application Personal
Internet Filter Proxy Firewalls 27
[1]
Research: Firewall Policy
Verification
• Firewall design: consistency, completeness, and compactness
• Gouda, M.G.; Liu, X.-Y.A., "Firewall design: consistency, completeness, and compactness,"
Distributed Computing Systems, 2004. Proceedings. 24th International Conference on , vol.,
no., pp.320,327, 2004
examples
Coming up: Lets do some
are hard to get right. Research in place to help validate
the configuration for errors
28
Lets do some examples
iptables is a common tool to build firewalls
rules
Coming up: iptables – matching
• iptables –A INPUT –p tcp –dport 22 –j ACCEPT
• # This allows SSH TO THE FIREWALL BOX!
30
iptables – matching rules
Jump targets – what to do upon match?
-j ACCEPT – allow it
-j REJECT -- send a rejection message
-j DROP – drop it, don’t send any message
-j logaccept, logdrop, logreject
(there are others)
rules
Coming up: iptables – more
Protocol matching rules
-p tcp , udp, icmp, all (0 means all)
Syn-flood protection:
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT 32
iptables - examples
• Lets stop all http access
rules
Coming up: iptables – more
• Lets allow www.gmu.edu though (but only GMU!)
• --destination www.gmu.edu
33
iptables – more rules
State matching:
-m state –state ESTABLISHED, RELATED
rules
Coming up: iptables – more
reply packet, or outgoing packet on a connection which has seen
replies).
RELATED - A packet which is related to, but not part of, an existing
connection, such as an ICMP error, or (with the FTP module inserted), a
packet establishing an ftp data connection.
INVALID - A packet which could not be identified for some reason: this
includes running out of memory and ICMP errors which don't
34
correspond to any known connection. Generally these packets should
be dropped.
iptables – more rules
TCP bit matching:
Above command says look at all the bits (‘ALL’ is synonymous with
`SYN,ACK,FIN,RST,URG,PSH’) and verify that only the SYN and ACK bits
are set.
35
34
iptables - Tunneling
• In our network we have one outward facing server, so to get in
from home we must travel (tunnel) through that server.
End of presentation
• iptables is a powerful example of how to create/manage
firewalls
37
35
29