Light-Weight Implementation Guidance (lwig) | D. Migault, Ed. |
Internet-Draft | Ericsson |
Intended status: Informational | T. Guggemos |
Expires: April 7, 2017 | LMU Munich |
October 4, 2016 |
Minimal ESP
draft-mglt-lwig-minimal-esp-03.txt
This document describes a minimal version of the IP Encapsulation Security Payload (ESP) described in RFC 4303 which is part of the IPsec suite.
ESP is used to provide confidentiality, data origin authentication, connectionless integrity, an anti-replay service (a form of partial sequence integrity), and limited traffic flow confidentiality.
This document does not update or modify RFC 4303, but provides a compact description of how to implement the minimal version of the protocol. If this document and RFC 4303 conflicts then RFC 4303 is the authoritative description.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 7, 2017.
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
ESP [RFC4303] is part of the IPsec suite protocol [RFC4301] . It is used to provide confidentiality, data origin authentication, connectionless integrity, an anti-replay service (a form of partial sequence integrity) and limited traffic flow confidentiality.
Figure 1 describes an ESP Packet. Currently ESP is implemented in the kernel of IPsec aware devices. This document provides a minimal ESP implementation guideline so that smaller devices like sensors without kernel and with hardware restrictions can implement ESP and benefit from IPsec.
For each field of the ESP packet represented in Figure 1 this document provides recommendations and guidance for minimal implementations.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ---- | Security Parameters Index (SPI) | ^Int. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- | Sequence Number | |ered +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ---- | Payload Data* (variable) | | ^ ~ ~ | | | | |Conf. + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- | | Padding (0-255 bytes) | |ered* +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | | Pad Length | Next Header | v v +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ------ | Integrity Check Value-ICV (variable) | ~ ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 1: ESP Packet Description
According to the [RFC4303], the SPI is a mandatory 32 bits field and is not allowed to be removed.
The SPI is used to index the Security Association and as such is unidirectional. The SPI MUST be unique so that any incoming ESP packet can appropriately be bound to its association. Uniqueness of the SPI may be provided by random functions. However, the SPI does not need to be unpredictable. As a result, if random functions are too costly for some constraint devices, the SPI can be generated using predictable functions or even fixed values.
A constraint device setting a unique ESP session with each remote peer may use a fix SPI value. Such configuration may result in two kind of collisions. SPI collision between inbound and outbound SPI of a given session with a given remote peer or SPI collision across sessions between different remote peers.
Inbound and outbound SPI collision: when IKEv2 [RFC7296] or [RFC7815] is use to agree the session key materials, the SPI proposed by the constraint device will be used by the constraint device in order to index its inbound traffic. The use of a fixed value SPI may result in collision between inbound and outbound traffic if the remote peer proposes the same SPI value for its inbound traffic. Such collisions are not an issue as for outbound traffic SPI value is not used by the sending device. Instead, it will be used by the remote peer to bing the inbound traffic to the appropriated SA.
Inter session SPI collisions: The SPI is mostly used for inbound traffic so the peer can identify the corresponding SA. Binding between inbound traffic and SA should first consider the SPI and the IP addresses, so as long as the constraint device does not have more then one ESP session per IP address, the IP address is sufficient to bind incoming packets to the SA.
Even though, the use of a single SPI value is possible as long as the device has only an single ESP session per remote node, it may also come with security or privacy drawbacks. The use of a fix SPI value may identify the constraint device communications from a passive attacker. This may provide such an attacker information such as the number of constraint devices connecting the remote peer, and in conjunction with data rate, the attacker may eventually determine the application the constraint device is associated to. In addition, if the fix value SPI is fixed by a manufacturer or by some software application, the SPI may leak in an obvious way the type of sensor, the application involved or the model of the constraint device. As a result, the use of a unpredictable SPI is preferred to provide better privacy.
Similarly, the use of a fixed SPI value may also come with some security issues. First of all, any information that reveals the type of application or model of the constraint device could be used to identify the vulnerabilities the constraint device is subject to. This is especially sensitive for constraint device where patches or software updates will be challenging to operate. As a result, these devices may remain vulnerable for relatively long period. In addition, predictable SPI enable an attacker to forge packets with a valid SPI. Such packet will not be rejected due to an SPI mismatch, but instead after the signature check which requires more resource and thus make DoS more efficient, especially for devices powered by batteries.
Values 0-255 SHOULD NOT be used. Values 1-255 are reserved and 0 is only allowed to be used internal and it MUST NOT be send on the wire.
[RFC4303] mentions :
According to [RFC4303], the sequence number is a mandatory 32 bits field in the packet.
The SN is set by the sender so the receiver can implement anti-replay protection. The SN is derived from any strictly increasing function that guarantees: if packet B is sent after packet A, then SN of packet B is strictly greater then the SN of packet A.
In IoT, constraint devices are expected to establish communication with specific devices, like a specific gateway, or nodes similar to them. As a result, the sender may know whereas the receiver implements anti-replay protection or not. Even though the sender may know the receiver does not implement anti replay protection, the sender MUST implement a always increasing function to generate the SN.
Usually, SN is generated by incrementing a counter for each packet sent. A constraint device may avoid maintaining this context. If the device has a clock, it may use the time indicated by the clock has a SN. This guarantees a strictly increasing function, and avoid storing any additional values or context related to the SN. When the use of a clock is considered, one should take care that packets associated to a given SA are not sent with the same time value.
[RFC4303] mentions :
The purpose of padding is to respect the 32 byte alignment of ESP. Padding is not mandatory in ESP and may be performed by the encryption algorithm. As a result, when ESP is designed with encryption algorithms that considers the padding, padding does not need to implement padding. AES in CBC mode [RFC3602] is one of these algorithms. Note that [RFC3602] does not specify how the padding bytes should be generated.
On the other hand, encryption algorithms like AES in CTR [RFC3686] or GCM[RFC4106] or CCM [RFC4309] mode do not consider Padding. As a result, when such algorithms are used, Padding must be done by ESP. ESP defines that padding bytes MUST be generated by a succession of unsigned bytes starting with 1, 2, 3 with the last byte set to Pad Length, where Pad Length designates the length of the padding bytes. Checking the padding structure is not mandatory, so the constraint device may not proceed to such checks, however, in order ton interoperate with existing ESP implementations, it MUST build the padding bytes as recommended by ESP.
[RFC4303] mentions :
According to [RFC4303], the Next Header is a mandatory 8 bits field in the packet. In some cases, devices are dedicated to a single application or a single transport protocol, in which case, the Next Header has a fix value.
[RFC4303] mentions :
The ICV is an optional value with variable length. Unless the crypto-suite provides authentication without the use of the ICV field, the ICV field is used to host the authentication part of the packet.
As detailed in Section 8 we recommend to use authentication, the ICV field is expected to be present that is to say with a size different from zero. This makes it a mandatory field which size is defined by the security recommendations only.
[RFC4303] mentions :
Light implementations of ESP will probably implement a reduced number of cipher suites. When choosing the cipher suites it is recommended to balance the number of cipher suites as well as the cipher itself with other criteria. This section attempts to provide some generic guidances for choosing the appropriated cipher suites. Some recommended and for IoT relevant ciphers are marked in [I-D.mglt-ipsecme-rfc7321bis] with the tag "IoT"
This section lists some of the criteria that may be considered. The list is not expected to be exhaustive and may also evolve overtime. As a result, the list is provided as indicative:
There are no IANA consideration for this document.
Security considerations are those of [RFC4303].
[I-D.mglt-ipsecme-implicit-iv] | Migault, D., Guggemos, T. and Y. Nir, "Implicit IV for Counter-based Ciphers in IPsec", Internet-Draft draft-mglt-ipsecme-implicit-iv-00, June 2016. |
[I-D.mglt-ipsecme-rfc7321bis] | Migault, D., Mattsson, J., Wouters, P. and Y. Nir, "Cryptographic Algorithm Implementation Requirements and Usage Guidance for Encapsulating Security Payload (ESP) and Authentication Header (AH)", Internet-Draft draft-mglt-ipsecme-rfc7321bis-00, March 2016. |
[RFC Editor: This section is to be removed before publication]
-00: First version published.
-01: Clarified description
-02: Clarified description