andreas steffen, 1.10.2013, 4.6-ike.pptx 1 information security 2 (infsi2) prof. dr. andreas steffen...

26
Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications (ITA) 4.6 Internet Key Exchange IKE

Upload: javier-hayn

Post on 28-Mar-2015

233 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1

Information Security 2 (InfSi2)

Prof. Dr. Andreas Steffen

Institute for Internet Technologies and Applications (ITA)

4.6 Internet Key ExchangeIKE

Page 2: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 2

IPsec – Automatic Key ManagementThe Internet Key Exchange (IKE)

• Security Association (SA)• A Security Association is a contract established between two

IPsec endpoints (hosts or security gateways).• Negotiation of parameters to be used for the IPsec

connection.• ISAKMP SA (IKEv1) or IKE SA (IKEv2) protects the IKE

negotiation.• Separate IPsec SA required for each subnet or single host.• Separate IPsec SA required for inbound and outbound

connection.• IPsec SAs are assigned a unique Security Parameters Index

(SPI)and are maintained in a database.

• Negotiated Parameters • Authentication Mechanism (IKEv1 only, pre-shared key or

public key)• Encryption algorithm, Hash algorithm, PRF• Key exchange using Diffie-Hellman groups• Key lifetimes (IKEv1 only) for the ISAKMP and IPsec SAs.

Page 3: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 3

Internet Key Exchange – IKEv1 Main Mode

IKEHeader

IKEHeader

DH KeyExchange

DH KeyExchange Nr

Nr4

3IKEHeader

IKEHeader

DH KeyExchange

DH KeyExchange Ni

Ni

IKEHeader

IKEHeader

ISAKMP SAProposal

ISAKMP SAProposal 1

IKEHeader

IKEHeader

ISAKMP SAResponse

ISAKMP SAResponse2

5IKEHeader

IKEHeader

encrypted

IDiIDi Certi

Certi SigiSigi encrypte

dIKE

Header

IKEHeader6 IDr

IDr CertrCertr Sigr

Sigr

• IKEv1 Quick Mode – another three messages to negotiate traffic selectors

ResponderInitiator UDP/500

Page 4: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 4

IKE Main Mode using Pre-Shared Keys

• Pre-shared key● is worked into Hash● is part of the IKE session key

IKEHeader

IKEHeader

DH KeyExchange

DH KeyExchange Nr

Nr4

3IKEHeader

IKEHeader

DH KeyExchange

DH KeyExchange Ni

Ni

IKEHeader

IKEHeader

ISAKMP SAProposal

ISAKMP SAProposal 1

IKEHeader

IKEHeader

ISAKMP SAResponse

ISAKMP SAResponse2

5IKEHeader

IKEHeader

encrypted

IDiIDi Hashi

Hashi encrypted

IKEHeader

IKEHeader

6 IDrIDr Hashr

Hashr

ResponderInitiator UDP/500

Page 5: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 5

IKE Aggressive Mode using PreShared Keys

• Unencrypted IKE Aggressive Mode messages carrying cleartext IDs can be easily sniffed by a passive attacker.

• Pre-Shared Key is worked into Hashr , together with other known parameters, so that an off-line cracking attack becomes possible.

ResponderInitiator

3HashiHashi

IKEHeader

IKEHeader

ISAKMP SAProposal

ISAKMP SAProposal 1DH Key

Exchange

DH KeyExchange Ni

Ni IDiIDi

IKEHeader

IKEHeader

ISAKMP SAResponse

ISAKMP SAResponse2 DH Key

Exchange

DH KeyExchange Nr

Nr IDrIDr Hashr

Hashr

UDP/500

Page 6: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 6

Man-in-the-Middle Attack possiblewith IKE Aggressive Mode and XAUTH

VPN GatewayWLAN

Access Point

Attacker

Man-in-the-Middle

Wireless LAN User

VPN Client

Username:

Password:

bodo

aznHu4Um

XAUTH

• With IKE Aggressive Mode, useOne-Time Password scheme (e.g. SecureID).

1

Group Password

2

bodo

aznHu4Um

XAUTH

Group Password

Page 7: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 7

ISAKMP and IPsec Security Associations

09:00 #1 ISAKMP SA [email protected]

10:50 #6 IPsec SA

11:00 #7 IPsec SA

11:40 #8 ISAKMP SA

9 10 11 12

09:00 #2 IPsec SA rightsubnet=10.1.1.0/22

09:10 #3 IPsec SA rightsubnet=10.1.9.0/24

#4 IPsec SA09:50 rightsubnet=10.1.1.0/22

10:05 #5 IPsec SA rightsubnet=10.1.9.0/24

ikelifetime=3h keylife=1h

ikelifetime=3h keylife=1h

Page 8: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 8

IKE Phase 2 – Quick ModeEstablish or Renew an IPsec SA

• Negotiation of IPsec Parameters • Phase 2 Quick Mode establishes an IPsec SA using the secure

channel created by the phase 1 ISAKMP SA.• The specific configuration parameters for the IPsec

connection are negotiated (AH, ESP, authentication / encryption methods and parameters).

• Quick Mode can be used to renew IPSec SAs about to expire.

• ESP/AH Key Derivation• The ESP encryption and ESP/AH authentication keys for the

IPsec SAs are derived from the Phase 1 Diffie-Hellman secret.

• Optional Perfect Forward Secrecy• If perfect forward secrecy is required, each consecutive

Quick Mode will do a fresh Diffie-Hellmann key-exchange.

Page 9: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 9

• Motivation for a new IKE RFC• IKEv1 is spread over three documents (RFCs 2407, 2408, and

2409)• Too many messages (6 in Main Mode plus 3 in Quick Mode)• Too many variants (AH/ESP, transport/tunnel, authentication

modes)• Too complex – therefore potentially insecure (Bruce Schneier)• Cookies not required when not under DoS attack• New features: NAT-T, Dead Peer Detection, etc.

• IKEv2 Protocol• IPsec SA can be established with 2 request/response pairs• Additional Child SAs require one request/response pair, each• EAP authentication modes supported (e.g. One-Time-

Passwords),replaces proprietary XAUTH

• New IKE configuration payload replaces proprietary Mode Config

• IKEv2 is not backwards compatible with IKEv1 !!!

The New Standard - IKEv2RFC 4306 (Dec. 2005) / RFC 5996 (Sep. 2010)

Page 10: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 10

IKEv2 – Authentication and first Child SA

• IKE_SA_INIT exchange pair

• IKE_AUTH exchange pair

IKEHeader

IKEHeader

1SA1iSA1i KEi

KEi NiNi

2 IKEHeader

IKEHeader SA1r

SA1r KErKEr Nr

Nr

3IKEHeader

IKEHeader

encrypted

IDiIDi Certi

Certi

AuthiAuthi

IDrIDr

SA2iSA2i TSi

TSi TSrTSr

4

encrypted

IKEHeader

IKEHeader IDr

IDr CertrCertr Authr

Authr

SA2rSA2r TSi

TSi TSrTSr

ResponderInitiator UDP/500

Page 11: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 11

Cookie Mechanism against DoS Attacks

IKEHeader

IKEHeader

1SA1iSA1i KEi

KEi NiNi

2 IKEHeader

IKEHeader N(COOKIE)N(COOKIE)

ResponderInitiator UDP/500

4 IKEHeader

IKEHeader SA1r

SA1r KErKEr Nr

Nr

IKEHeader

IKEHeader 3N(COOKIE)N(COOKIE)

SA1iSA1i KEi

KEi NiNi

# strongswan.conf

charon { dos_protection = yes cookie_threshold = 10 block_threshold = 5 }

Page 12: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 12

IKEv2 – Additional Child SAs

1IKEHeader

IKEHeader

encrypted

NN SAiSAi Ni

Ni

KEiKEi TSi

TSi TSrTSr

2 IKEHeader

IKEHeader

encrypted

SArSAr Nr

Nr

KErKEr TSi

TSi TSrTSr

ResponderInitiator UDP/500

• CREATE_CHILD_SA exchange pair

• Rekeying IKE_SA: { SAi, Ni, KEi }• Rekeying CHILD_SA: { N(REKEY_SA), SAi, Ni, [KEi], TSi,

TSr }• Reauthentication: Start with IKE_SA from scratch

Page 13: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 13

IKEv2 Remote Access Scenario

#ipsec.conf for roadwarrior carol

conn home keyexchange=ikev2 left=%any leftsourceip=%config leftcert=carolCert.pem [email protected] leftfirewall=yes right=192.168.0.1 [email protected] rightsubnet=10.1.0.0/16 auto=start

#ipsec.secrets for roadwarrior carol

: RSA carolKey.pem "nH5ZQEWtku0RJEZ6"

#ipsec.secrets for gateway moon

: RSA moonKey.pem

#ipsec.conf for gateway moon

conn rw keyexchange=ikev2 left=%any

leftsubnet=10.1.0.0/24 leftcert=moonCert.pem [email protected] leftfirewall=yes right=%any rightsourceip=10.3.0.0/24 auto=add

Page 14: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 14

Information Security 2 (InfSi2)

4.7 VPN Applications

Page 15: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 15

Virtual Private Networks

Internet

HeadQuarters Subsidiary

„Road Warrior“

VPN Tunnel

VPN Tunnel

VPN Gateway11.22.33.44

VPN Gateway55.66.77.88

VPN Client

10.1.0.0/16

10.2.0.0/16

10.3.0.210.1.0.5 10.2.0.3

55.66.x.x

Page 16: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 16

• Road Warrior sign on to their home network via IKE with varying IP addresses assigned dynamically by the local ISP.

The „Road Warrior“ Remote Access Case

Internet

HomeNetwork IPsec Tunnel

VPN Gateway11.22.33.44

10.1.0.0/16 Road Warrior

55.66.x.x

Dynamic IP

Virtual IP10.3.0.2

• Authentication is usually based on RSA public keys and X.509 certificates issued by the home network.

• Virtual IP assigned statically or dynamically by the home network. Remote hosts thus become part of an extruded net.

Page 17: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 17

Windows 7 Agile VPN Client

• Gateway certificate must containhost name [or IP address] and the serverAuth extendedKeyUsage flag.

Page 18: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 18

strongSwan Applet for the Linux Desktop

• D-Bus based communication between NetworkManager and strongSwan daemon.

• If a CA root certificate is specified then the hostname [or IP address] of the VPN gateway must be contained as a subjectAltName in the received gateway certificate.

Page 19: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 19

strongSwan in a Mixed VPN Environment

CampusNetwork

strongSwan

Linux Client

Windows 7/8Agile VPN

Client

LinuxFreeRadius

Server

Windows Active

Directory Server

Internet

High-AvailabilitystrongSwan

VPN Gateway

strongswan.hsr.ch

Page 20: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 20

Information Security 2 (InfSi2)

4.8 VPN Features

Page 21: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 21

• IKEv1 - XAUTH (eXtended AUTHentication)• Proprietary extension used by many vendors (Cisco,

Checkpoint, etc.)• Based on expired draft-beaulieu-ike-xauth-02.txt

• IKEv2 - EAP (Extensible Authentication Protocol)• EAP-AKA, EAP-SIM, EAP-MSCHAPv2, EAP-MD5, EAP-GTC, EAP-

TLS, etc.• VPN client triggers EAP by omitting AUTH payload• VPN gateway must send public key AUTH payload first!

• VPN gateway relays authentication messages to and from AAA server (RADIUS, DIAMETER or LDAP)

Extended Authentication

VPN Gateway

AAA ServerIKEmessages

VPN Client

Page 22: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 22

• IKEv1 – Mode Config Payload• Proprietary extension used by many vendors (Cisco,

Checkpoint, etc.)• Based on expired draft draft-dukes-ike-mode-cfg-02.txt

• IKEv2 – Configuration Paiload• has official CP payload

• VPN gateway fetches configuration attributes from AAA server• Virtual IPv4 or IPv6 address• Internal DNS and WINS servers• Proprietary attributes (Cisco Unity, Microsoft, 3GPP, etc.)

Configuration Payload

IKEmessages

VPN Client

AAA Server

Page 23: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 23

IPsec Passthrough (Transparent IPsec Connection)

• ADSL and Cable routers use Network Address Translation (NAT) to connect one or several hosts sitting behind the router access to the Internet.

• IPsec passthrough forwards ESP und IKE packets to a preconfigured host behind the NAT router.

• Drawback: Each router model is configured differently, causing exorbitant costs supporting individual users.

ESP and IKE from a single VPN client

10.3.0.2 UDP/500 55.66.x.x UDP/500

10.3.0.2 ESP 55.66.x.x ESP

11.22.33.44 UDP/500

11.22.33.44 ESP

Page 24: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 24

NAT-Traversal (UDP encapsulation of ESP packets)

• NAT-Traversal is used if several VPN clients want to set up secure tunnels through a common router doing NAT.

• Typical Applications: WLAN hotspots, hotels, conferences,mobility via GSM/GPRS.

• NAT-Traversal facilitates remote access e.g. working at home.

ESP and IKE from several VPN clients

10.3.0.3 UDP/4500 55.66.x.x UDP/1026

10.3.0.2 UDP/4500 55.66.x.x UDP/1025

11.22.33.44 UDP/4500

11.22.33.44 UDP/4500

Page 25: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 25

ESP-in-UDP Encapsulation (RFC 3948)

Src Port (4500) Dst Port (4500)

Length Checksum

Security Parameters Index

UDP Header

ESP Header

Src Port (4500) Dst Port (4500)

Length Checksum

0x00

IKE Header

UDP Header

IKE Header

Non-ESP Marker0x00 0x00 0x00

Src Port (4500) Dst Port (4500)

Length Checksum

0xFF

UDP Header

Keepalive Payload

• NAT-Keepalive Packet Format

• IKE Header Format for Port 4500

• UDP-Encapsulated ESP Header Format

Page 26: Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 1 Information Security 2 (InfSi2) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications

Andreas Steffen, 1.10.2013, 4.6-IKE.pptx 26

IKEv2 Dead Peer Detection

#ipsec.conf for roadwarrior carol

conn %default dpddelay=60 dpdaction=restart

#ipsec.conf for gateway moon

conn %default dpddelay=60 dpdaction=clear

Oct 24 11:45:10 13[IKE] CHILD_SA home{1} established with SPIs c50810d9_i c8485f4a_o Oct 24 11:46:10 16[NET] received packet: from 192.168.0.1[500] to 192.168.0.100[500] Oct 24 11:46:10 16[ENC] parsed INFORMATIONAL request 0 [ ] Oct 24 11:46:10 16[ENC] generating INFORMATIONAL response 0 [ ] Oct 24 11:46:10 16[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:47:09 09[IKE] sending DPD request Oct 24 11:47:09 09[ENC] generating INFORMATIONAL request 2 [ ] Oct 24 11:47:09 09[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:47:13 03[IKE] retransmit 1 of request with message ID 2 Oct 24 11:47:13 03[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:47:20 11[IKE] retransmit 2 of request with message ID 2 Oct 24 11:47:20 11[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:47:33 08[IKE] retransmit 3 of request with message ID 2 Oct 24 11:47:33 08[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:47:56 12[IKE] retransmit 4 of request with message ID 2 Oct 24 11:47:56 12[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:48:38 14[IKE] retransmit 5 of request with message ID 2 Oct 24 11:48:38 14[NET] sending packet: from 192.168.0.100[500] to 192.168.0.1[500] Oct 24 11:49:54 16[IKE] giving up after 5 retransmits Oct 24 11:49:54 16[IKE] restarting CHILD_SA home Oct 24 11:49:54 16[IKE] initiating IKE_SA home[2] to 192.168.0.1