ipsec: ah and espgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – an ipsec...

24
1 IPsec: AH and ESP

Upload: others

Post on 11-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

1

IPsec: AH and ESP

Page 2: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

2

Protocol Security – Where?

• Application layer: (+) easy access to user credentials, extend without waiting for OS vendor, understand data; (-) design again and again; e.g., PGP, ssh, Kerberos

• Transport layer: (+): security mostly seamlessly e.g., TLS

• Network layer: (+) reduced key management, fewer application changes, fewer implementations, VPN; (-): multiuser machines

• Data link layer: (+): speedl (-): hop-by-hop only

Page 3: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

3

Documents

Page 4: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

4

IPsec Objectives• Why do we need IPsec?

– IP V4 has no authentication• IP Spoofing• Payload could be changed without detection

– IP V4 has no confidentiality mechanism• Eavesdropping

– Denial of Service Attacks• Cannot hold the attacker accountable due to the lack of authentication

• IPsec Objectives– IP layer security mechanisms for IP V4 and V6

• Not all applications need to be security aware• Can be transparent to users• Provide authentication and confidentiality mechanisms

• IPsec– AH (Authentication Header) and ESP (Encapsulating Security Payload)

• IP header extensions for carrying cryptographically protected data– IKE (Internet Key Management)

• Authenticating and establishing a session key

Page 5: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

5

IPsec Architecture

Page 6: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

6

Security Associations (SA)

• SA is a cryptographically protected connection– An association between a sender and a receiver

– Consists of a set of security related parameters

• One way relationship: unidirectional

• Determine IPSec processing for senders

• Determine IPSec decoding for destination

• SAs are not fixed! Generated and customized per traffic flows

Page 7: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

7

Security Parameter Index (SPI)

• A bit string assigned to a SA

• Carried in the IPsec header

• The SPI allows the destination to select the correct SA under which the received packet will be processed (according to the agreement with the sender)

• SPI + Dest IP Address + IPsec Protocol (flag for whether it is AH or ESP)– Uniquely identify each SA

Page 8: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

8

Security Association Database (SAD)

• Holds parameters for each SA

• When transmitting to X, look up X in SAD– SPI

• Up to 32 bits large

• Allow the destination to select the correct SA

– Key

– Algorithms

– Sequence number

• When receiving an IP packet, look up SPI in SAD

Page 9: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

9

Security Policy Database (SPD)

• Which types of packets should be dropped?

• Which should be forwarded or accepted without IPsec protection?

• Which should be protected by IPsec? If protected, encrypted and/or integrity-protected?

• Index into SPD by Selector fields– Dest IP, Source IP, Transport Protocol, IPSec Protocol, Source

& Dest Ports, …

Page 10: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

10

Hosts & Gateways

• Hosts can implement IPSec to :– Other hosts in transport or tunnel mode

– Gateways with tunnel mode

• Gateways to gateways - tunnel mode

Page 11: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

11

A B

Encrypted Tunnel

Gateway Gateway

New IP Header

AH or ESP Header

TCP DataOrig IP Header

Encrypted

Unencrypted Unencrypted

Tunnel Mode

Page 12: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

12

Tunnel Mode

• ESP applies only to the tunneled packet• AH can be applied to portions of the outer header

Outer IPheader

Inner IPheader

IPSecheader

Higherlayer protocol

ESP

AH

Real IP destinationDestinationIPSecentity

Page 13: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

13

IPsec, tunnel mode, between firewall

Page 14: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

14

Transport Mode

• ESP protects higher layer payload only• AH can protect IP headers as well as higher layer payload

IPheader

IPoptions

IPSecheader

Higherlayer protocol

ESP

AH

Real IPdestination

Page 15: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

15

Is it for IPSec?If so, which policyentry to select?

SPD(Policy)

SA Database

IP Packet

Outbound packet (on A)

A B

SPI & IPSecPacket

Send to B

Determine the SA and its SPI

IPSec processing

Outbound Processing

Page 16: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

16

Use SPI to index the SAD

SA Database

Original IP Packet

SPI & Packet

Inbound packet (on B) A B

From A

Inbound Processing

SPD(Policy)

Was packet properly secured?

“un-process”

Page 17: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

17

NAT (Network Address Translation)

• What is it?– With a NAT box, the computer on your internal network do

not need global IPv4 addresses in order to connect to the Internet

– NAT box translates an internal IP

• The problem– An IPsec tunnel cannot go through a NAT box because the

NAT box wants to update the IP address inside the encrypted data and it does not have the key

– For transport mode, IP address is included in the computation of the TCP/UDP checksum

Page 18: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

18

IP Header

•Protocol field: ESP=50, AH=51

Page 19: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

19

AH (Authentication Header)

••Data integrity: Entire packet has not been tampered withData integrity: Entire packet has not been tampered with••Authentication: 1. Can Authentication: 1. Can ““trusttrust”” IP address source;2. Use MAC to authenticateIP address source;2. Use MAC to authenticate••AntiAnti--replay featurereplay feature••Integrity check valueIntegrity check value•Immutable or predictable IP header fields: version, IH length, total length, identification, protocol, source, destination (source node => predictable)•Upper-level data

Page 20: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

20

AH in Transport Mode

Page 21: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

21

AH in Tunnel Mode

Page 22: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

22

Encapsulating Security Payload (ESP)

Page 23: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

23

ESP

Page 24: IPsec: AH and ESPgalaxy.cs.lamar.edu/~bsun/security/lecture_notes/lecture_17.pdf · – An IPsec tunnel cannot go through a NAT box because the NAT box wants to update the IP address

24

ESP