marrion kujinga ; firewalls

52
Firewalls Firewalls

Upload: marrion-kujinga

Post on 12-Feb-2017

156 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Marrion Kujinga ; Firewalls

FirewallsFirewalls

Page 2: Marrion Kujinga ; Firewalls

What is a Firewall?What is a Firewall? A A choke pointchoke point of control and monitoring of control and monitoring Interconnects networks with differing Interconnects networks with differing

trusttrust Imposes restrictions on network servicesImposes restrictions on network services

only authorized traffic is allowed only authorized traffic is allowed Auditing and controlling accessAuditing and controlling access

can implement alarms for abnormal behaviorcan implement alarms for abnormal behavior Itself immune to penetrationItself immune to penetration Provides Provides perimeter defenceperimeter defence

Page 3: Marrion Kujinga ; Firewalls

Classification of FirewallClassification of FirewallCharacterized by protocol level it Characterized by protocol level it

controls incontrols in Packet filteringPacket filtering Circuit gatewaysCircuit gateways Application gatewaysApplication gateways

Combination of above is dynamic Combination of above is dynamic packet filterpacket filter

Page 4: Marrion Kujinga ; Firewalls

Firewalls – Packet FiltersFirewalls – Packet Filters

Page 5: Marrion Kujinga ; Firewalls

Firewalls – Packet FiltersFirewalls – Packet Filters Simplest of components Simplest of components Uses transport-layer information onlyUses transport-layer information only

IP Source Address, Destination AddressIP Source Address, Destination Address Protocol/Next Header (TCP, UDP, ICMP, etc)Protocol/Next Header (TCP, UDP, ICMP, etc) TCP or UDP source & destination portsTCP or UDP source & destination ports TCP Flags (SYN, ACK, FIN, RST, PSH, etc)TCP Flags (SYN, ACK, FIN, RST, PSH, etc) ICMP message typeICMP message type

ExamplesExamples DNS uses port 53DNS uses port 53

No incoming port 53 packets except known trusted No incoming port 53 packets except known trusted serversservers

Page 6: Marrion Kujinga ; Firewalls

Usage of Packet FiltersUsage of Packet Filters Filtering with incoming or outgoing Filtering with incoming or outgoing

interfacesinterfaces E.g., Ingress filtering of spoofed IP E.g., Ingress filtering of spoofed IP

addressesaddresses Egress filteringEgress filtering

Permits or denies certain servicesPermits or denies certain services Requires intimate knowledge of TCP and Requires intimate knowledge of TCP and

UDP port utilization on a number of UDP port utilization on a number of operating systemsoperating systems

Page 7: Marrion Kujinga ; Firewalls

How to Configure a How to Configure a Packet FilterPacket Filter

Start with a security policyStart with a security policy Specify allowable packets in terms of Specify allowable packets in terms of

logical expressions on packet fieldslogical expressions on packet fields Rewrite expressions in syntax Rewrite expressions in syntax

supported by your vendorsupported by your vendor General rules - least privilegeGeneral rules - least privilege

All that is not expressly permitted is All that is not expressly permitted is prohibitedprohibited

If you do not need it, eliminate itIf you do not need it, eliminate it

Page 8: Marrion Kujinga ; Firewalls

Every ruleset is followed by an Every ruleset is followed by an implicit rule reading like this.implicit rule reading like this.

Example 1: Example 1: Suppose we want to allow inbound Suppose we want to allow inbound

mail (SMTP, port 25) but only to our mail (SMTP, port 25) but only to our gateway machine. Also suppose gateway machine. Also suppose

that mail from some particular site that mail from some particular site SPIGOT is to be blocked.SPIGOT is to be blocked.

Page 9: Marrion Kujinga ; Firewalls

Solution 1: Solution 1:

Example 2: Example 2: Now suppose that we want to Now suppose that we want to implement the policy “any inside implement the policy “any inside

host can send mail to the outside”.host can send mail to the outside”.

Page 10: Marrion Kujinga ; Firewalls

Solution 2: Solution 2:

This solution allows calls to come This solution allows calls to come from any port on an inside machine, from any port on an inside machine,

and will direct them to port 25 on the and will direct them to port 25 on the outside. Simple enough…outside. Simple enough…

So why is it wrong?So why is it wrong?

Page 11: Marrion Kujinga ; Firewalls

Our defined restriction is based solely Our defined restriction is based solely on the outside host’s port number, on the outside host’s port number, which we have no way of controlling.which we have no way of controlling.

Now an enemy can access any internal Now an enemy can access any internal machines and port by originating his machines and port by originating his call from port 25 on the outside call from port 25 on the outside machine.machine.

What can be a better solution ?What can be a better solution ?

Page 12: Marrion Kujinga ; Firewalls

The ACK signifies that the packet is The ACK signifies that the packet is part of an ongoing conversationpart of an ongoing conversation

Packets without the ACK are Packets without the ACK are connection establishment messages, connection establishment messages, which we are only permitting from which we are only permitting from internal hostsinternal hosts

Page 13: Marrion Kujinga ; Firewalls

Security & Performance of Security & Performance of Packet FiltersPacket Filters

IP address spoofingIP address spoofing Fake source address to be trustedFake source address to be trusted Add filters on router to blockAdd filters on router to block

Tiny fragment attacksTiny fragment attacks Split TCP header info over several tiny packetsSplit TCP header info over several tiny packets Either discard or reassemble before checkEither discard or reassemble before check

Degradation depends on number of rules Degradation depends on number of rules applied at any pointapplied at any point

Order rules so that most common traffic is Order rules so that most common traffic is dealt with firstdealt with first

Correctness is more important than speedCorrectness is more important than speed

Page 14: Marrion Kujinga ; Firewalls

Port NumberingPort Numbering TCP connectionTCP connection

Server port is number less than 1024 Server port is number less than 1024 Client port is number between 1024 and 16383Client port is number between 1024 and 16383

Permanent assignmentPermanent assignment Ports <1024 assigned permanently Ports <1024 assigned permanently

20,21 for FTP 23 for Telnet20,21 for FTP 23 for Telnet 25 for server SMTP 80 for HTTP25 for server SMTP 80 for HTTP

Variable useVariable use Ports >1024 must be available for client to make Ports >1024 must be available for client to make

any connectionany connection This presents a limitation for stateless packet This presents a limitation for stateless packet

filteringfiltering If If client wants to use port 2048, firewall must allow client wants to use port 2048, firewall must allow

incoming incoming traffic on this porttraffic on this port Better: stateful filtering knows outgoing requestsBetter: stateful filtering knows outgoing requests

Page 15: Marrion Kujinga ; Firewalls

Firewalls – Stateful Packet Firewalls – Stateful Packet FiltersFilters

Traditional packet filters do not examine Traditional packet filters do not examine higher layer contexthigher layer context ie matching return packets with outgoing ie matching return packets with outgoing

flowflow Stateful packet filters address this needStateful packet filters address this need They examine each IP packet in contextThey examine each IP packet in context

Keep track of client-server sessionsKeep track of client-server sessions Check each packet validly belongs to oneCheck each packet validly belongs to one

Hence are better able to detect bogus Hence are better able to detect bogus packets out of context packets out of context

Page 16: Marrion Kujinga ; Firewalls

Stateful FilteringStateful Filtering

Page 17: Marrion Kujinga ; Firewalls

Firewall OutlinesFirewall Outlines Packet filteringPacket filtering Application gatewaysApplication gateways Circuit gatewaysCircuit gateways

Combination of above is dynamic Combination of above is dynamic packet filterpacket filter

Page 18: Marrion Kujinga ; Firewalls

Firewall GatewaysFirewall Gateways Firewall runs set of proxy programsFirewall runs set of proxy programs

Proxies filter incoming, outgoing packetsProxies filter incoming, outgoing packets All incoming traffic directed to firewall All incoming traffic directed to firewall All outgoing traffic appears to come from All outgoing traffic appears to come from

firewallfirewall Policy embedded in proxy programsPolicy embedded in proxy programs Two kinds of proxiesTwo kinds of proxies

Application-level gateways/proxiesApplication-level gateways/proxies Tailored to http, ftp, smtp, etc.Tailored to http, ftp, smtp, etc.

Circuit-level gateways/proxiesCircuit-level gateways/proxies Working on TCP levelWorking on TCP level

Page 19: Marrion Kujinga ; Firewalls

Firewalls - Firewalls - Application Application Level Gateway (or Proxy)Level Gateway (or Proxy)

Page 20: Marrion Kujinga ; Firewalls

Application-Level Application-Level FilteringFiltering

Has full access to protocol Has full access to protocol user requests service from proxy user requests service from proxy proxy validates request as legal proxy validates request as legal then actions request and returns result to then actions request and returns result to

user user Need separate proxies for each service Need separate proxies for each service

E.g., SMTP (E-Mail)E.g., SMTP (E-Mail) NNTP (Net news)NNTP (Net news) DNS (Domain Name System)DNS (Domain Name System) NTP (Network Time Protocol)NTP (Network Time Protocol) custom services generally not supportedcustom services generally not supported

Page 21: Marrion Kujinga ; Firewalls

App-level Firewall App-level Firewall ArchitectureArchitecture

Daemon spawns proxy when communication detected …Daemon spawns proxy when communication detected …

Network Connection

Telnet daemon

SMTP daemon

FTP daemon

Telnet

proxy

FTP proxy SMTP

proxy

Page 22: Marrion Kujinga ; Firewalls

Enforce policy for specific Enforce policy for specific protocolsprotocols

E.g., Virus scanning for SMTPE.g., Virus scanning for SMTP Need to understand MIME, encoding, Zip archivesNeed to understand MIME, encoding, Zip archives

Page 23: Marrion Kujinga ; Firewalls

Firewall OutlinesFirewall Outlines Packet filteringPacket filtering Application gatewaysApplication gateways Circuit gatewaysCircuit gateways

Combination of above is dynamic Combination of above is dynamic packet filterpacket filter

Page 24: Marrion Kujinga ; Firewalls

Firewalls - Firewalls - Circuit Level Circuit Level GatewayGateway

Page 25: Marrion Kujinga ; Firewalls

Figure 9.7: A typical SOCKS connection through interface A, and rogue connection through the external interface, B.

Page 26: Marrion Kujinga ; Firewalls

Bastion HostBastion Host Highly secure host system Highly secure host system Potentially exposed to "hostile" elements Potentially exposed to "hostile" elements Hence is secured to withstand this Hence is secured to withstand this

Disable all non-required services; keep it Disable all non-required services; keep it simplesimple

Trusted to enforce trusted separation Trusted to enforce trusted separation between network connectionsbetween network connections

Runs circuit / application level gateways Runs circuit / application level gateways Install/modify services you wantInstall/modify services you want

Or provides externally accessible services Or provides externally accessible services

Page 27: Marrion Kujinga ; Firewalls

Screened Host Screened Host ArchitectureArchitecture

Page 28: Marrion Kujinga ; Firewalls

Screened Subnet Using Two Screened Subnet Using Two RoutersRouters

Page 29: Marrion Kujinga ; Firewalls

Firewalls Aren’t Perfect?Firewalls Aren’t Perfect? Useless against attacks from the insideUseless against attacks from the inside

Evildoer exists on insideEvildoer exists on inside Malicious code is executed on an internal Malicious code is executed on an internal

machinemachine Organizations with greater insider threatOrganizations with greater insider threat

Banks and MilitaryBanks and Military Protection must exist at each layerProtection must exist at each layer

Assess risks of threats at every layerAssess risks of threats at every layer Cannot protect against transfer of all Cannot protect against transfer of all

virus infected programs or filesvirus infected programs or files because of huge range of O/S & file typesbecause of huge range of O/S & file types

Page 30: Marrion Kujinga ; Firewalls

QuizQuiz In this question, we explore some In this question, we explore some

applications and limitations of a stateless applications and limitations of a stateless packet filtering firewall. For each of the packet filtering firewall. For each of the question, briefly explain how the firewall question, briefly explain how the firewall should be configured to defend against the should be configured to defend against the attack, or why the firewall cannot defend attack, or why the firewall cannot defend against the attack. against the attack.

Can the firewall prevent a SYN flood denial-of-Can the firewall prevent a SYN flood denial-of-service attack from the external network?service attack from the external network?

Can the firewall prevent a Smurf attack from Can the firewall prevent a Smurf attack from the external network? Recall that as we the external network? Recall that as we discussed in the class before, the Smurf attack discussed in the class before, the Smurf attack uses the broadcast IP address of the subnet.uses the broadcast IP address of the subnet.

Page 31: Marrion Kujinga ; Firewalls

Can the firewall prevent external users from Can the firewall prevent external users from exploiting a security bug in a CGI script on an exploiting a security bug in a CGI script on an internal web server (the web server is serving internal web server (the web server is serving requests from the Internet)?requests from the Internet)?

Can the firewall prevent an online password Can the firewall prevent an online password dictionary attack from the external network on dictionary attack from the external network on the telnet port of an internal machine?the telnet port of an internal machine?

Can the firewall prevent a user on the external Can the firewall prevent a user on the external network from opening a window on an X server in network from opening a window on an X server in the internal network? Recall that by default an X the internal network? Recall that by default an X server listens for connections on port 6000server listens for connections on port 6000

Can the firewall block a virus embedded in an Can the firewall block a virus embedded in an incoming email?incoming email?

Can the firewall be used to block users on the Can the firewall be used to block users on the internal network from browsing a specific internal network from browsing a specific external IP address?external IP address?

Page 32: Marrion Kujinga ; Firewalls

Firewalls - Firewalls - Circuit Level Circuit Level GatewayGateway

Relays two TCP connectionsRelays two TCP connections Imposes security by limiting which such Imposes security by limiting which such

connections are allowedconnections are allowed Once created usually relays traffic Once created usually relays traffic

without examining contentswithout examining contents Typically used when trust internal users Typically used when trust internal users

by allowing general outbound by allowing general outbound connectionsconnections

SOCKS commonly used for thisSOCKS commonly used for this

Page 33: Marrion Kujinga ; Firewalls

Firewall OutlinesFirewall Outlines Packet filteringPacket filtering Application gatewaysApplication gateways Circuit gatewaysCircuit gateways

Combination of above is dynamic Combination of above is dynamic packet filterpacket filter

Page 34: Marrion Kujinga ; Firewalls

Dynamic Packet FiltersDynamic Packet Filters Most commonMost common Provide good administrators Provide good administrators

protection and full transparencyprotection and full transparency Network given full control over Network given full control over

traffictraffic Captures semantics of a connectionCaptures semantics of a connection

Page 35: Marrion Kujinga ; Firewalls

1.2.3.4

Intended connection from 1.2.3.4 to 5.6.7.8

5.6.7.81.2.3.45.6.7.8

Firewall

Redialing on a dynamic packet filter. The dashed arrow shows the intended connection; the solid arrows show the actual connections, to and from the relay in the firewall box. The Firewall impersonates each endpoint to the other.

Page 36: Marrion Kujinga ; Firewalls

1.2.3.4 5.6.7.810.11.12.135.6.7.8

ApplicationProxy

Firewall

Intended connection from 1.2.3.4 to 5.6.7.8

A dynamic packet filter with an application proxy. Note the change in source address

Page 37: Marrion Kujinga ; Firewalls

Figure 9.2: A firewall router with multiple internal networks.

Filter Rule: Open access to Net 2 means source address from Net 3

• Why not spoof address from Net 3?

Network TopologyNetwork Topology

Page 38: Marrion Kujinga ; Firewalls

Address-SpoofingAddress-Spoofing Detection is virtually impossible Detection is virtually impossible

unless source-address filtering and unless source-address filtering and logging are donelogging are done

One should not trust hosts outside of One should not trust hosts outside of one’s administrative controlone’s administrative control

Page 39: Marrion Kujinga ; Firewalls

External Interface External Interface RulesetRuleset

Allow outgoing calls, permit incoming Allow outgoing calls, permit incoming calls only for mail and only to gateway GWcalls only for mail and only to gateway GW

Note: Specify GW as destination host instead of Net 1 to prevent open access to Net 1

Page 40: Marrion Kujinga ; Firewalls

Net 1 Router Interface Net 1 Router Interface RulesetRuleset

Gateway machine speaks directly only to Gateway machine speaks directly only to other machines running trusted mail other machines running trusted mail server softwareserver software

Relay machines used to call out to GW to Relay machines used to call out to GW to pick up waiting mailpick up waiting mail

Note: Spoofing is avoided with the specification of GW

Page 41: Marrion Kujinga ; Firewalls

How Many Routers Do We How Many Routers Do We Need?Need?

If routers only support outgoing filtering, we If routers only support outgoing filtering, we need two:need two: One to use ruleset that protects against compromised One to use ruleset that protects against compromised

gatewaysgateways One to use ruleset that guards against address One to use ruleset that guards against address

forgery and restricts access to gateway machineforgery and restricts access to gateway machine An input filter on one port is exactly equivalent An input filter on one port is exactly equivalent

to an output filter on the other portto an output filter on the other port If you trust the network provider, you can go If you trust the network provider, you can go

without input filterswithout input filters Filtering can be done on the output side of the routerFiltering can be done on the output side of the router

Page 42: Marrion Kujinga ; Firewalls

Routing FiltersRouting Filters All nodes are somehow reachable from the All nodes are somehow reachable from the

InternetInternet Routers need to be able to control what Routers need to be able to control what

routes they advertise over various routes they advertise over various interfacesinterfaces

Clients who employ IP source routing make Clients who employ IP source routing make it possible to reach ‘unreachable’ hostsit possible to reach ‘unreachable’ hosts Enables address-spoofingEnables address-spoofing Block source routing at borders, not at Block source routing at borders, not at

backbonebackbone

Page 43: Marrion Kujinga ; Firewalls

Routing Filters (cont)Routing Filters (cont) Packet filters obviate the need for route Packet filters obviate the need for route

filtersfilters Route filtering becomes difficult or Route filtering becomes difficult or

impossible in the presence of complex impossible in the presence of complex technologiestechnologies

Route squatting – using unofficial IP Route squatting – using unofficial IP addresses inside firewalls that belong to addresses inside firewalls that belong to someone elsesomeone else

Difficult to choose non-addressed address Difficult to choose non-addressed address spacespace

Page 44: Marrion Kujinga ; Firewalls

Dual Homed Host Dual Homed Host ArchitectureArchitecture

Page 45: Marrion Kujinga ; Firewalls

Asymmetric RoutesAsymmetric Routes Both sides of the firewall know Both sides of the firewall know

nothing of one another’s topologynothing of one another’s topology Solutions:Solutions:

Maintain full knowledge of the topologyMaintain full knowledge of the topology Not feasible, too much state to keepNot feasible, too much state to keep

Multiple firewalls share state Multiple firewalls share state informationinformation Volume of messages may be prohibitive, Volume of messages may be prohibitive,

code complexitycode complexity

Page 46: Marrion Kujinga ; Firewalls

Are Dynamic Packet Are Dynamic Packet Filters Safe?Filters Safe?

Comparable to that of circuit gateways, Comparable to that of circuit gateways, as long as the implementation strategy is as long as the implementation strategy is simplesimple

If administrative interfaces use physical If administrative interfaces use physical network ports as the highest-level network ports as the highest-level constructconstruct Legal connections are generally defined in Legal connections are generally defined in

terms of the physical topologyterms of the physical topology Not if evildoers exist on the insideNot if evildoers exist on the inside

Circuit or application gateways demand user Circuit or application gateways demand user authentication for outbound traffic and are authentication for outbound traffic and are therefore more resistant to this threattherefore more resistant to this threat

Page 47: Marrion Kujinga ; Firewalls

Distributed FirewallsDistributed Firewalls A central management node sets the security A central management node sets the security

policy enforced by individual hostspolicy enforced by individual hosts Combination of high-level policy specification Combination of high-level policy specification

with file distribution mechanismwith file distribution mechanism Advantages:Advantages:

Lack of central point of failureLack of central point of failure Ability to protect machines outside topologically Ability to protect machines outside topologically

isolated spaceisolated space Great for laptopsGreat for laptops

Disadvantage:Disadvantage: Harder to allow in certain services, whereas it’s Harder to allow in certain services, whereas it’s

easy to blockeasy to block

Page 48: Marrion Kujinga ; Firewalls

Distributed Firewalls Distributed Firewalls DrawbackDrawback

Allowing in certain services works if Allowing in certain services works if and only if you’re sure the address and only if you’re sure the address can’t be spoofedcan’t be spoofed Requires anti-spoofing protectionRequires anti-spoofing protection Must maintain ability to roam safelyMust maintain ability to roam safely

Solution: IPsecSolution: IPsec A machine is trusted if and only if it can A machine is trusted if and only if it can

perform proper cryptographic perform proper cryptographic authenticationauthentication

Page 49: Marrion Kujinga ; Firewalls

Where to Filter?Where to Filter? Balance between risk and costsBalance between risk and costs Always a higher layer that is hard to Always a higher layer that is hard to

filterfilter HumansHumans

Page 50: Marrion Kujinga ; Firewalls

Dynamic Packet Filter Dynamic Packet Filter ImplementationImplementation

Dynamically update packet filter’s rulesetDynamically update packet filter’s ruleset Changes may not be benign due to orderingChanges may not be benign due to ordering

Redialing method offers greater Redialing method offers greater assurance of securityassurance of security No special-case code necessaryNo special-case code necessary FTP handled with user-level daemonFTP handled with user-level daemon UDP handled just as TCP except for tear UDP handled just as TCP except for tear

downdown ICMP handled with pseudoconnections and ICMP handled with pseudoconnections and

synthesized packetssynthesized packets

Page 51: Marrion Kujinga ; Firewalls

Per-Interface Tables Per-Interface Tables Consulted by Dynamic Consulted by Dynamic

Packet FilterPacket Filter Active Connection TableActive Connection Table

Socket structure decides whether data is Socket structure decides whether data is copied to outside socket or sent to copied to outside socket or sent to application proxyapplication proxy

Ordinary Filter TableOrdinary Filter Table Specifies which packets may pass in Specifies which packets may pass in

stateless mannerstateless manner Dynamic TableDynamic Table

Forces creation of local socket structuresForces creation of local socket structures

Page 52: Marrion Kujinga ; Firewalls

Presentation By Marrion KujingaPresentation By Marrion Kujinga Introduction To FirewallsIntroduction To Firewalls Bahwan CybertekBahwan Cybertek