DIMACS Security & Cryptography Crash Course - Day 4: Internet Cryptography Tools, Part II: IP-Sec
DIMACS Security & Cryptography Crash Course - Day 4: Internet Cryptography Tools, Part II: IP-Sec
DIMACS Security & Cryptography Crash Course - Day 4: Internet Cryptography Tools, Part II: IP-Sec
Sources
!
Partial but readable coverage in Stallings book, `Cryptography and Network Security` IP-Sec is defined in Internet Engineering Task Force (IETF) RFC Documents:
" " " "
Architecture RFC 2401 Authentication Header (AH) RFC 2402 Encapsulating Security Payload (ESP) RFC 2406 IKE Internet Key Exchange RFC 2409
7/23/03
http://Amir.Herzberg.name
Outline
!
Internet Layer Security IPsec Architecture The ESP Header The AH Header
! ! !
! !
7/23/03
http://Amir.Herzberg.name
Characteristics
" " "
Connectionless, Unreliable IP addresses can be easily spoofed Routers and gateway might be sniffed Data source authentication Integrity protection Replay protection Access control Confidentiality and privacy Clogging prevention (Availability)
http://Amir.Herzberg.name 4
Requirements
" " " " " "
7/23/03
Compare to SSL Handshake protocol; application layer Negotiate and establish `Security Association` Run once per `IP-sec connection` - not `real-time`
IP-Sec sub-layer: traffic encapsulation & protection " Compare to SSL record protocol " Between IP and Transport layers " AH Authentication Header (no secrecy)
"
"
7/23/03
Protection against DOS (clogging) Protect all applications, data Implemented by operating systems, Routers, Hard to implement Rarely available at destination
! !
Application Transport
IKE
Cons:
IPSec Tunnel sub-layer Internet Link
" "
7/23/03
msg
Transport (TCP)
TCP header msg
Internet (IP)
Link (Ethernet)
IP-Sec sub-layer
Internet (IP)
IP-Sec `envelope`
Longer (overhead)
Link (Ethernet)
IP-Sec `envelope`
9
http://Amir.Herzberg.name
2.
3.
BITW (Bump In The Wire) intercept IP traffic by tunneling via security gateway
Single gateway can protect multiple hosts Only `tunnel mode` of IP-Sec
7/23/03
http://Amir.Herzberg.name
10
Tunnel Mode " IPsec adds its own IP header " IPsec encapsulation/decapsulation either by hosts or by gateways along the route Transport Mode " IPsec uses existing IP header, just changes protocol field to IP-Sec " End-to-end - IPsec encapsulation by source host, decapsulation by destination host (receiver)
7/23/03
http://Amir.Herzberg.name
11
But also by hosts (at one or both ends) Traffic may be IP-Sec protected already (nested)
! ! !
Entire IP packet is payload to IPSEC If provided by gateway, transparent to host If encryption used, hides hosts IP address
Application TCP UDP IP
Application
Protected Data
IPSEC IP MAC
Link
Link
Host
7/23/03
Security Gateway
Security Gateway
Host
12
http://Amir.Herzberg.name
Requires IP-Sec support by both hosts: native or (at least) BITS (bump in the stack)
Application TCP UDP IPSEC IP Link Application TCP UDP IPSEC IP Link
Host
Host
7/23/03
http://Amir.Herzberg.name
13
Untrusted internet
Host to gateway
! !
AH Authentication Header (no confidentiality) ESP Encapsulating Secure Payload encryption (can be `null`), authentication Do not use encryption w/o authentication [Be96] Both support multiple security associations (SA)
" "
SA=Security parameters: keys, algorithms, counters Multiple SA btw same peers different protocols/ports
!
" "
Simplifies key update just change SA Identify SA by Security Parameter Index (SPI)
! !
Each party selects its SPI for each security association Send recipients SPI in each packet (32 bit)
7/23/03
Sequence number zero when SA established Increment per outgoing packet Receiver identify replay by repeated seq #
"
To avoid dropping legal packets arriving out of order, the receiver maintains in the SA a sliding window (minimal size 32)
Sequence number field is sent and included in the MAC computation Must not wrap during a single key lifetime
"
7/23/03
Original protocol (now protocol: AH) Replay Protection MAC over entire IP packet (IP header, other headers, data)
7/23/03
(0-255) bytes
E n c r y p t
I n t e g r i t y
IPsec is using two data structures (define in the IPsec architecture RFC) SAD Security Association Data contains all the active Security Associations (SAs)
"
SPI in each direction selected by recipient (for efficiency) IP addresses, TCP/UDP ports and more
"
"
SPD Security Policy Data contains user defined policy. The user defines which security services, at which level are offered to each IP datagram
http://Amir.Herzberg.name 19
7/23/03
Security services, protocol, and algorithms Pointer to the entry of matching active SA in the SAD
7/23/03
2.
AH MAC calculation includes IP header, changed by NAT #MAC verification fails UDP/TCP checksum: TCP and UDP checksum cover the IP addresses; NAT devices recalculate checksum, but cant after IP-Sec # receiving IP stack drop the packet
$
The problem doesnt occur in Tunnel mode, because only the outer IP header can be modified, while the TCP/UDP checksum is calculated over the inner (encrypted) IP header
http://Amir.Herzberg.name 21
7/23/03
The UDP ports are selected by the key management protocol Common solution to NAT interoperability
http://Amir.Herzberg.name 22
7/23/03
Protected using the ISAKMP SA Many 2nd phases may share ISAKMP SA (1st phase)
!
E.g. one 1st phase for gateways, then many 2nd phase for each pair of hosts using these gateways
"
7/23/03
http://Amir.Herzberg.name
23
To fulfill the PFS requirement, every phase I exchange, performs a DH exchange In Phase II, DH execution is optional phase II and the IPsec keys can be derived from phase I exchange Phase II is more efficient; many two phase II exchanges can use the same set of phase I keys
7/23/03
http://Amir.Herzberg.name
24
7/23/03
http://Amir.Herzberg.name
25
Why not establish & use one `master key`? Ensure reliable separation of sessions Restrict use of a single key
" "
"
"
Make cryptoanalysis harder less available ciphertext Restrict damage of known key attack: session key exposure does not expose past or future messages, session keys, or master key Forward secrecy exposing all keys now does not expose past session keys Proactive secrecy security recovered after all keys exposed
7/23/03
http://Amir.Herzberg.name
26
Conclusion
!
! !
Tunnel mode allows gateways to protect many hosts Transport mode allows efficient host-to-host security
"
! !
Support for authentication (AH/ESP) and encryption (ESP) Tunneling of IP s protected traffic is possible - ec
"
E.g. to hide identities of source/destination hosts behind gateway Block, allow (unprotected) or protect traffic Defined on host/port basis not per user!
! ! !
Resiliency to clogging (in IKE via cookies) Requires no change in applications Hard to implement, interoperate
http://Amir.Herzberg.name 27
7/23/03
Extras
7/23/03
http://Amir.Herzberg.name
28
Goal : protect against a DoS where the attacker perform IP spoofing. The attacker floods the victim with IKE requests, and forces him to perform expensive computations Solution : before performing expensive computations (e.g. DH), verify that the other party is indeed located in the IP address that appears in the header
Note: requires the `main mode` of IKE (6 flows, cf. to `aggressive mode of 3 flows)
http://Amir.Herzberg.name 29
7/23/03
! !
Any participant in the protocol sends a pseudo random string (Cookie) to the other party The other party return the cookie, proving it can receive from its IP address Compute cookie by hash (e.g. MD5) of IP addr, UDP ports, local secret value, date and hour Efficient generation, memory less verification Expensive calculations will be performed only after the other party cookie is received
7/23/03
http://Amir.Herzberg.name
30
Exercises
!
An organization connects to the Internet from multiple offices, but concerned about:
" "
"
Denial of service attacks from the Internet Protect data on few key applications (mostly web) from unauthorized exposure Efficiency and cost of solution
! !
IP-Sec uses connections. In what ways are these connections not reliable? Consider extranet btw 3 companies, using mostly web services. Present and compare SSL and IPSec designs.
http://Amir.Herzberg.name 31
7/23/03