Ipsec: Ah and Esp: Markus Hidell
Ipsec: Ah and Esp: Markus Hidell
Ipsec: Ah and Esp: Markus Hidell
Markus Hidell
[email protected]
1
Reading
Kaufman, chapter 16-17
2
TCP/IP Example
3
IP Security Issues
Eavesdropping
Modification of packets in transit
Identity spoofing (forged source IP addresses)
Denial of service
4
Operating system layers
App. User process
Socket API
TCP
OS kernel
IP
Device driver
L2
Interface specific
L1
Data Encapsulation
ESP: IP Encapsulating Security Payload (RFC 4303)
AH: IP Authentication Header (RFC 4302)
6
IPsec: Network Layer Security
8
IPsec Modes
Transport mode
Used to deliver services from host to host or from host to
gateway
Usually within the same network, but can also be end-to-end
across networks
Tunnel mode
Used to deliver services from gateway to gateway or from host
to gateway
Usually gateways owned by the same organization
With an insecure network in the middle
9
IPsec in Transport Mode
10
IPsec in Tunnel Mode
Gateway-to-gateway security
Internal traffic behind gateways not protected
Typical application: virtual private network (VPN)
Only requires IPsec support at gateways
11
Tunnel Mode Illustration
Implements Implements
IPsec IPsec
12
Transport Mode vs Tunnel Mode
Transport mode secures packet payload and leaves IP
header unchanged
IP header
IPSec header TCP/UDP header + data
(real dest)
IP header IP header
IPSec header TCP/UDP header + data
(gateway) (real dest)
13
Security Association (SA)
One-way sender-recipient relationship
Manually configured or negotiated through IKE
SA determines how packets are processed
Cryptographic algorithms, keys, AH/ESP, lifetimes, sequence
numbers, mode (transport or tunnel) read Kaufman!
SA is uniquely identified by {SPI, dst IP addr, flag}
SPI: Security Parameter Index
Chosen be destination (unless traffic is multicast...)
Flag: ESP or AH
Each IPsec implementation keeps a database of SAs
SPI is sent with packet, tells recipient which SA to use
14
Sending and Receiving IPsec Packets
When Alice is sending to Bob:
Consult security policy database (SPD) to check if packet
should protected with IPsec or not (selector fields)
SPD provides pointer to the associated SA entry in the security
association database (SAD)
SA provides SPI, algorithm, key, sequence number, etc.
Include the SPI in the message
When Bob receives a message:
Lookup the SA based on the destination address and SPI (In a
multicast message the address is not Bob's own)
Find algorithm, key, sequence number, etc.
After decrypting message, verify that packet matches
selector in the policy database (SPD)
15
Encapsulation Formats
AH
Authentication Header
Only provides integrity
ESP
Encapsulating Security Payload
Provides integrity and/or privacy
AH in transport mode
Original IP
AH TCP header Data
header
16
AH: Authentication Header
RFC 4302
Sender authentication
Integrity for packet contents and IP header
Sender and receiver must share a secret key
This key is used in HMAC computation
The key is set up by IKE key establishment protocol and
recorded in the Security Association (SA)
AHv2, RFC 4302
Let authentication header
implement IP integrity by
holding a hash of a shared
secret and the content of an
IP packet
17
AH and IP Header
Mutable fields
may change
Service type
Fragm. offset
TTL
Header
checksum
Predictable fields
may change in a
predictable way
Dst address
(source routing)
Immutable fields
will not change Mutable fields cant be included in
the AHs end-to-end integrity check
the rest....
18
Authentication Header Format
Provides integrity and origin authentication
Authenticates portions of the IP header
Anti-replay service (to counter denial of service)
No confidentiality
Authenticates source,
ICV: Integrity Check Value
verifies integrity of
(HMAC of IP header, AH, TCP payload) payload
19
ESP: Encapsulating Security Payload
RFC 4303
Adds new header and trailer fields to packet
Transport mode
Confidentiality of packet between two hosts
Complete hole through firewalls
Used sparingly
Tunnel mode
Confidentiality of packet between two gateways or a host and a
gateway
Implements VPN tunnels
20
ESP Security Guarantees
Confidentiality and integrity for packet payload
Symmetric cipher negotiated as part of security assoc
Optionally provides authentication (similar to AH)
Can work in transport
Encrypted (inner)
Original IP
ESP header TCP/UDP segment ESP trailer ESP auth
header
New IP Original IP
ESP header TCP/UDP segment ESP trailer ESP auth
header header
21
ESP Packet
Identifies security
association (shared
keys and algorithms)
Anti-replay
Type of payload
HMAC-based Integrity
Check Value (similar to AH)
22
Virtual Private Networks (VPN)
ESP is often used to implement a VPN
Packets go from internal network to a gateway with TCP/IP
headers for address in another network
Entire packet hidden by encryption
Including original headers so destination addresses are hidden
Receiving gateway decrypts packet and forwards original IP
packet to receiving address in the network that it protects
This is known as a VPN tunnel
Secure communication between parts of the same organization
over public Internet
23
Use Cases Summary
Host-Host
Transport mode
(Or tunnel mode) Secure connection
H (host-host) H
Gateway-Gateway
Tunnel mode Secure tunnel
(gw-gw)
Host-Gateway
H GW GW H
Tunnel mode
Secure tunnel
(host-gw)
H GW H