Top Banner
1 / 43 IPsec
43

IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

May 12, 2018

Download

Documents

phungque
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

1 / 43

IPsec

Page 2: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

2 / 43

Page 3: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Encryption at Different Layers

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

3 / 43

■ Most layers have control information that mustbe decoded before decryption is possible —this must always be sent in the clear

■ If the layer does demultiplexing, theinformation for that must be in the clear, too,to permit different keys for differentdestinations

■ Anything higher-level is hidden

Page 4: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Link Layer

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

4 / 43

■ Framing information must be in cleartext■ Link layer (if used) addresses must be

cleartext, to permit proper delivery■ Link layer type field must be cleartext■ Protects IP source and destination addresses

— but only for that hop■ Common for especially-vulnerable links: WiFi,

satellite downlinks, etc.■ Often used for access control

Page 5: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

5 / 43

■ Network-layer security protocol for theInternet.

■ Operates at the IP layer — has a cleartext IPheader

■ Completely transparent to applications.- Generally must modify protocol stack or kernel;

out of reach of application writers or users.

Page 6: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

History

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

6 / 43

SP3 Layer 3 security protocol for SDNS.NLSP OSIfied version of SP3, with an

incomprehensible spec.swIPe UNIX implementation by Ioannidis and

Blaze (1993).ka9q Phil Karn’s proto-IPsecIPsec Many years of design in the IETF1995 First IETF version of IPsec1998 Revised version with sequence numbers

and authentication2005 IPsec v3, for newer algorithms and larger

sequence numbers

Page 7: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Why IPsec?

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

7 / 43

■ SSL doesn’t protected against certain attacks■ Example: enemy sends forged packet with

RST bit set; tears down connection■ Example: enemy sends bogus data for

connection — SSL detects that, but can’trecover, since TCP has accepted the data

■ Also — SSL can’t (easily) protect UDP

Page 8: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Protects All Applications

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

8 / 43

■ To protect an application that uses TLS, youhave to change its code

■ IPsec protects all traffic■ But — how does an application know if IPsec

is present?■ Can it request IPsec protection?

Page 9: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec Structure

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

9 / 43

■ Nested headers: IP; ESP or AH; maybeanother IP; TCP or UDP; then data.

■ Cryptographic protection can be host to host,host to firewall, or firewall to firewall.

■ Option for user-granularity keying.■ Works with IPv4 and IPv6.■ Implements Virtual Private Networks (VPNs)

Page 10: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Some Packet Layouts

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

10 / 43

Transport Mode

IP

ESP

TCP

userdata

Tunnel Mode

IP

ESP

IP

TCP

user data

Page 11: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Tunnel and Transport Mode

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

11 / 43

■ Transport mode protects end-to-endconnections

■ Tunnel mode — much more common — isused for VPNs and telecommuter-to-firewwall

■ The inner IP header can have site-localaddresses

Page 12: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Implementation Choices

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

12 / 43

■ “Bump in the stack” — host-resident■ In network hardware; explicitly controlled by

the host■ “Bump in the wire” — external device in the

network cable; not known to the host■ Gateway- or firewall-resident — not known to

any hosts within the protected net

Page 13: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec Addressing

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

13 / 43

■ Packets are always addressed to the decryptor■ No need for “snooping”■ May be further forwarded

Page 14: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Security Associations

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

14 / 43

■ SA: Security Association

■ Think of it as an IPsec connection■ All of the parameters needed for an IPsec

session: crypto algorithms (AES, SHA1, etc.),modes of operation (CBC, HMAC, etc.), keylengths, digest lengths, traffic to be protected,etc.

■ Both sides must agree on the SA for securecommunications to work

Page 15: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Topologies

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

15 / 43

E1 A1

GW-A

E2 A2

GW-B B2

E3

WAN

E4

C

E5 GW-F

F1

Page 16: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Paths

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

16 / 43

■ A1 to F1:Encryptors E1, E5 (tunnel mode)

■ B2 to F1:Encryptors E3, E5 (tunnel mode)

■ A2 to C:Encryptors E2, E4 (transport mode)

Page 17: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Uses for IPsec

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

17 / 43

■ Virtual Private Networks.■ “Phone home” for laptops, telecommuters.■ General Internet security?

Page 18: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Outbound Packet Processing

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

18 / 43

■ Compare packet — src and dst addr, src anddst port numbers — against Security Policy

Database (SPD)■ If packet should be protected, consult Security

Association Database (SADB) to find SA■ Add appropriate IPsec header

Page 19: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Inbound Packet Processing

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

19 / 43

■ If IPsec-protected, look up SA, authenticate,and decrypt

■ Compare packet — src and dst addr, src anddst port numbers, as before — against SPD tosee if it should have been protected, and bywhich SA

■ If the protection characteristics match, acceptthe packet

■ If they do not match, discard it

Page 20: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Security Policy Database: Theory

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

20 / 43

■ IP address range or subnet: protect everythinggoing to 128.59.0.0/16

■ Port number list or range: 25,110,143■ Protect all addresses and/or all port numbers:

full protection■ Multiple sets of the above

Page 21: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Security Policy Database: Reality

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

21 / 43

■ Most IPsec usage is for VPNs■ Two options: send all traffic to the main site

for relaying (triangle routing) or sendInternet-bound traffic directly to the Internet

■ Tradeoff: performance and reliability versusprotection and policy enforcement by theorganizational firewall

Page 22: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Triangle Routing

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

22 / 43

Organization

Internet

For Triangle Routing, the SPD says “protecteverything”. For Direct Routing, the SPD says“protect traffic destined for the organization”.

Page 23: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

End-to-End ESP vs. Firewalls

IPsecEncryption atDifferent Layers

Link Layer

IPsec

History

Why IPsec?

Protects AllApplications

IPsec StructureSome PacketLayouts

Tunnel andTransport Mode

ImplementationChoices

IPsec Addressing

SecurityAssociations

Topologies

Paths

Uses for IPsecOutbound PacketProcessing

Inbound PacketProcessing

Security PolicyDatabase: Theory

Security PolicyDatabase: Reality

Triangle Routing

End-to-End ESP vs.Firewalls

23 / 43

■ Suppose you have a firewall that allows someoutgoing connections

■ Further suppose that some internal host wishesto talk end-to-end (transport mode) ESP tothe outside

■ When the firewall sees the encrypted packet, itcan’t tell if it’s a new connection (SYN bit set)or not

■ It also can’t tell what port number it’s goingto, or even if it’s transport mode or tunnelmode

Page 24: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec Details

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

24 / 43

Page 25: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Authentication Header (AH)

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

25 / 43

■ Based on keyed cryptographic hash function.■ Covers AH header, payload and immutable

portion of preceeding IP header.■ Not that useful today, compared to ESP with

null encryption■ Usually used with HMAC-SHA1 or

HMAC-MD5■ HMAC output is frequently truncated■ Details: see RFC 4302

Page 26: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Truncating HMACs

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

26 / 43

■ It is not necessary to send the full HMAC■ Tradeoff between packet size (i.e., network

performance) and probability of forgery■ 8 or 12 bytes is generally enough: forgery

probability is 2−64 or 2

−96

■ Also — makes it harder to verify apossibly-recovered key

Page 27: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

AH Layout

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

27 / 43

proto length reserved

SPI

Sequence Number

digest (variable length)

Page 28: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

What is an SPI?

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

28 / 43

■ SPI — Security Parameter Index■ Identifies Security Association

■ Each SA has its own keys, algorithms, policyrules

■ On packet receipt, look up SA from 〈SPI,dstaddr〉 pair

Page 29: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Other AH Fields

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

29 / 43

■ “Proto” — what transport protocol header isnext (i.e., TCP, UDP, etc.)

■ “length” — length of AH header in 32-bitwords, minus 2

■ Actually, length is implicit in the securityassociation; putting it in the header permitscontext-free (and unkeyed) examination of thepacket

■ “Sequence” — prevents replay attacks

Page 30: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Why a Sequence Number?

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

30 / 43

■ Prevent packet replays■ Permitted by the IP model — but accidents

are not the same as malice■ Many attacks possible if replays are permitted

Page 31: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Mutable Parts of the IP Header

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

31 / 43

■ Some parts of the IP header change in transit■ Obvious: TTL (and hence IP checksum)■ Fragmentation? You generally reassemble

fragments before doing AH processing■ DSCP (previously known as ToS)■ IP options — some change in flight (record

route, source route); others do not. SeeRFC 4302 for details

Page 32: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Encapsulating Security Payload

(ESP)

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

32 / 43

■ Carries encrypted packet.■ An SPI is used, as with AH.■ Preferred use of ESP is for AES in CBC mode

with HMAC-SHA1

Page 33: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

ESP Layout

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

33 / 43

SPI

sequence number

data

data padding

padding padlen payload

digest

digest

digest

digest

Digestrange

Page 34: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Padding

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

34 / 43

■ “padlen” says how many bytes of paddingshould be removed from the packet

■ Primary purpose: handle CBC blocksize issue■ Secondary purpose: add random extra

padding, to confuse traffic analysts (but itdoesn’t do a very good job of that)

Page 35: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Traffic Analysis of IP Packets

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

35 / 43

■ What can you learn from encrypted packets?■ Source address■ Destination address■ Length■ Time■ Hard to hide these things, even with crypto

Page 36: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Using ESP

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

36 / 43

■ Can be used with null authentication or nullencryption

■ With null encryption, provides authenticationonly

■ Easier to implement than AH■ Note: you should virtually always use

authentication with ESP■ Similarly, sequence numbers should be used

whenever possible

Page 37: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Nested IPsec

IPsec

IPsec DetailsAuthenticationHeader (AH)

Truncating HMACs

AH Layout

What is an SPI?

Other AH FieldsWhy a SequenceNumber?Mutable Parts of theIP HeaderEncapsulatingSecurity Payload(ESP)

ESP Layout

Padding

Traffic Analysis of IPPackets

Using ESP

Nested IPsec

Issues

37 / 43

■ In theory, can nest IPsec headers■ Outer layer: tunnel mode for VPN■ Inner layer: transport mode for host-to-host

protection■ Rarely implemented

Page 38: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Issues

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

38 / 43

Page 39: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec and Firewalls

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

39 / 43

■ Encryption is not authentication orauthorization

■ Access controls may need to be applied toencrypted traffic, depending on the source.

■ The source IP address is only authenticated ifit is somehow bound to the certificate.

■ Encrypted traffic can use a different firewall;however, co-ordination of policies may beneeded.

Page 40: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

IPsec and the DNS

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

40 / 43

■ IPsec often relies on the DNS.

◆ Users specify hostnames.◆ IPsec operates at the IP layer, where IP

addresses are used.◆ An attacker could try to subvert the

mapping.

■ We need to protect the DNS, via DNSSEC(later in the term)

■ DNSSEC may not meet some organizationalsecurity standards.

■ DNSSEC — which isn’t deployed yet, either —uses its own certificates, not X.509.

Page 41: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Implementation Issues

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

41 / 43

■ How do applications request cryptographicprotection? How do they verify its existence?

■ How do adminstrators mandate cryptographybetween host or network pairs?

■ We need to resolve authorization issues.

Page 42: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Requesting Protection

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

42 / 43

■ Some stacks permit applications to requestIPsec protection

■ Creates temporary SPD entry■ May cause key management negotiation or SA

change (wait till next class)■ But — what about bump-in-the-wire or

gateway-resident IPsec implementations?■ Would need marking in the packets, but no

mechanism for that has ever been defined

Page 43: IPsec - Columbia Universitysmb/classes/s09/l12.pdf · IPsec IPsec Encryption at Different Layers Link Layer IPsec History Why IPsec? Protects All Applications IPsec Structure Some

Implementation Status

IPsec

IPsec Details

Issues

IPsec and Firewalls

IPsec and the DNSImplementationIssuesRequestingProtectionImplementationStatus

43 / 43

■ IPsec is available for all major operatingsystems

■ Not all of them support all of the many options■ Hard to use for specific application protection■ Nested IPsec rarely available