Top Banner
CSC 474 Dr. Peng Ning 1 Computer Science CSC 474 Information Systems Security Topic 4.2: IPsec
34

Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

Mar 28, 2015

Download

Documents

Haley Maiden
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: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 1

Computer Science

CSC 474Information Systems Security

Topic 4.2: IPsec

Page 2: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 2Computer Science

Outline

• IPsec Objectives

• IPsec architecture & concepts

• IPsec authentication header

• IPsec encapsulating security payload

Page 3: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 3Computer Science

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 (DOS) attacks• Cannot hold the attacker accountable due to the lack of

authentication.

Page 4: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 4Computer Science

IPsec Objectives (cont’d)

• IP layer security mechanism for IPv4 and IPv6 – Not all applications need to be security aware– Can be transparent to users– Provide authentication and confidentiality

mechanisms.

Page 5: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 5Computer Science

IPsec Architecture

IPsec module 1 IPsec module 2

SPD

IKE

SAD IPsec

SPD

IKE

SADIPsecSA

SPD: Security Policy Database; IKE: Internet Key Exchange;SA: Security Association; SAD: Security Association Database.

Page 6: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 6Computer Science

IPsec Architecture (Cont’d)

• Two Protocols (Mechanisms)– Authentication Header (AH)– Encapsulating Security Payload (ESP)

• IKE Protocol– Internet Key Management

Page 7: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 7Computer Science

IPsec Architecture (Cont’d)

• Can be implemented in – Host or gateway

• Can work in two Modes– Tunnel mode– Transport mode

Page 8: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 8Computer Science

Hosts & Gateways

• Hosts can implement IPsec to connect to:– Other hosts in transport or tunnel mode – Or Gateways in tunnel mode

• Gateways to gateways– Tunnel mode

Page 9: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 9Computer Science

A B

Encrypted Tunnel

Gateway Gateway

New IP Header

AH or ESP Header

TCP DataOrig IP Header

Encrypted

Unencrypted Unencrypted

Tunnel Mode

Page 10: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 10Computer Science

Outer IPheader

Inner IPheader

IPsecheader

Higherlayer protocol

ESP

AH

Real IP destinationDestinationIPsecentity

Tunnel Mode (Cont’d)

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

Page 11: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 11Computer Science

A B

New IP Header

AH or ESP Header

TCP Data

Encrypted/Authenticated

Transport Mode

Page 12: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 12Computer Science

IPheader

IPoptions

IPsecheader

Higherlayer protocol

ESP

AH

Real IPdestination

Transport Mode (Cont’d)

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

Page 13: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 13Computer Science

Security Association (SA)

• An association between a sender and a receiver– Consists of a set of security related parameters– E.g., sequence number, encryption key

• One way relationship

• Determine IPsec processing for senders

• Determine IPsec decoding for destination

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

Page 14: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 14Computer Science

Security Parameters Index (SPI)

• A bit string assigned to an SA.

• Carried in AH and ESP headers to enable the receiving system to select the SA under which the packet will be processed.

• 32 bits

• SPI + Dest IP address + IPsec Protocol– Uniquely identifies each SA in SA Database

(SAD)

Page 15: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 15Computer Science

SA Database (SAD)

• Holds parameters for each SA– Sequence number counter– Lifetime of this SA– AH and ESP information– Tunnel or transport mode

• Every host or gateway participating in IPsec has their own SA database

Page 16: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 16Computer Science

SA Bundle

• More than 1 SA can apply to a packet

• Example: ESP does not authenticate new IP header. How to authenticate?– Use SA to apply ESP w/out authentication to

original packet– Use 2nd SA to apply AH

Page 17: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 17Computer Science

Security Policy Database (SPD)

• Decide– What traffic to protect?– Has incoming traffic been properly secured?

• Policy entries define which SA or SA Bundles to use on IP traffic

• Each host or gateway has their own SPD• Index into SPD by Selector fields

– Selectors: IP and upper-layer protocol field values.– Examples: Dest IP, Source IP, Transport Protocol,

IPSec Protocol, Source & Dest Ports, …

Page 18: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 18Computer Science

SPD Entry Actions

• Discard– Do not let in or out

• Bypass– Outbound: do not apply IPSec– Inbound: do not expect IPSec

• Protect – will point to an SA or SA bundle– Outbound: apply security– Inbound: security must have been applied

Page 19: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 19Computer Science

SPD Protect Action

• If the SA does not exist…– Outbound processing

• Trigger key management protocols to generate SA dynamically, or

• Request manual specification, or

• Other methods

– Inbound processing• Drop packet

Page 20: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 20Computer Science

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

SPD(Policy)

SA Database

IP Packet

Outbound packet (on A)

A B

SPI & IPsec Packet

Send to B

Determine the SA and its SPI

IPSec processing

Outbound Processing

Page 21: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 21Computer Science

Use SPI to index the SAD

SA Database

Original IP Packet

SPI & Packet

Inbound packet (on B)

A BFrom A

Inbound Processing

SPD(Policy)

Was packet properly secured?

“un-process”

Page 22: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 22Computer Science

Authentication Header (AH)

• Data integrity– Entire packet has not been tampered with

• Authentication– Can “trust” IP address source– Use MAC to authenticate

• Anti-replay feature

• Integrity check value

Page 23: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 23Computer Science

Integrity Check Value - ICV

• Message authentication code (MAC) calculated over– IP header fields that do not change or are

predictable– IP header fields that are unpredictable are set to

zero.– IPsec AH header with the ICV field set to zero.– Upper-level data

• Code may be truncated to first 96 bits

Page 24: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 24Computer Science

SAD

SPI

Sequence Number

ICV

Next Header (TCP/UDP)

Payload Length

6-2=4Reserved

IPsec Authentication Header

Page 25: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 25Computer Science

Encapsulated Security Protocol (ESP)

• Confidentiality for upper layer protocol

• Partial traffic flow confidentiality (Tunnel mode only)

• Data origin authentication and connectionless integrity (optional)

Page 26: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 26Computer Science

Outbound Packet Processing

• Form ESP payload

• Pad as necessary

• Encrypt result [payload, padding, pad length, next header]

• Apply authentication

Page 27: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 27Computer Science

Outbound Packet Processing...

• Sequence number generation– Increment then use– With anti-replay enabled, check for rollover and send only

if no rollover– With anti-replay disabled, still needs to increment and use

but no rollover checking

• ICV calculation– ICV includes whole ESP packet except for authentication

data field.– Implicit padding of ‘0’s between next header and

authentication data is used to satisfy block size requirement for ICV algorithm

– Not include the IP header.

Page 28: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 28Computer Science

SPI

Sequence Number

Original IP Header

Integrity Check Value

Au

then

tica

tio

n c

ove

rag

e

En

cryp

ted Payload (TCP Header and Data)

Variable Length

Pad Length

Padding (0-255 bytes)

Next Header

ES

P T

rans

port

Exa

mpl

e

Page 29: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 29Computer Science

0Sliding Windowsize >= 32

rejectCheck bitmap, verify if new

verify

Inbound Packet Processing

• Sequence number checking– Anti-replay is used only if authentication is

selected– Sequence number should be the first ESP check on

a packet upon looking up an SA– Duplicates are rejected!

Page 30: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 30Computer Science

Anti-replay Feature

• Optional

• Information to enforce held in SA entry

• Sequence number counter - 32 bit for outgoing IPsec packets

• Anti-replay window – 32-bit – Bit-map for detecting replayed packets

Page 31: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 31Computer Science

Anti-replay Sliding Window

• Window should not be advanced until the packet has been authenticated

• Without authentication, malicious packets with large sequence numbers can advance window unnecessarily– Valid packets would be dropped!

Page 32: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 32Computer Science

Inbound Packet Processing...

• Packet decryption– Decrypt quantity [ESP payload,padding,pad

length,next header] per SA specification– Processing (stripping) padding per encryption

algorithm; In case of default padding scheme, the padding field SHOULD be inspected

– Reconstruct the original IP datagram

• Authentication verification (option)

Page 33: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 33Computer Science

OrigIP hdr

TCP DataESP

trailerESPAuth

ESPhdr

TCP DataESP

trailerESPAuth

OrigIP hdr

ESPhdr

Origext hdr

IPv4

IPv6

ESP Processing - Header Location...

• Transport mode IPv4 and IPv6

Page 34: Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 4.2: IPsec.

CSC 474 Dr. Peng Ning 34Computer Science

ESP Processing - Header Location...

• Tunnel mode IPv4 and IPv6

New IP hdr

OrigIP hdr

TCP DataESP

trailerESPAuth

ESPhdr

Newext hdr

New IP hdr

TCP DataESP

trailerESPAuth

OrigIP hdr

ESPhdr

Origext hdr

IPv4

IPv6