Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 23 Network Security (cont) CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger slides are modified from Jim Kurose,

Similar presentations


Presentation on theme: "Lecture 23 Network Security (cont) CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger slides are modified from Jim Kurose,"— Presentation transcript:

1 Lecture 23 Network Security (cont) CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger slides are modified from Jim Kurose, Keith Ross

2 2 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per year over SSL r Originally designed by Netscape in 1993 r Number of variations: m TLS: transport layer security, RFC 2246 r Provides m Confidentiality m Integrity m Authentication r Original goals: m Had Web e-commerce transactions in mind m Encryption (especially credit-card numbers) m Web-server authentication m Optional client authentication m Minimum hassle in doing business with new merchant r Available to all TCP applications m Secure socket interface

3 3 SSL and TCP/IP Application TCP IP Normal Application Application SSL TCP IP Application with SSL SSL provides application programming interface (API) to applications C and Java SSL libraries/classes readily available

4 4 Could do something like PGP: But want to send byte streams & interactive data Want a set of secret keys for the entire connection Want certificate exchange part of protocol: handshake phase H( ). K A ( ). - + K A (H(m)) - m KAKA - m K S ( ). K B ( ). + + K B (K S ) + KSKS KBKB + Internet KSKS

5 5 Toy SSL: a simple secure channel r Handshake: Alice and Bob use their certificates and private keys to authenticate each other and exchange shared secret r Key Derivation: Alice and Bob use shared secret to derive set of keys r Data Transfer: Data to be transferred is broken up into a series of records r Connection Closure: Special messages to securely close connection

6 6 Toy: A simple handshake r MS = master secret r EMS = encrypted master secret hello certificate K B + (MS) = EMS

7 7 Toy: Key derivation r Considered bad to use same key for more than one cryptographic operation m Use different keys for message authentication code (MAC) and encryption r Four keys: m K c = encryption key for data sent from client to server m M c = MAC key for data sent from client to server m K s = encryption key for data sent from server to client m M s = MAC key for data sent from server to client r Keys derived from key derivation function (KDF) m Takes master secret and (possibly) some additional random data and creates the keys

8 8 Toy: Data Records r Why not encrypt data in constant stream as we write it to TCP? m Where would we put the MAC? If at end, no message integrity until all data processed. m For example, with instant messaging, how can we do integrity check over all bytes sent before displaying? r Instead, break stream in series of records m Each record carries a MAC m Receiver can act on each record as it arrives r Issue: in record, receiver needs to distinguish MAC from data m Want to use variable-length records lengthdataMAC

9 9 Toy: Sequence Numbers r Attacker can capture and replay record or re-order records r Solution: put sequence number into MAC: m MAC = MAC(M x, sequence||data) m Note: no sequence number field r Attacker could still replay all of the records m Use random nonce

10 10 Toy: Control information r Truncation attack: m attacker forges TCP connection close segment m One or both sides thinks there is less data than there actually is. r Solution: record types, with one type for closure m type 0 for data; type 1 for closure r MAC = MAC(M x, sequence||type||data) lengthtypedataMAC

11 11 Toy SSL: summary hello certificate, nonce K B + (MS) = EMS type 0, seq 1, data type 0, seq 2, data type 0, seq 1, data type 0, seq 3, data type 1, seq 4, close type 1, seq 2, close encrypted bob.com

12 12 Toy SSL isn’t complete r How long are the fields? r What encryption protocols? r No negotiation m Allow client and server to support different encryption algorithms m Allow client and server to choose together specific algorithm before data transfer

13 13 Most common symmetric ciphers in SSL r DES – Data Encryption Standard: block r 3DES – Two keys: block r RC2 – Rivest Cipher 2: block r RC4 – Rivest Cipher 4: stream Public key encryption r RSA

14 14 SSL Cipher Suite r Cipher Suite m Public-key algorithm m Symmetric encryption algorithm m MAC algorithm r SSL supports a variety of cipher suites r Negotiation: client and server must agree on cipher suite r Client offers choice; server picks one

15 15 Real SSL: Handshake (1) Purpose 1. Server authentication 2. Negotiation: agree on crypto algorithms 3. Establish keys 4. Client authentication (optional)

16 16 Real SSL: Handshake (2) 1. Client sends list of algorithms it supports, along with client nonce 2. Server chooses algorithms from list; sends back: choice + certificate + server nonce 3. Client verifies certificate, extracts server’s public key, generates pre_master_secret, encrypts with server’s public key, sends to server 4. Client and server independently compute encryption and MAC keys from pre_master_secret and nonces 5. Client sends a MAC of all the handshake messages 6. Server sends a MAC of all the handshake messages

17 17 Real SSL: Handshaking (3) Last 2 steps protect handshake from tampering r Client typically offers range of algorithms, some strong, some weak r Man-in-the middle could delete the stronger algorithms from list r Last 2 steps prevent this m Last two messages are encrypted

18 18 Real SSL: Handshaking (4) r Why the two random nonces? r Suppose Trudy sniffs all messages between Alice & Bob. r Next day, Trudy sets up TCP connection with Bob, sends the exact same sequence of records,. m Bob (Amazon) thinks Alice made two separate orders for the same thing. m Solution: Bob sends different random nonce for each connection. This causes encryption keys to be different on the two days. m Trudy’s messages will fail Bob’s integrity check.

19 19 SSL Record Protocol data fragment data fragment MAC encrypted data and MAC encrypted data and MAC record header record header record header: content type; version; length MAC: includes sequence number, MAC key M x Fragment: each SSL fragment 2 24 bytes (~16 Kbytes)

20 20 SSL Record Format content type SSL version length MAC data 1 byte 2 bytes3 bytes Data and MAC encrypted (symmetric algo)

21 21 handshake: ClientHello handshake: ServerHello handshake: Certificate handshake: ServerHelloDone handshake: ClientKeyExchange ChangeCipherSpec handshake: Finished ChangeCipherSpec handshake: Finished application_data Alert: warning, close_notify Real Connection TCP Fin follow Everything henceforth is encrypted

22 22 Key derivation r Client nonce, server nonce, and pre-master secret input into pseudo random-number generator. m Produces master secret r Master secret and new nonces inputed into another random-number generator: “key block” r Key block sliced and diced: m client MAC key m server MAC key m client encryption key m server encryption key m client initialization vector (IV) m server initialization vector (IV)

23 Chapter 8 roadmap 8.1 What is network security? 8.2 Principles of cryptography 8.3 Message integrity 8.4 Securing e-mail 8.5 Securing TCP connections: SSL 8.6 Network layer security: IPsec 8.7 Securing wireless LANs 8.8 Operational security: firewalls and IDS

24 24 What is confidentiality at the network-layer? Between two network entities: r Sending entity encrypts the payloads of datagrams. Payload could be: m TCP segment, UDP segment, ICMP message, OSPF message, and so on. r All data sent from one entity to the other would be hidden: m Web pages, e-mail, P2P file transfers, TCP SYN packets, and so on. r That is, “blanket coverage”.

25 25 Virtual Private Networks (VPNs) r Institutions often want private networks for security. m Costly! Separate routers, links, DNS infrastructure. r With a VPN, institution’s inter-office traffic is sent over public Internet instead. m But inter-office traffic is encrypted before entering public Internet

26 26 IP header IPsec header Secure payload IP header IPsec header Secure payload IP header IPsec header Secure payload IP header payload IP header payload headquarters branch office salesperson in hotel Public Internet laptop w/ IPsec Router w/ IPv4 and IPsec Router w/ IPv4 and IPsec Virtual Private Network (VPN)

27 27 IPsec services r Data integrity r Origin authentication r Replay attack prevention r Confidentiality r Two protocols providing different service models: m AH m ESP

28 28 IPsec Transport Mode r IPsec datagram emitted and received by end-system. r Protects upper level protocols IPsec

29 29 IPsec – tunneling mode (1) r End routers are IPsec aware. m Hosts need not be. IPsec

30 30 IPsec – tunneling mode (2) r Also tunneling mode. IPsec

31 Two protocols r Authentication Header (AH) protocol m provides source authentication & data integrity but not confidentiality r Encapsulation Security Protocol (ESP) m provides source authentication,data integrity, and confidentiality m more widely used than AH 31

32 32 Four combinations are possible! Host mode with AH Host mode with ESP Tunnel mode with AH Tunnel mode with ESP Most common and most important

33 33 Security associations (SAs) r Before sending data, a virtual connection is established from sending entity to receiving entity. r Called “security association (SA)” m SAs are simplex: for only one direction r Both sending and receiving entites maintain state information about the SA m Recall that TCP endpoints also maintain state information. m IP is connectionless; IPsec is connection-oriented! r How many SAs in VPN w/ headquarters, branch office, and n traveling salesperson?

34 34 193.68.2.23 200.168.1.100 172.16.1/24 172.16.2/24 SA Internet Headquarters Branch Office R1 R2 Example SA from R1 to R2 R1 stores for SA r 32-bit identifier for SA: Security Parameter Index (SPI) r the origin interface of the SA (200.168.1.100) r destination interface of the SA (193.68.2.23) r type of encryption to be used (for example, 3DES with CBC) r encryption key r type of integrity check (for example, HMAC with with MD5) r authentication key

35 35 Security Association Database (SAD) r Endpoint holds state of its SAs in a SAD, where it can locate them during processing. r With n salespersons, 2 + 2n SAs in R1’s SAD r When sending IPsec datagram, r R1 accesses SAD to determine how to process datagram. r When IPsec datagram arrives to R2, r R2 examines SPI in IPsec datagram, r indexes SAD with SPI, and r processes datagram accordingly.

36 Focus for now on tunnel mode with ESP 36 IPsec datagram new IP header ESP hdr original IP hdr Original IP datagram payload ESP trl ESP auth encrypted “enchilada” authenticated padding pad length next header SPI Seq #

37 37 What happens? 193.68.2.23 200.168.1.100 172.16.1/24 172.16.2/24 SA Internet Headquarters Branch Office R1 R2 new IP header ESP hdr original IP hdr Original IP datagram payload ESP trl ESP auth encrypted “enchilada” authenticated padding pad length next header SPI Seq #

38 38 R1 converts original datagram into IPsec datagram r Appends to back of original datagram (which includes original header fields!) an “ESP trailer” field. r Encrypts result using algorithm & key specified by SA. r Appends to front of this encrypted quantity the “ESP header, creating “enchilada”. r Creates authentication MAC over the whole enchilada, using algorithm and key specified in SA; r Appends MAC to back of enchilada, forming payload; r Creates brand new IP header, with all the classic IPv4 header fields, which it appends before payload.

39 39 Inside the enchilada: r ESP trailer: Padding for block ciphers r ESP header: m SPI, so receiving entity knows what to do m Sequence number, to thwart replay attacks r MAC in ESP auth field is created with shared secret key new IP header ESP hdr original IP hdr Original IP datagram payload ESP trl ESP auth encrypted “enchilada” authenticated padding pad length next header SPI Seq #

40 40 IPsec sequence numbers r For new SA, sender initializes seq. # to 0 r Each time datagram is sent on SA: m Sender increments seq # counter m Places value in seq # field r Goal: m Prevent attacker from sniffing and replaying a packet Receipt of duplicate, authenticated IP packets may disrupt service r Method: m Destination checks for duplicates m But doesn’t keep track of ALL received packets; instead uses a window

41 41 Security Policy Database (SPD) r Policy: For a given datagram, sending entity needs to know if it should use IPsec. r Needs also to know which SA to use m May use: source and destination IP address; protocol number. r Info in SPD indicates “what” to do with arriving datagram; r Info in the SAD indicates “how” to do it.

42 Summary: IPsec services r Suppose Trudy sits somewhere between R1 and R2. She doesn’t know the keys. m Will Trudy be able to see contents of original datagram? m How about source, dest IP address, transport protocol, application port? m Flip bits without detection? m Masquerade as R1 using R1’s IP address? m Replay a datagram? 42

43 43 Internet Key Exchange r In previous examples, we manually established IPsec SAs in IPsec endpoints: Example SA SPI: 12345 Source IP: 200.168.1.100 Dest IP: 193.68.2.23 Protocol: ESP Encryption algorithm: 3DES-cbc HMAC algorithm: MD5 Encryption key: 0x7aeaca… HMAC key: 0xc0291f … r Such manually keying is impractical for large VPN with, say, hundreds of sales people. r Instead use IPsec IKE (Internet Key Exchange)

44 44 IKE: PSK and PKI r Authentication (proof who you are) with either m pre-shared secret (PSK) or m with PKI (pubic/private keys and certificates). r With PSK, both sides start with secret: m then run IKE to authenticate each other and to generate IPsec SAs (one in each direction), including encryption and authentication keys r With PKI, both sides start with public/private key pair and certificate. m run IKE to authenticate each other and obtain IPsec SAs (one in each direction). m Similar with handshake in SSL.

45 45 IKE Phases r IKE has two phases m Phase 1: Establish bi-directional IKE SA Note: IKE SA different from IPsec SA Also called ISAKMP security association m Phase 2: ISAKMP is used to securely negotiate the IPsec pair of SAs r Phase 1 has two modes: aggressive mode and main mode m Aggressive mode uses fewer messages m Main mode provides identity protection and is more flexible

46 46 Summary of IPsec r IKE message exchange for algorithms, secret keys, SPI numbers r Either the AH or the ESP protocol (or both) r The AH protocol provides integrity and source authentication r The ESP protocol (with AH) additionally provides encryption r IPsec peers can be two end systems, two routers/firewalls, or a router/firewall and an end system

47 Chapter 8 roadmap 8.1 What is network security? 8.2 Principles of cryptography 8.3 Message integrity 8.4 Securing e-mail 8.5 Securing TCP connections: SSL 8.6 Network layer security: IPsec 8.7 Securing wireless LANs 8.8 Operational security: firewalls and IDS

48 Firewalls isolates organization’s internal net from larger Internet, allowing some packets to pass, blocking others. firewall administered network public Internet firewall

49 Firewalls: Why prevent denial of service attacks: m SYN flooding: attacker establishes many bogus TCP connections, no resources left for “real” connections prevent illegal modification/access of internal data. m e.g., attacker replaces CIA’s homepage with something else allow only authorized access to inside network m set of authenticated users/hosts three types of firewalls: m stateless packet filters m stateful packet filters m application gateways

50 Stateless packet filtering r internal network connected to Internet via router firewall r router filters packet-by-packet, decision to forward/drop packet based on: m source IP address, destination IP address m TCP/UDP source and destination port numbers m ICMP message type m TCP SYN and ACK bits Should arriving packet be allowed in? Departing packet let out?

51 Stateless packet filtering: example r example 1: block incoming and outgoing datagrams with IP protocol field = 17 and with either source or dest port = 23. m all incoming, outgoing UDP flows and telnet connections are blocked. r example 2: Block inbound TCP segments with ACK=0. m prevents external clients from making TCP connections with internal clients, but allows internal clients to connect to outside.

52 Policy Firewall Setting No outside Web access. Drop all outgoing packets to any IP address, port 80 No incoming TCP connections, except those for institution’s public Web server only. Drop all incoming TCP SYN packets to any IP except 130.207.244.203, port 80 Prevent Web-radios from eating up the available bandwidth. Drop all incoming UDP packets - except DNS and router broadcasts. Prevent your network from being used for a smurf DoS attack. Drop all ICMP packets going to a “broadcast” address (eg 130.207.255.255). Prevent your network from being tracerouted Drop all outgoing ICMP TTL expired traffic Stateless packet filtering: more examples

53 action source address dest address protocol source port dest port flag bit allow222.22/16 outside of 222.22/16 TCP> 102380 any allowoutside of 222.22/16 TCP80> 1023ACK allow222.22/16 outside of 222.22/16 UDP> 102353--- allowoutside of 222.22/16 UDP53> 1023---- denyall Access Control Lists r ACL: table of rules, applied top to bottom to incoming packets: (action, condition) pairs

54 Stateful packet filtering r stateless packet filter: heavy handed tool m admits packets that “make no sense,” e.g., dest port = 80, ACK bit set, even though no TCP connection established: action source address dest address protocol source port dest port flag bit allowoutside of 222.22/16 TCP80> 1023ACK r stateful packet filter: track status of every TCP connection m track connection setup (SYN), teardown (FIN) m can determine whether incoming, outgoing packets “makes sense” m timeout inactive connections at firewall: m no longer admit packets

55 action source address dest address proto source port dest port flag bit check conxion allow222.22/16 outside of 222.22/16 TCP> 102380 any allowoutside of 222.22/16 TCP80> 1023ACK x allow222.22/16 outside of 222.22/16 UDP> 102353--- allowoutside of 222.22/16 UDP53> 1023---- x denyall Stateful packet filtering r ACL augmented to indicate need to check connection state table before admitting packet

56 Application gateways r filters packets on application data as well as on IP/TCP/UDP fields. r example: allow select internal users to telnet outside. host-to-gateway telnet session gateway-to-remote host telnet session application gateway router and filter 1. require all telnet users to telnet through gateway. 2. for authorized users, gateway sets up telnet connection to dest host. Gateway relays data between 2 connections 3. router filter blocks all telnet connections not originating from gateway.

57 Limitations of firewalls and gateways r IP spoofing: router can’t know if data “really” comes from claimed source r if multiple app’s. need special treatment, each has own app. gateway. r client software must know how to contact gateway. m e.g., must set IP address of proxy in Web browser r filters often use all or nothing policy for UDP. r tradeoff: degree of communication with outside world, level of security r many highly protected sites still suffer from attacks.

58 Intrusion detection systems r packet filtering: m operates on TCP/IP headers only m no correlation check among sessions r IDS: intrusion detection system m deep packet inspection: look at packet contents e.g., check character strings in packet against database of known virus, attack strings m examine correlation among multiple packets port scanning network mapping DoS attack

59 Web server FTP server DNS server application gateway Internet demilitarized zone internal network firewall IDS sensors Intrusion detection systems r multiple IDSs: different types of checking at different locations

60 8: Network Security Network Security (summary) Basic techniques…... m cryptography (symmetric and public) m message integrity m end-point authentication …. used in many different security scenarios m secure email m secure transport (SSL) m IP sec m 802.11 Operational Security: firewalls and IDS


Download ppt "Lecture 23 Network Security (cont) CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger slides are modified from Jim Kurose,"

Similar presentations


Ads by Google