chapter 7 network security

88
Network Security 7-1 Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved Chapter 7 Network Security Communication Networks P. Demeester Computer networking - A top-down approach featuring the internet 4th Edition, 2008 Addison Wesley James F. Kurose, Keith W. Ross ISBN 0-321-49770-8

Upload: vesta

Post on 26-Jan-2016

63 views

Category:

Documents


4 download

DESCRIPTION

Computer networking - A top-down approach featuring the internet 4th Edition, 2008 Addison Wesley James F. Kurose, Keith W. Ross ISBN 0-321-49770-8. Communication Networks P. Demeester. Chapter 7 Network Security. Chapter 7: Network Security. Chapter goals: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 7 Network Security

Network Security 7-1

Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved

Chapter 7Network Security

Communication NetworksP. Demeester

Computer networking -A top-down approach featuring the internet4th Edition, 2008Addison WesleyJames F. Kurose, Keith W. RossISBN 0-321-49770-8

Page 2: Chapter 7 Network Security

Network Security 7-2

Chapter 7: Network Security

Chapter goals: understand principles of network security:

cryptography and its many uses beyond “confidentiality”

authentication message integrity key distribution

security in practice: firewalls security in application, transport, network, link

layers

Page 3: Chapter 7 Network Security

Network Security 7-3

Chapter 7 outline

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Page 4: Chapter 7 Network Security

Network Security 7-4

What is network security?

Confidentiality: only sender, intended receiver should “understand” message contents sender encrypts message receiver decrypts message

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, also check sender

Access and Availability: services must be accessible and available to (legitimate) users (<> DoS)

Page 5: Chapter 7 Network Security

Network Security 7-5

Friends and enemies: Alice, Bob, Trudy

well-known in network security world Bob, Alice want to communicate “securely” (requiring

data and control messages) Trudy (intruder) may intercept, delete, add messages

securesender

securereceiver

channel data, control messages

data data

Alice Bob

Trudy

Page 6: Chapter 7 Network Security

Network Security 7-6

Who might Bob, Alice be?

real-life Bobs and Alices! Web browser/server for electronic

transactions (e.g., on-line purchases) on-line banking client/server DNS servers routers exchanging routing table updates …

Page 7: Chapter 7 Network Security

Network Security 7-7

eavesdrop: intercept messages (passive) actively insert messages into connection impersonation: can fake (spoof) source

address in packet (or any field in packet) hijacking: “take over” ongoing connection

by removing sender or receiver, inserting himself in place

denial of service: prevent service from being used by others (e.g., by overloading resources)

See also www.cert.org

What may happen ?

Page 8: Chapter 7 Network Security

Network Security 7-8

Twisted pairEthernet

ADSL modem ADSL multiplexer

PUBLIC INTERNET

FTP server

Mail serverTrudy

publicgatewayrouter

CASE 1 : Home Network with single PC

Page 9: Chapter 7 Network Security

Network Security 7-9

Ethernet10/100 Mbit/s

or 1 Gbit/s Fiber

EthernetSwitch or

Hub

PUBLIC INTERNET

publicgatewayrouter

FTP server

Web server

Trudy

Trudy

CASE 2 : Company Network : multiple PC’s/servers

Page 10: Chapter 7 Network Security

Network Security 7-10

Trudy

e-mailserver

RouterSwitch PCTrudyTrudy

TrudyWirelessIEEE 802.11

Laptop

TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

WEP

SSL SSL

PGP

NetwDataPhy

DataPhy

NetwDataPhy

NetwDataPhy

NetwDataPhy

NetwDataPhy

wireless

IPSec IPSec

Ref. Scenario 1 : protection of information in transit

Page 11: Chapter 7 Network Security

Network Security 7-11

IP

TCP UDP

InternetExplorer

Netscape FTP-server … …

HTTP FTP … …

157.193.144.12

6 13

80 20,21

PW

IP address

Protocol number

Port number

Password

How to enter the computer ?

Ref. Scenario 2: protection of information on computers

Page 12: Chapter 7 Network Security

Network Security 7-12

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 13: Chapter 7 Network Security

Network Security 7-13

symmetric key cryptography: sender, receiver keys identical and secret

public-key cryptography: encryption key public, decryption key secret (private) [or vice versa]

encryptionalgorithm

decryption algorithm

ciphertext

KA

Alice’s encryptionkey

Bob’s decryptionkey

KB

plaintext orcleartext

Alice

plaintext

Bob

Trudy

The language of cryptography

Page 14: Chapter 7 Network Security

Network Security 7-14

7.1 What is network security?7.2 Principles of cryptography

7.2.1. Symmetric Key Encryption7.2.2. Public Key Encryption

7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 15: Chapter 7 Network Security

Network Security 7-15

substitution cipher: substituting one thing for another monoalphabetic cipher: substitute one letter for another

plaintext: abcdefghijklmnopqrstuvwxyz

ciphertext: mnbvcxzasdfghjklpoiuytrewq

ciphertext: nkn. s gktc wky. mgsbc

plaintext: bob. i love you. aliceE.g.:

Symmetric key cryptography

Page 16: Chapter 7 Network Security

Network Security 7-16

Symmetric key cryptography

symmetric key cryptography: Bob and Alice share same (symmetric) key: KA-B

e.g., key is knowing substitution pattern in mono alphabetic substitution cipher

plaintextciphertextencryptionalgorithm

decryption algorithm

KA-B

plaintextmessage, m

K (m)A-B

K (m)A-Bm = K ( )

A-B

Alice BobKA-B

Page 17: Chapter 7 Network Security

Network Security 7-17

Ciphertext-only attack brute force is difficult (26! or 1026 combinations) statistical analysis : use fact that “e” and “t” are

used 13% resp. 9% in English text, use particular combinations : “in”, “ion”, “ing”, … much easier to break

Known-plaintext attack If we now that Alice and Bob are communicating

we may know cipher for a,l,i,c,e,b,o Chosen-plaintext

the intruder is able to choose the plaintext (e.g. “The quick brown fox jumps over the lazy dog” allows to break the complete cypher)

How to break the cipher ?

What do we gain ?

Page 18: Chapter 7 Network Security

Network Security 7-18

DES: Data Encryption Standard US encryption standard [NIST 1993] [www.nist.org] 56-bit symmetric key, 64-bit plaintext input

(block cipher)

How secure is DES? DES Challenge: 56-bit-key-encrypted phrase

(“Strong cryptography makes the world a safer place”) decrypted (brute force) in 4 months (1997)

making DES more secure: use three keys sequentially (3-DES) use cipher-block chaining (XOR encrypted 64 bit

block j with block j+1 before its encrypted)

Symmetric key crypto: DES

Page 19: Chapter 7 Network Security

initial permutation 16 identical “rounds” each

using different 48 bits of key (based on permutations and substitutions)

final permutationreverse : from bottom to top

DES operation

Symmetric key crypto: DES

Page 20: Chapter 7 Network Security

Network Security 7-20

new (Nov. 2001) symmetric-key NIST standard, replacing DES

processes data in 128 bit blocks 128, 192, or 256 bit keys brute force decryption (try each key) taking

1 sec on DES, takes 149 trillion years for AES

Rijndael : Rijmen en Daemen (Belgian Researchers, KULeuven)

AES: Advanced Encryption Standard

Page 21: Chapter 7 Network Security

Network Security 7-21

Cipher Author Key length (bits)

Comments

Blowfish Schneier 1-448 Old and slow

DES IBM 56 Too weak

IDEA Massey & Xueja 128 Good, patented

RC4 Rivest 1-2048 Some keys weak

RC5 Rivest 128-256 Good, patented

Rijndael Daemen & Rijmen 128-256 Best choice

Serpent Anderson, Biham, Knudsen

128-256 Very strong

Triple DES IBM 168 Second best choice

Twofish Scheier 128-256 Very strong, widely used

A.S. Tanenbaum, computer networks, 2003

Overview

Page 22: Chapter 7 Network Security

Network Security 7-22

Chapter 7 outline

7.1 What is network security?7.2 Principles of cryptography

7.2.1. Symmetric Key Encryption7.2.2. Public Key Encryption

7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Page 23: Chapter 7 Network Security

Network Security 7-23

symmetric key crypto requires sender,

receiver know shared secret key

Q: how to agree on key in first place (particularly if never “met”)?

public key cryptography

radically different approach [Diffie-Hellman76, RSA78]

sender, receiver do not share secret key

public encryption key known to all

private decryption key known only to receiver

Public Key Cryptography

Page 24: Chapter 7 Network Security

Network Security 7-24

encryptionalgorithm

decryptionalgorithm

plaintextmessage, m

Alice

ciphertext

K (m)B+

Bob’s privatekey

K B

-

m = K (K (m))B+

B-

Bob’s public key K B

+

plaintextmessage

Bob

Public key cryptography

Page 25: Chapter 7 Network Security

Network Security 7-25

Requirements:

RSA: Rivest, Shamir, Adelson algorithm

2 given public key K , it should be impossible to compute private key K B

B+

-

B B+ -

K (K (m)) = m BB

- +

. .1 need K ( ) and K ( ) such that

Public key encryption algorithms

Page 26: Chapter 7 Network Security

Network Security 7-26

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<n) that has no common factors with z. (e, z are “relatively prime”).

4. Choose d such that ed-1 is exactly divisible by z. (in other words: ed mod z = 1 ).

5. Public key is (n,e). Private key is (n,d).

K B+ K B

-

p=5, q=7

n=35, z=24

e=5

d=29(ed-

1=144=24.6)

(35,5) (35,29)

RSA: Choosing keys

e : encryptiond : decryption

Page 27: Chapter 7 Network Security

Network Security 7-27

1. To encrypt bit pattern, m (=12), compute

c = m mod n

e (i.e., remainder when m is divided by n)e

2. To decrypt received bit pattern, c, compute

m = c mod n

d (i.e., remainder when c is divided by n)d

m = (m mod n)

e mod n

dMagichappens!

c

c=125 mod 35=17

0. Given (n,e) and (n,d) as computed above(35,5) (35,29)

c=1729 mod 35=12

RSA: Encryption, decryption

Page 28: Chapter 7 Network Security

Network Security 7-28

Bob chooses p=5, q=7 then n=35, z=24e=5 (so e, z relatively prime)d=29 (so ed-1 exactly divisible by z)

letter m me c = m mod ne

l 12 1524832 17encrypt:

c m = c mod nd

17 481968572106750915091411825223071697

12cd letter

ldecrypt:

RSA example summary :

Page 29: Chapter 7 Network Security

Network Security 7-29

m = (m mod n)

e mod n

d

(m mod n)

e mod n = m mod n

d ed

= m mod n

ed mod (p-1)(q-1)

= m mod n1

= m

(since ed divisible by (p-1)(q-1) with remainder 1 )

Useful number theory result: If p,q prime and n = pq, then:

x mod n = x mod ny y mod (p-1)(q-1)

modular arithmetic :{(a mod n).(b mod n)} mod n = (ab) mod n

&(a mod n) mod n = a mod n

RSA: Why is that

Page 30: Chapter 7 Network Security

Network Security 7-30

The following property will be very useful later:

K (K (m)) = m BB

- +K (K (m))

BB+ -

=

use public key first, followed

by private key

use private key first,

followed by public key

Result is the same!

RSA: another important property

Page 31: Chapter 7 Network Security

Network Security 7-31

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 32: Chapter 7 Network Security

Network Security 7-32

Goal: Bob wants Alice to “prove” her identity to him

Protocol ap1.0: Alice says “I am Alice”

“I am Alice”Alice Bob

Trudy“I am Alice”

in a network,Bob can not “see”

Alice, so Trudy simply declares

herself to be Alice

Authentication

Page 33: Chapter 7 Network Security

Network Security 7-33

Protocol ap2.0: Alice says “I am Alice” in an IP packetcontaining her source IP address

“I am Alice”Alice’s

IP address

Alice Bob

Trudy“I am Alice”

Alice’s IP address

Trudy can createa packet

“spoofing”Alice’s address

Trudy’s first hop router to be configured to forward only IP packets with correct subnetwork address [RFC 2827]; not universally deployed or enforced and maybe Trudy configures her router

Authentication: another try

Page 34: Chapter 7 Network Security

Network Security 7-34

Protocol ap3.0: Alice says “I am Alice” and sends her secret password to “prove” it.

“I’m Alice”Alice’s IP addr

Alice’s password

OKAlice’s IP addr

Alice Bob

Trudy

playback attack: Trudy records Alice’s packet

and laterplays it back to

Bob “I’m Alice”Alice’s

IP addrAlice’s

password

OKAlice’s IP addr

Authentication: another try

Page 35: Chapter 7 Network Security

Network Security 7-35

Protocol ap3.0: Alice says “I am Alice” and sends her encrypted secret password to “prove” it.

“I’m Alice”Alice’s IP addr

encrypted password

OKAlice’s IP addr

Alice Bob

Trudy

playback attack: Still works

“I’m Alice”Alice’s IP addr

encrypted password

OKAlice’s IP addr

Authentication: another try

Page 36: Chapter 7 Network Security

Network Security 7-36

Goal: avoid playback attack

Nonce: number (R) used only once–in-a-lifetime

ap4.0: to prove Alice “live”, Bob sends Alice nonce, R. Alice

must return R, encrypted with shared secret key“I am Alice”

R

K (R)A-B

Alice is live, and only Alice knows key to encrypt

nonce, so it must be Alice!

AliceBob

Authentication: yet another try

Page 37: Chapter 7 Network Security

Network Security 7-37

ap4.0 requires shared symmetric key can we authenticate using public key techniques?ap5.0: use nonce, public key cryptography

“I am Alice”

RK (R)A

-

“send me your public key”

K A+

Bob computes

(K (R)) = RA

-K A

+

and knows only Alice could have the

private key, that encrypted R such that

(K (R)) = RA-

K A+

AliceBob

Authentication: ap5.0

Page 38: Chapter 7 Network Security

Network Security 7-38

Trudy replaces Alice

“I am Alice”

RK (R)T

-

“send me your public key”

K T+

Bob computes

(K (R)) = RT

-K T

+

and believes only Alice could have the

private key, that encrypted R such that

(K (R)) = RT-

K T+

TrudyBob

Authentication: ap5.0 : security hole

Page 39: Chapter 7 Network Security

Network Security 7-39

“man-in-the-middle-attack”: Trudy poses as Alice (to Bob) and as Bob (to Alice)

I am Alice I am Alice

R

TK (R)

-

Send me your public key

TK

+A

K (R)-

Send me your public key

AK

+

TK (m)+

Tm = K (K (m))+

T-

Trudy gets

sends m to Alice encrypted

with Alice’s public key

AK (m)+

Am = K (K (m))+

A-

R

Alice BobTrudy

AK

+A

K -

TK

+T

K -

AK

+T

K +

ap5.0: security hole How is this possible ?

Use of Certification Authority (CA)!

Page 40: Chapter 7 Network Security

Network Security 7-40

Chapter 7 outline

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Message integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Page 41: Chapter 7 Network Security

Network Security 7-41

Cryptographic technique analogous to hand-written signatures.

sender (Bob) digitally signs document, establishing he is document owner/creator.

verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document

Digital Signatures

Page 42: Chapter 7 Network Security

Network Security 7-42

Dear Alice

I will provide you 2 M$ within the coming month. Best regards,

Bob

Bob’s message, m

Public keyencryptionalgorithm

Bob’s privatekey

K B-

ssdhetiaksjjsdnaekfieqqewjknfeiqwpsjfnwerpanbgbpwwwejnbopweajwerskapqbrmdo

srofnqnjfnd

K B-(m)

--

Simple digital signature for message m:Bob signs m by encrypting with his private key KB, creating “signed” message, KB(m)

Digital Signatures

Page 43: Chapter 7 Network Security

Network Security 7-43

Suppose Alice receives msg m, digital signature KB(m)

Alice verifies m signed by Bob by applying Bob’s public key KB to KB(m) then checks KB(KB(m) ) = m.

If KB(KB(m) ) = m, whoever signed m must have used

Bob’s private key.

+ +

-

-

- -

+

Alice thus verifies that: Bob signed m. No one else signed m. Bob signed m and not m’.

Non-repudiation: Alice can take m, and signature KB(m) to

court and prove that Bob signed m.

Digital Signatures

-

Page 44: Chapter 7 Network Security

Network Security 7-44

Computationally expensive to public-key-encrypt long messages

Goal: fixed-length, easy- to-compute digital “fingerprint”

apply hash function H to m, get fixed size message digest, H(m).

Hash function properties: many-to-1 produces fixed-size msg

digest (fingerprint) given message digest x,

computationally infeasible to find m such that x = H(m)

large message

m

H: HashFunction

H(m)

Message Digests

Page 45: Chapter 7 Network Security

Network Security 7-45

Internet checksum has some properties of hash function: produces fixed length digest (16-bit sum) of message is many-to-one

But given message with given hash value, it is easy to find another message with same hash value:

I O U 10 0 . 99 B O B

message49 4F 55 3130 30 2E 3939 42 4F 42

ASCII format

B2 C1 D2 AC

I O U 90 0 . 19 B O B

message49 4F 55 3930 30 2E 3139 42 4F 42

ASCII format

B2 C1 D2 ACdifferent messagesbut identical checksums!

Internet checksum: poor crypto hash function

Page 46: Chapter 7 Network Security

Network Security 7-46

large message

mH: Hashfunction H(m)

digitalsignature(encrypt)

Bob’s privat

ekey

K B-

+

Bob sends digitally signed message:Alice verifies signature and

integrity of digitally signed message:

KB(H(m))-

encrypted msg digest

digitalsignature(decrypt)

KB(H(m))-

encrypted msg digest

large message

m

H: Hashfunction

H(m)

Bob’s public

key K B+

Digital signature = signed message digest

H(m)

equal ?

Page 47: Chapter 7 Network Security

Network Security 7-47

MD5 hash function widely used (RFC 1321, Ron Rivest) computes 128-bit message digest in 4-step

process. arbitrary 128-bit string x, appears difficult to

construct msg m whose MD5 hash is equal to x.

SHA-1 is also used. US standard [NIST, FIPS PUB 180-1] 160-bit message digest (more secure compared to

MD5)

Hash Function Algorithms

Page 48: Chapter 7 Network Security

Network Security 7-48

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 49: Chapter 7 Network Security

Network Security 7-49

Symmetric key problem:

How do two entities establish shared secret key over network?

Solution: trusted key distribution

center (KDC) acting as intermediary between entities

Public key problem: When Alice obtains

Bob’s public key (from web site, e-mail, diskette), how does she know it is Bob’s public key, not Trudy’s?

Solution: trusted certification

authority (CA)

Trusted Intermediaries

Page 50: Chapter 7 Network Security

Network Security 7-50

KDC

Alice, Bob need shared symmetric key. KDC: server shares different secret key with each

registered user (many users) Alice, Bob know own symmetric keys, KA-KDC KB-KDC ,

for communicating with KDC.

KX-KDC

KY-KDC

KZ-KDC

Key Distribution Center (KDC)

KA-KDC

KA-KDCAlice KB-KDC

KB-KDCBob

KP-KDC

KP-KDC

Peter

Page 51: Chapter 7 Network Security

Network Security 7-51

Aliceknows

R1

Alice and Bob communicate: using R1 as session key for shared symmetric

encryption

How does KDC allow Bob, Alice to determine shared symmetric secret key to communicate with each other? KDC

generates R1

KB-KDC(A,R1)

KA-KDC(A,B)

K A-KDC(R1,K B-KDC

(A,R1))

Key Distribution Center (KDC)

Alice

Bob knows R1 to

communicate with Alice

Bob

e.g. : KDC : Kerberos

Page 52: Chapter 7 Network Security

Network Security 7-52

Certification authority (CA): binds public key to particular entity, E.

E (person, router) registers its public key with CA. E provides “proof of identity” to CA. CA creates certificate, binding E to E’s public key. certificate containing E’s public key digitally signed by

CA – CA says “this is E’s public key”

Bob’s public

key K B+

certificate for Bob’s public

key, signed by CA

Certification Authorities

Bob CABob’s identifyin

g informati

on

digitalsignature(encrypt)

CA privat

ekey

K CA-

K B+

Bob

Page 53: Chapter 7 Network Security

Network Security 7-53

When Alice wants Bob’s public key: gets Bob’s certificate (from Bob or

elsewhere). apply CA’s public key to signature of Bob’s

certificate, trust Bob’s public keydigital

signature(decrypt)

CA public

key K CA+

Bob’s public

Keytrusted

K B+

Certification Authorities

K B+

Bob

Page 54: Chapter 7 Network Security

Network Security 7-54

Serial number (unique to issuer) info about certificate owner, including

algorithm and key value itself (not shown) info about

certificate issuer valid dates digital signature by

issuer

A certificate contains

Page 55: Chapter 7 Network Security

Network Security 7-55

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 56: Chapter 7 Network Security

Network Security 7-56

isolates organization’s internal network from larger Internet, allowing some packets to pass, blocking others.

firewall

administerednetwork

publicInternet

firewall

Firewalls

Page 57: Chapter 7 Network Security

Network Security 7-57

prevent denial of service attacks: SYN flooding: attacker establishes many

bogus TCP connections, no resources left for “real” connections.

prevent illegal modification/access of internal data. e.g., attacker replaces CIA’s homepage with

something elseallow only authorized access to inside network (set

of authenticated users/hosts)two types of firewalls:

application-level packet-filtering

Firewalls: Why

Page 58: Chapter 7 Network Security

Network Security 7-58

internal network connected to Internet via router firewall

router filters packet-by-packet, decision to forward/drop packet based on: source IP address, destination IP address TCP/UDP source and destination port numbers ICMP message type TCP SYN and ACK bits

Packet FilteringShould arriving packet

be allowed in? Departing packet let

out?

Page 59: Chapter 7 Network Security

Network Security 7-59

Packet Filtering

firewall

Internet

157.193.0.0/16

157.193.122.5e-mail server

Forward policy DENY

protocol source destination ports

ACCEPT TCP 157.193.0.0/16 0.0.0.0/0 1024:65535 -> 80

ACCEPT TCP 0.0.0.0/0 157.193.0.0/16 80 -> 1024:65535

ACCEPT TCP 157.193.122.5/32

0.0.0.0/0 25 -> 1024:65535

ACCEPT TCP 0.0.0.0/0 157.193.122.5/32

1024:65535 -> 25

General rule : deny all traffic

allow browsingto outside world

(HTTP)

accept e-mails(SMTP)

Page 60: Chapter 7 Network Security

Network Security 7-60

Application gateways

Internet

webserver

kpn157.193.122.0/24

133.102.57.213

Filter incoming/outgoing information based on application dataTypically combined with packet filtersExample : Web proxy (but also e-mail server, Telnet server, …)

packetfilter

Only traffic from/to157.193.123.25

Internet Explorer : tools>internet options>LAN settings>proxy settings advanced

157.193.123.25

applicationgateway

packetfilter

Only traffic from/to157.193.123.25

Application gateway could also act as cache for web trafficApplication gateway could act as e-mail server (including virus scanning of all e-mails)…

To 157.193.123.25 (application gateway)GET HTTP://www.kpn.com/ HTTP/1.0

To 133.102.57.213 (webserver)GET HTTP://www.kpn.com/ HTTP/1.0

Page 61: Chapter 7 Network Security

Network Security 7-61

IP spoofing: router can’t know if data “really” comes from claimed source

if multiple app’s. need special treatment, each has own app. gateway.

client software must know how to contact gateway. e.g., must set IP address

of proxy in Web browser

filters often use all or nothing policy for UDP.

tradeoff: degree of communication with outside world, level of security

many highly protected sites still suffer from attacks.

Limitations of firewalls and gateways

Page 62: Chapter 7 Network Security

Network Security 7-62

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures7.8 Security in many layers

Chapter 7 outline

Page 63: Chapter 7 Network Security

Network Security 7-63

Mapping: before attacking: find out what services are

implemented on network Use ping to determine what hosts have

addresses on network Port-scanning: try to establish TCP connection

to each port in sequence (see what happens) nmap (http://www.insecure.org/nmap/)

mapper: “network exploration and security auditing”

Internet security threats

Mapping: countermeasures record traffic entering network look for suspicious activity (IP addresses,

ports being scanned sequentially)

Page 64: Chapter 7 Network Security

Network Security 7-64

Packet sniffing: broadcast media promiscuous NIC reads all packets passing by can read all unencrypted data (e.g. passwords)

A

B

C

src:B dest:A payload

Internet security threats

Packet sniffing: countermeasures all hosts in organization run software that

checks periodically if host interface in promiscuous mode ( report to IT manager).

Avoid broadcast medium (e.g. use switched Ethernet)

Page 65: Chapter 7 Network Security

Network Security 7-65

IP Spoofing: can generate “raw” IP packets directly

from application, putting any value into IP source address field

receiver can’t tell if source is spoofed

A

B

C

src:B dest:A payload

Internet security threats

IP Spoofing: ingress filtering routers should not forward outgoing packets with

invalid source addresses (e.g., datagram source address not in router’s network)

Page 66: Chapter 7 Network Security

Network Security 7-66

Denial of service (DOS): flood of maliciously generated packets “swamp”

receiver Distributed DOS (DDOS): multiple coordinated

sources swamp receiverA

B

C

SYN

SYNSYNSYN

SYN

SYN

Internet security threats

Denial of service (DOS): countermeasures filter out flooded packets (e.g., SYN) before

reaching host: throw out good with bad trace back to source of floods (most likely

an innocent, compromised machine)

TCP sync (do not send 3th packet)Fragmented IP packets (do not send all fragments)

Page 67: Chapter 7 Network Security

Network Security 7-67

Internet security threats find out the location (IP address)

DNS (Domain Name System) search for ports that are open

port scan programs try to find the password

password scan programs all interesting additional information sniffing

spoofing of identity get own software on the server

take control (trojan horse) damage the software/hardware (virus)

(D)DoS viruses …

www.cert.orgcert.belnet.be

Page 68: Chapter 7 Network Security

Network Security 7-68

Internet security counter measures firewall (protection against outside world) (central/local) virus scanner (update regularly !!!) good password protection (do not use post-it on your

PC) monitoring and data logging/analysis (to detect attacks) protection for information in transit (on the network)

(WEP, IPsec, SSL, PGP, …) make good software choice (e.g. Linux <> MS server) install (security) patches (to repair security bugs) know the hacker tools yourself have a good security policy internal security is important problem (switches, PGP,

SSH, …) never think that nobody is interested in your computer !

(maybe there is no interesting information but it might be an ideal place for hackers to start attacks, e.g. DDoS)

Page 69: Chapter 7 Network Security

Network Security 7-69

Chapter 7 outline

7.1 What is network security?7.2 Principles of cryptography7.3 Authentication7.4 Integrity7.5 Key Distribution and certification7.6 Access control: firewalls7.7 Attacks and counter measures

7.8 Security in many layers7.8.1. Secure email7.8.2. Secure sockets7.8.3. IPsec7.8.4. 802.11 WEP

Page 70: Chapter 7 Network Security

Network Security 7-70

Trudy

e-mailserver

RouterSwitch PCTrudyTrudy

TrudyWirelessIEEE 802.11

Laptop

TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

WEP

SSL SSL

PGP

NetwDataPhy

DataPhy

NetwDataPhy

NetwDataPhy

NetwDataPhy

NetwDataPhy

wireless

IPSec IPSec

Ref. Scenario : protection of information in transit

Page 71: Chapter 7 Network Security

Network Security 7-71

Alice: generates random symmetric private key, KS. encrypts message with KS (for efficiency) also encrypts KS with Bob’s public key. sends both KS(m) and KB(KS) to Bob.

-

KS( ). KS(m

)

KS

KS

KB( ).+

KB(KS )+

KB+

KS

KS( ). mKS(m

)

KB( ).-

KB-

KB(KS )+

Secure e-mail TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

PGP

Bob: uses his private key to decrypt and recover KS

uses KS to decrypt KS(m) to recover m

m

Alice Bob

Alice wants to send confidential e-mail, m, to Bob.

+ Internet

Page 72: Chapter 7 Network Security

Network Security 7-72

Alice wants to provide sender authentication message integrity.

H( ). KA( ).- KA(H(m))

-KA-

m

-

KA(H(m))-

m

H(m )KA( )

.+

KA+

H( ). H(m )

compare

Secure e-mail

Alice digitally signs message. sends both message (not encrypted) and digital signature.

+ Internet

m

Alice Bob

Page 73: Chapter 7 Network Security

Network Security 7-73

Alice wants to provide secrecy, sender authentication, message integrity.

Alice uses three keys: her private key, Bob’s public key, newly created symmetric

key

H( ). KA( ).-

+

KA(H(m))-

KA-

m

KS( ).

KB( ).+

+

KB(KS )+

KS

KB+

KS

Secure e-mail

m

Alice

Internet

Page 74: Chapter 7 Network Security

Network Security 7-74

Internet e-mail encryption scheme, de-facto standard.

uses symmetric key cryptography, public key cryptography, hash function, and digital signature as described.

provides secrecy, sender authentication, integrity.

inventor, Phil Zimmerman, was target of 3-year federal investigation.

---BEGIN PGP SIGNED MESSAGE---Hash: SHA1

Bob: My exam was very bad, it was very difficult, yours, Alice

---BEGIN PGP SIGNATURE---Version: PGP 5.0Charset: noconvyhHJRHhGJGhgg/

12EpJ+lo8gE4vB3mqJhFEvZP9t6n7G6m5Gw2

---END PGP SIGNATURE---

A PGP signed message:

Pretty good privacy (PGP)

Page 75: Chapter 7 Network Security

Network Security 7-75

transport layer security to any TCP-based app using SSL services.

used between Web browsers, servers for e-commerce (https).

security services: server authentication data encryption client authentication

(optional)

Secure Sockets Layer TranspAppl

NetwDataPhy

TranspAppl

NetwDataPhy

SSLTransp

Appl

NetwDataPhy

Transp

Appl

NetwDataPhy

SSLSSL SSL

SSL: basis of IETF Transport Layer Security (TLS).

SSL can be used for non-Web applications, e.g., IMAP.

Client authentication can be done with client certificates.

Page 76: Chapter 7 Network Security

Network Security 7-76

Secure Socket Layer

HTTPS connection

server certificate (incl. public key of server)

browse to secure page of server (include SSL version and preferences)

clientserver

random symmetric key generated by clientand encrypted with public key of server

secure data exchange : symmetric key algorithm

Page 77: Chapter 7 Network Security

Network Security 7-77

Encrypted SSL session: Browser generates

symmetric session key, encrypts it with server’s public key, sends encrypted key to server.

Using private key, server decrypts session key.

Browser, server know session key All data sent into TCP

socket (by client or server) encrypted with session key.

Secure Socket Layer

Server authentication: 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.

Page 78: Chapter 7 Network Security

Network Security 7-78

Network-layer secrecy sending host encrypts the

data in IP datagram TCP and UDP segments;

ICMP and SNMP messages. Network-layer authentication

destination host can authenticate source IP address (avoid spoofing)

Two principle protocols authentication header (AH)

protocol (source authentication and data integrity)

encapsulation security payload (ESP) protocol (also confidentiality)

Source, destination handshake: create network-layer logical

channel called a security association (SA)

Each SA unidirectional : two SA’s required for bidirectional communication

Uniquely determined by: security protocol (AH or ESP) source IP address 32-bit connection ID

IPsec: Network Layer Security

• Authentication : HMAC : Hashed Message Authentication Code• Encryption : different algorithms possible (symmetric : should be fast !)• Security Assocations : ISAKMP (Internet Security Association

and Key Management Protocol) [complex], • Key exchange : IKE [Internet Key Exchange]

NetwDataPhy

NetwDataPhy

NetwDataPhy

IPSec

Page 79: Chapter 7 Network Security

79

authenticationheader

IPheader

authenticated

payload + paddingTCPheader

- IP header, protocol field = 51- AH header :

- next header field (e.g. 6 for TCP, 17 for UDP)- payload length (of AH header)- SPI (Security Parameter Index) [4 bytes] (no wrap allowed, new SA to be set-up)

- Sequence number [4 bytes]- Authentication data field (variable length): HMAC (Hashed Message Authentication Code) : compute hash over {packet + secret key} (but do not send the secret key in each packet)

[shared key and hash function negotiated/exchanged during Security Association SA set-up]

(note : AH calculation does not include e.g. TTL because this changes in every hop, the value is set to 0 before AH calculation; AH calculation does include IP addresses, avoiding spoofing)

AH Protocol

Page 80: Chapter 7 Network Security

80

transport mode

tunnel mode

ESPheader

authentication(HMAC)

IPheader

authenticated

encrypted

ESPheader

authentication(HMAC)

new IPheader

authenticated

encrypted

payload + paddingTCPheader

old IPheader

payload + paddingTCPheader

- IP header (old in transport mode, new in tunnel mode), protocol field = 50- ESP header : SPI (Security Parameters Index)- ESP header : sequence number [4 bytes] (no wrap allowed, new SA to be set-up)- ESP header : IV (Initialization Vector) [variable, eventually zero]- data : {old IP header in tunnel mode}, TCP (or UDP,…) header, payload + padding [variable]- ESP trailer : padding length : in number of bytes [1 byte]- ESP trailer : next header/protocol byte : 6 if TCP, [1 byte]- authentication data : HMAC [could be zero if no authentication is used]

ESP Protocol

ESPtrailer

ESPtrailer

Page 81: Chapter 7 Network Security

81

IPsec: Network Layer Security

157.193.0.0145.12.0.0

153.145.0.0

Public Internet

IPsec tunnel

Tunnel Mode : 3 company locations :secure IPsec connectionsbetween the different sites(between the firewalls)All traffic between terminals/server is encryptedin public internet VPN (Virtual Private

Network)

- access router- firewall- end-point IPsec

Two modestransport mode : between end point (terminals, servers)tunnel mode : between intermediate routers, firewalls (“proxy” mode)

Page 82: Chapter 7 Network Security

82

157.193.0.0145.12.0.0

153.145.0.0

Public Internet

IPsec tunnel

IPsec: tunnel example

122.1.1.254

134.1.1.254

153.145.1.1

157.193.1.1

122.1.1.254 134.1.1.254

S D157.193.1.1 153.145.1.1

S D

Page 83: Chapter 7 Network Security

Network Security 7-83

War-driving: drive around Bay area, see what 802.11 networks available? More than 9000 accessible from public roadways 85% use no encryption/authentication packet-sniffing and various attacks easy!

Wired Equivalent Privacy (WEP): authentication as in protocol ap4.0 host requests authentication by access point access point sends 128 bit nonce host encrypts nonce using shared symmetric key access point decrypts nonce, authenticates host

IEEE 802.11 security : WEP

Page 84: Chapter 7 Network Security

Network Security 7-84

Wired Equivalent Privacy (WEP): data encryption Host/AP share 40 bit symmetric key KS

(semi-permanent) Host appends 24-bit initialization vector (IV) to

create 64-bit key 64 bit key used to generate stream of keys, ki

IV

kiIV used to encrypt ith byte, di, in frame:

ci = di XOR kiIV

IV and encrypted bytes, ci sent in frame

IEEE 802.11 security : WEP

Page 85: Chapter 7 Network Security

Network Security 7-85Sender-side WEP encryption

802.11 WEP encryption (RC4)

IV WEP encrypted : c1 c2 … (data+CRC)

802.11header

d1 d2 d3 dN… CRC1 CRC4…

c1

key sequence generator

+ c2+ c3+ cN cN+1 cN+4… …+ + +

k2 k3 kN kN+1 kN+4… …k1

IV

KS

Page 86: Chapter 7 Network Security

Network Security 7-86

Security hole: 24-bit IV, one IV per frame, -> IV’s eventually reused IV transmitted in plaintext -> IV reuse detected Attack:

Trudy causes Alice to encrypt known plaintext d1 d2 d3 d4 … (e.g. Trudy request to Alice a known file)

Trudy sees: ci = di XOR kiIV

Trudy knows ci di, so can compute kiIV

Trudy knows encrypting key sequence k1IV k2

IV k3IV …

Next time IV is used, Trudy can decrypt!

Breaking 802.11 WEP encryption

Example reuse of IV : IV = 24 bits = 16 M valuesafter 12000 frames >99% chance same IV1 KB frame, 11 Mb/s 12 s to see same IV !

new standard IEEE 802.11i developed in 2004(stronger encryption, better authentication, key distribution mechanism)

Page 87: Chapter 7 Network Security

Network Security 7-87

Basic techniques…... cryptography (symmetric and public) authentication message integrity key distribution

…. used in many different security scenarios secure email secure transport (SSL) IP sec 802.11 WEP

Network Security (summary)

Page 88: Chapter 7 Network Security

Network Security 7-88

7.1 What is network security? 37.2 Principles of cryptography 12

7.2.1. Symmetric Key Encryption 147.2.2. Public Key Encryption 22

7.3 Authentication 317.4 Integrity 407.5 Key Distribution and certification 487.6 Access control: firewalls 557.7 Attacks and counter measures 627.8 Security in many layers 69

7.8.1. Secure email 717.8.2. Secure sockets 757.8.3. IPsec 787.8.4. 802.11 WEP 83

Summary 87Table on contents 88

Table of contents