Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and...

50
Firewalls Firewalls
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    1

Transcript of Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and...

Page 1: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

FirewallsFirewalls

Page 2: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 trustInterconnects networks with differing trust 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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Firewalls – Packet FiltersFirewalls – Packet Filters

Page 5: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 direect them to port 25 on and will direect them to port 25 on

the outside. Simple enough…the outside. Simple enough…

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

Page 11: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 Split TCP header info over several tiny

packetspackets 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 Order rules so that most common traffic is dealt with firstis dealt with first

Correctness is more important than speedCorrectness is more important than speed

Page 14: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Firewalls – Stateful Packet Firewalls – Stateful Packet FiltersFilters

Traditional packet filters do not Traditional packet filters do not examine higher layer contextexamine higher 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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Stateful FilteringStateful Filtering

Page 17: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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

Page 20: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Firewalls - Firewalls - Circuit Level Circuit Level GatewayGateway

Page 25: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Firewalls - Firewalls - Circuit Level Circuit Level GatewayGateway

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

such connections are allowedsuch connections are allowed Once created usually relays traffic Once created usually relays traffic

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

users by allowing general outbound users by allowing general outbound connectionsconnections

SOCKS commonly used for thisSOCKS commonly used for this

Page 26: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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

Page 27: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 28: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Screened Host Screened Host ArchitectureArchitecture

Page 29: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Screened Subnet Using Two Screened Subnet Using Two RoutersRouters

Page 30: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 31: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 32: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 33: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

1.2.3.45.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 34: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 Organizations with greater insider

threatthreat 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 35: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Backup SlidesBackup Slides

Page 36: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 37: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 38: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 39: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 Relay machines used to call out to GW to pick up waiting mailto pick up waiting mail

Note: Spoofing is avoided with the specification of GW

Page 40: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 One to use ruleset that protects against

compromised gatewayscompromised gateways 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 41: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 42: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 43: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Dual Homed Host Dual Homed Host ArchitectureArchitecture

Page 44: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 45: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 as long as the implementation strategy is simpleis simple

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 Circuit or application gateways demand user authentication for outbound traffic and user authentication for outbound traffic and are therefore more resistant to this threatare therefore more resistant to this threat

Page 46: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 47: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 48: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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 49: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

Dynamic Packet Filter Dynamic Packet Filter ImplementationImplementation

Dynamically update packet filter’s Dynamically update packet filter’s rulesetruleset 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 50: Firewalls. What is a Firewall? A choke point of control and monitoring A choke point of control and monitoring Interconnects networks with differing trust.

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