32
1 CS155 - Firewalls Simon Cooper <[email protected]> CS155 – Firewalls 22 May 2003

CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper CS155 – Firewalls 22 May 2003

  • Upload
    others

  • View
    24

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

1

CS155 - Firewalls

Simon Cooper <[email protected]>

CS155 – Firewalls22 May 2003

Page 2: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

2

Why Firewalls?

� Need for the exchange of information; education, business, recreation, social and political

� Need to do something useful with your computer

� Drawbacks; unsolicited attention and bugs

Page 3: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

3

Why Firewalls?

� There are a lot of people on the Internet

� Millions of people together -> bad things happen

� True for cities; it is true for the Internet

� With the Internet...

� Everyone is in your backyard!

� You can be scoped out at any time from anywhere

� The community discourages neighborhood watch like activities (a hot potato!)

Page 4: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

4

Bugs, Bugs, Bugs

� All programs contain bugs

� Larger programs contain more bugs!

� Network protocols contain;

� Design weaknesses (SSH CRC)

� Implementation flaws (SSL, NTP, FTP, SMTP...)

� Careful (defensive) programming & protocol design is hard

Page 5: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

5

What is a Firewall?

� Literally?

� Prevents fire from spreading!

� The Castle & Moat Analogy

� Restricts access from the outside

� Prevents attackers from getting too close

� Restricts people from leaving <- Important!!

Page 6: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

6

What is a Firewall?

� Logically

� A separator, a restrictor and an analyzer

� Rarely a single physical object!

� Practically any place where internal and external data can meet

Page 7: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

7

Where do you put a Firewall?

� Between insecure systems & the Internet

� To separate test or lab networks

� For networks with more sensitive data;

� Financial records

� Student grades

� Secret projects

� Partner or joint venture networks

Page 8: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

8

Firewall Design & Architecture Issues

� Least privilege

� Defense in depth (very important)

� Choke point

� Weakest links

� Fail-safe stance

� Universal participation

� Diversity of defense

� Simplicity

Page 9: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

9

Firewall Architectures

Using a Screening Router to do Packet Filtering

Page 10: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

10

Packet Filtering: IPv4 Packet Header

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|Version| IHL |Type of Service| Total Length |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Identification |Flags| Fragment Offset |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Time to Live | Protocol | Header Checksum |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Source Address |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Destination Address |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Options | Padding |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

http://www.faqs.org/rfcs/rfc760.html

Page 11: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

11

Packet Filtering: UDP Packets

0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | Source | Destination | | Port | Port | +--------+--------+--------+--------+ | | | | Length | Checksum | +--------+--------+--------+--------+ | | data octets ... +---------------- ...

User Datagram Header Format

http://www.faqs.org/rfcs/rfc768.html

Page 12: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

12

Packet Filtering: TCP packet structure 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Source Port | Destination Port |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Sequence Number |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Acknowledgment Number |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Data | |U|A|E|R|S|F| || Offset| Reserved |R|C|O|S|Y|I| Window || | |G|K|L|T|N|N| |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Checksum | Urgent Pointer |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Options | Padding |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| data |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

TCP Header Format

http://www.faqs.org/rfcs/rfc761.html

Page 13: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

13

Packet Filtering: Ipv6 Packet Header+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|Version| Prio. | Flow Label |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Payload Length | Next Header | Hop Limit |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| |+ +| |+ Source Address +| |+ +| |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| |+ +| |+ Destination Address +| |+ +| |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

http://www.faqs.org/rfcs/rfc1883.html

Page 14: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

14

Packet Filtering: Summary

� IP Source Address

� IP Destination Address

� Protocol/Next Header (TCP, UDP, ICMP, etc)

� TCP or UDP source & destination ports

� TCP Flags (SYN, ACK, FIN, RST, PSH, etc)

� ICMP message type

� Packet size

� Fragmentation

Page 15: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

15

Router Knowledge

� Interface packet arrives on

� Interface a packet will go out

� Is the packet in response to another one?

� How many packets have been seen recently?

� Is the packet a duplicate?

� Is the packet an IP fragment?

Page 16: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

16

Filtering Example: Inbound SMTP

Page 17: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

17

Filtering Example: Outbound SMTP

Page 18: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

18

Stateful or Dynamic Packet Filtering

Page 19: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

19

Network Address Translation (NAT)Port & Address Translation (PAT)

Page 20: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

20

Normal Fragmentation

Page 21: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

21

Abnormal Fragmentation

Page 22: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

22

Firewall Architectures

Screened Host Architecture

Page 23: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

23

Bastion Host

� A secured system (it will interact/accepts data from the Internet)

� Disable all non-required services; keep it simple

� Install/modify services you want

� Run security audit to establish baseline

� Connect system to network <- important

� Be prepared for the system to be compromised

Page 24: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

24

Firewall Architectures

Screened Subnet Architecture Using Two Routers

Page 25: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

25

Firewall Architectures

Source/Destination Address Forgery

Page 26: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

26

Firewall Architectures

Dual Homed Host Architecture

Page 27: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

27

Proxies

� Application level; dedicated proxy (HTTP)

� Circuit level; generic proxy

� SOCKS

� WinSock – almost generic proxy for Microsoft

� Some protocols are “natural” to proxy

� SMTP (E-Mail)

� NNTP (Net news)

� DNS (Domain Name System)

� NTP (Network Time Protocol)

Page 28: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

28

Firewall Architectures

A Complex Firewall Setup

Page 29: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

29

Firewall Architectures

A web server using a database on a perimeter network

Page 30: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

30

Firewall Architectures

A web server and database server on an internal network

Page 31: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

31

Problems with Firewalls

� They interfere with the Internet

� They don't solve the real problems;

� Buggy software

� Bad protocols

� Generally cannot prevent Denial of Service

� Are becoming more complicated

� Many commercial firewalls permit very, very complex configurations

Page 32: CS155 - Firewalls · 1 CS155 - Firewalls Simon Cooper  CS155 – Firewalls 22 May 2003

32

Elizabeth D. Zwicky, Simon CooperD. Brent Chapman

Questions?

Simon Cooper <[email protected]>