Скачать презентацию Chapter 7 Network Security A note on the Скачать презентацию Chapter 7 Network Security A note on the

e98d54a821e841ecdc8968396364be82.ppt

  • Количество слайдов: 54

Chapter 7 Network Security A note on the use of these ppt slides: We’re Chapter 7 Network Security A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in powerpoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: q If you use these slides (e. g. , in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) q If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2002. Thanks and enjoy! JFK / KWR All material copyright 1996 -2002 J. F Kurose and K. W. Ross, All Rights Reserved 7: Network Security 1

Chapter 7: Network security Foundations: q what is security? q cryptography q authentication q Chapter 7: Network security Foundations: q what is security? q cryptography q authentication q message integrity q key distribution and certification Security in practice: q application layer: secure e-mail q transport layer: Internet commerce, SSL, SET q network layer: IP security q Firewalls 7: Network Security 2

Friends and enemies: Alice, Bob, Trudy Figure 7. 1 goes here q well-known in Friends and enemies: Alice, Bob, Trudy Figure 7. 1 goes here q well-known in network security world q Bob, Alice (lovers!) want to communicate “securely” q Trudy, the “intruder” may intercept, delete, add messages 7: Network Security 3

What is network security? Secrecy: only sender, intended receiver should “understand” msg contents m What is network security? Secrecy: only sender, intended receiver should “understand” msg contents m sender encrypts msg m receiver decrypts msg Authentication: sender, receiver want to confirm identity of each other Message Integrity: sender, receiver want to ensure message not altered (in transit, or afterwards) without detection 7: Network Security 4

Internet security threats Packet sniffing: m broadcast media m promiscuous NIC reads all packets Internet security threats Packet sniffing: m broadcast media m promiscuous NIC reads all packets passing by m can read all unencrypted data (e. g. passwords) m e. g. : C sniffs B’s packets C A src: B dest: A payload B 7: Network Security 5

Internet security threats IP Spoofing: m can generate “raw” IP packets directly from application, Internet security threats IP Spoofing: m can generate “raw” IP packets directly from application, putting any value into IP source address field m receiver can’t tell if source is spoofed m e. g. : C pretends to be B C A src: B dest: A payload B 7: Network Security 6

Internet security threats Denial of service (DOS): m flood of maliciously generated packets “swamp” Internet security threats Denial of service (DOS): m flood of maliciously generated packets “swamp” receiver m Distributed DOS (DDOS): multiple coordinated sources swamp receiver m e. g. , C and remote host SYN-attack A C A SYN SYN SYN B SYN 7: Network Security 7

The language of cryptography plaintext K K A ciphertext B plaintext Figure 7. 3 The language of cryptography plaintext K K A ciphertext B plaintext Figure 7. 3 goes here symmetric key crypto: sender, receiver keys identical public-key crypto: encrypt key public, decrypt key secret 7: Network Security 8

Symmetric key cryptography substitution cipher: substituting one thing for another m monoalphabetic cipher: substitute Symmetric key cryptography substitution cipher: substituting one thing for another m monoalphabetic cipher: substitute one letter for another plaintext: abcdefghijklmnopqrstuvwxyz ciphertext: mnbvcxzasdfghjklpoiuytrewq E. g. : Plaintext: bob. i love you. alice ciphertext: nkn. s gktc wky. mgsbc Q: How hard to break this simple cipher? : • brute force (how hard? ) • other? 7: Network Security 9

Perfect cipher q Definition: m Let C = E[M] m Pr[C=c] = Pr[C=c | Perfect cipher q Definition: m Let C = E[M] m Pr[C=c] = Pr[C=c | M] q Example: one time pad m Generate random bits b 1. . . bn m E[M 1. . . Mn] = (M 1 b 1. . . Mn bn ) q Cons: size q Pseudo Random Generator m G(R) = b 1. . . bn m Indistinguishable from random (efficiently) 7: Network Security 10

Symmetric key crypto: DES: Data Encryption Standard q US encryption standard [NIST 1993] q Symmetric key crypto: DES: Data Encryption Standard q US encryption standard [NIST 1993] q 56 -bit symmetric key, 64 bit plaintext input q How secure is DES? m DES Challenge: 56 -bit-key-encrypted phrase (“Strong cryptography makes the world a safer place”) decrypted (brute force) in 4 months m no known “backdoor” decryption approach q making DES more secure m use three keys sequentially (3 -DES) on each datum m use cipher-block chaining 7: Network Security 11

Symmetric key crypto: DES operation initial permutation 16 identical “rounds” of function application, each Symmetric key crypto: DES operation initial permutation 16 identical “rounds” of function application, each using different 48 bits of key final permutation 7: Network Security 12

Block Cipher chaining q How do we encode a large message m Would like Block Cipher chaining q How do we encode a large message m Would like to guarantee integrity q Encoding: m Ci = E[Mi Ci-1] q Decoding: m Mi = D[Ci] Ci-1 q Malfunctions: m Loss m Reorder/ integrity 7: Network Security 13

Key Exchange q Diffie & Helman m Based on DISCRETE LOG. q Alice chooses Key Exchange q Diffie & Helman m Based on DISCRETE LOG. q Alice chooses KA and a prime p q Alice selects g (a generator) mod p q Alice sends to Bob (g, p, g. KA mod p) q Bob send to Alice (g, p, g. KB mod p) q The common key is m KA+B = g(KA*KB) mod p m How is the key computed? 7: Network Security 14

Exponentiation q Compute gx mod n Expg, n (x) q Assume x = 2 Exponentiation q Compute gx mod n Expg, n (x) q Assume x = 2 y + b q Let z = Expg, n (y) q R=z 2 q If (b=1) R = g R mod n q Return R q Complexity: logarithmic in x 7: Network Security 15

Public Key Cryptography symmetric key crypto q requires sender, receiver know shared secret key Public Key Cryptography symmetric key crypto q requires sender, receiver know shared secret key q Q: how to agree on key in first place (particularly if never “met”)? public key cryptography q radically different approach [Diffie. Hellman 76, RSA 78] q sender, receiver do not share secret key q encryption key public (known to all) q decryption key private (known only to receiver) 7: Network Security 16

Public key cryptography Figure 7. 7 goes here 7: Network Security 17 Public key cryptography Figure 7. 7 goes here 7: Network Security 17

Public key encryption algorithms Two inter-related requirements: . B 1 need d ( ) Public key encryption algorithms Two inter-related requirements: . B 1 need d ( ) and e ( ) such that d (e (m)) = m B B 2 need public and private keys for d. B( ) and e ( ) . . B RSA: Rivest, Shamir, Adelson algorithm 7: Network Security 18

RSA: Choosing keys 1. Choose two large prime numbers p, q. (e. g. , RSA: Choosing keys 1. Choose two large prime numbers p, q. (e. g. , 1024 bits each) 2. Compute n = pq, z = (p-1)(q-1) 3. Choose e (with e

RSA: Encryption, decryption 0. Given (n, e) and (n, d) as computed above 1. RSA: Encryption, decryption 0. Given (n, e) and (n, d) as computed above 1. To encrypt bit pattern, m, compute e mod n (i. e. , remainder when m e is divided by n) c=m 2. To decrypt received bit pattern, c, compute d m = c d mod n (i. e. , remainder when c is divided by n) Magic d m = (m e mod n) mod n happens! 7: Network Security 20

RSA example: Bob chooses p=5, q=7. Then n=35, z=24. e=5 (so e, z relatively RSA example: Bob chooses p=5, q=7. Then n=35, z=24. e=5 (so e, z relatively prime). d=29 (so ed-1 exactly divisible by z). encrypt: decrypt: letter m me l 12 1524832 c 17 d c 48196857210675091411825223072000 c = me mod n 17 m = cd mod n letter 12 l 7: Network Security 21

RSA: Why m = (m e mod n) d mod n Number theory results: RSA: Why m = (m e mod n) d mod n Number theory results: • Euler Theorem: xp-1 mod p =1 • Chinese Remainder Theorem: • Primes qi • Eq. X mod qi =ai • A unique S, S qi , such that • S mod qi =ai • Consider the eq. mod either p or q (primes!) • R = (me mod p)d mod p = med mod p • ed = k(p-1) +1 • R = m mod p • Chinese Remainder Theorem: unique solution 7: Network Security 22

Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. 0: Alice says “I am Alice” Failure scenario? ? 7: Network Security 23

Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” and sends Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” and sends her IP address along to “prove” it. Failure scenario? ? 7: Network Security 24

Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends her secret password to “prove” it. Failure scenario? 7: Network Security 25

Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and sends her encrypted secret password to “prove” it. I am Alice encrypt(password) Failure scenario? 7: Network Security 26

Authentication: yet another try Goal: avoid playback attack Nonce: number (R) used onlyonce in Authentication: yet another try Goal: avoid playback attack Nonce: number (R) used onlyonce in a lifetime ap 4. 0: to prove Alice “live”, Bob sends Alice nonce, R. Alice must return R, encrypted with shared secret key Figure 7. 11 goes here Failures, drawbacks? 7: Network Security 27

Authentication: ap 5. 0 ap 4. 0 requires shared symmetric key m problem: how Authentication: ap 5. 0 ap 4. 0 requires shared symmetric key m problem: how do Bob, Alice agree on key m can we authenticate using public key techniques? ap 5. 0: use nonce, public key cryptography Figure 7. 12 goes here Should we trust Alice for its public key? 7: Network Security 28

ap 5. 0: security hole ? Man (woman) in the middle attack: Trudy poses ap 5. 0: security hole ? Man (woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) Figure 7. 14 goes here Need “certified” public keys (more later …) 7: Network Security 29

ap 5. 0: security hole ? Man (woman) in the middle attack: Trudy poses ap 5. 0: security hole ? Man (woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) Figure 7. 14 goes here Need “certified” public keys (more later …) 7: Network Security 30

Digital Signatures Cryptographic technique analogous to handwritten signatures. Simple digital signature for message m: Digital Signatures Cryptographic technique analogous to handwritten signatures. Simple digital signature for message m: q Sender (Bob) digitally signs private key d. B, creating signed message, d. B(m). q Bob sends m and d. B(m) to Alice. document, establishing he is document owner/creator. q Verifiable, nonforgeable: recipient (Alice) can verify that Bob, and no one else, signed document. q Assumption: m m q Bob decrypts m with his e. B(d. B(m)) = d. B(e. B(m)) RSA 7: Network Security 31

Digital Signatures (more) q Suppose Alice receives Alice thus verifies that: msg m, and Digital Signatures (more) q Suppose Alice receives Alice thus verifies that: msg m, and digital m Bob signed m. signature d. B(m) m No one else signed m. q Alice verifies m signed m Bob signed m and not m’. by Bob by applying Non-repudiation: Bob’s public key e. B to m Alice can take m, and d. B(m) then checks signature d. B(m) to court e. B(d. B(m) ) = m. and prove that Bob q If e. B(d. B(m) ) = m, signed m. whoever signed m must have used Bob’s private key. 7: Network Security 32

Message Digests Computationally expensive to public-key-encrypt long messages Goal: fixed-length, easy to compute digital Message Digests Computationally expensive to public-key-encrypt long messages Goal: fixed-length, easy to compute digital signature, “fingerprint” q apply hash function H to m, get fixed size message digest, H(m). Hash function properties: q Many-to-1 q Produces fixed-size msg digest (fingerprint) q Given message digest x, computationally infeasible to find m such that x = H(m) q computationally infeasible to find any two messages m and m’ such that H(m) = H(m’). 7: Network Security 33

Digital signature = Signed message digest Bob sends digitally signed message: Alice verifies signature Digital signature = Signed message digest Bob sends digitally signed message: Alice verifies signature and integrity of digitally signed message: 7: Network Security 34

Hash Function Algorithms q Internet checksum would make a poor message digest. m Too Hash Function Algorithms q Internet checksum would make a poor message digest. m Too easy to find two messages with same checksum. q MD 5 hash function widely used. m Computes 128 -bit message digest in 4 -step process. m arbitrary 128 -bit string x, appears difficult to construct msg m whose MD 5 hash is equal to x. q SHA-1 is also used. m US standard m 160 -bit message digest 7: Network Security 35

Trusted Intermediaries Problem: m How do two entities m When Alice obtains establish shared Trusted Intermediaries Problem: m How do two entities m When Alice obtains establish shared Bob’s public key secret key over (from web site, enetwork? mail, diskette), how does she know it is Solution: Bob’s public key, not m trusted key Trudy’s? distribution center Solution: (KDC) acting as intermediary m trusted certification between entities authority (CA) 7: Network Security 36

Key Distribution Center (KDC) q Alice, Bob need shared symmetric key. q KDC: server Key Distribution Center (KDC) q Alice, Bob need shared symmetric key. q KDC: server shares different secret key with each registered user. q Alice, Bob know own symmetric keys, KA-KDC KB-KDC , for communicating with KDC. q Alice communicates with KDC, gets session key R 1, and KBKDC(A, R 1) q Alice sends Bob KB-KDC(A, R 1), Bob extracts R 1 q Alice, Bob now share the symmetric key R 1. 7: Network Security 37

Certification Authorities q Certification authority (CA) binds public key to particular entity. q Entity Certification Authorities q Certification authority (CA) binds public key to particular entity. q Entity (person, router, etc. ) can register its public key with CA. m Entity provides “proof of identity” to CA. m CA creates certificate binding entity to public key. m Certificate digitally signed by CA. q When Alice wants Bob’s public key: q gets Bob’s certificate (Bob or elsewhere). q Apply CA’s public key to Bob’s certificate, get Bob’s public key 7: Network Security 38

Secure e-mail • Alice wants to send secret e-mail message, m, to Bob. • Secure e-mail • Alice wants to send secret e-mail message, m, to Bob. • generates random symmetric private key, KS. • encrypts message with KS • also encrypts KS with Bob’s public key. • sends both KS(m) and e. B(KS) to Bob. 7: Network Security 39

Secure e-mail (continued) • Alice wants to provide sender authentication message integrity. • Alice Secure e-mail (continued) • Alice wants to provide sender authentication message integrity. • Alice digitally signs message. • sends both message (in the clear) and digital signature. 7: Network Security 40

Secure e-mail (continued) • Alice wants to provide secrecy, sender authentication, message integrity. Note: Secure e-mail (continued) • Alice wants to provide secrecy, sender authentication, message integrity. Note: Alice uses both her private key, Bob’s public key. 7: Network Security 41

Pretty good privacy (PGP) q Internet e-mail encryption scheme, a de-facto standard. q Uses Pretty good privacy (PGP) q Internet e-mail encryption scheme, a de-facto standard. q Uses symmetric key cryptography, public key cryptography, hash function, and digital signature as described. q Provides secrecy, sender authentication, integrity. q Inventor, Phil Zimmerman, was target of 3 -year federal investigation. A PGP signed message: ---BEGIN PGP SIGNED MESSAGE--Hash: SHA 1 Bob: My husband is out of town tonight. Passionately yours, Alice ---BEGIN PGP SIGNATURE--Version: PGP 5. 0 Charset: noconv yh. HJRHh. GJGhgg/12 Ep. J+lo 8 g. E 4 v. B 3 mq. Jh FEv. ZP 9 t 6 n 7 G 6 m 5 Gw 2 ---END PGP SIGNATURE--- 7: Network Security 42

Secure sockets layer (SSL) q PGP provides security for a specific network app. q Secure sockets layer (SSL) q PGP provides security for a specific network app. q SSL works at transport layer. Provides security to any TCP-based app using SSL services. q SSL: used between WWW browsers, servers for Icommerce (https). q SSL security services: m m m server authentication data encryption client authentication (optional) q Server authentication: m m m SSL-enabled browser includes public keys for trusted CAs. Browser requests server certificate, issued by trusted CA. Browser uses CA’s public key to extract server’s public key from certificate. q Visit your browser’s security menu to see its trusted CAs. 7: Network Security 43

Internet Explorer: Tools Internet options Content Certificates 7: Network Security 44 Internet Explorer: Tools Internet options Content Certificates 7: Network Security 44

Internet Explorer: Error Message 7: Network Security 45 Internet Explorer: Error Message 7: Network Security 45

SSL (continued) Encrypted SSL session: q Browser generates symmetric session key, encrypts it with SSL (continued) Encrypted SSL session: q Browser generates symmetric session key, encrypts it with server’s public key, sends encrypted key to server. q Using its private key, server decrypts session key. q Browser, server agree that future msgs will be encrypted. q All data sent into TCP socket (by client or server) is encrypted with session key. q SSL: basis of IETF Transport Layer Security (TLS). q SSL can be used for non. Web applications, e. g. , IMAP. q Client authentication can be done with client certificates. 7: Network Security 46

IPsec: Network Layer Security q Network-layer secrecy: sending host encrypts the data in IP IPsec: Network Layer Security q Network-layer secrecy: sending host encrypts the data in IP datagram m TCP and UDP segments; ICMP and SNMP messages. q Network-layer authentication m destination host can authenticate source IP address q Two principle protocols: m authentication header (AH) protocol m encapsulation security payload (ESP) protocol m q For both AH and ESP, source, destination handshake: m create network-layer logical channel called a service agreement (SA) q Each SA unidirectional. q Uniquely determined by: m security protocol (AH or ESP) m source IP address m 32 -bit connection ID 7: Network Security 48

ESP Protocol q Provides secrecy, host q ESP authentication, data field is similar to ESP Protocol q Provides secrecy, host q ESP authentication, data field is similar to AH integrity. authentication field. q Data, ESP trailer q Protocol = 50. encrypted. q Next header field is in ESP trailer. 7: Network Security 49

Authentication Header (AH) Protocol q Provides source host authentication, data integrity, but not secrecy. Authentication Header (AH) Protocol q Provides source host authentication, data integrity, but not secrecy. q AH header inserted between IP header and IP data field. q Protocol field = 51. q Intermediate routers process datagrams as usual. AH header includes: q connection identifier q authentication data: signed message digest, calculated over original IP datagram, providing source authentication, data integrity. q Next header field: specifies type of data (TCP, UDP, ICMP, etc. ) 7: Network Security 50

Firewalls firewall isolates organization’s internal net from larger Internet, allowing some packets to pass, Firewalls firewall isolates organization’s internal net from larger Internet, allowing some packets to pass, blocking others. Two firewall types: m packet filter m application gateways To prevent denial of service attacks: m SYN flooding: attacker establishes many bogus TCP connections. Attacked host alloc’s TCP buffers for bogus connections, none left for “real” connections. To prevent illegal modification of internal data. m e. g. , attacker replaces CIA’s homepage with something else To prevent intruders from obtaining secret info. 7: Network Security 51

Packet Filtering q Internal network is connected to Internet through a router. q Router Packet Filtering q Internal network is connected to Internet through a router. q Router manufacturer provides options for filtering packets, based on: m m m source IP address destination IP address TCP/UDP source and destination port numbers ICMP message type TCP SYN and ACK bits q Example 1: block incoming and outgoing datagrams with IP protocol field = 17 and with either source or dest port = 23. m All incoming and outgoing UDP flows and telnet connections are blocked. q 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. 7: Network Security 52

Application gateways q Filters packets on application data as well as on IP/TCP/UDP fields. Application gateways q Filters packets on application data as well as on IP/TCP/UDP fields. q Example: allow select internal users to telnet outside. gateway-to-remote host telnet session host-to-gateway 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. 7: Network Security 53

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

Network Security (summary) Basic techniques…. . . q cryptography (symmetric and public) q authentication Network Security (summary) Basic techniques…. . . q cryptography (symmetric and public) q authentication q message integrity …. used in many different security scenarios q secure email q secure transport (SSL) q IP sec q Firewalls 7: Network Security 55