LogMeIn Hamachi 2 Security: An Overview

Similar documents
IPsec Details 1 / 43. IPsec Details

Security Protocols HTTPS/ DNSSEC TLS. Internet (IPSEC) Network (802.1x) Application (HTTP,DNS) Transport (TCP/UDP) Transport (TCP/UDP) Internet (IP)

Secure Sockets Layer

APNIC elearning: IPSec Basics. Contact: esec03_v1.0

Communication Security for Applications

Chapter 7 Transport-Level Security

Network Security [2] Plain text Encryption algorithm Public and private key pair Cipher text Decryption algorithm. See next slide

Introduction to Security and PIX Firewall

Chapter 17. Transport-Level Security

Network Security Part II: Standards

Security. Contents. S Wireless Personal, Local, Metropolitan, and Wide Area Networks 1

INF3510 Information Security University of Oslo Spring Lecture 9 Communication Security. Audun Jøsang

Final exam review, Fall 2005 FSU (CIS-5357) Network Security

Computer Networks. Secure Systems

Protocol Security Where?

Chapter 4 Virtual Private Networking

IP Security. Ola Flygt Växjö University, Sweden

Network Security. Marcus Bendtsen Institutionen för Datavetenskap (IDA) Avdelningen för Databas- och Informationsteknik (ADIT)

Client Server Registration Protocol

Use Shrew Soft VPN Client to connect with IPSec VPN Server on RV130 and RV130W

Chapter 10. Network Security

Internet Protocol Security IPSec

Cryptography and network security CNET4523

Communication Systems 16 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2009

Transport Level Security

Chapter 6 CDMA/802.11i

Príprava štúdia matematiky a informatiky na FMFI UK v anglickom jazyku

Application Note: Onsight Device VPN Configuration V1.1

VPN. VPN For BIPAC 741/743GE

Building scalable IPSec infrastructure with MikroTik. IPSec, L2TP/IPSec, OSPF

Using etoken for SSL Web Authentication. SSL V3.0 Overview

Using IKEv2 on Juniper Networks Junos Pulse Secure Access Appliance

CSCI 454/554 Computer and Network Security. Topic 8.1 IPsec

Security vulnerabilities in the Internet and possible solutions

Overview. SSL Cryptography Overview CHAPTER 1

Security in Android apps

Web Security Considerations

TLS and SRTP for Skype Connect. Technical Datasheet

LogMeIn Hamachi. Getting Started Guide

VPN Configuration Guide. Dell SonicWALL

Security Engineering Part III Network Security. Security Protocols (II): IPsec

Network Authentication X Secure the Edge of the Network - Technical White Paper

Creating a Gateway to Client VPN between Sidewinder G2 and a Mac OS X Client

CS 356 Lecture 27 Internet Security Protocols. Spring 2013

Network Security Essentials Chapter 5

Bit Chat: A Peer-to-Peer Instant Messenger

Real-Time Communication Security: SSL/TLS. Guevara Noubir CSU610

: Network Security. Name of Staff: Anusha Linda Kostka Department : MSc SE/CT/IT

Internetwork Security

Outline. INF3510 Information Security. Lecture 10: Communications Security. Communication Security Analogy. Network Security Concepts

SSL Secure Socket Layer

Lecture 10: Communications Security

Configuring CSS Remote Access Methods

Entrust Managed Services PKI. Getting started with digital certificates and Entrust Managed Services PKI. Document issue: 1.0

7 Network Security. 7.1 Introduction 7.2 Improving the Security 7.3 Internet Security Framework. 7.5 Absolute Security?

ASA Remote Access VPN with OCSP Verification under Microsoft Windows 2012 and OpenSSL

OPENID AUTHENTICATION SECURITY

Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Overview of CSS SSL. SSL Cryptography Overview CHAPTER

Using BroadSAFE TM Technology 07/18/05

Authentication applications Kerberos X.509 Authentication services E mail security IP security Web security

Case Study for Layer 3 Authentication and Encryption

IT Networks & Security CERT Luncheon Series: Cryptography

Security Technical. Overview. BlackBerry Enterprise Service 10. BlackBerry Device Service Solution Version: 10.2

IPsec VPN Security between Aruba Remote Access Points and Mobility Controllers

Fireware How To Authentication

WIRELESS LAN SECURITY FUNDAMENTALS

McAfee Firewall Enterprise 8.2.1

Network Security. Lecture 3

Securing IP Networks with Implementation of IPv6

Chapter 3. Network Domain Security

Security (II) ISO : Security Architecture of OSI Reference Model. Outline. Course Outline: Fundamental Topics. EE5723/EE4723 Spring 2012

Secure Network Communications FIPS Non Proprietary Security Policy

Implementing and Managing Security for Network Communications

Configure an IPSec Tunnel between a Firebox Vclass & a Check Point FireWall-1

Outline. Transport Layer Security (TLS) Security Protocols (bmevihim132)

axsguard Gatekeeper IPsec XAUTH How To v1.6

[MS-SSTP]: Secure Socket Tunneling Protocol (SSTP) Intellectual Property Rights Notice for Open Specifications Documentation

Secure Shell SSH provides support for secure remote login, secure file transfer, and secure TCP/IP and X11 forwarding. It can automatically encrypt,

ETSF10 Part 3 Lect 2

7750 SR OS System Management Guide

Configuration Guide. How to establish IPsec VPN Tunnel between D-Link DSR Router and iphone ios. Overview

CSCI 454/554 Computer and Network Security. Final Exam Review

Connected from everywhere. Cryptelo completely protects your data. Data transmitted to the server. Data sharing (both files and directory structure)

ReadyNAS Remote White Paper. NETGEAR May 2010

Communication Systems SSL

Branch Office VPN Tunnels and Mobile VPN

How To Understand And Understand The Ssl Protocol ( And Its Security Features (Protocol)

Configuring IKEv2 Load Balancer

Securing Cisco Network Devices (SND)

Sonian Getting Started Guide October 2008

Wireless VPN White Paper. WIALAN Technologies, Inc.

Application Notes. How to Configure UTM with Apple OSX and ios Devices for IPsec VPN

FortiOS Handbook IPsec VPN for FortiOS 5.0

McAfee Firewall Enterprise 8.3.1

Issue 1. Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation

Grandstream Networks, Inc. UCM6100 Security Manual

Lecture 17 - Network Security

SSL A discussion of the Secure Socket Layer

CCNA Security 1.1 Instructional Resource

Transcription:

LogMeIn Hamachi 2 Security: An Overview

2 Table of Contents Overview 3 Audience 3 Abbreviations 3 Security in LogMeIn Hamachi H1 4 Security in LogMeIn Hamachi H2 7 H2 Summary of Changes 7 Appendix A Tunnel Exchanges 17 PUBLISHED BY LogMeIn, Inc. 500 Unicorn Park Drive Woburn, MA 01801 Copyright 2009 by LogMeIn, Inc. All rights reserved. No part of the contents of this document may be reproduced or transmitted in any form or by any means without the written permission of the publisher. LogMeIn, (LogMeIn Backup, LogMeIn Free, LogMeIn Pro, LogMeIn IT Reach, LogMeIn Rescue, LogMeIn Ignition, Hamachi ), LogMeIn Rescue+Mobile, RemotelyAnywhere and Network Console are either registered trademarks or trademarks of LogMeIn, Inc. in the United States and/or other countries. This publication may contain the trademarks and service marks of third parties and such trademarks and service marks are the property of their respective owners. THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS AND SERVICES IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS AND SERVICES. THE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT AND SERVICES ARE SET FORTH IN THE LOGMEIN TERMS AND CONDITIONS AND ARE INCORPORATED HEREIN BY THIS REFERENCE.

3 Overview This document provides an overview and protocol-level details of the security architecture employed by LogMeIn Hamachi. Audience This document is written for security professionals and assumes advanced knowledge of applied cryptography and security practices. Abbreviations AE Authentication Exchange CE Configuration Exchange H1 LogMeIn Hamachi version 0.9 and 1.x H2 LogMeIn Hamachi version 2.x KE Key Exchange SA Security Association (IPsec specification) SPI Security Provider Index (IPsec specification) ESP Encapsulated Security Payload protocol (IPsec specification)

4 Security in LogMeIn Hamachi H1 This section provides an overview of Hamachi security architecture as implemented in versions 0.9 and 1.0 (H1) of the Hamachi client software and respective server-side components. If you are reasonably familiar with the H1 security model, review this section and skip to Security in LogMeIn Hamachi H2 below. H1 Security Summary Server has an RSA pair Client has an RSA pair Login is mutually authenticated with RSA signatures or authentication token based HMACs Client-to-client connections are secured with either: - Server-provided keying material - Client-to-client key exchange authenticated with clients RSA keys Clients learn each other public keys by retrieving them from the server Once retrieved, peer keys are added to a local key store Clients may block the tunnel until they manually authenticate peer s public key H1 Client keypair and Account ID Each Hamachi client generates and stores an RSA keypair as a part of its configuration. The keypair is generated only once, at the initialization step during the first application run. The private key is stored unencrypted as it is assumed that it is safeguarded against unauthorized use with file-level access control mechanisms. Windows clients generate a 1024 bit key. Linux, OSX and some older versions of Windows create a 2048 bit key. The H2 client defaults to 2048 bit keys and the strength can be overridden by the user if needed. When the client connects to the server for the first time, it transmits its public key to the server. The server allocates a new account record for the client and permanently associates it with the key. It then sends an Account ID back to the client, and the client stores it in its configuration. H1 Account ID is a 32 bit value, which is a client s server-assigned virtual IP v4 address from the 5.0.0.0/8 range. The RSA keypair and Account ID comprise the client s login credentials.

5 H1 Server keypair The Hamachi server component owns at least one RSA keypair. Its public key is distributed as a part of a client installation package. H1 Client-Server Authentication During the login process, the client and the server perform mutual authentication. Authentication ensures the identities of both parties and also protects the initial handshake (a key exchange) against Man-in-the-Middle attacks. H1 supports two modes of authentication exchange RSA mode and PSK mode (or a Quick mode ). PSK stands for Pre- Shared Key and it is also referred to as an authentication token. With RSA mode, the client uses its private key to encrypt a hash of the handshake traffic. The resulting signature is then sent to the server for verification. The server does essentially the same, except the hash is computed slightly differently. The client checks the server s signature of the handshake, thus completing the authentication. To use the PSK mode, the server first seeds the client a pre-shared key (PSK). This is done within the scope of one of the previous client s sessions. The pre-shared key is not known to anyone but the client and the server. H1 client keeps its PSK value in a resident memory only; it never stores it in a disk file. Therefore, a newly started client will always log in using an RSA mode; and then will use PSK mode for all subsequent logins until the application is terminated. The server may retire PSK values at will, in which case client s attempt to login with a Quick mode will be rejected. The client is then required to clear its PSK and retry the login with the RSA mode. As with RSA mode, in the PSK mode the client starts by computing a hash of the handshake traffic. It then generates an HMAC of this hash, using pre-shared secret as an HMAC key. HMAC serves as an analog of RSA signature, and it is sent to the server for verification. The server does the same, replying with its own version of a handshake hash HMAC. H1 Client-Server Connection Security H1 client has a choice of two connection types to connect to the server: SSL and Native. With the SSL option, the client uses TLSv1 protocol with DH-anon-AES-256-CBC-SHA-1 suite to secure the connection. Once the TLS handshake is complete, the client goes through a login sequence and authenticates TLS handshake. Control connection privacy and authentication is therefore provided by TLS protocol. With the Native option, the client uses a two-message handshake to execute a key exchange and generate shared keying material. This material is then used to derive authentication and encryption keys, which in turn are used to protect all subsequent application protocol messages. Every message is also tagged with a sequence number.

6 The bulk of the traffic is protected using ESP-like processing. Packets are padded, encrypted with a block cipher, the encryption IV and the sequence number are added; and then all this data is authenticated using 96-bit HMAC. Version 1 Client-to-Client Security When the server establishes a tunnel between two H1 clients, it sends along a keying material string to both clients. This string is a vector of random bytes dynamically generated by the server and discarded immediately after it is sent to the clients. The server neither re-uses nor stores it. Clients use this keying material to derive encryption and authentication keys that protect the tunnel traffic. The tunnel traffic is also tagged with the sequence numbers. Once the tunnel is secured, the clients may execute a peer-to-peer key exchange. With this exchange they generate their own secret keying material and therefore disable the server s theoretical ability to peek at the tunnel traffic. Depending on the exact H1 version, the client may use one of two versions of the key exchange protocol. The older version (PKE) of the protocol implements only the key exchange. The newer version (TPX) can also negotiate additional tunnel configuration parameters, such as a use of compression and/or encryption. Unlike PKE, TPX re-negotiates so-called tunnel SPI values with every exchange. In case of UDP tunnels, these values are included in every packet and effectively allow the recipient to identify the sender and to decide how to process the packet The clients use their RSA keys to authenticate the key exchange. When the tunnel is established for the first time, the client is not likely to know the public key of its peer. As a result it requests peer s key from the server. The peer does the same. This arrangement implies that a client is expected to trust the server to be an honest public key repository. If the server decides to violate this trust, it becomes possible to mount a Man-in-the-Middle attack on a tunnel. To protect against this exploitation of trust, the client has the option of blocking all traffic on tunnels authenticated with newly retrieved peer keys. The user is then required to compare fingerprints of his and the original peer s public key copies, and unblock the tunnel if there is a match. H1 clients do not support authentication of a tunnel with either pre-shared keys or PKI certificates.

7 Security in LogMeIn Hamachi H2 H2 Summary of Changes The client-server authentication is password-based; the server stores the password in a salted hashed form - However the initial login (the enrollment) still uses RSA to authenticate the server The client does not register or store its public key on a server; server never sees client s public key The client-to-client authentication can utilize RSA, PSK or PKI certificates The tunnel is never used for bulk traffic transfer unless it is secured with a client-to-client key exchange Client-to-client tunnel security and configuration protocol is redesigned H2 The enrollment The H2 client account is identified by a username. The username is an opaque string automatically assigned by the server when the account is created. The username cannot be changed and it is not guaranteed to be human-readable. The server also generates a random password for an account. Default password size is 64 symbols. Both the username and the password are passed back to the client in a response to its enrollment request. The server s enrollment response also includes RSA signature of the handshake hash. This allows the client to ensure it creates an account with the server it wants (and not some random server posing as a Hamachi backend). H2 The Password The server stores the password in a hashed form. Furthermore, to prevent dictionary attacks against leaked password hashes, the server employs salted hashing. Salting is a process of appending an extra string of random or somewhat random data to the password prior to hashing it. This effectively renders password recovery through the use pre-computed hash tables infeasible. The hash value of the password is further referred to as a client authentication token. The client is allowed to change the authentication token at will (given its control session is an authenticated state). The client application also has an option to not store the token in a disk configuration file, in which case the user will be prompted for a password before the login. H2 The Login The H2 login is essentially the same as H1 login in a pre-shared key mode.

8 The client sends the username and the HMAC of the handshake traffic. HMAC is computed using the client s authentication token as a password. The server locates the client s account record, verifies the HMAC, and responds with its own value of the handshake HMAC. H2 Client-server security H2 introduces no major changes in the way the client-server control connection is secured. H2 Client-to-client security The H2 client implements a revised version of the tunnel security setup. A combination of the cipher, the MAC, their keys, and other traffic processing options is referred to as Security Association (SA). Simply put, the SA includes all the information needed to tunnel or de-tunnel the traffic to/from the peer. The Security Provider Index (SPI) value is an ID of an SA and it is included in all packets exchanged by the peers. Each tunnel has two SAs; one SA per direction. Both SA and SPI are established terms from the IPsec specification. H2 tunnels are comprised of one or more links. A link provides a simple connectivity service between the clients. A link may be direct or relayed, it may be UDP or TCP based, it may or may not be established with a help of the Hamachi server. H2 Client-to-Client Security Exchanges H2 tunnel configuration and setup is based on three exchanges. All three exchanges use the same initiator-responder mechanism and the same packet header format. They all negotiate new SA and they share a logic used to activate new SA. These similarities are intentional as they simplify the implementation. KE - Key Exchange AE - Authentication Exchange CE - Configuration Exchange KE generates shared secret used to protect the rest of the tunnel traffic AE authenticates the KE CE adjusts tunnel options such as traffic compression and encryption General Exchange Structure The Initiator of the exchange selects a new random 32 bit SPI value and sends an offer message:

9 <exchange-type> SPI_i 0 <exchange-specific data> The responder decides whether to accept or reject the offer. The offer is rejected by aborting the exchange as described below. If the responder accepts the exchange it creates its own SPI value and prepares a new SA and replies with: <exchange-type> SPI_r SPI_i <exchange-specific data> At this point the responder has two SAs old and new. It continues to use the old SA for the outbound traffic. Inbound traffic is checked against both the new and old SAs. Once the new SA is used, the old SA is discarded. The initiator receives a response. Similar to the responder, it has an option of aborting an exchange if it does not like the response. If the initiator accepts the response, it creates a new SA. At this point the initiator also has two SAs and it starts processing all outbound traffic using the newer one. Inbound traffic is checked against both new and old SAs. Once the new SA is used, the old SA is discarded. The initiator periodically re-sends the request until it receives a reply or exhausts a number of retransmissions. The exchange is initiator-driven. The responder aborts the exchange by sending: <exchange-type> 0 SPI_i <exchange-specific data> It can only abort the exchange as a response to one of the initiator s messages. The initiator aborts the exchange by sending: <exchange-type> 0 SPI_r <exchange-specific data> And the responder acknowledges it with: <exchange-type> 0 SPI_i <exchange-specific data> Symmetrical Exchange A symmetrical exchange occurs when both sides simultaneously initiate an exchange. Clients know they are in this situation if they receive an OFFER in response to their own OFFER.Instead of trying to complete a symmetrical exchange, clients implement a simple initiator-responder election mechanism instead. Each client compares its username to the username of the peer. The client with a smaller username (as per certain ordering criteria) becomes a responder, and its peer an initiator. The initiator drops the peer s request and awaits a reply to his own. The responder does the opposite: it cancels its own request and replies to the peer s. See also Appendix A Tunnel Exchanges. H2 Client-to-client security Initial SA

10 When an individual link is first established, it may or may not have an Initial SA set up. For example, when the server establishes a direct or relayed link, it provides both clients with a pre-generated keying material. This enables clients to establish an SA. On the other hand, if the link is manually configured, the clients do not have any shared secret data, so the link does not have an initial SA. This SA, when present, is used for traffic authentication only; and not its encryption. Its sole purpose is to provide DoS attack protection for the key exchange that follows. The use of initial SA is somewhat unique to H2. Traditional IKE-based VPN systems are susceptible to DoS attacks against the initial handshake, and this is considered a known deployment risk. Initial SA is referred to as Weak SA. The name is due to the fact that it is derived from a server-supplied keying material. This theoretically grants the server full access to any client-to-client traffic protected under this SA. As a result, the SA is not used for anything but preliminary authentication of the key exchange traffic. Summary If the server provides an initial keying material for a link, the Weak SA is established. This is a link SA and it is used for traffic authentication only. The SA exists until the KE is executed between the clients, at which point a tunnel SA is established. The latter is then used to process the traffic on all links, thus making all individual link SAs obsolete. H2 Client-to-Client Security Overview Once the H2 tunnel gets its first operational link, the clients execute a key exchange. The KE generates an SA that is based on a secret known only to the clients. In other words, it excludes the server from a loop. Initial key exchange is followed by an Authentication Exchange (AE). It confirms the identities of both clients and verifies that KE was not a subject to a Man-in-the-Middle attack. The key exchange may be re-run later on, which is also known as re-keying. It typically is not followed by an AE, because the authenticity of the exchange parties is simply inherited from the existing SA. Overview of the Tunnel Security Setup Process 1 Link A is up. If the server provides keying material, Weak SA is set up for this link. 2 Client initiates KE with a peer If KE messages are sent over A, then its Weak SA is used to authenticate them. 3 KE is completed. This creates Anonymous SA, which a shared tunnel SA.

11 Weak SAs on all links are discarded. 4 Client initiates AE with a peer. The traffic is protected by Anonymous SA. 5 AE is completed. This creates Strong SA (for the lack of better name) and completes the setup. H2 Client-to-Client Security KE Details The key exchange is modeled loosely after JFK and IKEv2 protocols and is a request-response protocol. The flow of the exchange is as follows. 1 A generates new SPI value, new Nonce, private DH key and public DH exponent 2 A sends SPI, Nonce and public DH exponent to A 3 A receives the packet, generates its own SPI value, Nonce, private DH key and public DH exponent 4 A generates shared DH key and uses it as a keying material to create new SA 5 A sends its SPI, Nonce and public DH exponent to A 6 A receives the packet, generates shared DH key and creates an SA. Client A may facilitate a switch to a new SA by sending a ping-like application level message. This will be processed under the new SA; thereby causing A to switch the SA when it receives the message. In turn, A will echo the packet; this response will cause A to switch its SA. A may choose to delay expensive operations such as DH secret computation until it receives the first packet from SA with a new SPI value. This provides a protection against CPU-bound DoS attacks. Also note that this sort of attack is only possible when the KE messages are not authenticated (when there are no link or tunnel SAs). Both the request and the response use the same format: Type 8 bits Message type, 0xC1 for KE message SPI_x 16 bits Sender s new SPI value SPI_y 16 bits Recipient s new SPI value Suite 32 bits An ID of a pre-configured set of crypto algorithms and their parameters used by SA and KE itself. All clients must support suite 1, which is described below Nonce_x var Sender s vector of random bytes, used for generating SA s keying material. DH_gx var Sender s public DH exponent. The modulus and the base are defined by a suite being used. Additionally, both clients compute a key exchange hash, which is hash of the following:

12 SPI_x, SPI_y, Suite, Nonce_x, Nonce_y, DH_gx, DH_gy Where..._x is a client s own value and..._y is a peer s value. This hash is later used with an Authentication Exchange. H2 Client-to-Client Security AE Details Authentication exchange is used to confirm the identities of the clients and to check the integrity of the key exchange. It follows the KE that generates Anonymous SA. There are three types of authentication methods supported by the H2 clients: RSA keys Pre-shared key (passwords) PKI certificates The protocol flow of AE does not depend on specifics of the method and it is as follows: 1 A checks its configuration and selects authentication method 2 A sends SA SPIs, auth method ID, its arguments, and an authentication hash to A Authentication hash is computed from key exchange hash and authentication data 3 A receives the packet, checks the auth hash and a creates new SA All parameters of new SA except for SPIs are copied from existing SA 4 A sends SA SPIs, auth method ID, its arguments and its own auth hash to A A may use an auth method that is different from the one used by A 5 A receives the packet, checks the auth hash and creates new SA Client A may reject the exchange in there s no matching authentication method or for some other reason. In this case, it

13 replies with a reject message: Type 8 bits Message type, 0xC2 for AE message <zero> 16 bits SPI_y 16 bits Initiator s SPI value ErrorCode 32 bits the cause of the failure The client may be configured to send zero as an ErrorCode for all AE failures. RSA Keys This is the method employed by H1 clients. The authentication model is similar to that of an SSH protocol. The first time a client authenticates a peer, it adds peer s public key to its key repository and marks it as unverified. The user is then expected to check key s fingerprint via an out-of-band channel. Once validated, the key is then marked as verified or trusted. The client then also warns the user if the peer switches to using a different key as this might be a manifestation of a Manin-the-Middle attack against AE. The ID of this authentication method is 1. The packet format is as follows: Type 8 bits Message type, 0xC2 for AE message SPI_x 16 bits Sender s SPI value SPI_y 16 bits Recipient s SPI value AuthMethod 8 bits Authentication method ID, 0x01 for RSA PublicKey var Sender s public key Signature var Sender s RSA signature of an auth hash Authentication hash is computed as follows: SPI_x, SPI_y, ID_x, ID_y, AuthMethod, PublicKey, KE_hash Where ID_x and ID_y are the usernames of the local and remote client respectively. Note that when computing initiator s hash, the SPI_y value is going to be zero. Pre-shared Key This method is supported to allow RSA-free deployments. Both clients are configured with the matching pre-shared tunnel keys (passwords) and these are used to compute HMAC over the authentication hash. The HMAC is then sent over to the peer for verification: Type 8 bits Message type, 0xC2 for AE message

14 SPI_x 16 bits Sender s SPI value SPI_y 16 bits Recipient s SPI value AuthMethod 8 bits Authentication method ID, 0x02 for PSK AuthHash var HMAC as per above PKI Certificate The third authentication method is based on certified public keys. It allows establishing a validity of (previously unknown) peer s public key identity through trust in a 3rd party a Certificate Authority. This method is structured the same way as RSA one, except the public key certificate is included into an AE packet instead of a public key itself. Type 8 bits Message type, 0xC2 for AE message SPI_x 16 bits Sender s SPI value SPI_y 16 bits Recipient s SPI value AuthMethod 8 bits Authentication method ID, 0x03 for Cert PublicKeyCert Var Sender s public key certificate Signature var Sender s RSA signature of an auth hash H2 Client-to-Client Configuration H2 clients are capable of dynamically re-configuring the tunnel to toggle the use of encryption, compression and potentially other settings. Each traffic processing option has three settings ON, OFF and ANY. The last option indicates a willingness of a peer to accept whatever the other side wants to use. For example, if the client wants to enable the compression, it sends an offer to the peer with ON as a compression setting. If peer s own configuration has this setting either at ON or ANY, the compression is turned on. However, if it is set to OFF, there is a conflict and the compression setting is left unmodified. More formally, a tunnel is re-configured using a configuration exchange (CE). A peer starts CE by sending his version of

15 the tunnel option set. Second peer responds with its own version, at which point both peers look at both options sets and deduce new set of options. In case of conflicting settings, its value copied from the existing SA. An option set is encoded as a bitfield stored in a 32 bit integer. Each option occupies 2 bits. The value of 01 is ON, 02 OFF, 03 ANY. The value of 00 is reserved and should be treated as a protocol error if encountered. When encoded, bits 0 and 1 are used for an encryption option, bits 2 and 3 for the compression. Remaining bits are reserved at the moment and should be set to zero. New option value is deduced from two peer s values as follows: ON OFF ANY ON on no-change on OFF no-change off off ANY on off no-change The exchange itself progresses as follows: 1 A generates new SPI, decides on the new tunnel configuration 2 A sends new SPI and the new tunnel config encoded in 32 bit integer to A 3 A receives the packet 4 A generates new SPI, deduces effective tunnel configuration and creates new SA 5 A sends back SPI and its own version of the tunnel config 6 A receives the packet, deduces effective config and creates new SA Encryption and authentication keys are inherited from existing SAs, only SPIs and traffic processing options are updated. The activation process for new SAs is the same as that of a Key Exchange. The handling of a symmetrical exchange start is also the same as with the KE. The offer packet: Type 8 bits Message type, 0xC3 for CE message SPI_x 16 bits Sender s SPI value <zero> 16 bits Recipient s-would-be-spi-value Options 32 bits Initiator s configuration option set The accept packet:

16 Type 8 bits Message type, 0xC3 for CE message SPI_x 16 bits Sender s SPI value SPI_y 16 bits Recipient s SPI value Options 32 bits Responder s configuration option set

17 Appendix A Tunnel Exchanges Typical Flow The following diagram demonstrates a general flow of the events during the exchange. Both sides are assumed to have an existing SA (SA_cur) before the exchange starts. Client A uses its existing SA to process the traffic Client B uses its its existing SA to process the traffic A initiates the exchange generates SPI_i generates SPI_i sends an OFFER packet sends an OFFER packet A processes the ACCEPT A processes the ACCEPT creates SA_new starts using using SA_new SA_new for both for inbound both inbound and and outbound traffic outbound traffic continues using SA_cur for inbound continues traffic using SA_cur for inbound traffic Once the first packet under SA_new is received, SA_new is received, A discards SA_cur. discards SA_cur. The exchange is complete. The exchange is complete. B responds to the OFFER: generates SPI_r B responds creates SA_new to the OFFER: and starts generates SPI_r using it for inbound traffic creates SA_new and starts using replies it for with inbound ACCEPT traffic replies with ACCEPT B continues to use SA_cur for continues to use SA_cur for both inbound and outbound traffic Once the first packet under SA_new is received, B discards SA_cur and starts using SA_new for all its traffic. using SA_new for all its traffic. The exchange is complete. The exchange is complete.

18 Packet Loss and Excessive Link Latency Client A periodically re-sends its OFFER if it does not hear back from A within a timeout period. Once A exhausts all retransmission attempts, it cancels the exchange. If A responds to the OFFER after A has cancelled the exchange, A sends a REJECT packet, thus forcing A to discard its SA_new. A is expected to respond with its own REJECT to confirm the reception of A s REJECT. Similar to the OFFER, A retransmits REJECT few times if A does no respond in a timely manner. A aborts the retransmission sequence if another exchange is initiated by either side. REJECT retransmits are really for B s own benefit they try to make sure that A knows that the exchange has been cancelled. Client A may in fact not send a single REJECT and the logic described below will still ensure the tunnel is always in a consistent state. B s SA_new can be viewed as an initially disabled SA that is activated by a packet received from A. This means that if A decides not to use SA_new, A may be required to discard the SA without ever using it. Specifically, in cases when there is a packet loss in a B-to-A direction, A may never receive any of the ACCEPT packets. Client A will exhaust its retransmission attempts and cancel the exchange. A, however, will generate SA_new. In this scenario, A is required to discard its SA_new under either of two conditions: It receives new OFFER from A It makes its own OFFER and receives a response from A (either ACCEPT or REJECT) This behavior also covers the case when either A rejects A s OFFER or A rejects B s ACCEPT and these REJECT packets are lost. When can the new exchange be started The key exchange and the configuration exchange are an offer-accept or an offer-reject sequence. However the authentication exchange may be longer - offer-accept-reject-reject. As a result of this, the conditions under which the new exchange may be started depend on the exchange type and the role of the peer in a preceding exchange. The Initiator: KE, CE, AE after receiving ACCEPT or REJECT. The Responder: KE, CE after sending ACCEPT or REJECT. AE after receiving REJECT or the first packet processed under the new SA