RFC 7401
Host Identity Protocol Version 2 (HIPv2)
Host Identity Protocol Version 2 (HIPv2) ๐ฆ
okay bestie, this is RFC 7401 and it's giving Standards Track ๐
. It's an IETF document edited by R. Moskowitz (that's the Ed., so they're running the show ๐). The other authors are T. Heer, P. Jokela, and T. Henderson. Moskowitz is at HTT Consulting, Heer at Hirschmann Automation and Control, Jokela at Ericsson Research NomadicLab, and Henderson at the University of Washington. It dropped in April 2015 ๐ธ with ISSN 2070-1721. The big tea โ: it obsoletes RFC 5201 ๐ญ, so 5201 is officially retired. The title block doesn't list anything under Updates.
Abstract โจ
okay so this doc spells out the nitty-gritty of the Host Identity Protocol (HIP) ๐. HIP lets hosts that both consent to it safely set up and keep shared IP-layer state. The big idea is that it splits the identifier role and the locator role of IP addresses apart, which means your communications can keep going even when your IP address changes ๐ฆ. HIP runs on a Diffie-Hellman key exchange, and it uses public key identifiers from a brand-new Host Identity namespace for mutual peer authentication ๐. It's built to hold up against denial-of-service (DoS) and man-in-the-middle (MitM) attacks, which is so important ๐. When you pair it with another solid security protocol, like the Encapsulating Security Payload (ESP), it gives upper-layer protocols like TCP and UDP integrity protection and optional encryption ๐.
This doc obsoletes RFC 5201 and tackles the concerns the IESG raised, especially the one about crypto agility ๐. It also bakes in lessons learned from people actually implementing RFC 5201 ๐.
Status of This Memo ๐
this is an Internet Standards Track document โจ.
It's a product of the Internet Engineering Task Force (IETF), so it reflects the consensus of the IETF community ๐ซถ. It went through public review and got the green light from the Internet Engineering Steering Group (IESG) ๐. If you want more on Internet Standards, check out Section 2 of RFC 5741 ๐.
For the latest status, any errata, or to send feedback, head to http://www.rfc-editor.org/info/rfc7401 ๐.
Copyright Notice ๐ฅ
copyright (c) 2015 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) as they stand on the publication date ๐. Please actually read these, bestie, because they spell out your rights and restrictions ๐.
Code Components pulled out of this document have to include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions. They also come with no warranty, per the Simplified BSD License ๐ซถ.
Table of Contents ๐
1. Introduction ....................................................5
1.1. A New Namespace and Identifiers ............................6
1.2. The HIP Base Exchange (BEX) ................................6
1.3. Memo Structure .............................................7
2. Terms and Definitions ...........................................7
2.1. Requirements Terminology ...................................7
2.2. Notation ...................................................8
2.3. Definitions ................................................8
3. Host Identity (HI) and Its Structure ............................9
3.1. Host Identity Tag (HIT) ...................................10
3.2. Generating a HIT from an HI ...............................11
4. Protocol Overview ..............................................12
4.1. Creating a HIP Association ................................12
4.1.1. HIP Puzzle Mechanism ...............................14
4.1.2. Puzzle Exchange ....................................15
4.1.3. Authenticated Diffie-Hellman Protocol with
DH Group Negotiation ...............................17
4.1.4. HIP Replay Protection ..............................18
4.1.5. Refusing a HIP Base Exchange .......................19
4.1.6. Aborting a HIP Base Exchange .......................20
4.1.7. HIP Downgrade Protection ...........................20
4.1.8. HIP Opportunistic Mode .............................21
4.2. Updating a HIP Association ................................24
4.3. Error Processing ..........................................24
4.4. HIP State Machine .........................................25
4.4.1. State Machine Terminology ..........................26
4.4.2. HIP States .........................................27
4.4.3. HIP State Processes ................................28
4.4.4. Simplified HIP State Diagram .......................35
4.5. User Data Considerations ..................................37
4.5.1. TCP and UDP Pseudo Header Computation for
User Data ..........................................37
4.5.2. Sending Data on HIP Packets ........................37
4.5.3. Transport Formats ..................................37
4.5.4. Reboot, Timeout, and Restart of HIP ................37
4.6. Certificate Distribution ..................................38
5. Packet Formats .................................................38
5.1. Payload Format ............................................38
5.1.1. Checksum ...........................................40
5.1.2. HIP Controls .......................................40
5.1.3. HIP Fragmentation Support ..........................40
5.2. HIP Parameters ............................................41
5.2.1. TLV Format .........................................44
5.2.2. Defining New Parameters ............................46
5.2.3. R1_COUNTER .........................................47
5.2.4. PUZZLE .............................................48
5.2.5. SOLUTION ...........................................49
5.2.6. DH_GROUP_LIST ......................................50
5.2.7. DIFFIE_HELLMAN .....................................51
5.2.8. HIP_CIPHER .........................................52
5.2.9. HOST_ID ............................................54
5.2.10. HIT_SUITE_LIST ....................................56
5.2.11. TRANSPORT_FORMAT_LIST .............................58
5.2.12. HIP_MAC ...........................................59
5.2.13. HIP_MAC_2 .........................................59
5.2.14. HIP_SIGNATURE .....................................60
5.2.15. HIP_SIGNATURE_2 ...................................61
5.2.16. SEQ ...............................................61
5.2.17. ACK ...............................................62
5.2.18. ENCRYPTED .........................................62
5.2.19. NOTIFICATION ......................................64
5.2.20. ECHO_REQUEST_SIGNED ...............................67
5.2.21. ECHO_REQUEST_UNSIGNED .............................68
5.2.22. ECHO_RESPONSE_SIGNED ..............................69
5.2.23. ECHO_RESPONSE_UNSIGNED ............................69
5.3. HIP Packets ...............................................70
5.3.1. I1 - the HIP Initiator Packet ......................71
5.3.2. R1 - the HIP Responder Packet ......................72
5.3.3. I2 - the Second HIP Initiator Packet ...............75
5.3.4. R2 - the Second HIP Responder Packet ...............76
5.3.5. UPDATE - the HIP Update Packet .....................77
5.3.6. NOTIFY - the HIP Notify Packet .....................78
5.3.7. CLOSE - the HIP Association Closing Packet .........78
5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet ..79
5.4. ICMP Messages .............................................79
5.4.1. Invalid Version ....................................79
5.4.2. Other Problems with the HIP Header and
Packet Structure ...................................80
5.4.3. Invalid Puzzle Solution ............................80
5.4.4. Non-existing HIP Association .......................80
6. Packet Processing ..............................................80
6.1. Processing Outgoing Application Data ......................81
6.2. Processing Incoming Application Data ......................82
6.3. Solving the Puzzle ........................................83
6.4. HIP_MAC and SIGNATURE Calculation and Verification ........84
6.4.1. HMAC Calculation ...................................84
6.4.2. Signature Calculation ..............................87
6.5. HIP KEYMAT Generation .....................................89
6.6. Initiation of a HIP Base Exchange .........................90
6.6.1. Sending Multiple I1 Packets in Parallel ............91
6.6.2. Processing Incoming ICMP Protocol
Unreachable Messages ...............................92
6.7. Processing of Incoming I1 Packets .........................92
6.7.1. R1 Management ......................................94
6.7.2. Handling of Malformed Messages .....................94
6.8. Processing of Incoming R1 Packets .........................94
6.8.1. Handling of Malformed Messages .....................97
6.9. Processing of Incoming I2 Packets .........................97
6.9.1. Handling of Malformed Messages ....................100
6.10. Processing of Incoming R2 Packets .......................101
6.11. Sending UPDATE Packets ..................................101
6.12. Receiving UPDATE Packets ................................102
6.12.1. Handling a SEQ Parameter in a Received
UPDATE Message ...................................103
6.12.2. Handling an ACK Parameter in a Received
UPDATE Packet ....................................104
6.13. Processing of NOTIFY Packets ............................104
6.14. Processing of CLOSE Packets .............................105
6.15. Processing of CLOSE_ACK Packets .........................105
6.16. Handling State Loss .....................................105
7. HIP Policies ..................................................106
8. Security Considerations .......................................106
9. IANA Considerations ...........................................109
10. Differences from RFC 5201 ....................................113
11. References ...................................................117
11.1. Normative References ....................................117
11.2. Informative References ..................................119
Appendix A. Using Responder Puzzles ..............................122
Appendix B. Generating a Public Key Encoding from an HI ..........123
Appendix C. Example Checksums for HIP Packets ....................123
C.1. IPv6 HIP Example (I1 Packet) ..............................124
C.2. IPv4 HIP Packet (I1 Packet) ...............................124
C.3. TCP Segment ...............................................125
Appendix D. ECDH and ECDSA 160-Bit Groups ........................125
Appendix E. HIT Suites and HIT Generation ........................125
Acknowledgments ..................................................127
Authors' Addresses ...............................................128
1. Introduction โจ
Okay bestie, so this doc is the nitty-gritty spec for the Host Identity Protocol (HIP) ๐ฆ. If you want the big-picture vibes and the architecture thinking, go read the separate HIP architecture description [HIP-ARCH] first. Here's the quick version: the HIP architecture offers an alternative to using IP addresses for two jobs at once, as "locators" (routing labels) and as "identifiers" (endpoint, or host, identifiers) ๐ธ. In HIP, the public key from a public/private key pair is used as the host identifier, and higher-layer protocols get bound to that instead of an IP address ๐. Because public keys (and their representations) are the identifiers, changes to a host's set of IP addresses can be directly authenticated between hosts ๐ . And if you want it, strong authentication between hosts at the TCP/IP stack level is possible too ๐ก๏ธ.
This memo specifies the base HIP protocol ("base exchange") that hosts use to set up an IP-layer communications context before they talk, called a HIP association ๐. It also defines a packet format and the procedures for updating and terminating an active HIP association ๐. Other parts of the HIP architecture live in other documents, such as:
- "Using the Encapsulating Security Payload (ESP) Transport Format with the Host Identity Protocol (HIP)" [RFC7402]: how to use the Encapsulating Security Payload (ESP) for integrity protection and optional encryption ๐
- "Host Mobility with the Host Identity Protocol" [HIP-HOST-MOB]: how to support host mobility in HIP ๐
- "Host Identity Protocol (HIP) Domain Name System (DNS) Extension" [HIP-DNS-EXT]: how to extend DNS to contain Host Identity information ๐ง
- "Host Identity Protocol (HIP) Rendezvous Extension" [HIP-REND-EXT]: using a rendezvous mechanism to contact mobile HIP hosts ๐ฑ
Okay, now the crypto tea โ. Since the HIP base exchange was first developed, there have been a few advances in cryptography and attacks against cryptographic systems ๐ญ. So all cryptographic protocols need to be agile. That is, the ability to switch from one cryptographic primitive to another should be a part of such protocols ๐. It's important to support a reasonable set of mainstream algorithms to cater to different use cases, and to allow moving away from algorithms that are later discovered to be vulnerable ๐. This update to the base exchange includes this needed cryptographic agility, and it also deals with the downgrade attacks that all that flexibility introduces ๐. On top of that, Elliptic Curve support via Elliptic Curve DSA (ECDSA) and Elliptic Curve Diffie-Hellman (ECDH) has been added ๐โจ. Iconic glow-up, no cap ๐.
1.1. A New Namespace and Identifiers
okay so HIP introduces a whole new namespace, the Host Identity namespace ๐ฆ The HIP architecture description [HIP-ARCH] explains some of the ramifications of it, so go check that one too if you're curious.
there are two main ways to represent a Host Identity: the full Host Identity (HI) and the Host Identity Tag (HIT) ๐ The HI is a public key, and it directly represents the identity of a host. but public key algorithms come in different key lengths, so the HI on its own is not suitable as a packet identifier, or as an index into the state structures that HIP needs ๐ so they hash the HI into the Host Identity Tag (HIT), and that's the operational representation. the HIT is 128 bits long, it's used in the HIP headers, and it indexes the matching state in the end hosts โจ the HIT is also self-certifying, which is a huge security property (see Section 3) ๐
1.2. The HIP Base Exchange (BEX)
the HIP base exchange is a two-party cryptographic handshake used to set up communications context between hosts ๐ค it's a SIGMA-compliant [KRA03] four-packet exchange. the first party is the Initiator and the second is the Responder. Diffie-Hellman [DIF76] keys get swapped in the 2nd and 3rd packets, and the parties authenticate each other in the 3rd and 4th packets ๐
the four-packet design is what makes HIP resistant to DoS attacks, and it's honestly so clever ๐ญ the Responder can stay stateless until the IP address and the cryptographic puzzle are verified. the Responder kicks off the puzzle exchange in the 2nd packet, the Initiator completes it in the 3rd packet, and only then does the Responder store any state from the exchange ๐งฉ
the exchange can use the Diffie-Hellman output to encrypt the Initiator's Host Identity in the 3rd packet. (Aura, et al. [AUR05] point out that this might interfere with packet-inspecting middleboxes, so keep that in mind ๐) or the Host Identity can just be sent unencrypted. the Responder's Host Identity is not protected.
heads up: both the Initiator's and the Responder's HITs travel in cleartext in the packets. so an eavesdropper who already knows who the parties are can identify them by their HITs ๐ which means encrypting the HI of any party doesn't give you privacy against that kind of attacker.
data packets start flowing after the 4th packet ๐ the 3rd and 4th HIP packets may carry a data payload in the future, but the details of that may be defined later.
an existing HIP association can be updated using the update mechanism in this document, and once it's no longer needed, it can be closed using the defined closing mechanism ๐ซถ
last but not least, HIP is designed as an end-to-end authentication and key establishment protocol, meant to be used with Encapsulating Security Payload (ESP) [RFC7402] and other end-to-end security protocols ๐ the base protocol does not cover all the fine-grained policy control found in Internet Key Exchange (IKE) [RFC7296], which is what lets IKE handle complex gateway policies. so no, HIP is not a complete replacement for IKE ๐ โโ๏ธ
1.3. Memo Structure
okay the rest of the memo is laid out like this ๐บ๏ธ Section 2 defines the central keywords, notation, and terms used through the rest of the document. Section 3 defines the structure of the Host Identity and its various representations. Section 4 gives an overview of the HIP base exchange protocol. Sections 5 and 6 define the detailed packet formats and the rules for processing packets. And finally, Sections 7, 8, and 9 cover policy, security, and IANA considerations, respectively ๐
2. Terms and Definitions
2.1. Requirements Terminology
the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be read as described in RFC 2119 [RFC2119] ๐โจ
2.2. Notation
here's the notation cheat sheet, bestie ๐
[x] indicates that x is optional.
{x} indicates that x is encrypted.
X(y) indicates that y is a parameter of X.
<x>i indicates that x exists i times.
--> signifies "Initiator to Responder" communication (requests).
<-- signifies "Responder to Initiator" communication (replies).
| signifies concatenation of information (e.g., X | Y is the
concatenation of X with Y).
Ltrunc (H(x), #K)
denotes the lowest-order #K bits of the result of the
hash function H on the input x.
2.3. Definitions
okay the glossary, let's go ๐
- HIP base exchange (BEX): the handshake for establishing a new HIP association. ๐ค
- Host Identity (HI): the public key of the signature algorithm that represents the identity of the host. in HIP, a host proves its identity by creating a signature with the private key belonging to its HI (cf. Section 3). ๐
- Host Identity Tag (HIT): a shorthand for the HI in IPv6 format. it's generated by hashing the HI (cf. Section 3.1). ๐
- HIT Suite: a HIT Suite groups all the cryptographic algorithms that are required to generate and use an HI and its HIT. specifically, these algorithms are 1) the public key signature algorithm, 2) the hash function, and 3) the truncation (cf. Appendix E). ๐ง
- HIP association: the shared state between two peers after the BEX is complete. ๐ซ
- HIP packet: a control packet carrying a HIP packet header related to establishing, maintaining, or terminating the HIP association. ๐ฆ
- Initiator: the host that initiates the BEX. this role is typically forgotten once the BEX is completed. ๐
- Responder: the host that responds to the Initiator in the BEX. this role is typically forgotten once the BEX is completed. ๐
- Responder's HIT hash algorithm (RHASH): the hash algorithm used for the various hash calculations in this document. it's the same algorithm used to generate the Responder's HIT. the RHASH is the hash function defined by the HIT Suite of the Responder's HIT (cf. Section 5.2.10). ๐
- Length of the Responder's HIT hash algorithm (RHASH_len): the natural output length of RHASH in bits. ๐
- Signed data: data that is signed is protected by a digital signature created by the sender of the data using the private key of its HI. โ๏ธ
- KDF: the Key Derivation Function (KDF) is used to derive the symmetric keys from the Diffie-Hellman key exchange. ๐๏ธ
- KEYMAT: the keying material derived from the Diffie-Hellman key exchange using the KDF. symmetric keys for encryption and integrity protection of HIP packets and encrypted user data packets are drawn from this keying material. ๐
3. Host Identity (HI) and Its Structure
in this section we get into the properties of the Host Identity and the Host Identity Tag, and the exact format for each one is defined ๐ฆ in HIP, the public key of an asymmetric key pair is used as the Host Identity (HI). the host itself is defined as the entity that holds the private key of that pair. see the HIP architecture specification [HIP-ARCH] for more on the difference between an identity and its corresponding identifier ๐
HIP implementations MUST support the Rivest Shamir Adleman [RSA] public key algorithm and the Elliptic Curve Digital Signature Algorithm (ECDSA) for generating the HI, as defined in Section 5.2.9. Additional algorithms MAY be supported. ๐
a hashed encoding of the HI, the Host Identity Tag (HIT), is what protocols use to represent the Host Identity โจ the HIT is 128 bits long and has three key properties: i) it's the same length as an IPv6 address, so it fits in fixed address-sized fields in APIs and protocols; ii) it's self-certifying, meaning that given a HIT, it's computationally hard to find a Host Identity key that matches it; and iii) the probability of a HIT collision between two hosts is very low, so it's infeasible for an attacker to find a collision with a HIT that's in use ๐ก๏ธ for the details on the security properties of the HIT, check [HIP-ARCH].
the structure of the HIT is defined in [RFC7343] ๐ธ the HIT is an Overlay Routable Cryptographic Hash Identifier (ORCHID) and has three parts: first, an IANA-assigned prefix that tells it apart from other IPv6 addresses; second, a four-bit encoding of the algorithms used to generate the HI and its hashed representation; and third, a 96-bit hashed representation of the Host Identity. the encoding of the ORCHID generation algorithm and the exact algorithm for the hashed representation are specified in Appendix E and [RFC7343].
carrying HIs and HITs in the header of every user data packet would bloat the overhead, so they aren't expected to show up in every packet ๐ โโ๏ธ other methods map the data packets to the right HIs instead. in some cases, that means you can use HIP without any extra headers in the user data packets, which is iconic ๐ for example, if ESP is used to protect data traffic, the Security Parameter Index (SPI) carried in the ESP header can be used to map the encrypted data packet to the correct HIP association.
3.1. Host Identity Tag (HIT)
the Host Identity Tag is a 128-bit value, a hashed encoding of the Host Identifier ๐ using a hashed encoding over the actual variable-sized Host Identity public key in protocols has two big advantages. first, the fixed length of the HIT keeps packet sizes manageable and makes protocol coding easier. second, it gives the protocol a consistent format no matter what underlying identity technology is in use ๐
RFC 7343 [RFC7343] specifies 128-bit hash-based identifiers called ORCHIDs ๐ฆ their prefix, allocated from the IPv6 address block, is defined in [RFC7343]. the Host Identity Tag is one type of ORCHID.
this document extends the original, experimental HIP specification [RFC5201] with measures to support crypto agility ๐ one of those measures allows different hash functions for creating a HIT. HIT Suites group the sets of algorithms required to generate and use a particular HIT, and the Suites are encoded in HIT Suite IDs. these HIT Suite IDs are transmitted in the ORCHID Generation Algorithm (OGA) field in the ORCHID. with the HIT Suite ID in the OGA ID field, a host can tell from another host's HIT whether it supports the necessary hash and signature algorithms to establish a HIP association with that host ๐ง
3.2. Generating a HIT from an HI โจ
Okay bestie, this is where the HIT actually gets made ๐ฆ A HIT MUST be generated with the ORCHID generation method from [RFC7343], using the context ID 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA. (The editor of this spec picked that tag value at random, which is so iconic ๐ฒ) The input is the Host Identity field found in a HIP payload packet, encoded as described in Section 5.2.9. Which hash function, signature algorithm, and HI-to-HIT algorithm you get depends on the HIT Suite (see Section 5.2.10), and the four bits of the OGA ID field in the ORCHID tell you which one it is. Right now, truncated SHA-1, truncated SHA-384, and truncated SHA-256 [FIPS.180-4.2012] are the hashes defined for making a HIT ๐
For identities built on RSA, Digital Signature Algorithm (DSA) [FIPS.186-4.2013], or Elliptic Curve DSA (ECDSA) public keys, the ORCHID input is the public key encoding, the same one used for the Host Identity field of the HOST_ID parameter (see Section 5.2.9). This document defines four algorithm profiles: RSA, DSA, ECDSA, and ECDSA_LOW. The ECDSA_LOW profile is aimed at devices with low computational power ๐ So one of the following applies:
- The RSA public key is encoded as defined in [RFC3110], Section 2. You concatenate the exponent length (
e_len), the exponent (e), and the modulus (n) fields. The length of the modulus (n_len) can be worked out from the total HI Length plus the HI fields that come before it, including the exponent (e). So the data that feeds into HIT generation is the same length as the HI itself. The fields MUST be encoded in network byte order, as defined in [RFC3110]. - The DSA public key is encoded as defined in [RFC2536], Section 2. You concatenate the fields T, Q, P, G, and Y as input. That makes the data to be hashed
1 + 20 + 3 * 64 + 3 * 8 * Toctets long, where T is the size parameter defined in [RFC2536]. The size parameter T, which sets the field lengths, MUST be the minimum value that is still big enough to fit P, G, and Y. The fields MUST be encoded in network byte order, as defined in [RFC2536]. - The ECDSA public keys are encoded as defined in Sections 4.2 and 6 of [RFC6090].
Appendix B walks through the public key encoding process in pseudo-code if you want to see it in action ๐ง
4. Protocol Overview โจ
This section is a simplified tour of how HIP works ๐ธ It skips a lot of the packet format and packet processing details. Sections 5 and 6 go deeper into those, and they're the normative source if anything here seems to clash with this section.
IANA has assigned protocol number 139 to the Host Identity Protocol ๐ข
The HIP payload header (Section 5.1) could be carried in every IP datagram. But HIP headers are pretty chunky at 40 bytes, so it's nicer to "compress" the HIP header so it only shows up in control packets that set up or change HIP association state. How that compression works, and how data packets get matched to existing HIP associations (if there are any), is defined in separate documents covering transport formats and methods. All HIP implementations MUST implement, at minimum, the ESP transport format for HIP [RFC7402]. Non-negotiable, babe ๐
4.1. Creating a HIP Association ๐
By definition, the system that kicks off a HIP base exchange is the Initiator, and the other side is the Responder. This label gets forgotten once the base exchange is done, and either party can be the Initiator in later conversations ๐
The HIP base exchange is how the two sides set up state between an Initiator and a Responder. The first packet, I1, starts the exchange. The last three packets, R1, I2, and R2, make up an authenticated Diffie-Hellman [DIF76] key exchange used to generate the session key. In the first two packets, the hosts agree on a set of cryptographic identifiers and algorithms to use during and after the exchange. While the Diffie-Hellman exchange runs, some keying material gets generated. The HIP association keys are pulled out of that keying material with a Key Derivation Function (KDF). If any other cryptographic keys are needed, for example for ESP, they're also supposed to come out of the same keying material through the KDF ๐
The Initiator starts by sending a trigger packet, I1, to the Responder. It carries the Initiator's HIT and, if it happens to know it, the Responder's HIT too. The I1 packet also kicks off negotiation of the Diffie-Hellman group used to make the keying material, so it includes a list of the Diffie-Hellman Group IDs the Initiator supports. Heads up, though: in some cases the I1 trigger can be swapped out for some other kind of trigger, and then the protocol begins with the Responder sending R1. In that situation, some other mechanism has to be defined to tell the Responder which DH groups the Initiator supports (for example, by using a default group) ๐ค
The second packet, R1, kicks off the real authenticated Diffie-Hellman exchange. It contains a puzzle, which is a cryptographic challenge the Initiator has to solve before the exchange can continue ๐งฉ How hard the puzzle is can be tuned based on how much the Responder trusts the Initiator, the current load, or other factors. R1 also has the Responder's Diffie-Hellman parameter and lists of the cryptographic algorithms the Responder supports. Using those lists, the Initiator can carry on, bail out, or restart the base exchange with a different choice of algorithms. R1 further includes a signature covering selected parts of the message. Some fields sit outside the signature so that R1 packets can be created ahead of time ๐ฆ
In the I2 packet, the Initiator MUST display the solution to the puzzle it received. Without a correct solution, the I2 message gets thrown away ๐๏ธ I2 also carries a Diffie-Hellman parameter with information the Responder needs, and the Initiator signs the I2 packet.
The R2 packet acknowledges that I2 arrived and wraps up the base exchange. The Responder signs this one ๐๏ธ
Here's the base exchange drawn out in Figure 1. "key" refers to the Host Identity public key, and "sig" is a signature made with that key. The packets carry other parameters too, which aren't shown in this figure.
Initiator Responder
I1: DH list
-------------------------->
select precomputed R1
R1: puzzle, DH, key, sig
<-------------------------
check sig remain stateless
solve puzzle
I2: solution, DH, {key}, sig
-------------------------->
compute DH check puzzle
check sig
R2: sig
<--------------------------
check sig compute DH
Figure 1
4.1.1. HIP Puzzle Mechanism ๐ง
The HIP puzzle mechanism exists to protect the Responder from a bunch of denial-of-service threats ๐ก๏ธ It lets the Responder hold off on creating state until an I2 packet shows up. On top of that, the puzzle gives the Responder a pretty cheap calculation to check that the Initiator is "sincere", meaning it really did burn CPU cycles solving the puzzle ๐ฅ
The puzzle lets a Responder implementation hold off completely on creating association-specific state until a valid I2 packet arrives. An I2 packet without a valid puzzle solution can be rejected right away once the Responder has checked the solution. Checking the solution only takes computing one hash function, so invalid solutions get tossed before any state is made and before the CPU-hungry public-key signature verification and Diffie-Hellman key generation happen. By changing how hard the puzzle is, the Responder can frustrate attacks that target the CPU or memory ๐ช
The Responder can stay stateless and still drop most spoofed I2 packets, because the puzzle calculation is tied to the Initiator's Host Identity Tag. The trick is that the Responder keeps a number of pre-calculated R1 packets (the number might change over time) and picks one based on what's in the I1 packet. When the I2 packet comes back, the Responder can check that the puzzle was solved using the Initiator's HIT. This makes it really impractical for an attacker to do one I1/R1 exchange and then spray out a ton of spoofed I2 packets that look like they come from different HITs ๐ โโ๏ธ This method doesn't protect the Responder from an attacker that keeps using fixed HITs, though. Against that kind of attacker, a good move might be to keep a bit of local state and remember that a puzzle check already failed. Appendix A shows one possible way to do that ๐ต๏ธโโ๏ธ Responder implementations SHOULD include enough randomness in the puzzle values that algorithmic complexity attacks become impossible [CRO03] โจ
The Responder can set the puzzle difficulty for each Initiator based on how much it trusts that Initiator ๐๏ธ Since the puzzle isn't part of the signature calculation, the Responder can use pre-calculated R1 packets and slot the puzzle in just before sending R1 to the Initiator. The Responder SHOULD use heuristics to figure out when it's under a denial-of-service attack, and set the puzzle difficulty value #K accordingly, as explained later ๐จ
4.1.2. Puzzle Exchange ๐งฉ
okay so the Responder kicks off the puzzle exchange the second it gets an I1 packet ๐
. It picks a random number #I and then asks the Initiator to find a #J. To find a valid #J, the Initiator hashes the concatenation of #I, the HITs of both parties, and #J using the RHASH algorithm. The lowest-order #K bits of that result MUST be zeros. The value #K is what sets how hard the puzzle is ๐ช.
To find a proper #J, the Initiator basically keeps generating #Js until one gives the all-zeros hash target (it's giving brute force ๐ญ). The Initiator SHOULD give up after going past the puzzle Lifetime in the PUZZLE parameter (see Section 5.2.4). The Responder only has to rebuild the concatenation of #I, the HITs, and the #J it got back, then hash it once to prove the Initiator actually did the work โ
.
To block precomputation attacks, the Responder MUST pick #I in a way the Initiator can't guess ๐
. The construction MUST also let the Responder check that it was the one who picked #I, not the Initiator. Appendix A has an example of how to do this ๐ง .
Using the Opaque data field in the PUZZLE (see Section 5.2.4), in an ECHO_REQUEST_SIGNED (see Section 5.2.20) or in an ECHO_REQUEST_UNSIGNED parameter (see Section 5.2.21), the Responder can slip some data into R1. The Initiator MUST copy that data unmodified into the matching I2 packet ๐. The Responder can use this opaque data to pass a bit of local state to the Initiator and back again, like recognizing that an I2 is answering an R1 it sent earlier. The Responder can generate the opaque data in different ways, like encryption or hashing with some secret, the #I it sent, and possibly other related data. With that same secret, the received #I (from the I2 packet), and the other related data (if any), the Responder can verify that it really sent that #I to the Initiator ๐ต๏ธ. The Responder MUST periodically change such a secret ๐.
It is RECOMMENDED that the Responder generates new secrets for the puzzle and new R1s once every few minutes โฐ. It is also RECOMMENDED that the Responder is able to verify a valid puzzle solution at least Lifetime seconds after the puzzle secret has been deprecated. That timing means the puzzle stays valid for at least Lifetime and at most 2 * Lifetime seconds, which limits how useful an old, solved puzzle is to an attacker. It also avoids validity headaches when the lifetime is pretty short compared to the network delay and the time it takes to solve the puzzle ๐.
The puzzle value #I and the solution #J are inputs for deriving the keying material from the Diffie-Hellman key exchange (see Section 6.5). So, to make sure the derived keying material differs, a Responder SHOULD NOT use the same puzzle #I with the same DH keys for the same Initiator twice ๐ซ. One way to get that uniqueness is to use a counter as an additional input when generating #I. The counter can go up for each I1 packet it processes. Its state can be sent in the Opaque data field in the PUZZLE (see Section 5.2.4), in an ECHO_REQUEST_SIGNED parameter (see Section 5.2.20), or in an ECHO_REQUEST_UNSIGNED parameter (see Section 5.2.21), so no state has to be kept ๐ธ.
NOTE: The protocol developers explicitly considered whether R1 should include a timestamp in order to protect the Initiator from replay attacks. The decision was to NOT include a timestamp, to avoid problems with global time synchronization.
NOTE: The protocol developers explicitly considered whether a memory-bound function should be used for the puzzle instead of a CPU-bound function. The decision was to not use memory-bound functions.
4.1.3. Authenticated Diffie-Hellman Protocol with DH Group Negotiation ๐ค
R1, I2, and R2 are the packets that together make up a standard authenticated Diffie-Hellman exchange. The Responder sends one of its public Diffie-Hellman keys plus its public authentication key (its Host Identity) in R1. The signature in R1 lets the Initiator verify that the R1 was generated by the Responder at some point. But since R1 is precomputed, it doesn't cover association-specific information from the I1 packet, so it does not protect against replay attacks ๐ฌ.
Before the actual authenticated Diffie-Hellman exchange, the Initiator expresses its preference for DH groups in the I1 packet. The preference is a sorted list of DH Group IDs. The I1 packet isn't protected by a signature, so this list goes over in an unauthenticated way. That keeps the Responder from doing costly computations just to process I1 ๐งฎ. Based on the Initiator's preferences, the Responder sends an R1 with its most suitable public DH value. It also attaches its own preference list to R1 so the Initiator can see the basis for the DH group selection. That list lives in the signed part of R1. If the DH group value in R1 doesn't match the preferences of the Initiator and the Responder, the Initiator can detect that the list of DH Group IDs in I1 got manipulated (more on that below) ๐ต๏ธโโ๏ธ.
If none of the DH Group IDs in the I1 packet are supported by the Responder, the Responder selects the DH group most suitable for it, regardless of the Initiator's preference. It then sends R1 containing that DH group and its list of supported DH Group IDs to the Initiator.
When the Initiator receives an R1, it gets one of the Responder's public Diffie-Hellman values and the list of DH Group IDs the Responder supports. That list is covered by the signature in R1 to avoid forgery ๐. The Initiator compares the Group ID of the public DH value in R1 to the list of supported DH Group IDs in the R1 packets, and to its own preferences expressed in its list of supported DH Group IDs. The Initiator continues the BEX only if the Group ID of the Responder's public DH value is the most preferred of the IDs supported by both the Initiator and Responder. Otherwise, the communication is subject to a downgrade attack ๐จ, and the Initiator MUST either restart the base exchange with a new I1 packet or abort the base exchange. If the Responder's choice of DH group isn't supported by the Initiator, the Initiator MAY abort the handshake or send a new I1 packet with a different list of supported DH groups. However, the Initiator MUST verify the signature of the R1 packet before restarting or aborting the handshake. It MUST silently ignore the R1 packet if the signature is not valid.
If the preferences regarding the DH Group ID match, the Initiator computes the Diffie-Hellman session key (Kij). It creates a HIP association using keying material from the session key (see Section 6.5) and may use that HIP association to encrypt its public authentication key, i.e., the Host Identity. The resulting I2 packet contains the Initiator's Diffie-Hellman key and its (optionally encrypted) public authentication key. The signature of the I2 message covers all parameters of the signed parameter ranges (see Section 5.2) in the packet without exceptions, just like in R1 ๐.
The Responder pulls the Initiator's Diffie-Hellman public key out of the I2 packet, computes the Diffie-Hellman session key, creates a corresponding HIP association, and decrypts the Initiator's public authentication key. Then it can verify the signature using that authentication key โ .
The final message, R2, completes the BEX and protects the Initiator against replay attacks ๐. The Responder uses the shared key from the Diffie-Hellman exchange to create a Hashed Message Authentication Code (HMAC), and it also uses the private key of its Host Identity to sign the packet contents.
4.1.4. HIP Replay Protection ๐
HIP includes the following mechanisms to protect against malicious packet replays. Responders are protected against replays of I1 packets thanks to the stateless response to I1 packets with pre-signed R1 messages ๐ก๏ธ. Initiators are protected against R1 replays by a monotonically increasing "R1 generation counter" included in the R1. Responders are protected against replays of forged I2 packets by the puzzle mechanism (see Section 4.1.1 above), plus the optional use of opaque data. Hosts are protected against replays of R2 packets and UPDATEs by using a less expensive HMAC verification before the HIP signature verification ๐ .
The R1 generation counter is a monotonically increasing 64-bit counter that may be initialized to any value. The scope of the counter MAY be system-wide, but there SHOULD be a separate counter for each Host Identity, if there is more than one local Host Identity. The value of this counter SHOULD be preserved across system reboots and invocations of the HIP base exchange. This counter indicates the current generation of puzzles. Implementations MUST accept puzzles from the current generation and MAY accept puzzles from earlier generations. A system's local counter MUST be incremented at least as often as every time old R1s cease to be valid. The local counter SHOULD never be decremented; otherwise, the host exposes its peers to the replay of previously generated, higher-numbered R1s ๐ข.
A host may receive more than one R1, either due to sending multiple I1 packets (see Section 6.6.1) or due to a replay of an old R1. When sending multiple I1 packets to the same host, an Initiator SHOULD wait a small amount of time (a reasonable time may be 2 * expected RTT) after the first R1 reception to allow possibly multiple R1s to arrive. It SHOULD respond to an R1 among the set with the largest R1 generation counter. If an Initiator is processing an R1 or has already sent an I2 packet (still waiting for the R2 packet) and it receives another R1 with a larger R1 generation counter, it MAY elect to restart R1 processing with the fresher R1, as if it were the first R1 to arrive ๐โโ๏ธ.
The R1 generation counter may roll over or may become reset. It is important for an Initiator to be robust to the loss of state about the R1 generation counter of a peer, or to a reset of the peer's counter. It is recommended that, when choosing between multiple R1s, the Initiator prefer to use the R1 that corresponds to the current R1 generation counter. But if it is unable to make progress with that R1, the Initiator may try the other R1s, beginning with the R1 packet with the highest counter ๐ซถ.
4.1.5. Refusing a HIP Base Exchange ๐ โโ๏ธ
Okay so a HIP-aware host is totally allowed to say "nope, not today" ๐ and turn down a HIP base exchange. If its policy is to only ever be an Initiator, and that policy allows setting up a HIP association with the original Initiator, then it should start its very own HIP base exchange ๐. A host MAY choose to have a policy like this, because only the privacy of the Initiator's HI is protected in the exchange ๐. Just so you know, this can cause a race condition if both hosts are only Initiators ๐ฌ, and then the HIP base exchange fails ๐.
If the host's policy doesn't let it enter a HIP exchange with the Initiator, it should send an ICMP 'Destination Unreachable, Administratively Prohibited' message. Why not a fancier HIP packet? Because a more complex one actually opens up more potential DoS attacks than a simple ICMP message does ๐จ. A HIP NOTIFY message isn't used here either, since no HIP association exists between the two hosts at that point ๐.
4.1.6. Aborting a HIP Base Exchange ๐
Two HIP hosts can run into trouble where they just can't finish a HIP base exchange, because one of them doesn't support enough cryptographic algorithms ๐ฅฒ. This is especially true for the HIT Suites and DH groups. After getting the R1 packet, the Initiator can figure out whether the Responder supports the cryptographic operations it needs to set up a HIP association successfully โจ. If the R1 packet shows an unsupported set of algorithms, the Initiator can abort the BEX silently ๐คซ. Here are the specific conditions ๐.
The R1 packet has a signed list of HIT Suite IDs that the Responder supports. So the Initiator can check whether its source HIT is supported by the Responder ๐. If the HIT Suite ID of the Initiator's HIT isn't in the list of HIT Suites in the R1, the Initiator MAY abort the handshake silently, or MAY restart the handshake with a new I1 packet that has a source HIT the Responder supports ๐.
During the handshake, the Initiator and the Responder agree on a single DH group ๐ค. The Responder picks the DH group and its DH public value in the R1, based on the list of DH Group IDs in the I1 packet ๐ฏ. If the Responder supports none of the DH groups the Initiator asked for, it picks an arbitrary DH group and replies with an R1 that has its own list of supported DH Group IDs ๐ณ. In that case, the Initiator gets an R1 packet with the DH public value for a DH group it never requested, plus the Responder's DH group list inside the signed part of the R1 packet ๐ฆ. At this point, the Initiator MAY abort the handshake, or MAY restart it by sending a new I1 packet with a selection of DH Group IDs that the Responder supports ๐.
4.1.7. HIP Downgrade Protection ๐ก๏ธ
In a downgrade attack, an attacker sneakily messes with the packets of an Initiator and/or a Responder ๐. The goal is to influence the cryptographic negotiations in the BEX in its favor. As a result, the victims pick weaker cryptographic algorithms than they would have picked without the attacker interfering ๐. Downgrade attacks only work if the victims don't notice them and falsely assume they have a secure communication channel ๐ฑ.
In HIP, almost all packet parameters related to cryptographic negotiations are covered by signatures โ๏ธ. These parameters can't be directly manipulated in a downgrade attack without invalidating the signature. However, signed packets can still be subject to replay attacks. ๐ค
In a replay attack like this, the attacker could take an old BEX packet with an outdated, weak selection of cryptographic algorithms and replay it instead of a more recent packet with stronger ones ๐ฅ. The signed packets that could be subject to this replay attack are the R1 and I2 packet. But replayed R1 and I2 packets can't be used to successfully set up a HIP BEX, because these packets also contain the public DH values of the Initiator and the Responder ๐ โโ๏ธ. Old DH values from replayed packets lead to invalid keying material and mismatched shared secrets. The attacker can't derive valid keying material from the DH public keys in the R1, and can't generate a valid HMAC and signature for a replayed I2 ๐.
In contrast to the first version of HIP [RFC5201], version 2 of HIP as defined in this document begins the negotiation of the DH groups already in the first BEX packet, the I1. โจ The I1 packet is, by design, not protected by a signature ๐. That's so the Responder doesn't have to do CPU-intensive cryptographic operations when it's flooded with I1 packets aimed at it ๐ง . So the list of DH Group IDs in the I1 packet is vulnerable to forgery and manipulation ๐ฉ. To catch an unnoticed manipulation of the I1 packet, the Responder chooses the DH group deterministically and includes its own list of DH Group IDs in the signed part of the R1 packet ๐. The Initiator can detect an attempted downgrade attack by comparing the list of DH Group IDs in the R1 packet to its own preferences in the I1 packet ๐ต๏ธโโ๏ธ. If the DH group chosen in the R1 packet doesn't match the best match of the two lists (the highest-priority DH ID of the Responder that is present in the Initiator's DH list), the Initiator can conclude that an attacker changed its list in the I1 packet ๐ฉ. In that case, the Initiator can restart or abort the BEX. As mentioned before, detecting the downgrade attack is enough to stop it ๐ ๐
4.1.8. HIP Opportunistic Mode โจ
Okay bestie, so it's totally possible to kick off a HIP BEX ๐ฆ even when the Responder's HI (and HIT) is a total mystery to you. In that case, the initial I1 packet contains all zeros as the destination HIT ๐ง. This setup is called opportunistic mode, and it's giving "let's meet strangers" energy ๐.
The Responder might have several HITs because it can support multiple HIT Suites. Since the Responder's HIT Suite in opportunistic mode isn't set by the destination HIT of the I1 packet (it's all zeros, remember ๐ญ), the Responder can freely pick a HIT from any HIT Suite it likes. The Responder also doesn't know the full set of HIT Suites the Initiator supports ๐คทโโ๏ธ. So the Responder SHOULD choose its HIT from the same HIT Suite as the Initiator's HIT, which you can spot in the OGA ID field of the Initiator's HIT, because that suite is obviously supported by the Initiator ๐ . If the Responder picks a different HIT that the Initiator doesn't support, the Initiator MAY restart the BEX with an I1 packet whose source HIT is contained in the list of the Responder's HIT Suites in the R1 packet ๐ธ.
Now, the Initiator can't verify the signature on the R1 packet if the Responder's HIT Suite isn't supported. So the Initiator MUST treat R1 packets with unsupported Responder HITs as potentially forged ๐จ, and it MUST NOT use any parameters from that unverified R1 besides the HIT_SUITE_LIST. Moreover, an Initiator that uses an unverified HIT_SUITE_LIST from an R1 packet to work out a possible source HIT MUST verify that the HIT_SUITE_LIST in the first unverified R1 packet matches the HIT_SUITE_LIST in the second R1 packet, the one for which the Initiator supports the signature algorithm. The Initiator MUST restart the BEX with a new I1 packet, using an algorithm that was mentioned in the verifiable R1, if the two lists do not match. This whole procedure is necessary to mitigate downgrade attacks ๐ก๏ธ.
There are both security and API issues involved with opportunistic mode. We'll go through them in the rest of this section ๐.
Given that the Responder's HI isn't known by the Initiator, there must be suitable API calls that let the Initiator request, directly or indirectly, that the underlying system starts the HIP base exchange based only on locators ๐. The Responder's HI will be tentatively available in the R1 packet, and in an authenticated form once the R2 packet has been received and verified. So the Responder's HIT could be passed up to the application through new API mechanisms. However, with a backwards-compatible API, the application only sees the locators used for the initial contact. Depending on what semantics the API is going for, this can raise the following issues:
- The actual locators may later change if an UPDATE message is used, even if from the API's point of view the association still looks like it's between two specific locators. Still, the locator update is secure, and the association is still between the same nodes ๐.
- Different associations between the same two locators may end up connecting to different nodes, if the implementation no longer remembers which identifier the peer had in an earlier association ๐ฌ. This can happen when the peer's locator has changed for legitimate reasons, or when an attacker pretends to be a node that has the peer's locator. Therefore, when using opportunistic mode, HIP implementations MUST NOT place any expectation that the peer's HI returned in the R1 message matches any HI previously seen from that address ๐ โโ๏ธ.
If the HIP implementation and the application don't have the same understanding of what counts as an association, this may even happen within the same association ๐คฏ. For instance, an implementation may not know when HIP state can be purged for UDP-based applications.
In addition, the following security considerations apply ๐ฅบ. The generation counter mechanism will be less efficient at protecting against replays of the R1 packet, since the Responder can choose a replay that uses an arbitrary HI, not just the one given in the I1 packet.
More importantly, the opportunistic exchange is vulnerable to man-in-the-middle attacks, because the Initiator doesn't have any public key information about the peer ๐ฑ. To figure out how bad this vulnerability is, we can compare it to vulnerabilities in current, non-HIP-capable communications.
An attacker on the path between the two peers can slide in as a man-in-the-middle by giving its own identifier to the Initiator and then starting another HIP association towards the Responder ๐. For this to be possible, the Initiator must employ opportunistic mode, and the Responder must be configured to accept a connection from any HIP-enabled node.
An attacker outside the path can't do this, since it can't respond to the messages in the base exchange ๐ โโ๏ธ.
These security properties are also characteristic of communications on the current Internet. A client contacting a server without using end-to-end security may find itself talking to the server through a man-in-the-middle, again assuming the server is willing to talk to anyone ๐ซ .
If end-to-end security is in place, then the worst that can happen in both the opportunistic HIP and non-HIP (normal IP) cases is denial-of-service. An entity on the path can disrupt communications, but it won't be able to successfully insert itself as a man-in-the-middle ๐.
Once the opportunistic exchange has completed successfully, though, HIP provides confidentiality and integrity protection for the communications, and it can securely change the locators of the endpoints ๐โจ.
So opportunistic mode in HIP offers a "better than nothing" security model ๐. At the start, a base exchange authenticated in opportunistic mode involves a leap of faith that's open to man-in-the-middle attacks. But subsequent datagrams related to the same HIP association can't be compromised by a new man-in-the-middle attack. Also, if the man-in-the-middle moves away from the path of the active association, the attack would be exposed after the fact ๐ต๏ธโโ๏ธ. Thus, it can be stated that opportunistic mode in HIP is at least as secure as unprotected IP-based communications ๐ .
4.2. Updating a HIP Association
A HIP association between two hosts may need to be updated over time ๐. Examples include rekeying expiring security associations, adding new security associations, or changing the IP addresses associated with hosts. The UPDATE packet is used for those and other similar purposes. This document only specifies the UPDATE packet format and the basic processing rules, along with the mandatory parameters. The actual usage is defined in separate specifications ๐.
HIP provides a general-purpose UPDATE packet, which can carry multiple HIP parameters for updating the HIP state between two peers ๐. The UPDATE mechanism has the following properties:
- UPDATE messages carry a monotonically increasing sequence number and are explicitly acknowledged by the peer ๐ข. Lost UPDATEs or acknowledgments may be recovered via retransmission. Multiple UPDATE messages may be outstanding under certain circumstances.
- UPDATE is protected by both HIP_MAC and HIP_SIGNATURE parameters, since processing UPDATE signatures alone is a potential DoS attack against intermediate systems ๐ซ.
- UPDATE packets are explicitly acknowledged by using an acknowledgment parameter that echoes an individual sequence number received from the peer ๐. A single UPDATE packet may contain both a sequence number and one or more acknowledgment numbers (i.e., piggybacked acknowledgment(s) for the peer's UPDATE), which is very efficient of it ๐ง .
The UPDATE packet is defined in Section 5.3.5 ๐.
4.3. Error Processing
HIP error processing behavior depends on whether or not there's an active HIP association ๐ง. In general, if a HIP association exists between the sender and receiver of a packet that causes an error condition, the receiver SHOULD respond with a NOTIFY packet ๐จ. On the other hand, if there are no existing HIP associations between the sender and receiver, or the receiver can't reasonably determine the identity of the sender, the receiver MAY respond with a suitable ICMP message. See Section 5.4 for more details.
The HIP protocol and state machine are designed to recover when one of the parties crashes and loses its state ๐ซถ. The following scenarios describe the main use cases the design covers.
- No prior state between the two systems.
- The system with data to send is the Initiator. The process follows the standard four-packet base exchange, establishing the HIP association ๐ค.
- The system with data to send has no state with the receiver, but the receiver has a residual HIP association.
- The system with data to send is the Initiator. The Initiator acts as in no prior state, sending an I1 packet and receiving an R1 packet. When the Responder receives a valid I2 packet, the old association is 'discovered' and deleted, and the new association is established ๐งน.
- The system with data to send has a HIP association, but the receiver does not.
- The system sends data on the outbound user data security association. The receiver 'detects' the situation when it receives a user data packet that it cannot match to any HIP association ๐. The receiving host MUST discard this packet ๐๏ธ.
- The receiving host SHOULD send an ICMP packet, with the type
Parameter Problem, to inform the sender that the HIP association does not exist (see Section 5.4), and it MAY initiate a new HIP BEX. However, responding with these optional mechanisms is implementation or policy dependent ๐คทโโ๏ธ. If the sending application doesn't expect a response, the system could possibly send a large number of packets in this state. For this reason, sending one or more ICMP packets is RECOMMENDED. However, any such responses MUST be rate-limited to prevent abuse (see Section 5.4) ๐ฆ๐.
4.4. HIP State Machine โจ
okay so HIP itself doesn't keep a ton of state ๐ซถ During the HIP base exchange there's an Initiator and a Responder, but once the security associations (SAs) are set up, that distinction basically disappears ๐ If the HIP state ever needs to be re-established, what matters is which peer still has state and which one has a datagram to send to the other peer. The state machine below tries to capture all of that ๐ฆ
The state machine is symmetric and it's shown from a single system view, which can represent either an Initiator or a Responder ๐ It is not a full picture of the processing logic though. The extra processing rules live in the packet definitions, so you need both to fully implement HIP ๐
This document extends the state machine from [RFC5201] and adds a restart option so the peers can negotiate cryptographic algorithms ๐ฅ The only change to the [RFC5201] state machine is a transition from I1-SENT back to I1-SENT, and that's the restart option. An Initiator is required to restart the HIP base exchange if the Responder doesn't support the HIT Suite of the Initiator. When that happens, the Initiator restarts by sending a new I1 packet with a source HIT that the Responder supports ๐ง
Implementors must understand that the state machine here is informational. Specific implementations are free to implement the actual processing logic differently. Section 6 goes deeper into the packet processing rules ๐ธ This state machine focuses only on the HIP I1, R1, I2, and R2 packets. New states and state transitions may be introduced by mechanisms in other specifications (such as mobility and multihoming) ๐
4.4.1. State Machine Terminology
- Unused Association Lifetime (UAL): This is an implementation-specific time. If no packet is sent or received for that whole interval, a host MAY begin to tear down an active HIP association ๐
- Maximum Segment Lifetime (MSL): This is the maximum time that a HIP packet is expected to spend in the network. The default value of 2 minutes was borrowed from [RFC0793] because it's the prevailing assumption for packet lifetimes โณ
- Exchange Complete (EC): This is the time the host spends in the R2-SENT state before it moves to the ESTABLISHED state. The time is n * I2 retransmission timeout, where n is about
I2_RETRIES_MAX๐ - Receive ANYOTHER: Any received packet for which no state transitions or processing rules are defined for a given state ๐
4.4.2. HIP States
Here are all the states, with a quick explanation of each one ๐
+---------------------+---------------------------------------------+
| State | Explanation |
+---------------------+---------------------------------------------+
| UNASSOCIATED | State machine start |
| | |
| I1-SENT | Initiating base exchange |
| | |
| I2-SENT | Waiting to complete base exchange |
| | |
| R2-SENT | Waiting to complete base exchange |
| | |
| ESTABLISHED | HIP association established |
| | |
| CLOSING | HIP association closing, no data can be |
| | sent |
| | |
| CLOSED | HIP association closed, no data can be sent |
| | |
| E-FAILED | HIP base exchange failed |
+---------------------+---------------------------------------------+
Table 1: HIP States
4.4.3. HIP State Processes
Let's see what the system does in UNASSOCIATED, Table 2 ๐ง
+----------------------------+--------------------------------------+
| Trigger | Action |
+----------------------------+--------------------------------------+
| User data to send, | Send I1 and go to I1-SENT |
| requiring a new HIP | |
| association | |
| | |
| Receive I1 | Send R1 and stay at UNASSOCIATED |
| | |
| Receive I2, process | If successful, send R2 and go to |
| | R2-SENT |
| | |
| | If fail, stay at UNASSOCIATED |
| | |
| Receive user data for an | Optionally send ICMP as defined in |
| unknown HIP association | Section 5.4 and stay at UNASSOCIATED |
| | |
| Receive CLOSE | Optionally send ICMP Parameter |
| | Problem and stay at UNASSOCIATED |
| | |
| Receive ANYOTHER | Drop and stay at UNASSOCIATED |
+----------------------------+--------------------------------------+
Table 2: UNASSOCIATED - Start State
Next up is I1-SENT, Table 3 ๐ฆ
+---------------------+---------------------------------------------+
| Trigger | Action |
+---------------------+---------------------------------------------+
| Receive I1 from | If the local HIT is smaller than the peer |
| Responder | HIT, drop I1 and stay at I1-SENT (see |
| | Section 6.5 for HIT comparison) |
| | |
| | If the local HIT is greater than the peer |
| | HIT, send R1 and stay at I1-SENT |
| | |
| Receive I2, process | If successful, send R2 and go to R2-SENT |
| | |
| | If fail, stay at I1-SENT |
| | |
| Receive R1, process | If the HIT Suite of the local HIT is not |
| | supported by the peer, select supported |
| | local HIT, send I1, and stay at I1-SENT |
| | |
| | If successful, send I2 and go to I2-SENT |
| | |
| | If fail, stay at I1-SENT |
| | |
| Receive ANYOTHER | Drop and stay at I1-SENT |
| | |
| Timeout | Increment trial counter |
| | |
| | If counter is less than I1_RETRIES_MAX, |
| | send I1 and stay at I1-SENT |
| | |
| | If counter is greater than I1_RETRIES_MAX, |
| | go to E-FAILED |
+---------------------+---------------------------------------------+
Table 3: I1-SENT - Initiating the HIP Base Exchange
Now for I2-SENT, Table 4 ๐
+---------------------+---------------------------------------------+
| Trigger | Action |
+---------------------+---------------------------------------------+
| Receive I1 | Send R1 and stay at I2-SENT |
| | |
| Receive R1, process | If successful, send I2 and stay at I2-SENT |
| | |
| | If fail, stay at I2-SENT |
| | |
| Receive I2, process | If successful and local HIT is smaller than |
| | the peer HIT, drop I2 and stay at I2-SENT |
| | |
| | If successful and local HIT is greater than |
| | the peer HIT, send R2 and go to R2-SENT |
| | |
| | If fail, stay at I2-SENT |
| | |
| Receive R2, process | If successful, go to ESTABLISHED |
| | |
| | If fail, stay at I2-SENT |
| | |
| Receive CLOSE, | If successful, send CLOSE_ACK and go to |
| process | CLOSED |
| | |
| | If fail, stay at I2-SENT |
| | |
| Receive ANYOTHER | Drop and stay at I2-SENT |
| | |
| Timeout | Increment trial counter |
| | |
| | If counter is less than I2_RETRIES_MAX, |
| | send I2 and stay at I2-SENT |
| | |
| | If counter is greater than I2_RETRIES_MAX, |
| | go to E-FAILED |
+---------------------+---------------------------------------------+
Table 4: I2-SENT - Waiting to Finish the HIP Base Exchange
And last but not least for this bit, here's the R2-SENT behaviour, Table 5 โจ
Okay so this part is basically one big state-table party, and I'm obsessed ๐ซถ๐ Each table is "what happens when X arrives while you're in state Y," and I've copied every row exactly so nothing gets lost in translation ๐
Table 5 is the one for R2-SENT, where the system is waiting to finish HIP โจ
+------------------------+------------------------------------------+
| Trigger | Action |
+------------------------+------------------------------------------+
| Receive I1 | Send R1 and stay at R2-SENT |
| | |
| Receive I2, process | If successful, send R2 and stay at |
| | R2-SENT |
| | |
| | If fail, stay at R2-SENT |
| | |
| Receive R1 | Drop and stay at R2-SENT |
| | |
| Receive R2 | Drop and stay at R2-SENT |
| | |
| Receive data or UPDATE | Move to ESTABLISHED |
| | |
| Exchange Complete | Move to ESTABLISHED |
| Timeout | |
| | |
| Receive CLOSE, process | If successful, send CLOSE_ACK and go to |
| | CLOSED |
| | |
| | If fail, stay at ESTABLISHED |
| | |
| Receive CLOSE_ACK | Drop and stay at R2-SENT |
| | |
| Receive NOTIFY | Process and stay at R2-SENT |
+------------------------+------------------------------------------+
Table 5: R2-SENT - Waiting to Finish HIP
Next up is the system behavior in ESTABLISHED, which is Table 6 ๐ฆ
+---------------------+---------------------------------------------+
| Trigger | Action |
+---------------------+---------------------------------------------+
| Receive I1 | Send R1 and stay at ESTABLISHED |
| | |
| Receive I2 | Process with puzzle and possible Opaque |
| | data verification |
| | |
| | If successful, send R2, drop old HIP |
| | association, establish a new HIP |
| | association, and go to R2-SENT |
| | |
| | If fail, stay at ESTABLISHED |
| | |
| Receive R1 | Drop and stay at ESTABLISHED |
| | |
| Receive R2 | Drop and stay at ESTABLISHED |
| | |
| Receive user data | Process and stay at ESTABLISHED |
| for HIP association | |
| | |
| No packet | Send CLOSE and go to CLOSING |
| sent/received | |
| during UAL minutes | |
| | |
| Receive UPDATE | Process and stay at ESTABLISHED |
| | |
| Receive CLOSE, | If successful, send CLOSE_ACK and go to |
| process | CLOSED |
| | |
| | If fail, stay at ESTABLISHED |
| | |
| Receive CLOSE_ACK | Drop and stay at ESTABLISHED |
| | |
| Receive NOTIFY | Process and stay at ESTABLISHED |
+---------------------+---------------------------------------------+
Table 6: ESTABLISHED - HIP Association Established
Now for CLOSING, which is Table 7. This one has a lot going on with timeouts, so pay attention bestie ๐
+----------------------------+--------------------------------------+
| Trigger | Action |
+----------------------------+--------------------------------------+
| User data to send, | Send I1 and go to I1-SENT |
| requires the creation of | |
| another incarnation of the | |
| HIP association | |
| | |
| Receive I1 | Send R1 and stay at CLOSING |
| | |
| Receive I2, process | If successful, send R2 and go to |
| | R2-SENT |
| | |
| | If fail, stay at CLOSING |
| | |
| Receive R1, process | If successful, send I2 and go to |
| | I2-SENT |
| | |
| | If fail, stay at CLOSING |
| | |
| Receive CLOSE, process | If successful, send CLOSE_ACK, |
| | discard state, and go to CLOSED |
| | |
| | If fail, stay at CLOSING |
| | |
| Receive CLOSE_ACK, process | If successful, discard state and go |
| | to UNASSOCIATED |
| | |
| | If fail, stay at CLOSING |
| | |
| Receive ANYOTHER | Drop and stay at CLOSING |
| | |
| Timeout | Increment timeout sum and reset |
| | timer. If timeout sum is less than |
| | UAL+MSL minutes, retransmit CLOSE |
| | and stay at CLOSING. |
| | |
| | If timeout sum is greater than |
| | UAL+MSL minutes, go to UNASSOCIATED |
+----------------------------+--------------------------------------+
Table 7: CLOSING - HIP Association Has Not Been Used for UAL Minutes
Then comes the system behavior in CLOSED, which is Table 8 ๐ธ
+----------------------------------------+--------------------------+
| Trigger | Action |
+----------------------------------------+--------------------------+
| Datagram to send, requires the | Send I1 and stay at |
| creation of another incarnation of the | CLOSED |
| HIP association | |
| | |
| Receive I1 | Send R1 and stay at |
| | CLOSED |
| | |
| Receive I2, process | If successful, send R2 |
| | and go to R2-SENT |
| | |
| | If fail, stay at CLOSED |
| | |
| Receive R1, process | If successful, send I2 |
| | and go to I2-SENT |
| | |
| | If fail, stay at CLOSED |
| | |
| Receive CLOSE, process | If successful, send |
| | CLOSE_ACK and stay at |
| | CLOSED |
| | |
| | If fail, stay at CLOSED |
| | |
| Receive CLOSE_ACK, process | If successful, discard |
| | state and go to |
| | UNASSOCIATED |
| | |
| | If fail, stay at CLOSED |
| | |
| Receive ANYOTHER | Drop and stay at CLOSED |
| | |
| Timeout (UAL+2MSL) | Discard state and go to |
| | UNASSOCIATED |
+----------------------------------------+--------------------------+
Table 8: CLOSED - CLOSE_ACK Sent, Resending CLOSE_ACK if Necessary
Last but not least, E-FAILED gets Table 9, and it's a short one ๐ฅบ
+-------------------------+-----------------------------------------+
| Trigger | Action |
+-------------------------+-----------------------------------------+
| Wait for | Go to UNASSOCIATED. Renegotiation is |
| implementation-specific | possible after moving to UNASSOCIATED |
| time | state. |
+-------------------------+-----------------------------------------+
Table 9: E-FAILED - HIP Failed to Establish Association with Peer
That's the whole state-table lineup, and every row is copied exactly as the original has it ๐๐
4.4.4. Simplified HIP State Diagram โจ
okay so here's the big-picture map ๐บ๏ธ of the major state transitions (Figure 2). quick heads up: any transition triggered by a received packet quietly assumes that packet was successfully authenticated or processed ๐
+--+ +----------------------------+
recv I1, send R1 | | | |
| v v |
+--------------+ recv I2, send R2 |
+----------------| UNASSOCIATED |----------------+ |
datagram | +--+ +--------------+ | |
to send, | | | Alg. not supported, | |
send I1 | | | send I1 | |
. v | v | |
. +---------+ recv I2, send R2 | |
+---->| I1-SENT |--------------------------------------+ | |
| +---------+ +----------------------+ | | |
| | recv R2, | recv I2, send R2 | | | |
| v send I2 | v v v |
| +---------+ | +---------+ |
| +--->| I2-SENT |----------+ +--------------| R2-SENT |<---+ |
| | +---------+ | +---------+ | |
| | | |recv R2 | data or| | |
| |recv R1, | | | EC timeout| | |
| |send I2 +--|-----------------+ | receive I2,| |
| | | | +-------------+ | send R2| |
| | | +------>| ESTABLISHED |<----------+ | |
| | | +-------------+ | |
| | | | | | receive I2, send R2 | |
| | +------------+ | +-------------------------------+ |
| | | +-----------+ | |
| | | no packet sent/received| +---+ | |
| | | for UAL min, send CLOSE| | |timeout | |
| | | v v |(UAL+MSL) | |
| | | +---------+ |retransmit | |
+--|----------|------------------------| CLOSING |-+CLOSE | |
| | +---------+ | |
| | | | | | | |
+----------|-------------------------+ | | +----------------+ |
| | +-----------+ +------------------|--+
| | |recv CLOSE, recv CLOSE_ACK | |
| +-------------+ |send CLOSE_ACK or timeout | |
| recv CLOSE, | | (UAL+MSL) | |
| send CLOSE_ACK v v | |
| +--------+ receive I2, send R2 | |
+---------------------| CLOSED |------------------------------+ |
+--------+ |
^ | | |
recv CLOSE, send CLOSE_ACK| | | timeout (UAL+2MSL) |
+-+ +------------------------------------+
Figure 2
4.5. User Data Considerations ๐
4.5.1. TCP and UDP Pseudo Header Computation for User Data ๐งฎ
when you're doing TCP and UDP checksums on user data packets that flow through sockets bound to HITs, the IPv6 pseudo header format [RFC2460] MUST be used, even if the actual addresses in the packet header are IPv4 addresses ๐ญ. also, the HITs MUST be used in place of the IPv6 addresses in that pseudo header. side note: the pseudo header for actual HIP payloads is computed differently, so check Section 5.1.1 for that one ๐ .
4.5.2. Sending Data on HIP Packets ๐ฆ
other documents may define how to include user data in various HIP packets. however, for now the HIP header is a terminal header, which means nothing else comes after it ๐.
4.5.3. Transport Formats ๐
the actual data transmission format used for user data after the HIP base exchange isn't defined in this document. those transport formats and methods live in separate specs ๐ง. every HIP implementation MUST implement, at minimum, the ESP transport format for HIP [RFC7402], no exceptions bestie ๐ฅ. the transport format gets negotiated during the base exchange: the Responder states its preference in the TRANSPORT_FORMAT_LIST in the R1 packet, and the Initiator picks one and adds the matching HIP parameter to the I2 packet ๐.
4.5.4. Reboot, Timeout, and Restart of HIP ๐
simulating a loss of state is a potential DoS attack ๐, so this process was carefully designed to handle state recovery without handing attackers a DoS opportunity ๐ก๏ธ.
if a host reboots or its HIP association times out, it has lost its HIP state. if that host has a datagram to send to the peer, it just restarts the HIP base exchange. once the base exchange is done, the Initiator can create a new payload association and start sending data. the peer doesn't reset its state until it receives a valid I2 packet ๐ซถ.
if a system gets a user data packet that can't be matched to any existing HIP association, it's possible that it lost its state while its peer didn't. it MAY send an ICMP packet with the Parameter Problem type, with the Pointer pointing to the referred HIP-related association information ๐. how to react to that traffic depends on the implementation and the environment it's running in.
if the host that apparently lost its state decides to restart the HIP base exchange, it sends an I1 packet to the peer. after the base exchange completes successfully, the Initiator can create a new HIP association, and the peer drops its old payload associations and creates a new one โจ.
4.6. Certificate Distribution ๐
this document doesn't define how to use certificates or how to transfer them between hosts ๐ โโ๏ธ. those jobs are expected to be handled by a future specification, same as what happened for HIP version 1 (see [RFC6253]). a parameter type value meant for carrying certificates is reserved though: CERT, Type 768; see Section 5.2 ๐.
5. Packet Formats ๐ฆ
5.1. Payload Format ๐
every HIP packet starts with a fixed header, and it looks like this ๐:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Header Length |0| Packet Type |Version| RES.|1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Controls |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sender's Host Identity Tag (HIT) |
| |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Receiver's Host Identity Tag (HIT) |
| |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ HIP Parameters /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the HIP header is logically an IPv6 extension header ๐งฉ. however, this document doesn't describe processing for Next Header values other than decimal 59, IPPROTO_NONE, the IPv6 'no next header' value. future documents MAY define behavior for other values. still, current implementations MUST ignore trailing data if an unimplemented Next Header value is received ๐ โโ๏ธ.
the Header Length field holds the combined length of the HIP Header and HIP parameters in 8-byte units, excluding the first 8 bytes ๐. since all HIP headers MUST contain the sender's and receiver's HIT fields, the minimum value for this field is 4. the maximum length of the HIP Parameters field is (255 * 8) - 32 = 2008 bytes (see Section 5.1.3 regarding HIP fragmentation). note: this sets an additional limit on the sizes of parameters included in the Parameters field, on top of the individual parameter maximum lengths ๐.
the Packet Type tells you which HIP packet type it is, and the individual packet types are defined in the relevant sections ๐๏ธ. if a HIP host receives a HIP packet with an unrecognized packet type, it MUST drop the packet ๐๏ธ.
the HIP Version field is four bits long. the version defined in this document is 2. the version number is only expected to go up if there are incompatible changes to the protocol. most extensions can be handled by defining new packet types, new parameter types, or new Controls (see Section 5.1.2) ๐.
the following three bits are reserved for future use. they MUST be zero when sent, and they MUST be ignored when handling a received packet ๐คซ.
the two fixed bits in the header are reserved for SHIM6 compatibility [RFC5533], Section 5.3. for implementations adhering (only) to this specification, they MUST be set as shown when sending and MUST be ignored when receiving. this is to ensure optimal forward compatibility. note that for implementations that also implement other compatible specifications, the corresponding rules may well be different. for example, an implementation that implements both this specification and the SHIM6 protocol may need to check these bits in order to decide how to handle the packet ๐ฆ.
the HIT fields are always 128 bits (16 bytes) long ๐ .
5.1.1. Checksum ๐งพ
since the checksum covers the source and destination addresses in the IP header, it MUST be recomputed on HIP-aware NAT devices ๐.
if IPv6 carries the HIP packet, the pseudo header [RFC2460] contains the source and destination IPv6 addresses, the HIP packet length in the pseudo header Length field, a zero field, and the HIP protocol number (see Section 5.1) in the Next Header field. the Length field is in bytes and can be calculated from the HIP Header Length field like this:
(HIP Header Length + 1) * 8
if you're using IPv4, the IPv4 UDP pseudo header format [RFC0768] is used instead. in that pseudo header, the source and destination addresses are the ones used in the IP header, the zero field is obviously zero, the protocol is the HIP protocol number (see Section 4), and the length is calculated the same way as in the IPv6 case ๐ธ.
5.1.2. HIP Controls ๐
okay so the HIP Controls field is basically the packet's little info card ๐ชช. It tells you how the packet is built and what the host is capable of, so it's giving "read the label before you open the box" energy โจ
The following fields have been defined:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | | | |A|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
A - Anonymous: bestie, this one is a whole vibe ๐ If it's set, the sender's HI in this packet is anonymous, which just means it's not listed in a directory. Anonymous HIs SHOULD NOT be stored ๐ซฃ This control gets set in packets that use anonymous sender HIs. And if an R1 or I2 shows up with an anonymous HI, the receiver may choose to refuse it. No judgment, just boundaries ๐
The rest of the fields are reserved for future use ๐ฎ They MUST be set to zero in sent packets and MUST be ignored in received packets. Basically, nobody touches them until they get their own job ๐ง
5.1.3. HIP Fragmentation Support ๐งฉ
okay this section is about packets getting too chunky to fit through the pipe ๐ A HIP implementation MUST support IP fragmentation/reassembly, no exceptions bestie ๐ญ Fragment reassembly MUST be implemented in both IPv4 and IPv6. Fragment generation is REQUIRED to be implemented in IPv4 (IPv4 stacks and networks will usually do this by default), and RECOMMENDED to be implemented in IPv6. IPv6 networks have a bigger minimum MTU, 1280 bytes, compared to IPv4, and that's usually enough room for most HIP packets, so fragment generation may not be needed ๐ฆ But if a host expects to send HIP packets bigger than the minimum IPv6 MTU, the implementation MUST implement fragment generation even for IPv6. No skipping that part, periodt ๐
In IPv4 networks, HIP packets may run into low MTUs along their routed path ๐ง๏ธ Here's the tea: basic HIP, as defined in this document, doesn't have a way to spread one HIP packet across multiple IP datagrams. So path MTU discovery doesn't really bring any value to HIP in IPv4 networks ๐คทโโ๏ธ HIP-aware NAT devices SHOULD perform IPv4 reassembly/fragmentation for HIP packets โจ
โ ๏ธ DoS alert, bestie: every HIP implementation has to be careful with its reassembly algorithm. It needs to be sufficiently resistant to DoS attacks, or someone can absolutely mess with it ๐ค
Certificate chains can make the packet big enough to get fragmented, and fragmentation can open implementations up to denial-of-service attacks [KAU03] ๐ If you want to dodge fragmentation and mitigate those DoS attacks, "Hash and URL" schemes from [RFC6253] for HIP version 1 may be used ๐ธ Smart move, honestly iconic ๐
5.2. HIP Parameters โจ
okay so HIP parameters are the little info packets ๐ they carry everything you need to set up and keep a HIP association alive. Like, the peer's public keys ๐, plus the signaling for picking ciphers and how payloads get handled ๐. Extra info that's useful for end hosts or middleboxes can ride along in them too ๐ฆ. The whole spec is built to be super flexible, so extensions can define brand new parameters and brand new behavior. iconic, honestly ๐
In HIP packets, the parameters are ordered by their numeric type number and encoded in TLV format. ๐
Here's the lineup of parameter types that are currently defined ๐ธ
+------------------------+-------+-----------+----------------------+
| TLV | Type | Length | Data |
+------------------------+-------+-----------+----------------------+
| R1_COUNTER | 129 | 12 | Puzzle generation |
| | | | counter |
| | | | |
| PUZZLE | 257 | 12 | #K and Random #I |
| | | | |
| SOLUTION | 321 | 20 | #K, Random #I and |
| | | | puzzle solution #J |
| | | | |
| SEQ | 385 | 4 | UPDATE packet ID |
| | | | number |
| | | | |
| ACK | 449 | variable | UPDATE packet ID |
| | | | number |
| | | | |
| DH_GROUP_LIST | 511 | variable | Ordered list of DH |
| | | | Group IDs supported |
| | | | by a host |
| | | | |
| DIFFIE_HELLMAN | 513 | variable | public key |
| | | | |
| HIP_CIPHER | 579 | variable | List of HIP |
| | | | encryption |
| | | | algorithms |
| | | | |
| ENCRYPTED | 641 | variable | Encrypted part of a |
| | | | HIP packet |
| | | | |
| HOST_ID | 705 | variable | Host Identity with |
| | | | Fully Qualified |
| | | | Domain Name (FQDN) |
| | | | or Network Access |
| | | | Identifier (NAI) |
| | | | |
| HIT_SUITE_LIST | 715 | variable | Ordered list of the |
| | | | HIT Suites supported |
| | | | by the Responder |
| | | | |
| CERT | 768 | variable | HI Certificate; used |
| | | | to transfer |
| | | | certificates. |
| | | | Specified in a |
| | | | separate document. |
| | | | |
| NOTIFICATION | 832 | variable | Informational data |
| | | | |
| ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be |
| | | | echoed back; signed |
| | | | |
| ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed |
| | | | back by request; |
| | | | signed |
| | | | |
| TRANSPORT_FORMAT_LIST | 2049 | Ordered | variable |
| | | list of | |
| | | preferred | |
| | | HIP | |
| | | transport | |
| | | type | |
| | | numbers | |
| | | | |
| HIP_MAC | 61505 | variable | HMAC-based message |
| | | | authentication code, |
| | | | with key material |
| | | | from KEYMAT |
| | | | |
| HIP_MAC_2 | 61569 | variable | HMAC-based message |
| | | | authentication code, |
| | | | with key material |
| | | | from KEYMAT. Unlike |
| | | | HIP_MAC, the HOST_ID |
| | | | parameter is |
| | | | included in |
| | | | HIP_MAC_2 |
| | | | calculation. |
| | | | |
| HIP_SIGNATURE_2 | 61633 | variable | Signature used in R1 |
| | | | packet |
| | | | |
| HIP_SIGNATURE | 61697 | variable | Signature of the |
| | | | packet |
| | | | |
| ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be |
| | | | echoed back; after |
| | | | signature |
| | | | |
| ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed |
| | | | back by request; |
| | | | after signature |
+------------------------+-------+-----------+----------------------+
Now, the ordering of HIP parameters (lowest to highest) is strictly enforced, see Section 5.2.1 ๐ That's exactly why the type values for existing parameters are spaced out, so future extensions have room to slot in ๐ง
Next up, the parameter type number ranges ๐
+---------------+---------------------------------------------------+
| Type Range | Purpose |
+---------------+---------------------------------------------------+
| 0 - 1023 | Handshake |
| | |
| 1024 - 2047 | Reserved |
| | |
| 2048 - 4095 | Parameters related to HIP transport formats |
| | |
| 4096 - 8191 | Signed parameters allocated through specification |
| | documents |
| | |
| 8192 - 32767 | Reserved |
| | |
| 32768 - 49151 | Reserved for Private Use. Signed parameters. |
| | |
| 49152 - 61439 | Reserved |
| | |
| 61440 - 62463 | Signatures and (signed) MACs |
| | |
| 62464 - 63487 | Parameters that are neither signed nor MACed |
| | |
| 63488 - 64511 | Rendezvous and relaying |
| | |
| 64512 - 65023 | Parameters that are neither signed nor MACed |
| | |
| 65024 - 65535 | Reserved |
+---------------+---------------------------------------------------+
The process for defining new parameters lives in Section 5.2.2 of this document ๐
One more thing, and it's a big one ๐จ The range from 32768 (2^15) up to 49151 (2^15 + 2^14) is Reserved for Private Use. Types from this range SHOULD be selected in a random fashion to reduce the probability of collisions. Picking them randomly is how you dodge stepping on someone else's toes ๐๐ซถ
5.2.1. TLV Format โจ
okay so every HIP parameter comes packed in TLV style ๐ and the Type number also decides the order they show up in the packet ๐ The parameters MUST be included in the packet so that their types form an increasing order. If there are multiple parameters with the same type number in one packet, those same-type parameters MUST be consecutive in the packet. If the order doesn't follow this rule, the packet is considered to be malformed and it MUST be discarded. no cap, that's a hard rule ๐ญ
Parameters using type values from 2048 up to 4095 are related to transport formats. Right now there's only one transport format defined: the ESP transport format [RFC7402] ๐ฆ
All of the encoded TLV parameters have a length (that includes the Type and Length fields) that's a multiple of 8 bytes. When needed, padding MUST be added to the end of the parameter so that the total length is a multiple of 8 bytes. this rule keeps the data aligned, and alignment is everything ๐ธ Any added padding bytes MUST be zeroed by the sender, and their values SHOULD NOT be checked by the receiver.
The Length field tells you the length of the Contents field in bytes. So the total length of the TLV parameter (Type, Length, Contents, and Padding) is related to the Length field by this formula:
Total Length = 11 + Length - (Length + 3) % 8;
where % is the modulo operator.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type |C| Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ Contents /
/ +-+-+-+-+-+-+-+-+
| | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type Type code for the parameter. 16 bits long, C-bit
being part of the Type code.
C Critical. One if this parameter is critical and
MUST be recognized by the recipient, zero otherwise.
The C-bit is considered to be a part of the Type
field. Consequently, critical parameters are always
odd, and non-critical ones have an even value.
Length Length of the Contents, in bytes, excluding Type,
Length, and Padding
Contents Parameter specific, defined by Type
Padding Padding, 0-7 bytes, added if needed
Critical parameters (the ones with an odd type number) MUST be recognized by the recipient. If a recipient runs into a critical parameter it doesn't recognize, it MUST NOT process the packet any further. It MAY send an ICMP or NOTIFY, as defined in Section 4.3. ๐ค
Non-critical parameters MAY be safely ignored. If a recipient runs into a non-critical parameter it doesn't recognize, it SHOULD proceed as if that parameter was never in the received packet. chill, not a big deal ๐ซถ
5.2.2. Defining New Parameters ๐
future specs are totally allowed to define new parameters as needed ๐ When you're defining them, be careful that the type values make sense and leave room for other future extensions. Remember that the parameters MUST always be arranged in numerically increasing order by Type code, which limits the order of parameters (see Section 5.2.1).
The following rules MUST be followed when defining new parameters.
- The low-order bit C of the Type code is used to tell critical and non-critical parameters apart. Even parameter type numbers mean non-critical parameters, and odd parameter type numbers mean critical parameters.
- A new parameter MAY be critical only if an old implementation that ignored it would cause security problems. In general, new parameters SHOULD be defined as non-critical, and expect a reply from the recipient. ๐ฅ
- If a system implements a new critical parameter, it MUST provide the ability to set the associated feature off, so the critical parameter is not sent at all. The configuration option MUST be well documented. Implementations operating in a mode adhering to this specification MUST disable the sending of new critical parameters by default. In other words, the management interface MUST allow vanilla standards-only mode as a default configuration setting, and MAY allow new critical payloads to be configured on (and off). ๐
- See Section 9 for allocation rules regarding Type codes. ๐
5.2.3. R1_COUNTER ๐ฆ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved, 4 bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| R1 generation counter, 8 bytes |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 129
Length 12
R1 generation
counter The current generation of valid puzzles
The R1_COUNTER parameter holds a 64-bit unsigned integer in network byte order, which tells you the current generation of valid puzzles. The sender SHOULD increment this counter periodically. It is RECOMMENDED that the counter gets incremented at least as often as old PUZZLE values get deprecated, so that SOLUTIONs to them are no longer accepted. โฐ
Support for the R1_COUNTER parameter is mandatory, but including it in the R1 packet is optional. It SHOULD be included in the R1 (in which case it's covered by the signature). If it is present in the R1, it MUST be echoed back by the Initiator in the I2 packet, Reserved field and all, verbatim ๐
5.2.4. PUZZLE ๐งฉ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| #K, 1 byte | Lifetime | Opaque, 2 bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Random #I, RHASH_len / 8 bytes |
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 257
Length 4 + RHASH_len / 8
#K #K is the number of verified bits
Lifetime puzzle lifetime 2^(value - 32) seconds
Opaque data set by the Responder, indexing the puzzle
Random #I random number of size RHASH_len bits
Random #I is represented as an n-bit integer (where n is RHASH_len), and #K and Lifetime as 8-bit integers, all in network byte order.
The PUZZLE parameter carries the puzzle difficulty #K and an n-bit random integer #I. The Puzzle Lifetime says how long the puzzle solution stays valid, and it sets a time limit that the Initiator should not go past while it's trying to solve the puzzle. The lifetime is a power of 2, using the formula 2^(Lifetime - 32) seconds. โณ
A puzzle MAY be augmented with an ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included in the R1. The contents of the echo request then get echoed back in the ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED parameter, which lets the Responder use that info as part of its puzzle processing. ๐
The Opaque and Random #I fields are not covered by the HIP_SIGNATURE_2 parameter. ๐
5.2.5. SOLUTION ๐
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| #K, 1 byte | Reserved | Opaque, 2 bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Random #I, n bytes |
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Puzzle solution #J, RHASH_len / 8 bytes |
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 321
Length 4 + RHASH_len / 4
#K #K is the number of verified bits
Reserved zero when sent, ignored when received
Opaque copied unmodified from the received PUZZLE
parameter
Random #I random number of size RHASH_len bits
Puzzle solution #J random number of size RHASH_len bits
Random #I and Random #J are represented as n-bit unsigned integers (where n is RHASH_len), and #K as an 8-bit unsigned integer, all in network byte order.
The SOLUTION parameter contains a solution to a puzzle. It also echoes back the random difficulty #K, the Opaque field, and the puzzle integer #I. ๐
5.2.6. DH_GROUP_LIST ๐
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DH GROUP ID #1| DH GROUP ID #2| DH GROUP ID #3| DH GROUP ID #4|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DH GROUP ID #n| Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
okay so this is the DH_GROUP_LIST parameter, and it's giving organized list energy ๐โจ Here's the field breakdown:
Type: 511Length: number of DH Group IDsDH GROUP ID: identifies a DH GROUP ID supported by the host. The list is ordered by the host's preference. The possible DH Group IDs are defined in the DIFFIE_HELLMAN parameter. Each DH Group ID is one octet long.
So this parameter is literally the host's little wishlist of DH groups ๐ง The Initiator sends its DH_GROUP_LIST in the I1 packet, and the Responder sends its own list in the signed part of the R1 packet. The IDs at the front are the ones the host likes best, so the earlier ones beat the later ones. That ordering is what lets the Responder pick the group it prefers and the Initiator supports. ๐
Then the Initiator can check the R1 list and see whether the Responder picked the best possible option, based on both sides' preferences. If the Responder's pick isn't the best choice, the Initiator can conclude that there was an attempted downgrade attack (see Section 4.1.7). Not me noticing the sneaky move ๐
When the Responder picks a group for the DIFFIE_HELLMAN parameter in the R1 packet, it MUST select the first DH Group ID in its own DH_GROUP_LIST (in the R1 packet) that is compatible with one of the Suite IDs in the Initiator's DH_GROUP_LIST (in the I1 packet). It MUST NOT select any other DH Group ID that's in both lists, because then a downgrade attack can't be detected. That rule is non-negotiable, bestie ๐ โโ๏ธ
In general, hosts SHOULD prefer stronger groups over weaker ones if the computation overhead isn't prohibitively high for the intended application. Stronger is iconic, as long as the math doesn't melt your device ๐ฅ
5.2.7. DIFFIE_HELLMAN ๐ฆ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Group ID | Public Value Length | Public Value /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Now the DIFFIE_HELLMAN parameter, the actual key-exchange moment โจ Its fields are:
Type: 513Length: length in octets, excluding Type, Length, and PaddingGroup ID: identifies values for p and g as well as the KDFPublic Value Length: length of the following Public Value in octetsPublic Value: the sender's public Diffie-Hellman key
A single DIFFIE_HELLMAN parameter may be included in selected HIP packets, based on the DH Group ID selected (Section 5.2.6). These Group IDs have been defined, with values assigned by this document:
Group KDF Value
Reserved 0
DEPRECATED 1
DEPRECATED 2
1536-bit MODP group [RFC3526] HKDF [RFC5869] 3
3072-bit MODP group [RFC3526] HKDF [RFC5869] 4
DEPRECATED 5
DEPRECATED 6
NIST P-256 [RFC5903] HKDF [RFC5869] 7
NIST P-384 [RFC5903] HKDF [RFC5869] 8
NIST P-521 [RFC5903] HKDF [RFC5869] 9
SECP160R1 [SECG] HKDF [RFC5869] 10
2048-bit MODP group [RFC3526] HKDF [RFC5869] 11
The MODP Diffie-Hellman groups are defined in [RFC3526]. ECDH groups 7-9 are defined in [RFC5903] and [RFC6090]. ECDH group 10 is covered in Appendix D. Any ECDH used with HIP MUST have a co-factor of 1. Strict, but iconic ๐
The Group ID also defines the key derivation function used to derive the symmetric keys for the HMAC and symmetric encryption from the keying material produced by the Diffie-Hellman key exchange (see Section 6.5). So the Group ID is doing double duty, and I respect the hustle ๐ช
A HIP implementation MUST implement Group ID 3. The 160-bit SECP160R1 group can be used when lower security is enough (e.g., web surfing) and when the equipment isn't powerful enough (e.g., some PDAs). Implementations SHOULD implement Group IDs 4 and 8.
To avoid unnecessary failures during the base exchange, the rest of the groups SHOULD be implemented in hosts where resources are adequate. Basically: don't break the handshake for no reason ๐
5.2.8. HIP_CIPHER ๐
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cipher ID #1 | Cipher ID #2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cipher ID #n | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Last but not least, HIP_CIPHER ๐ธ Its fields are:
Type: 579Length: length in octets, excluding Type, Length, and PaddingCipher ID: identifies the cipher algorithm used for encrypting the contents of the ENCRYPTED parameter
These Cipher IDs are defined:
Suite ID Value
RESERVED 0
NULL-ENCRYPT 1 ([RFC2410])
AES-128-CBC 2 ([RFC3602])
RESERVED 3 (unused value)
AES-256-CBC 4 ([RFC3602])
The sender of a HIP_CIPHER parameter MUST make sure there are no more than six (6) Cipher IDs in one HIP_CIPHER parameter. ๐โโ๏ธ Six is the cap, bestie.
Conversely, a recipient MUST be prepared to handle received transport parameters that contain more than six Cipher IDs. It accepts the first six Cipher IDs and drops the rest. That limit of six is what sets the maximum size of the HIP_CIPHER parameter. As the default configuration, the HIP_CIPHER parameter MUST contain at least one of the mandatory Cipher IDs. There MAY be a configuration option that lets the administrator override this default. Admins really do have the final say here ๐ง
The Responder lists its supported and desired Cipher IDs in order of preference in the R1, up to the maximum of six. The Initiator MUST choose only one of the corresponding Cipher IDs, and that one gets used for generating the ENCRYPTED parameter. One cipher, no drama ๐
Mandatory implementation: AES-128-CBC. Implementors SHOULD support NULL-ENCRYPT for testing and debugging purposes, but MUST NOT offer or accept this value unless it's explicitly configured for testing or debugging of HIP. Don't let NULL-ENCRYPT leak into production, periodt ๐
5.2.9. HOST_ID โจ
okay bestie, HOST_ID is the parameter that carries the Host Identity itself, plus an optional Domain Identifier tag ๐ here's the layout:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| HI Length |DI-Type| DI Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Algorithm | Host Identity /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ | Domain Identifier /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 705
Length length in octets, excluding Type, Length, and
Padding
HI Length length of the Host Identity in octets
DI-Type type of the following Domain Identifier field
DI Length length of the Domain Identifier field in octets
Algorithm index to the employed algorithm
Host Identity actual Host Identity
Domain Identifier the identifier of the sender
The following DI-Types have been defined:
Type Value
none included 0
FQDN 1
NAI 2
FQDN Fully Qualified Domain Name, in binary format
NAI Network Access Identifier
the DI-Type field tells you what kind of Domain Identifier you're carrying: nothing, a FQDN (in binary format), or an NAI ๐ธ the format for the FQDN comes from RFC 1035 [RFC1035], Section 3.1, and the NAI format is in [RFC4282] ๐ฆ
a host MAY optionally tie its Host Identity to one single Domain Identifier in the HOST_ID parameter ๐ and if there's no Domain Identifier (so DI-Type is zero), the DI Length gets set to zero too. no drama ๐
these are the HI Algorithms that have been defined:
Algorithm profiles Values
RESERVED 0
DSA 3 [FIPS.186-4.2013] (RECOMMENDED)
RSA 5 [RFC3447] (REQUIRED)
ECDSA 7 [RFC4754] (REQUIRED)
ECDSA_LOW 9 [SECG] (RECOMMENDED)
for DSA, RSA, and ECDSA key types, you should go for profiles with at least 112 bits of security strength (as defined by [NIST.800-131A.2011]) ๐ฅ and for RSA signature padding, the Probabilistic Signature Scheme (PSS) method of padding [RFC3447] MUST be used. this one is not optional, babe ๐ซถ
the Host Identity is derived from the DNSKEY format for RSA and DSA. for those, the Public Key field of the RDATA part from RFC 4034 [RFC4034] is what gets used ๐ง for Elliptic Curve Cryptography (ECC), there are two profiles: ECDSA and ECDSA_LOW. ECC has the NIST-approved curves defined in RFC 4754 [RFC4754]. ECDSA_LOW is made for devices with low computational capabilities, and it uses shorter curves from the Standards for Efficient Cryptography Group [SECG] โจ and any ECDSA used with HIP MUST have a co-factor of 1 ๐
for ECDSA and ECDSA_LOW, Host Identities are shown with these fields:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ECC Curve | /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ Public Key |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
ECC Curve Curve label
Public Key Represented in octet-string format [RFC6090]
for hosts running ECDSA as their algorithm, these ECC curves are required:
Algorithm Curve Values
ECDSA RESERVED 0
ECDSA NIST P-256 1 [RFC4754]
ECDSA NIST P-384 2 [RFC4754]
and for hosts using the ECDSA_LOW algorithm profile, this curve is required:
Algorithm Curve Values
ECDSA_LOW RESERVED 0
ECDSA_LOW SECP160R1 1 [SECG]
5.2.10. HIT_SUITE_LIST
okay so HIT_SUITE_LIST is basically the Responder's menu of supported HIT Suite IDs ๐ the Responder sends it inside the signed part of the R1 packet, and then the Initiator can look at it and figure out which of its own source HIT Suite IDs the Responder can actually handle ๐
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ID #1 | ID #2 | ID #3 | ID #4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ID #n | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 715
Length number of HIT Suite IDs
ID identifies a HIT Suite ID supported by the host.
The list of IDs is ordered by preference of the
host. Each HIT Suite ID is one octet long. The
four higher-order bits of the ID field correspond
to the HIT Suite ID in the ORCHID OGA ID field. The
four lower-order bits are reserved and set to 0
by the sender. The reception of an ID with the
four lower-order bits not set to 0 SHOULD be
considered as an error that MAY result in a
NOTIFICATION of type UNSUPPORTED_HIT_SUITE.
the ID list is ordered by the host's preference, and each ID is one octet ๐ the top four bits line up with the HIT Suite ID in the ORCHID OGA ID field, and the bottom four bits are reserved and set to 0 by the sender ๐ฆ if a receiver sees an ID whose bottom four bits aren't 0, that SHOULD be treated as an error, and it MAY end up triggering a NOTIFICATION of type UNSUPPORTED_HIT_SUITE ๐
a HIT Suite ID points at a HIT Suite, and HIT Suites are built out of signature algorithms (from Section 5.2.9) and hash functions ๐ the ID field here is eight bits, not the four bits used in the ORCHID, which is a little extra room in case sixteen values turn out to be not enough ๐ one of those sixteen values, zero, is the signal that four more ORCHID bits are being used to encode the HIT Suite ID. so the current four-bit IDs only use the higher-order bits of the ID field, and future documents may decide what the lower-order bits do ๐ง
here's how the defined HIT Suite IDs map between the four-bit ORCHID value and the eight-bit encoding in this field:
HIT Suite Four-bit ID Eight-bit encoding
RESERVED 0 0x00
RSA,DSA/SHA-256 1 0x10 (REQUIRED)
ECDSA/SHA-384 2 0x20 (RECOMMENDED)
ECDSA_LOW/SHA-1 3 0x30 (RECOMMENDED)
and this table gives the extra detail on those combos ๐ฅ the input to each generation algorithm is the encoding of the HI from Section 3.2, and the output is 96 bits long and gets used directly in the ORCHID:
+-------+----------+--------------+------------+--------------------+
| Index | Hash | HMAC | Signature | Description |
| | function | | algorithm | |
| | | | family | |
+-------+----------+--------------+------------+--------------------+
| 0 | | | | Reserved |
| | | | | |
| 1 | SHA-256 | HMAC-SHA-256 | RSA, DSA | RSA or DSA HI |
| | | | | hashed with |
| | | | | SHA-256, truncated |
| | | | | to 96 bits |
| | | | | |
| 2 | SHA-384 | HMAC-SHA-384 | ECDSA | ECDSA HI hashed |
| | | | | with SHA-384, |
| | | | | truncated to 96 |
| | | | | bits |
| | | | | |
| 3 | SHA-1 | HMAC-SHA-1 | ECDSA_LOW | ECDSA_LOW HI |
| | | | | hashed with SHA-1, |
| | | | | truncated to 96 |
| | | | | bits |
+-------+----------+--------------+------------+--------------------+
Table 10: HIT Suites
the hash the Responder uses in its HIT Suite decides which HMAC gets used for the RHASH function ๐ the HMACs defined here are HMAC-SHA-256 [RFC4868], HMAC-SHA-384 [RFC4868], and HMAC-SHA-1 [RFC2404] โจ
5.2.11. TRANSPORT_FORMAT_LIST
and last but not least, TRANSPORT_FORMAT_LIST ๐ฆ this one is the Responder's list of supported HIP transport formats (TFs). it also rides in the signed part of the R1 packet. the Initiator reads the list, picks one suitable transport format, and puts the matching HIP transport format parameter in its response packet ๐ซถ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TF type #1 | TF type #2 /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ TF type #n | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 2049
Length 2x number of TF types
TF Type identifies a transport format (TF) type supported
by the host. The TF type numbers correspond to
the HIP parameter type numbers of the respective
transport format parameters. The list of TF types
is ordered by preference of the sender.
the TF type numbers match up with the HIP parameter type numbers for those transport format parameters, which live in the range 2050 to 4095 ๐ธ the parameters and how they're used are defined in separate documents, and right now the only transport format defined is IPsec ESP [RFC7402] ๐ง
for every TF type on the list, the sender of TRANSPORT_FORMAT_LIST MUST include the matching transport format parameter in the HIP packet ๐ and the receiver MUST ignore any TF type in the list if there's no matching transport format parameter in the packet ๐ no matching parameter, no problem, it just gets skipped ๐
5.2.12. HIP_MAC ๐
okay so HIP_MAC is the parameter that carries an HMAC (a message authentication code) ๐ง the packet gets hashed and the result lives right here. here's the layout:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| HMAC |
/ /
/ +-------------------------------+
| | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the fields, bestie ๐
Type 61505
Length length in octets, excluding Type, Length, and
Padding
HMAC HMAC computed over the HIP packet, excluding the
HIP_MAC parameter and any following parameters,
such as HIP_SIGNATURE, HIP_SIGNATURE_2,
ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED.
The Checksum field MUST be set to zero, and the
HIP header length in the HIP common header MUST be
calculated not to cover any excluded parameters
when the HMAC is calculated. The size of the
HMAC is the natural size of the hash computation
output depending on the used hash function.
the HMAC uses RHASH as the hash algorithm ๐ธ the calculation and verification process is in Section 6.4.1, so go check that one too ๐ซถ
5.2.13. HIP_MAC_2 ๐ฆ
HIP_MAC_2 is giving "HIP_MAC but make it sneaky" โจ it's a MAC of the packet and the HI of the sender, shaped as a HOST_ID parameter, for when that HOST_ID isn't actually in the packet. the structure is the same as the one in Section 5.2.12, so it's the same vibe ๐
Type 61569
Length length in octets, excluding Type, Length, and
Padding
HMAC HMAC computed over the HIP packet, excluding the
HIP_MAC_2 parameter and any following parameters
such as HIP_SIGNATURE, HIP_SIGNATURE_2,
ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED,
and including an additional sender's HOST_ID
parameter during the HMAC calculation. The
Checksum field MUST be set to zero, and the HIP
header length in the HIP common header MUST be
calculated not to cover any excluded parameters
when the HMAC is calculated. The size of the
HMAC is the natural size of the hash computation
output depending on the used hash function.
same deal here: the HMAC uses RHASH as the hash algorithm ๐ and the calculation and verification process is in Section 6.4.1 ๐
5.2.14. HIP_SIGNATURE ๐๏ธ
HIP_SIGNATURE is the signed version of the vibe ๐ it carries a signature over the HIP packet, with the algorithm named in the SIG alg field. layout first:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SIG alg | Signature /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
and the field breakdown ๐ง
Type 61697
Length length in octets, excluding Type, Length, and
Padding
SIG alg signature algorithm
Signature the signature is calculated over the HIP packet,
excluding the HIP_SIGNATURE parameter and any
parameters that follow the HIP_SIGNATURE
parameter. When the signature is calculated, the
Checksum field MUST be set to zero, and the HIP
header length in the HIP common header MUST be
calculated only up to the beginning of the
HIP_SIGNATURE parameter.
the signature algorithms are defined in Section 5.2.9 ๐ the signature in the Signature field gets encoded with whatever method matches the algorithm. so RSA/SHA-1 follows [RFC3110], RSA/SHA-256 follows [RFC5702], DSA follows [RFC2536], and ECDSA follows [RFC6090]. so many citations, so much ๐ค
HIP_SIGNATURE calculation and verification follow the process in Section 6.4.2 ๐
5.2.15. HIP_SIGNATURE_2 ๐
okay this one is lowkey clever ๐ HIP_SIGNATURE_2 leaves out the variable bits of the R1 packet so the R1 can be pre-made ahead of time. the structure is the same as Section 5.2.14, so here are the fields:
Type 61633
Length length in octets, excluding Type, Length, and
Padding
SIG alg signature algorithm
Signature Within the R1 packet that contains the
HIP_SIGNATURE_2 parameter, the Initiator's HIT, the
Checksum field, and the Opaque and Random #I fields
in the PUZZLE parameter MUST be set to zero while
computing the HIP_SIGNATURE_2 signature. Further,
the HIP packet length in the HIP header MUST be
adjusted as if the HIP_SIGNATURE_2 was not in the
packet during the signature calculation, i.e., the
HIP packet length points to the beginning of
the HIP_SIGNATURE_2 parameter during signing and
verification.
so zeroing the Initiator's HIT lets you make R1 packets beforehand, which helps minimise the effects of possible DoS attacks ๐ก๏ธ and zeroing the Random #I and Opaque fields inside the PUZZLE parameter means those fields can get filled in dynamically on precomputed R1s. big brain energy, honestly ๐ง โจ
signature calculation and verification follow the process in Section 6.4.2 ๐
5.2.16. SEQ ๐ข
SEQ is the Update ID counter, and it's giving sequence number realness ๐ here's the layout:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Update ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 385
Length 4
Update ID 32-bit sequence number
the Update ID is an unsigned number in network byte order ๐ธ a host sets it to zero when it moves to ESTABLISHED state. the scope is one single HIP association, so it doesn't carry across other associations or other hosts ๐ โโ๏ธ every new UPDATE the host sends bumps it up by one, so the very first UPDATE a host originates has an Update ID of 0 ๐ผ
5.2.17. ACK โ
last one in this part, and it's a cute one ๐ฆ ACK tells the peer which of its Update IDs you've already received. here's the layout:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| peer Update ID 1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ peer Update ID n |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the fields ๐งโโ๏ธ
Type 449
Length length in octets, excluding Type and Length
peer Update ID 32-bit sequence number corresponding to the
Update ID being ACKed
the ACK parameter can hold one or more Update IDs that came in from the peer. count them by dividing the Length by 4, because each peer Update ID is 4 octets ๐ that's the whole vibe, periodt ๐ โจ
5.2.18. ENCRYPTED ๐โจ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IV /
/ /
/ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
/ Encrypted data /
/ /
/ +-------------------------------+
/ | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 641
Length length in octets, excluding Type, Length, and
Padding
Reserved zero when sent, ignored when received
IV Initialization vector, if needed, otherwise
nonexistent. The length of the IV is inferred from
the HIP_CIPHER.
Encrypted The data is encrypted using the encryption algorithm
data defined in the HIP_CIPHER parameter.
okay so the ENCRYPTED parameter is basically a sealed little envelope ๐ that carries other parameters inside it. Its encrypted data holds one or more HIP parameters in block encrypted form ๐.
Because of that, the first fields inside the encapsulated parameter(s) are a Type and a Length for the first one ๐งฉ. That's the bit that makes the contents easy to parse once they've been decrypted, which is so clever, honestly ๐.
The "Encrypted data" field is the output of one or more HIP parameters that get stuck together and then run through an encryption algorithm ๐ง. Each of those inner parameters gets padded using the rules from Section 5.2.1 for padding individual parameters ๐. Once they're all combined, the concatenated parameters come out as a block of data that is 8-byte aligned โจ.
Some encryption algorithms need the data to be a multiple of the cipher's block size ๐. When that's the case, the block of data MUST include extra padding, as the encryption algorithm specifies ๐จ. That extra padding gets sized so the unencrypted data block lines up as a multiple of the cipher block size ๐ . The algorithm can use padding bytes that aren't zero. For example, AES [FIPS.197.2001] uses the PKCS5 padding scheme (see Section 6.1.1 of [RFC2898]), where each of the remaining n bytes that fill the block has the value n ๐ฆ. The result is an "unencrypted data" block that the cipher suite turns into an "encrypted data" block ๐ฅ. This extra padding, the stuff added just to hit the cipher block alignment rules, doesn't get counted in HIP TLV Length fields ๐. It should be removed by the cipher suite when decrypting ๐งน.
Heads up, the cipher output can be smaller or bigger than the parameters you started with ๐. The encryption process might compress the data or tack extra padding onto it ๐.
Once encryption is done, the Encrypted data field is ready to go into the parameter ๐. If it's needed, extra Padding for 8-byte alignment gets added on top, following the rules in Section 5.2.1 ๐ธ.
5.2.19. NOTIFICATION ๐ฃ๐
The NOTIFICATION parameter is how HIP sends informational stuff, like error conditions and state transitions, over to a HIP peer ๐ฌ. A NOTIFICATION parameter may appear in NOTIFY packets ๐ฆ. Using it in other packet types is for further study ๐ฎ.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved | Notify Message Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| /
/ Notification Data /
/ +---------------+
/ | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 832
Length length in octets, excluding Type, Length, and
Padding
Reserved zero when sent, ignored when received
Notify Message specifies the type of notification
Type
Notification informational or error data transmitted in
Data addition to the Notify Message Type. Values
for this field are type specific (see below).
Notification info can be error messages that explain why a HIP Security Association couldn't be set up ๐ญ. It can also be status data that a HIP implementation wants to share with its peer process ๐. HIP packets MAY contain multiple NOTIFICATION parameters if a few problems pop up or if several separate pieces of info need to be sent ๐งบ. The table below lists the notification messages and their Notify Message Types ๐.
To dodge certain kinds of attacks, a Responder SHOULD avoid sending a NOTIFICATION to any host it hasn't successfully verified a puzzle solution with ๐ก๏ธ. Notify Message Types in the range 0-16383 are for reporting errors, and the ones in 16384-65535 are for other status info ๐๏ธ. If an implementation gets a NOTIFY packet with an error Notify Message Type in response to a request packet (like I1, I2, or UPDATE), it SHOULD assume that the request has failed entirely ๐. Unrecognized error types MUST be ignored, but they SHOULD be logged ๐.
As currently defined, Notify Message Type values 1-10 cover errors in packet structures, and values 11-20 cover problems in parameters ๐ง .
Notification Data in NOTIFICATION parameters with a Notify Message Type in the status range MUST be ignored if it isn't recognized ๐.
Notify Message Types - Errors Value
----------------------------- -----
UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1
Sent if the parameter type has the "critical" bit set and the
parameter type is not recognized. Notification Data contains the
two-octet parameter type.
INVALID_SYNTAX 7
Indicates that the HIP message received was invalid because some
type, length, or value was out of range or because the request
was otherwise malformed. To avoid a denial-of-service
attack using forged messages, this status may only be returned
for packets whose HIP_MAC (if present) and SIGNATURE have been
verified. This status MUST be sent in response to any error not
covered by one of the other status types and SHOULD NOT contain
details, to avoid leaking information to someone probing a node.
To aid debugging, more detailed error information SHOULD be
written to a console or log.
NO_DH_PROPOSAL_CHOSEN 14
None of the proposed Group IDs were acceptable.
INVALID_DH_CHOSEN 15
The DH Group ID field does not correspond to one offered
by the Responder.
NO_HIP_PROPOSAL_CHOSEN 16
None of the proposed HIT Suites or HIP Encryption Algorithms were
acceptable.
INVALID_HIP_CIPHER_CHOSEN 17
The HIP_CIPHER Crypto ID does not correspond to one offered by
the Responder.
UNSUPPORTED_HIT_SUITE 20
Sent in response to an I1 or R1 packet for which the HIT Suite
is not supported.
AUTHENTICATION_FAILED 24
Sent in response to a HIP signature failure, except when
the signature verification fails in a NOTIFY message.
CHECKSUM_FAILED 26
Sent in response to a HIP checksum failure.
HIP_MAC_FAILED 28
Sent in response to a HIP HMAC failure.
ENCRYPTION_FAILED 32
The Responder could not successfully decrypt the
ENCRYPTED parameter.
INVALID_HIT 40
Sent in response to a failure to validate the peer's
HIT from the corresponding HI.
BLOCKED_BY_POLICY 42
The Responder is unwilling to set up an association
for some policy reason (e.g., the received HIT is NULL
and the policy does not allow opportunistic mode).
RESPONDER_BUSY_PLEASE_RETRY 44
The Responder is unwilling to set up an association, as it is
suffering under some kind of overload and has chosen to shed load
by rejecting the Initiator's request. The Initiator may retry;
however, the Initiator MUST find another (different) puzzle
solution for any such retries. Note that the Initiator may need
to obtain a new puzzle with a new I1/R1 exchange.
Notify Message Types - Status Value
----------------------------- -----
I2_ACKNOWLEDGEMENT 16384
The Responder has an I2 packet from the Initiator but had to
queue the I2 packet for processing. The puzzle was correctly
solved, and the Responder is willing to set up an association but
currently has a number of I2 packets in the processing queue.
The R2 packet is sent after the I2 packet was processed.
5.2.20. ECHO_REQUEST_SIGNED ๐ช๐
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opaque data (variable length) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 897
Length length of the opaque data in octets
Opaque data opaque data, supposed to be meaningful only to
the node that sends ECHO_REQUEST_SIGNED and
receives a corresponding ECHO_RESPONSE_SIGNED or
ECHO_RESPONSE_UNSIGNED
The ECHO_REQUEST_SIGNED parameter is a little opaque blob of data ๐ซง that the sender wants echoed right back in the matching reply packet ๐.
The ECHO_REQUEST_SIGNED and its matching echo response parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet ๐ง. ECHO_REQUEST_SIGNED is covered by the HIP_MAC and SIGNATURE ๐. A HIP packet can contain only one ECHO_REQUEST_SIGNED parameter and MAY contain multiple ECHO_REQUEST_UNSIGNED parameters ๐ . The ECHO_REQUEST_SIGNED parameter MUST be responded to with an ECHO_RESPONSE_SIGNED ๐.
5.2.21. ECHO_REQUEST_UNSIGNED โจ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opaque data (variable length) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 63661
Length length of the opaque data in octets
Opaque data opaque data, supposed to be meaningful only to
the node that sends ECHO_REQUEST_UNSIGNED and
receives a corresponding ECHO_RESPONSE_UNSIGNED
okay so the ECHO_REQUEST_UNSIGNED parameter is basically a little opaque blob ๐ซง that the sender wants echoed back in the matching reply packet. bestie, it's giving "carry a sticky note with you and get it handed back to you later" ๐
The ECHO_REQUEST_UNSIGNED and its matching echo response parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet ๐. The ECHO_REQUEST_UNSIGNED is not covered by the HIP_MAC and SIGNATURE, so it's NOT protected ๐ญ. A HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters ๐ฆ.
Lowkey spicy part: middleboxes might add ECHO_REQUEST_UNSIGNED parameters to HIP packets as they pass by ๐. Whoever creates the ECHO_REQUEST_UNSIGNED (the end host OR a middlebox) has to build the Opaque field so they can later identify and remove the matching ECHO_RESPONSE_UNSIGNED parameter ๐ง. That's the whole trick, so label your sticky note properly ๐ .
The ECHO_REQUEST_UNSIGNED parameter MUST be responded to with an ECHO_RESPONSE_UNSIGNED parameter ๐ฅ.
5.2.22. ECHO_RESPONSE_SIGNED ๐ธ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opaque data (variable length) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 961
Length length of the opaque data in octets
Opaque data opaque data, copied unmodified from the
ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED
parameter that triggered this response
This one is the signed glow-up ๐. The ECHO_RESPONSE_SIGNED parameter carries an opaque blob that the sender of the ECHO_REQUEST_SIGNED wants handed back. The opaque data gets copied over unmodified from the ECHO_REQUEST_SIGNED parameter ๐.
The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet ๐ซถ. Unlike the unsigned version, the ECHO_RESPONSE_SIGNED IS covered by the HIP_MAC and SIGNATURE ๐. Main character energy, literally protected ๐.
5.2.23. ECHO_RESPONSE_UNSIGNED ๐ฆ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opaque data (variable length) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Type 63425
Length length of the opaque data in octets
Opaque data opaque data, copied unmodified from the
ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED
parameter that triggered this response
And the unsigned reply ๐. The ECHO_RESPONSE_UNSIGNED parameter carries an opaque blob that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED wants echoed back. The opaque data is copied unmodified from the corresponding echo request parameter ๐.
The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet โจ. And yep, the ECHO_RESPONSE_UNSIGNED is NOT covered by the HIP_MAC and SIGNATURE ๐.
5.3. HIP Packets ๐ง
There are eight basic HIP packets (see Table 11) ๐. Four are for the HIP base exchange, one is for updating, one is for sending notifications, and two are for closing a HIP association ๐ . Support for the NOTIFY packet type is optional, but support for all other HIP packet types listed below is mandatory ๐ฅ.
+------------------+------------------------------------------------+
| Packet type | Packet name |
+------------------+------------------------------------------------+
| 1 | I1 - the HIP Initiator Packet |
| | |
| 2 | R1 - the HIP Responder Packet |
| | |
| 3 | I2 - the Second HIP Initiator Packet |
| | |
| 4 | R2 - the Second HIP Responder Packet |
| | |
| 16 | UPDATE - the HIP Update Packet |
| | |
| 17 | NOTIFY - the HIP Notify Packet |
| | |
| 18 | CLOSE - the HIP Association Closing Packet |
| | |
| 19 | CLOSE_ACK - the HIP Closing Acknowledgment |
| | Packet |
+------------------+------------------------------------------------+
Table 11: HIP Packets and Packet Type Values
Packets are made of the fixed header from Section 5.1, followed by the parameters. The parameter part is zero or more TLV-coded parameters ๐.
In addition to the base packets, other packet types may be defined later in separate specifications ๐ธ. For example, mobility and multihoming support is NOT included in this specification, so that's a whole other story for later ๐ฆ.
For the notation used in the operations, check out "Notation" (Section 2.2) ๐.
In the future, an optional upper-layer payload MAY follow the HIP header ๐. The Next Header field in the header tells you if there's extra data after the HIP header. The HIP packet, however, MUST NOT be fragmented into multiple extension headers by setting the Next Header field in a HIP header to the HIP protocol number ๐ซ. That limits how much extra data can ride along in the packet ๐.
5.3.1. I1 - the HIP Initiator Packet ๐
The HIP header values for the I1 packet:
Header:
Packet Type = 1
SRC HIT = Initiator's HIT
DST HIT = Responder's HIT, or NULL
IP ( HIP ( DH_GROUP_LIST ) )
The I1 packet contains the fixed HIP header and the Initiator's DH_GROUP_LIST ๐ซถ.
Valid control bits: None ๐
The Initiator gets the Responder's HIT from a DNS lookup of the Responder's FQDN (see [HIP-DNS-EXT]), some other repository, or a local table ๐. If the Initiator doesn't know the Responder's HIT, it may attempt to use opportunistic mode by using NULL (all zeros) as the Responder's HIT ๐งธ. See also "HIP Opportunistic Mode" (Section 4.1.8) โจ.
Since the I1 packet is so easy to spoof even if it were signed, no attempt is made to add to its generation or processing cost ๐. Nobody's paying extra for that one, sorry not sorry ๐.
The Initiator includes a DH_GROUP_LIST parameter in the I1 packet to tell the Responder its preferred DH Group IDs ๐. Note that the DH_GROUP_LIST in the I1 packet is not protected by a signature ๐.
Implementations MUST be able to handle a storm of received I1 packets, discarding those with common content that arrive within a small time delta ๐ช๏ธ. Storm survival is a core skill, iykyk ๐ญ.
5.3.2. R1 - the HIP Responder Packet โจ
okay bestie, the R1 is the responder's reply to an I1, and it's giving main character energy ๐ฆ here's the header setup:
Header:
Packet Type = 2
SRC HIT = Responder's HIT
DST HIT = Initiator's HIT
IP ( HIP ( [ R1_COUNTER, ]
PUZZLE,
DIFFIE_HELLMAN,
HIP_CIPHER,
HOST_ID,
HIT_SUITE_LIST,
DH_GROUP_LIST,
[ ECHO_REQUEST_SIGNED, ]
TRANSPORT_FORMAT_LIST,
HIP_SIGNATURE_2 )
<, ECHO_REQUEST_UNSIGNED >i)
Valid control bits: A ๐
If the Responder's HI is an anonymous one, the A control MUST be set. No skipping this, periodt ๐
The Initiator's HIT MUST match the one received in the I1 packet if the R1 is a response to an I1. And if the Responder has multiple HIs, the Responder's HIT used MUST match the Initiator's request. It's giving "match the vibe" ๐ซถ But if the Initiator used opportunistic mode, the Responder may select freely among its HIs. See also "HIP Opportunistic Mode" (Section 4.1.8) ๐ธ
The R1 packet generation counter is how everyone figures out which puzzles are currently valid ๐ง It goes up over time, and it is RECOMMENDED that it goes up at least as often as solutions to old puzzles stop being accepted. Think of it like a timestamp that keeps the puzzle drama fresh โจ
The puzzle has a Random #I and a difficulty #K. The difficulty #K tells you how many low-order bits in the puzzle hash result must be zeros; see Section 4.1.2 ๐ฅ The Random #I is NOT covered by the signature, so it gets zeroed during the signature calculation. That's the trick that lets the sender pick the #I and slot it into a precomputed R1 right before sending it to the peer. Galaxy brain move ๐
The Responder picks the DIFFIE_HELLMAN Group ID and Public Value based on the Initiator's preference in the DH_GROUP_LIST parameter from the I1 packet. Then it sends back its own preference, based on which DH public value it chose, as DH_GROUP_LIST. This is how the Initiator can tell whether its own DH_GROUP_LIST, the one in the I1 it sent, got manipulated by some attacker ๐ not on my watch.
The Diffie-Hellman public value is ephemeral, and values SHOULD NOT be reused across different HIP associations. Once the Responder gets a valid response to an R1 packet, that Diffie-Hellman value SHOULD be deprecated. It's possible the Responder sent the same DH value to different hosts at the same time in matching R1 packets, and those responses should also be accepted ๐ However, as a defense against I1 packet storms, an implementation MAY propose, and reuse unless avoidable, the same Diffie-Hellman value for a period of time, for example 15 minutes. By using a small number of different puzzles for a given Diffie-Hellman value, the R1 packets can be precomputed and delivered about as fast as I1 packets arrive. And a scavenger process should clean up unused Diffie-Hellman values and puzzles ๐งน
Reusing Diffie-Hellman public values opens the door to a security risk: more than one Initiator might end up with the same keying material, which can happen with faulty random number generators ๐ญ Also, more than one Initiator using the same Responder public key half may lead to potentially easier cryptographic attacks and to imperfect forward security. Not the vibe.
BUT (and this part is important) these risks are statistical. The authors aren't aware of any mechanism that would let someone manipulate the protocol so that the risk of reusing a given Responder DH public key differs from the base probability. So it is RECOMMENDED that Responders avoid reusing the same DH key with multiple Initiators. However, because the risk is considered statistical and not known to be manipulable, implementations MAY reuse a key to ease resource-constrained implementations and to raise the odds of successful communication with legitimate clients even under an I1 packet storm. Specifically, when it's too expensive to generate enough precomputed R1 packets to give each potential Initiator a different DH key, the Responder MAY send the same DH key to several Initiators. That does create the possibility of multiple legitimate Initiators ending up with the same Responder-side public key, so keep that in mind ๐ But as soon as the Responder knows it will use a particular DH key, it SHOULD stop offering it. This design lets resource-constrained Responders keep offering services during I1 packet storms, while making DH key reuse both statistical and as low as possible. Iconic ๐
If the Responder uses the same DH key pair for multiple handshakes, it must take care to avoid small subgroup attacks [RFC2785]. To dodge these attacks, when receiving the I2 message, the Responder SHOULD validate the Initiator's DH public key as described in [RFC2785], Section 3.1. And if the validation fails, the Responder MUST NOT generate a DH shared key and MUST silently abort the HIP BEX. Bye bye, sketchy key ๐
The HIP_CIPHER parameter lists the encryption algorithms the Responder supports for encrypting the contents of the ENCRYPTED parameter, in order of preference. All implementations MUST support AES [RFC3602] ๐
The HIT_SUITE_LIST parameter is an ordered list of the Responder's preferred and supported HIT Suites. It lets the Initiator check whether its own source HIT matches any suite the Responder supports ๐ธ
The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED parameters hold data the sender wants back, unmodified, in the matching response packet, in either ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED. The R1 packet may contain zero or more ECHO_REQUEST_UNSIGNED parameters, as described in Section 5.2.21 โจ
The TRANSPORT_FORMAT_LIST parameter is an ordered list of the Responder's preferred and supported transport format types. It helps the Initiator and the Responder agree on a common type for payload protection. This parameter is described in Section 5.2.11 ๐ฆ
The signature is calculated over the whole HIP packet, as described in Section 5.2.15. This is what lets the Responder use precomputed R1s ๐ง The Initiator SHOULD validate this signature, and it MUST check that the Responder's HI matches the one it expected, if there is one ๐ซถ
5.3.3. I2 - the Second HIP Initiator Packet ๐
Now the I2, the Initiator's second packet. Here's the header:
Header:
Packet Type = 3
SRC HIT = Initiator's HIT
DST HIT = Responder's HIT
IP ( HIP ( [R1_COUNTER,]
SOLUTION,
DIFFIE_HELLMAN,
HIP_CIPHER,
ENCRYPTED { HOST_ID } or HOST_ID,
[ ECHO_RESPONSE_SIGNED, ]
TRANSPORT_FORMAT_LIST,
HIP_MAC,
HIP_SIGNATURE
<, ECHO_RESPONSE_UNSIGNED>i ) )
Valid control bits: A ๐
The HITs used MUST match the ones used in the R1. Consistency is everything, bestie ๐
If the Initiator's HI is an anonymous one, the A control bit MUST be set.
If it was present in the I1 packet, the Initiator MUST include an unmodified copy of the R1_COUNTER parameter it received in the matching R1 packet into the I2 packet. Copy-paste, but make it sacred ๐
The Solution contains the Random #I from R1 and the computed #J. The low-order #K bits of the RHASH( #I | ... | #J ) MUST be zero. That's the puzzle being solved, and honestly it's so satisfying โจ
The Diffie-Hellman value is ephemeral. If it was precomputed, a scavenger process should clean up unused Diffie-Hellman values. The Responder MAY reuse Diffie-Hellman values under some conditions, as specified in Section 5.3.2 ๐งน
The HIP_CIPHER contains the single encryption suite the Initiator picked, which it uses to encrypt the ENCRYPTED parameters. The chosen cipher MUST correspond to one of the ciphers the Responder offered in the R1. And again, All implementations MUST support AES [RFC3602] ๐
The Initiator's HI MAY be encrypted using the HIP_CIPHER encryption algorithm. The keying material comes from the Diffie-Hellman exchange, as defined in Section 6.5 ๐
The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED parameters carry the unmodified opaque data copied from the matching echo request parameter(s). Echoing back exactly what you were given, that's a whole mood ๐ซถ
The TRANSPORT_FORMAT_LIST contains the single transport format type the Initiator selected. The chosen type MUST correspond to one of the types the Responder offered in the R1. Currently, the only transport format defined is the ESP transport format ([RFC7402]) ๐ฆ
The HMAC value in the HIP_MAC parameter is calculated over the whole HIP packet, excluding any parameters after the HIP_MAC, as described in Section 6.4.1. The Responder MUST validate the HIP_MAC ๐
The signature is calculated over the whole HIP packet, excluding any parameters after the HIP_SIGNATURE, as described in Section 5.2.14. The Responder MUST validate this signature. It uses the HI in the packet, or an HI acquired by some other means, to verify the signature. Verified and iconic ๐
5.3.4. R2 - the Second HIP Responder Packet ๐ธ
And last but not least, the R2, the Responder's second packet, served with the final header:
Header:
Packet Type = 4
SRC HIT = Responder's HIT
DST HIT = Initiator's HIT
IP ( HIP ( HIP_MAC_2, HIP_SIGNATURE ) )
Valid control bits: None ๐ง
The HIP_MAC_2 is calculated over the whole HIP packet, with the Responder's HOST_ID parameter concatenated with the HIP packet. The HOST_ID parameter is removed after the HMAC calculation. The procedure is described in Section 6.4.1 ๐ฅ
The signature is calculated over the whole HIP packet ๐
The Initiator MUST validate both the HIP_MAC and the signature. Double-check, triple-slay โจ
5.3.5. UPDATE - the HIP Update Packet ๐โจ
Okay bestie, the UPDATE packet is literally the little messenger that keeps an association up to date. Here's the header setup ๐
Header:
Packet Type = 16
SRC HIT = Sender's HIT
DST HIT = Recipient's HIT
IP ( HIP ( [SEQ, ACK, ] HIP_MAC, HIP_SIGNATURE ) )
Valid control bits: None ๐ซถ
The UPDATE packet always carries a HIP_MAC and a HIP_SIGNATURE, plus whatever other optional parameters it needs. ๐
Now, the SEQ thing. An UPDATE has zero or one SEQ parameter, and if it has one, the receiver MUST acknowledge the UPDATE. ๐ An UPDATE with only an ACK parameter is just a reply to an earlier UPDATE, so it MUST NOT be acknowledged by a separate ACK parameter. Those ACK-only UPDATEs also don't need to be processed in order with other UPDATEs. ๐งโโ๏ธ And an UPDATE with neither a SEQ nor an ACK is invalid. If you want to send something unacknowledged, you MUST use a NOTIFY packet instead. ๐ซ
About ACK: an UPDATE has zero or one ACK parameter, and it echoes back the SEQ number of the UPDATE being acknowledged. A host MAY acknowledge more than one UPDATE at a time. For example, the ACK might carry the last two SEQ values it got, which is extra resilient if packets go missing. ๐ก๏ธ ACK values are NOT cumulative. Every unique SEQ value needs at least one matching ACK in reply, and redundant ACKs just get ignored. ๐๏ธ Hosts MUST implement processing of ACKs with multiple SEQ numbers, even if they don't send them that way. Receiving it is non-negotiable, bestie! ๐
An UPDATE can hold both a SEQ and an ACK. When it does, the ACK is piggybacking on an outgoing UPDATE, which is so efficient ๐ฆ. In general, UPDATEs carrying a SEQ SHOULD be ACKed once they've finished being processed. A host MAY hold an UPDATE carrying an ACK for a little while so it can catch a ride on a later packet, kind of like TCP delayed acknowledgments. โณ
Sometimes a sender just doesn't care anymore, like when things are overcome by events ๐. A sender MAY choose to forego reliable transmission of a particular UPDATE. Even then, the receiver MUST still acknowledge that UPDATE. The sender just MAY choose to not care about getting the ACK parameter back. ๐คทโโ๏ธ
Last bit: UPDATEs MAY be retransmitted without incrementing SEQ. And if the same subset of parameters shows up in multiple UPDATEs with different SEQ values, the host MUST make sure that processing those parameters more than once won't cause a protocol error. No drama allowed ๐.
5.3.6. NOTIFY - the HIP Notify Packet ๐ฃ
The NOTIFY packet MAY be used to pass information along to a peer. ๐ฌ Usually it's for telling someone about a protocol error or a negotiation failure ๐ฌ. NOTIFY packets are unacknowledged. The receiver can only treat the packet as informational, and it SHOULD NOT change its HIP state (see Section 4.4.2) based purely on a NOTIFY it received. Just vibes, no state changes! ๐ธ
Here's the header:
Header:
Packet Type = 17
SRC HIT = Sender's HIT
DST HIT = Recipient's HIT, or zero if unknown
IP ( HIP (<NOTIFICATION>i, [HOST_ID, ] HIP_SIGNATURE) )
Valid control bits: None ๐
The NOTIFY packet carries one or more NOTIFICATION parameters. That's the whole job! โจ
5.3.7. CLOSE - the HIP Association Closing Packet ๐ช
Time to say bye, but make it secure ๐ง. Here's the header for CLOSE:
Header:
Packet Type = 18
SRC HIT = Sender's HIT
DST HIT = Recipient's HIT
IP ( HIP ( ECHO_REQUEST_SIGNED, HIP_MAC, HIP_SIGNATURE ) )
Valid control bits: None
The sender MUST include an ECHO_REQUEST_SIGNED. That's what lets it validate the CLOSE_ACK it gets back ๐. The sender also MUST include both a HIP_MAC and a signature, and the signature is calculated over the whole HIP packet. Triple-checked, bestie! ๐
The receiving peer MUST reply with a CLOSE_ACK that contains an ECHO_RESPONSE_SIGNED matching the ECHO_REQUEST_SIGNED it received. ๐ซถ
5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet ๐
And here's the reply that closes the loop ๐. Header time:
Header:
Packet Type = 19
SRC HIT = Sender's HIT
DST HIT = Recipient's HIT
IP ( HIP ( ECHO_RESPONSE_SIGNED, HIP_MAC, HIP_SIGNATURE ) )
Valid control bits: None
The sender MUST include both an HMAC and a signature, and the signature is calculated over the whole HIP packet. ๐
The receiving peer MUST validate the ECHO_RESPONSE_SIGNED. It MUST also validate both the HIP_MAC and the signature, but only if the receiver actually has state for a HIP association. If there's no state, there's nothing to check against, so it's giving efficiency ๐.
5.4. ICMP Messages ๐ก
Okay, so what happens when a HIP implementation spots a problem with an incoming packet? If it either can't figure out who sent the packet, or it has no existing HIP association with the sender, it MAY respond with an ICMP packet. ๐ Any such replies MUST be rate-limited as described in [RFC4443]. Most of the time, the ICMP packet is type Parameter Problem (12 for ICMPv4, 4 for ICMPv6), and its Pointer points at the field that caused the ICMP message to be generated. Pointing at the culprit, iconic ๐ซฃ.
5.4.1. Invalid Version ๐ข
If a HIP implementation gets a HIP packet with a version number it doesn't recognize, it SHOULD respond, rate-limited, with an ICMP packet of type Parameter Problem. The Pointer should point to the Version/RES. byte in the HIP header. ๐
5.4.2. Other Problems with the HIP Header and Packet Structure ๐งฑ
If a HIP implementation gets a HIP packet with other unrecoverable problems in the header or packet format, it MAY respond, rate-limited, with an ICMP packet of type Parameter Problem. The Pointer points at the field that failed the format checks. ๐ค However, an implementation MUST NOT send an ICMP message if the checksum fails. Instead, it MUST silently drop the packet. Ghosted, but make it protocol ๐ป.
5.4.3. Invalid Puzzle Solution ๐งฉ
If a HIP implementation gets an I2 packet with an invalid puzzle solution, what happens depends on which version of IP is in use. ๐ค
If IPv6 is used, the implementation SHOULD respond with an ICMP packet of type Parameter Problem. The Pointer should point to the beginning of the Puzzle solution #J field in the SOLUTION payload in the HIP message. ๐ฏ
If IPv4 is used, the implementation MAY respond with an ICMP packet of type Parameter Problem. It copies enough bytes from the I2 message so that the SOLUTION parameter fits into the ICMP message, and the Pointer points to the beginning of the Puzzle solution #J field, same as the IPv6 case. Heads up though: the resulting ICMPv4 message goes over the typical ICMPv4 message size as defined in [RFC0792]. Big message energy ๐ฆ.
5.4.4. Non-existing HIP Association ๐ต๏ธโโ๏ธ
If a HIP implementation gets a CLOSE or UPDATE packet, or any other packet whose handling needs an existing association, and it has a Receiver or Sender HIT that doesn't match any existing HIP association, the implementation MAY respond, rate-limited, with an ICMP packet of type Parameter Problem. The Pointer of that ICMP Parameter Problem packet is set to point at the beginning of the first HIT that doesn't match. ๐
A host MUST NOT reply with such an ICMP if it receives any of the following messages: I1, R2, I2, R2, and NOTIFY packet. ๐ โโ๏ธ When new packet types get introduced, a specification SHOULD define the right rules for sending or not sending this kind of ICMP reply. Future-proofing is everything ๐ฎ.
6. Packet Processing ๐ง
Each host is assumed to have a single HIP implementation that manages the host's HIP associations and handles requests for new ones. ๐ Each HIP association is governed by a conceptual state machine, with the states defined above in Section 4.4. The HIP implementation can keep HIP associations with more than one host at the same time. ๐คนโโ๏ธ It can even have more than one active HIP association with the same host. When that happens, the associations are told apart by their HITs. It is not possible to have more than one HIP association between any given pair of HITs. So the only way two hosts can have more than one parallel association is to use different HITs, at least at one end. Different HITs, different vibes ๐.
How packets get processed depends on the state of the HIP association(s) with respect to the authenticated or apparent originator of the packet. A HIP implementation figures out whether it has an active association with the packet's originator based on the HITs. ๐ For user data carried in a specific transport format, the transport format document says how incoming packets get matched with active associations.
6.1. Processing Outgoing Application Data ๐ค
In a HIP host, an application can send application-level data using an identifier that's specified via the underlying API. ๐ The API can be a backwards-compatible one (see [RFC5338]), using identifiers that look similar to IP addresses. It can also be a completely new API that offers enhanced services related to Host Identities. Depending on the HIP implementation, the identifier the application gets might be different. For example, it could be a HIT or an IP address. ๐ชช
The exact format and method for moving the user data from the source HIP host to the destination HIP host are defined in the matching transport format document. The actual data travels across the network using the appropriate source and destination IP addresses. ๐
In this document, conceptual processing rules are only defined for the base case, where both hosts have only single usable IP addresses. The multi-address multihoming case is specified separately. ๐ซง
The following conceptual algorithm describes the steps that are required for handling outgoing datagrams destined to a HIT. Here we go, step by step ๐:
- If the datagram has a specified source address, it MUST be a HIT. If it isn't, the implementation MAY replace the source address with a HIT. Otherwise, it MUST drop the packet. ๐๏ธ
- If the datagram has an unspecified source address, the implementation MUST choose a suitable source HIT for the datagram. Which HIT gets picked is subject to local policy. ๐
- If there is no active HIP association with the given <source, destination> HIT pair, one MUST be created by running the base exchange. While waiting for the base exchange to finish, the implementation SHOULD queue at least one user data packet per HIP association that's about to be formed, and it MAY queue more than one. โณ๐
- Once there is an active HIP association for the given <source, destination> HIT pair, the outgoing datagram is passed to transport handling. The possible transport formats are defined in separate documents. The ESP transport format for HIP is mandatory for all HIP implementations. ๐
- Before the packet is sent, the HITs in the datagram are replaced with suitable IP addresses. For IPv6, the rules defined in [RFC6724] SHOULD be followed. This HIT-to-IP-address conversion step MAY also be performed at some other point in the stack, e.g., before wrapping the packet into the output format. Flexible, bestie ๐ฆ.
6.2. Processing Incoming Application Data ๐ฅ
okay so this one is about what happens when a datagram shows up at the receiving host and HITs are being used as the application-level identifiers ๐ฆ it's a conceptual algorithm, and the more detailed packet steps live in the transport format docs, so don't panic if it feels a bit high-level ๐ซถ
- The incoming datagram gets mapped to an existing HIP association, usually using some info from the packet ๐ง for example, that mapping can be based on the ESP Security Parameter Index (SPI).
- The specific transport format gets unwrapped, depending on which transport format it is, and that gives you a packet that looks like a standard (unencrypted) IP packet โจ if possible, this step SHOULD also verify that the packet was indeed (once) sent by the remote HIP host, as identified by the HIP association.
Depending on the transport mode, the verification method can vary ๐ while the HI (as well as the HIT) is used as the higher-layer identifier, the verification method has to verify that the data packet was sent by the correct node identity and that the actual identity maps to this particular HIT. When using the ESP transport format [RFC7402], the verification is done using the SPI value in the data packet to find the corresponding SA with associated HIT and key, and decrypting the packet with that associated key. ๐
- The IP addresses in the datagram get swapped out for the HITs associated with the HIP association ๐ note that this IP-address-to-HIT conversion step MAY also be performed at some other point in the stack.
- The datagram gets delivered up to the upper layer (for example, UDP or TCP) ๐ when demultiplexing, the right upper-layer socket is selected based on the HITs.
6.3. Solving the Puzzle ๐งฉ
this subsection is where we get into the nitty-gritty of solving the puzzle, so grab a snack ๐
in the R1 packet, the values #I and #K are sent in network byte order. same deal in the I2 packet, where the values #I and #J are sent in network byte order. the hash is built by concatenating, in network byte order, the following data, in this exact order, using the RHASH algorithm ๐
- n-bit random value #I (where n is RHASH_len), in network byte order, as appearing in the R1 and I2 packets.
- 128-bit Initiator's HIT, in network byte order, as appearing in the HIP Payload in the R1 and I2 packets.
- 128-bit Responder's HIT, in network byte order, as appearing in the HIP Payload in the R1 and I2 packets.
- n-bit random value #J (where n is RHASH_len), in network byte order, as appearing in the I2 packet.
in a valid response puzzle, the #K low-order bits of the resulting RHASH digest MUST be zero. no exceptions bestie ๐ญ
Notes:
i) The length of the data to be hashed is variable, depending on the output length of the Responder's hash function RHASH.
ii) All the data in the hash input MUST be in network byte order. non-negotiable ๐
iii) The orderings of the Initiator's and Responder's HITs are different in the R1 and I2 packets; see Section 5.1. Care must be taken to copy the values in the right order to the hash input. this is the kind of detail that makes or breaks your whole vibe ๐
iv) For a puzzle #I, there may exist multiple valid puzzle solutions #J. ๐
the following procedure walks through the processing steps, assuming the Responder chooses to precompute the R1 packets โจ
Precomputation by the Responder:
Sets up the puzzle difficulty #K.
Creates a signed R1 and caches it.
Responder:
Selects a suitable cached R1.
Generates a random number #I.
Sends #I and #K in an R1.
Saves #I and #K for a delta time.
Initiator:
Generates repeated attempts to solve the puzzle until a matching
#J is found:
Ltrunc( RHASH( #I | HIT-I | HIT-R | #J ), #K ) == 0
Sends #I and #J in an I2.
Responder:
Verifies that the received #I is a saved one.
Finds the right #K based on #I.
Computes V := Ltrunc( RHASH( #I | HIT-I | HIT-R | #J ), #K )
Rejects if V != 0
Accepts if V == 0
6.4. HIP_MAC and SIGNATURE Calculation and Verification ๐
these subsections cover the actions for processing HIP_MAC, HIP_MAC_2, HIP_SIGNATURE, and HIP_SIGNATURE_2 parameters. the HIP_MAC_2 parameter lives in the R2 packet, and the HIP_SIGNATURE_2 parameter lives in the R1 packet. HIP_SIGNATURE and HIP_MAC show up in the other HIP packets ๐
6.4.1. HMAC Calculation ๐ธ
the HMAC uses RHASH as its underlying hash function, and the type of RHASH depends on the HIT Suite of the Responder. so basically: HMAC-SHA-256 [RFC4868] is used for HIT Suite RSA/DSA/SHA-256, HMAC-SHA-1 [RFC2404] is used for HIT Suite ECDSA_LOW/SHA-1, and HMAC-SHA-384 [RFC4868] is used for HIT Suite ECDSA/SHA-384 ๐ฆ
the same process applies to both the HIP_MAC and HIP_MAC_2 parameters. the difference when processing HIP_MAC_2 is that the HIP_MAC calculation includes a pseudo HOST_ID field containing the Responder's information as sent in the R1 packet earlier ๐ง
both the Initiator and the Responder should take some care when verifying or calculating the HIP_MAC_2. specifically, the Initiator has to preserve the HOST_ID exactly as it was received in the R1 packet until it receives the HIP_MAC_2 in the R2 packet. ๐ซถ
the scope of the HIP_MAC calculation looks like this:
HMAC: { HIP header | [ Parameters ] }
where Parameters include all of the packet's HIP parameters with type values ranging from 1 to (HIP_MAC's type value - 1), and excluding those parameters with type values greater than or equal to HIP_MAC's type value.
during the HIP_MAC calculation, the following apply:
- In the HIP header, the Checksum field is set to zero.
- In the HIP header, the Header Length field value is calculated to the beginning of the HIP_MAC parameter.
Parameter order is described in Section 5.2.1. ๐
the scope of the HIP_MAC_2 calculation looks like this:
HIP_MAC_2: { HIP header | [ Parameters ] | HOST_ID }
where Parameters include all of the packet's HIP parameters with type values from 1 to (HIP_MAC_2's type value - 1), and excluding those parameters with type values greater than or equal to HIP_MAC_2's type value.
during the HIP_MAC_2 calculation, the following apply:
- In the HIP header, the Checksum field is set to zero.
- In the HIP header, the Header Length field value is calculated to the beginning of the HIP_MAC_2 parameter and increased by the length of the concatenated HOST_ID parameter length (including the Type and Length fields).
- The HOST_ID parameter is exactly in the form it was received in the R1 packet from the Responder.
Parameter order is described in Section 5.2.1, except that the HOST_ID parameter in this calculation is added to the end. ๐
the HIP_MAC parameter is defined in Section 5.2.12 and the HIP_MAC_2 parameter in Section 5.2.13. the HMAC calculation and verification process (which applies to both HIP_MAC and HIP_MAC_2, except where HIP_MAC_2 is mentioned separately) goes like this ๐
Packet sender:
- Create the HIP packet, without the HIP_MAC, HIP_SIGNATURE, HIP_SIGNATURE_2, or any other parameter with greater type value than the HIP_MAC parameter has.
- In case of HIP_MAC_2 calculation, add a HOST_ID (Responder) parameter to the end of the packet.
- Calculate the Header Length field in the HIP header, including the added HOST_ID parameter in case of HIP_MAC_2.
- Compute the HMAC using either the HIP-gl or HIP-lg integrity key retrieved from KEYMAT as defined in Section 6.5.
- In case of HIP_MAC_2, remove the HOST_ID parameter from the packet.
- Add the HIP_MAC parameter to the packet, plus any parameter with greater type value than the HIP_MAC's (HIP_MAC_2's) that may follow, including possible HIP_SIGNATURE or HIP_SIGNATURE_2 parameters.
- Recalculate the Length field in the HIP header.
Packet receiver:
- Verify the HIP Header Length field.
- Remove the HIP_MAC or HIP_MAC_2 parameter, as well as all other parameters that follow it with greater type value including possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the contents if they are needed later.
- In case of HIP_MAC_2, build and add a HOST_ID parameter (with Responder information) to the packet. The HOST_ID parameter should be identical to the one previously received from the Responder.
- Recalculate the HIP packet length in the HIP header and clear the Checksum field (set it to all zeros). In case of HIP_MAC_2, the length is calculated with the added HOST_ID parameter.
- Compute the HMAC using either the HIP-gl or HIP-lg integrity key as defined in Section 6.5 and verify it against the received HMAC.
- Set the Checksum and Header Length fields in the HIP header to original values. Note that the Checksum and Length fields contain incorrect values after this step. ๐
- In case of HIP_MAC_2, remove the HOST_ID parameter from the packet before further processing.
6.4.2. Signature Calculation ๐
okay so this process is used for BOTH HIP_SIGNATURE and HIP_SIGNATURE_2 ๐ซถ The only difference for HIP_SIGNATURE_2 is that you use that parameter instead, and before computing the signature you clear the Initiator's HIT and the PUZZLE Opaque and Random #I fields (set them to all zeros). The HIP_SIGNATURE parameter lives in Section 5.2.14 and HIP_SIGNATURE_2 in Section 5.2.15 ๐ธ
the scope of the calculation for the two signatures looks like this:
HIP_SIGNATURE: { HIP header | [ Parameters ] }
where Parameters includes all of the packet's HIP parameters with type values from 1 to (HIP_SIGNATURE's type value - 1) โจ
while you're calculating, keep these in mind:
- in the HIP header, the Checksum field is set to zero ๐
- in the HIP header, the Header Length field value is calculated up to the beginning of the
HIP_SIGNATUREparameter ๐ง
parameter order is described in Section 5.2.1 ๐
HIP_SIGNATURE_2: { HIP header | [ Parameters ] }
where Parameters includes all of the packet's HIP parameters with type values ranging from 1 to (HIP_SIGNATURE_2's type value - 1) ๐ฆ
during signature calculation, the following apply:
- in the HIP header, both the Checksum and the Receiver's HIT fields are set to zero ๐
- in the HIP header, the Header Length field value is calculated up to the beginning of the
HIP_SIGNATURE_2parameter ๐ - the PUZZLE parameter's Opaque and Random #I fields are set to zero ๐
parameter order is described in Section 5.2.1 again, because it matters ๐
the signature calculation and verification process is next. it applies to both HIP_SIGNATURE and HIP_SIGNATURE_2, except where HIP_SIGNATURE_2 is called out separately ๐
Packet sender:
- create the HIP packet without the
HIP_SIGNATUREparameter or any other parameters that follow theHIP_SIGNATUREparameter ๐ธ - calculate the Length field and zero the Checksum field in the HIP header. for
HIP_SIGNATURE_2, also set the Initiator's HIT field in the HIP header and the PUZZLE parameter's Opaque and Random #I fields to zero ๐ - compute the signature using the private key that corresponds to the Host Identifier (public key) ๐ฅ
- add the
HIP_SIGNATUREparameter to the packet โจ - add any parameters that follow the
HIP_SIGNATUREparameter ๐ฆ - recalculate the Length field in the HIP header, and then calculate the Checksum field ๐ซถ
Packet receiver:
- verify the HIP Header Length field and checksum ๐
- save the contents of the
HIP_SIGNATUREparameter and any other parameters that follow it, and remove them from the packet ๐ - recalculate the HIP packet Length in the HIP header and clear the Checksum field (set it to all zeros). for
HIP_SIGNATURE_2, also set the Initiator's HIT field in the HIP header and the PUZZLE parameter's Opaque and Random #I fields to zero ๐ - compute the signature and verify it against the received signature, using the packet sender's Host Identity (public key) ๐
- restore the original packet by adding back the parameters you removed in step 2 and resetting the values you zeroed in step 3 โญ
the verification can use any of these HIs: the HI received from a HIP packet, the HI retrieved from a DNS query (if the FQDN has been received in the HOST_ID parameter), or an HI received by some other means ๐
6.5. HIP KEYMAT Generation ๐
HIP keying material is derived from the Diffie-Hellman session key, Kij, which is produced during the HIP base exchange (see Section 4.1.3) ๐ The Initiator has Kij while it creates the I2 packet, and the Responder has Kij once it receives the I2 packet. that's why I2 can already contain encrypted information ๐ซถ
the KEYMAT is derived by feeding Kij into the key derivation function defined by the DH Group ID. right now, the only key derivation function defined in this document is the Hash-based Key Derivation Function (HKDF) [RFC5869], using the RHASH hash function. other documents may define new DH Group IDs and their matching key distribution functions ๐
here are the details for deriving the keying material with HKDF:
where
info = sort(HIT-I | HIT-R)
salt = #I | #J
okay so Sort(HIT-I | HIT-R) means the network byte order concatenation of the two HITs, with the smaller HIT placed before the larger one. the comparison is a numeric one, with both HITs read as positive (unsigned) 128-bit integers in network byte order ๐ง the #I and #J values come from the puzzle and its solution, which were exchanged in the R1 and I2 messages when this HIP association was set up. both hosts have to store the #I and #J values for the HIP association so they can use them later ๐
the initial keys are drawn in sequence, in the order set by that numeric comparison of the two HITs. HOST_g is the host with the greater HIT value, and HOST_l is the host with the lower HIT value ๐ฆ
the drawing order for the four initial keys is:
HIP-glencryption key forHOST_g's ENCRYPTED parameter โจHIP-glintegrity (HMAC) key forHOST_g's outgoing HIP packets ๐ธHIP-lgencryption key forHOST_l's ENCRYPTED parameter ๐HIP-lgintegrity (HMAC) key forHOST_l's outgoing HIP packets ๐
the number of bits drawn for a given algorithm is that algorithm's "natural" key size. for the mandatory algorithms, the sizes are:
AES 128 or 256 bits
SHA-1 160 bits
SHA-256 256 bits
SHA-384 384 bits
NULL 0 bits
if other key sizes are used, they MUST be treated as different encryption algorithms and defined separately ๐ฅ
6.6. Initiation of a HIP Base Exchange ๐ฆ
an implementation may start a HIP base exchange with another host based on a local policy decision, usually triggered by an application datagram. it works a bit like how an IPsec IKE key exchange can dynamically create a Security Association โจ on the flip side, a system may also start a HIP exchange if it has rebooted, timed out, or otherwise lost its HIP state, as described in Section 4.5.4 ๐
the implementation prepares an I1 packet and sends it to the IP address that corresponds to the peer host. the peer's IP address can be obtained through conventional mechanisms, such as a DNS lookup. the I1 packet contents are specified in Section 5.3.1. choosing which source or destination Host Identity to use (when an Initiator or Responder has more than one to pick from) is typically a policy decision ๐
these are the conceptual processing rules for starting a HIP base exchange:
- the Initiator receives one or more of the Responder's HITs and one or more addresses, from a DNS lookup of the Responder's FQDN, some other repository, or a local database. if the Initiator doesn't know the Responder's HIT, it may try opportunistic mode by using NULL (all zeros) as the Responder's HIT (see also "HIP Opportunistic Mode" (Section 4.1.8)). if the Initiator can choose from multiple Responder HITs, it selects a HIT for which the Initiator supports the HIT Suite ๐ธ
- the Initiator sends an I1 packet to one of the Responder's addresses. choosing which address to use is a local policy decision ๐
- the Initiator includes the DH_GROUP_LIST in the I1 packet. the selection and order of DH Group IDs in the DH_GROUP_LIST MUST be stored by the Initiator, because this list is needed later for R1 processing. most of the time, the DH group preferences are static, so no per-association storage is necessary ๐ซถ
- after sending an I1 packet, the sender transitions to state I1-SENT and starts a timer. the timeout value SHOULD be larger than the worst-case anticipated RTT. the sender SHOULD also increment the trial counter associated with the I1 ๐
- when the timer times out, the sender SHOULD retransmit the I1 packet and restart the timer, up to a maximum of
I1_RETRIES_MAXtries ๐
6.6.1. Sending Multiple I1 Packets in Parallel โญ
to keep association establishment latency down, an implementation MAY send the same I1 packet to more than one of the Responder's addresses. however, it MUST NOT send to more than three (3) Responder addresses in parallel. also, when a timeout happens, the implementation MUST refrain from sending the same I1 packet to multiple addresses. so if it retries to set up the connection after a timeout, it MUST NOT send the I1 packet to more than one destination address ๐ฅ these limits exist to avoid network congestion and potential DoS attacks. for example, someone claiming to have hundreds or thousands of addresses could make the Initiator generate a huge number of I1 packets ๐
the Responder isn't guaranteed to tell apart the duplicate I1 packets it receives at several of its addresses, because it avoids storing state when it answers with an R1 packet. so the Initiator may receive several duplicate R1 packets ๐ง
the Initiator SHOULD then select the initial preferred destination address using the source address of the selected received R1, and use that preferred address as the source address for the I2 packet. the processing rules for received R1s are discussed in Section 6.8 ๐
6.6.2. Processing Incoming ICMP Protocol Unreachable Messages ๐
a host may receive an ICMP 'Destination Protocol Unreachable' message in response to sending a HIP I1 packet. that could mean the peer doesn't support HIP, or it could be an attack that tries to make the Initiator believe the Responder doesn't support HIP ๐
when a system receives an ICMP 'Destination Protocol Unreachable' message while it's waiting for an R1 packet, it MUST NOT stop waiting. it MAY carry on as if it hadn't received the ICMP message, and send a few more I1 packets. alternatively, it MAY take the ICMP message as a hint that the peer most probably doesn't support HIP, and go back to state UNASSOCIATED earlier than it otherwise would. however, at minimum, it MUST continue waiting for an R1 packet for a reasonable time before returning to UNASSOCIATED ๐โจ
6.7. Processing of Incoming I1 Packets โจ
okay bestie, when an I1 shows up, an implementation SHOULD reply with an R1 packet ๐, unless it's unable or unwilling to set up a HIP association. If it's unable to, the host SHOULD send an 'ICMP Destination Protocol Unreachable, Administratively Prohibited' message to the I1 packet's source IP address. If it's unwilling, the host MAY ignore the I1 packet ๐. That last case can happen during a DoS attack, like an I1 packet flood.
Also, the implementation SHOULD be able to handle a storm of I1 packets ๐ช๏ธ, tossing the ones with common content that arrive within a small time delta.
A spoofed I1 packet can cause an R1 attack on a system ๐ฌ. An R1 packet sender MUST have a mechanism to rate-limit R1 packets sent to an address. Protect your R1s, periodt ๐ก๏ธ.
It is RECOMMENDED that the HIP state machine does not transition upon sending an R1 packet ๐ง .
The following steps define the conceptual processing rules for responding to an I1 packet:
- The Responder MUST check that the Responder's HIT in the received I1 packet is either one of its own HITs or NULL. Otherwise, it must drop the packet.
- If the Responder is in ESTABLISHED state, the Responder MAY respond to this with an R1 packet, prepare to drop an existing HIP security association with the peer, and stay at ESTABLISHED state.
- If the Responder is in I1-SENT state, it MUST make a comparison between the sender's HIT and its own (i.e., the receiver's) HIT. If the sender's HIT is greater than its own HIT, it should drop the I1 packet and stay at I1-SENT. If the sender's HIT is smaller than its own HIT, it SHOULD send the R1 packet and stay at I1-SENT. The HIT comparison is performed as defined in Section 6.5. ๐ฅ
- If the implementation chooses to respond to the I1 packet with an R1 packet, it creates a new R1 or selects a precomputed R1 according to the format described in Section 5.3.2. It creates or chooses an R1 that contains its most preferred DH public value that is also contained in the DH_GROUP_LIST in the I1 packet. If no suitable DH Group ID was contained in the DH_GROUP_LIST in the I1 packet, it sends an R1 with any suitable DH public key.
- If the received Responder's HIT in the I1 is NULL, the Responder selects a HIT with the same HIT Suite as the Initiator's HIT. If this HIT Suite is not supported by the Responder, it SHOULD select a REQUIRED HIT Suite from Section 5.2.10, which is currently RSA/DSA/SHA-256. Other than that, selecting the HIT is a local policy matter. ๐
- The Responder expresses its supported HIP transport formats in the TRANSPORT_FORMAT_LIST as described in Section 5.2.11. The Responder MUST provide at least one payload transport format type. ๐
- The Responder sends the R1 packet to the source IP address of the I1 packet. Sent ๐คโจ
6.7.1. R1 Management
All compliant implementations MUST be able to produce R1 packets ๐ญ. Even if a device is configured by policy to only initiate associations, it must be able to process I1s in cases of recovery from loss of state or key exhaustion. An R1 packet MAY be precomputed. An R1 packet MAY be reused for a short time period, denoted here as "Delta T", which is implementation dependent, and SHOULD be deprecated and not used once a valid response I2 packet has been received from an Initiator. During an I1 message storm, an R1 packet MAY be reused beyond the normal Delta T. R1 information MUST NOT be discarded until a time period "Delta S" (again, implementation dependent) after the R1 packet is no longer being offered. Delta S is the assumed maximum time needed for the last I2 packet in response to the R1 packet to arrive back at the Responder. โณ
Implementations that support multiple DH groups MAY precompute R1 packets for each supported group so that incoming I1 packets with different DH Group IDs in the DH_GROUP_LIST can be served quickly. ๐
An implementation MAY keep state about received I1 packets and match the received I2 packets against the state, as discussed in Section 4.1.1. ๐๏ธ
6.7.2. Handling of Malformed Messages
If an implementation receives a malformed I1 packet, it SHOULD NOT respond with a NOTIFY message, as such a practice could open up a potential denial-of-service threat ๐ซ. Instead, it MAY respond with an ICMP packet, as defined in Section 5.4. ๐ง
6.8. Processing of Incoming R1 Packets
A system receiving an R1 packet MUST first check to see if it has sent an I1 packet to the originator of the R1 packet (i.e., it is in state I1-SENT). If so, it SHOULD process the R1 as described below, send an I2 packet, and transition to state I2-SENT, setting a timer to protect the I2 packet ๐ก๏ธ. If the system is in state I2-SENT, it MAY respond to the R1 packet if the R1 packet has a larger R1 generation counter; if so, it should drop its state due to processing the previous R1 packet and start over from state I1-SENT. If the system is in any other state with respect to that host, the system SHOULD silently drop the R1 packet ๐คซ.
When sending multiple I1 packets, an Initiator SHOULD wait for a small amount of time after the first R1 reception to allow possibly multiple R1 packets to arrive, and it SHOULD respond to an R1 packet among the set with the largest R1 generation counter ๐.
The following steps define the conceptual processing rules for responding to an R1 packet:
- A system receiving an R1 MUST first check to see if it has sent an I1 packet to the originator of the R1 packet (i.e., it has a HIP association that is in state I1-SENT and that is associated with the HITs in the R1). Unless the I1 packet was sent in opportunistic mode (see Section 4.1.8), the IP addresses in the received R1 packet SHOULD be ignored by the R1 processing and, when looking up the right HIP association, the received R1 packet SHOULD be matched against the associations using only the HITs. If a match exists, the system should process the R1 packet as described below. ๐
- Otherwise, if the system is in any state other than I1-SENT or I2-SENT with respect to the HITs included in the R1 packet, it SHOULD silently drop the R1 packet and remain in the current state. ๐
- If the HIP association state is I1-SENT or I2-SENT, the received Initiator's HIT MUST correspond to the HIT used in the original I1. Also, the Responder's HIT MUST correspond to the one used in the I1, unless the I1 packet contained a NULL HIT. ๐ฏ
- The system SHOULD validate the R1 signature before applying further packet processing, according to Section 5.2.15. โ๏ธ
- If the HIP association state is I1-SENT, and multiple valid R1 packets are present, the system MUST select from among the R1 packets with the largest R1 generation counter. ๐
- The system MUST check that the Initiator's HIT Suite is contained in the HIT_SUITE_LIST parameter in the R1 packet (i.e., the Initiator's HIT Suite is supported by the Responder). If the HIT Suite is supported by the Responder, the system proceeds normally. Otherwise, the system MAY stay in state I1-SENT and restart the BEX by sending a new I1 packet with an Initiator HIT that is supported by the Responder and hence is contained in the HIT_SUITE_LIST in the R1 packet. The system MAY abort the BEX if no suitable source HIT is available. The system SHOULD wait for an acceptable time span to allow further R1 packets with higher R1 generation counters or different HIT and HIT Suites to arrive before restarting or aborting the BEX. โฐ
- The system MUST check that the DH Group ID in the DIFFIE_HELLMAN parameter in the R1 matches the first DH Group ID in the Responder's DH_GROUP_LIST in the R1 packet, and also that this Group ID corresponds to a value that was included in the Initiator's DH_GROUP_LIST in the I1 packet. If the DH Group ID of the DIFFIE_HELLMAN parameter does not express the Responder's best choice, the Initiator can conclude that the DH_GROUP_LIST in the I1 packet was adversely modified. In such a case, the Initiator MAY send a new I1 packet; however, it SHOULD NOT change its preference in the DH_GROUP_LIST in the new I1 packet. Alternatively, the Initiator MAY abort the HIP base exchange. ๐ต๏ธ
- If the HIP association state is I2-SENT, the system MAY re-enter state I1-SENT and process the received R1 packet if it has a larger R1 generation counter than the R1 packet responded to previously. ๐
- The R1 packet may have the A-bit set -- in this case, the system MAY choose to refuse it by dropping the R1 packet and returning to state UNASSOCIATED. The system SHOULD consider dropping the R1 packet only if it used a NULL HIT in the I1 packet. If the A-bit is set, the Responder's HIT is anonymous and SHOULD NOT be stored permanently. ๐ฅท
- The system SHOULD attempt to validate the HIT against the received Host Identity by using the received Host Identity to construct a HIT and verify that it matches the Sender's HIT. ๐
- The system MUST store the received R1 generation counter for future reference. ๐
- The system attempts to solve the puzzle in the R1 packet. The system MUST terminate the search after exceeding the remaining lifetime of the puzzle. If the puzzle is not successfully solved, the implementation MAY either resend the I1 packet within the retry bounds or abandon the HIP base exchange. ๐งฉ
- The system computes standard Diffie-Hellman keying material according to the public value and Group ID provided in the DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material Kij is used for key extraction as specified in Section 6.5. ๐
- The system selects the HIP_CIPHER ID from the choices presented in the R1 packet and uses the selected values subsequently when generating and using encryption keys, and when sending the I2 packet. If the proposed alternatives are not acceptable to the system, it may either resend an I1 within the retry bounds or abandon the HIP base exchange. ๐ฐ
- The system chooses one suitable transport format from the TRANSPORT_FORMAT_LIST and includes the respective transport format parameter in the subsequent I2 packet. ๐
- The system initializes the remaining variables in the associated state, including Update ID counters. ๐ ๏ธ
- The system prepares and sends an I2 packet, as described in Section 5.3.3. ๐จ
- The system SHOULD start a timer whose timeout value SHOULD be larger than the worst-case anticipated RTT, and MUST increment a trial counter associated with the I2 packet. The sender SHOULD retransmit the I2 packet upon a timeout and restart the timer, up to a maximum of I2_RETRIES_MAX tries. โฒ๏ธ
- If the system is in state I1-SENT, it SHALL transition to state I2-SENT. If the system is in any other state, it remains in the current state. ๐ฆ
6.8.1. Handling of Malformed Messages
Okay, so if an implementation gets a malformed R1 message, it MUST silently drop the packet, no notes. ๐ Sending back a NOTIFY or an ICMP wouldn't help anyone, because the sender of that R1 usually has no state for it anyway ๐. The implementation SHOULD wait a little longer in case a well-formed R1 shows up, and after that it MAY try again by sending a fresh I1 packet ๐ฆ.
6.9. Processing of Incoming I2 Packets
Bestie, when an I2 packet lands, the system MAY run some initial checks to see whether it matches a recent R1 that went out, but only if the Responder is keeping that kind of state ๐. For example, the sender could check whether the I2 is coming from an address or HIT that the Responder recently got an I1 from. The R1 might have had opaque data in it that gets echoed back in the I2, which is a very cute little handshake moment ๐. If the I2 looks suspect, it MAY be silently discarded by the system ๐ โโ๏ธ.
Otherwise, the HIP implementation SHOULD process the I2 packet โจ. That covers validating the puzzle solution, generating the Diffie-Hellman key, possibly decrypting the Initiator's Host Identity, verifying the signature, creating state, and then finally sending an R2 packet. It's a whole production, honestly ๐ฌ๐.
The following steps define the conceptual processing rules for responding to an I2 packet:
- The system MAY perform checks to verify that the I2 packet corresponds to a recently sent R1 packet. Such checks are implementation dependent. See Appendix A for a description of an example implementation. ๐ธ
- The system MUST check that the Responder's HIT corresponds to one of its own HITs and MUST drop the packet otherwise. ๐ซ
- The system MUST further check that the Initiator's HIT Suite is supported. The Responder SHOULD silently drop I2 packets with unsupported Initiator HITs. ๐
- If the system's state machine is in the R2-SENT state, the system MAY check to see if the newly received I2 packet is similar to the one that triggered moving to R2-SENT. If so, it MAY retransmit a previously sent R2 packet and reset the R2-SENT timer, and the state machine stays in R2-SENT. ๐
- If the system's state machine is in the I2-SENT state, the system MUST make a comparison between its local and sender's HITs (similar to the comparison method described in Section 6.5). If the local HIT is smaller than the sender's HIT, it should drop the I2 packet, use the peer Diffie-Hellman key and nonce #I from the R1 packet received earlier, and get the local Diffie-Hellman key and nonce #J from the I2 packet sent to the peer earlier. Otherwise, the system should process the received I2 packet and drop any previously derived Diffie-Hellman keying material Kij it might have formed upon sending the I2 packet previously. The peer Diffie-Hellman key and the nonce #J are taken from the I2 packet that just arrived. The local Diffie-Hellman key and the nonce #I are the ones that were sent earlier in the R1 packet. ๐ฅโจ
- If the system's state machine is in the I1-SENT state, and the HITs in the I2 packet match those used in the previously sent I1 packet, the system uses this received I2 packet as the basis for the HIP association it was trying to form, and stops retransmitting I1 packets (provided that the I2 packet passes the additional checks below). ๐ฏ
- If the system's state machine is in any state other than R2-SENT, the system SHOULD check that the echoed R1 generation counter in the I2 packet is within the acceptable range if the counter is included. Implementations MUST accept puzzles from the current generation and MAY accept puzzles from earlier generations. If the generation counter in the newly received I2 packet is outside the accepted range, the I2 packet is stale (and perhaps replayed) and SHOULD be dropped. ๐ฐ๏ธ๐จ
- The system MUST validate the solution to the puzzle by computing the hash described in Section 5.3.3 using the same RHASH algorithm. ๐งฉ
- The I2 packet MUST have a single value in the HIP_CIPHER parameter, which MUST match one of the values offered to the Initiator in the R1 packet. ๐
- The system must derive Diffie-Hellman keying material Kij based on the public value and Group ID in the DIFFIE_HELLMAN parameter. This key is used to derive the HIP association keys, as described in Section 6.5. If the Diffie-Hellman Group ID is unsupported, the I2 packet is silently dropped. ๐
- The encrypted HOST_ID is decrypted by the Initiator's encryption key defined in Section 6.5. If the decrypted data is not a HOST_ID parameter, the I2 packet is silently dropped. ๐ต๏ธโโ๏ธ
- The implementation SHOULD also verify that the Initiator's HIT in the I2 packet corresponds to the Host Identity sent in the I2 packet. (Note: some middleboxes may not be able to make this verification.) ๐ง
- The system MUST process the TRANSPORT_FORMAT_LIST parameter. Other documents specifying transport formats (e.g., [RFC7402]) contain specifications for handling any specific transport selected. ๐
- The system MUST verify the HIP_MAC according to the procedures in Section 5.2.12. โ
- The system MUST verify the HIP_SIGNATURE according to Sections 5.2.14 and 5.3.3. โ๏ธ
- If the checks above are valid, then the system proceeds with further I2 processing; otherwise, it discards the I2 and its state machine remains in the same state. ๐
- The I2 packet may have the A-bit set -- in this case, the system MAY choose to refuse it by dropping the I2 and the state machine returns to state UNASSOCIATED. If the A-bit is set, the Initiator's HIT is anonymous and should not be stored permanently. ๐ซฅ
- The system initializes the remaining variables in the associated state, including Update ID counters. ๐งฎ
- Upon successful processing of an I2 message when the system's state machine is in state UNASSOCIATED, I1-SENT, I2-SENT, or R2-SENT, an R2 packet is sent and the system's state machine transitions to state R2-SENT. ๐
- Upon successful processing of an I2 packet when the system's state machine is in state ESTABLISHED, the old HIP association is dropped and a new one is installed, an R2 packet is sent, and the system's state machine transitions to R2-SENT. ๐
- Upon the system's state machine transitioning to R2-SENT, the system starts a timer. The state machine transitions to ESTABLISHED if some data has been received on the incoming HIP association, or an UPDATE packet has been received (or some other packet that indicates that the peer system's state machine has moved to ESTABLISHED). If the timer expires (allowing for a maximal amount of retransmissions of I2 packets), the state machine transitions to ESTABLISHED. โฐ๐ฅณ
6.9.1. Handling of Malformed Messages
If an implementation gets a malformed I2 message, the reaction SHOULD depend on how many checks that message has already passed ๐ง. If the puzzle solution in the message has already been checked, the implementation SHOULD report the error by responding with a NOTIFY packet. Otherwise, the implementation MAY respond with an ICMP message as defined in Section 5.4. ๐
6.10. Processing of Incoming R2 Packets
An R2 packet received in state UNASSOCIATED, I1-SENT, or ESTABLISHED gets dropped, and the state machine stays exactly where it was ๐. If an R2 packet shows up in state I2-SENT, it MUST be processed โจ.
The following steps define the conceptual processing rules for an incoming R2 packet:
- If the system is in any state other than I2-SENT, the R2 packet is silently dropped. ๐ซ
- The system MUST verify that the HITs in use correspond to the HITs that were received in the R1 packet that caused the transition to the I1-SENT state. ๐
- The system MUST verify the HIP_MAC_2 according to the procedures in Section 5.2.13. ๐
- The system MUST verify the HIP signature according to the procedures in Section 5.2.14. ๐๏ธ
- If any of the checks above fail, there is a high probability of an ongoing man-in-the-middle or other security attack. The system SHOULD act accordingly, based on its local policy. ๐จ๐ฑ
- Upon successful processing of the R2 packet, the state machine transitions to state ESTABLISHED. ๐
6.11. Sending UPDATE Packets
Whenever a host wants to update some information tied to a HIP association, it sends an UPDATE packet ๐ฌ. There are a bunch of reasons this can happen, like mobility management and rekeying an existing ESP Security Association, so it's giving multitasking ๐ฆ. The paragraphs below define the conceptual rules for sending an UPDATE packet to the peer. Other documents can add extra steps wherever the UPDATE packet is used ๐งฉ.
The UPDATE messages are kept in order by their SEQ parameter ๐ข. Before sending a new UPDATE, the system first checks whether any outstanding UPDATE messages might conflict with it. When multiple UPDATEs are outstanding (not yet acknowledged), the sender must assume that those UPDATEs may be processed in an arbitrary order by the receiver. So any new UPDATEs that depend on a previous outstanding UPDATE being successfully received and acknowledged MUST be postponed until the necessary ACK(s) show up ๐. One way to avoid conflicts entirely is to allow only one outstanding UPDATE at a time. That said, allowing multiple UPDATEs can make mobility and multihoming protocols faster, so it's a real trade-off ๐.
The following steps define the conceptual processing rules for sending UPDATE packets:
- The first UPDATE packet is sent with an Update ID of zero. Otherwise, the system increments its own Update ID value by one before continuing the steps below. 0๏ธโฃ
- The system creates an UPDATE packet that contains a SEQ parameter with the current value of the Update ID. The UPDATE packet MAY also include zero or more ACKs of the peer's Update ID(s) from previously received UPDATE SEQ parameter(s). ๐ฆ
- The system sends the created UPDATE packet and starts an UPDATE timer. The default value for the timer is 2 * RTT estimate. If multiple UPDATEs are outstanding, multiple timers are in effect. โฑ๏ธ
- If the UPDATE timer expires, the UPDATE is resent. The UPDATE can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be exponentially backed off for subsequent retransmissions. If no acknowledgment is received from the peer after UPDATE_RETRY_MAX times, the HIP association is considered to be broken and the state machine SHOULD move from state ESTABLISHED to state CLOSING as depicted in Section 4.4.4. The UPDATE timer is cancelled upon receiving an ACK from the peer that acknowledges receipt of the UPDATE. ๐โก๏ธ๐
6.12. Receiving UPDATE Packets ๐
okay bestie, so when a system gets an UPDATE packet, what it does next depends on two things: what state the HIP association is in, and whether the SEQ and ACK parameters are there (and what their values are) ๐. An UPDATE also usually carries optional parameters, but those are handled in separate documents, so we're not going there today ๐ง.
For each association, a host keeps track of the peer's next expected in-sequence Update ID, which we call the "peer Update ID" ๐. It starts at zero. Update ID comparisons of "less than" and "greater than" are done on a circular sequence number space, so a wraparound after 2^32 updates has to be expected and MUST be handled accordingly ๐ญ. Be ready for it, no excuses!
The sender MAY send multiple outstanding UPDATE messages ๐ฆ. These get processed in the order they arrive at the receiver (aka no resequencing happens). When UPDATEs come in out of order, the receiver MUST keep track of which ones it already processed, so duplicates or retransmissions get ACKed and not processed again ๐
. A receiver MAY also define a receive window of Update IDs that it's willing to process at any given time, and discard any received UPDATEs that fall outside that window ๐ซถ.
The following steps define the conceptual processing rules for receiving UPDATE packets ๐:
- If there is no corresponding HIP association, the implementation MAY reply with an ICMP Parameter Problem, as specified in Section 5.4.4. ๐
- If the association is in the
ESTABLISHEDstate and theSEQ(but notACK) parameter is present, theUPDATEis processed and replied to as described in Section 6.12.1. โจ - If the association is in the
ESTABLISHEDstate and theACK(but notSEQ) parameter is present, theUPDATEis processed as described in Section 6.12.2. โจ - If the association is in the
ESTABLISHEDstate and there are both anACKandSEQin theUPDATE, theACKis processed first as described in Section 6.12.2, and then the rest of theUPDATEis processed as described in Section 6.12.1. ๐
6.12.1. Handling a SEQ Parameter in a Received UPDATE Message ๐ง
The following steps define the conceptual processing rules for handling a SEQ parameter in a received UPDATE packet ๐:
- If the Update ID in the received
SEQis not the next in the sequence of Update IDs and is greater than the receiver's window for newUPDATEs, the packet MUST be dropped. ๐ซ - If the Update ID in the received
SEQcorresponds to anUPDATEthat has recently been processed, the packet is treated as a retransmission. The HIP_MAC verification (next step) MUST NOT be skipped. (A byte-by-byte comparison of the received packet and a stored packet would be acceptable, though.) It is recommended that a host cachesUPDATEpackets sent with ACKs to avoid the cost of generating a new ACK packet to respond to a replayedUPDATE. The system MUST acknowledge, again, such (apparent)UPDATEmessage retransmissions but SHOULD also consider rate-limiting such retransmission responses to guard against replay attacks ๐ก๏ธ. Replay attacks are NOT it, bestie ๐ โโ๏ธ. - The system MUST verify the HIP_MAC in the
UPDATEpacket. If the verification fails, the packet MUST be dropped. ๐ - The system MAY verify the SIGNATURE in the
UPDATEpacket. If the verification fails, the packet SHOULD be dropped and an error message logged. ๐ - If a new
SEQparameter is being processed, the parameters in theUPDATEare then processed. The system MUST record the Update ID in the receivedSEQparameter, for replay protection. ๐ง - An
UPDATEacknowledgment packet with theACKparameter is prepared and sent to the peer. ThisACKparameter MAY be included in a separateUPDATEor piggybacked in anUPDATEwith theSEQparameter, as described in Section 5.3.5. TheACKparameter MAY acknowledge more than one of the peer's Update IDs. ๐
6.12.2. Handling an ACK Parameter in a Received UPDATE Packet ๐ฆข
The following steps define the conceptual processing rules for handling an ACK parameter in a received UPDATE packet ๐:
- The sequence number reported in the
ACKmust match with anUPDATEpacket sent earlier that has not already been acknowledged. If no match is found, or if theACKdoes not acknowledge a newUPDATE, then either the packet MUST be dropped if noSEQparameter is present, or the processing steps in Section 6.12.1 are followed. ๐ค - The system MUST verify the HIP_MAC in the
UPDATEpacket. If the verification fails, the packet MUST be dropped. ๐ - The system MAY verify the SIGNATURE in the
UPDATEpacket. If the verification fails, the packet SHOULD be dropped and an error message logged. ๐ - The corresponding
UPDATEtimer is stopped (see Section 6.11) so that the now-acknowledgedUPDATEis no longer retransmitted. If multipleUPDATEs are acknowledged, multiple timers are stopped. โน๏ธ โจ
6.13. Processing of NOTIFY Packets ๐
Processing of NOTIFY packets is OPTIONAL. ๐ธ If processed, any errors in a received NOTIFICATION parameter SHOULD be logged. Received errors MUST be considered only as informational, and the receiver SHOULD NOT change its HIP state (see Section 4.4.2) purely based on the received NOTIFY message. Chill, it's just info ๐ซง.
6.14. Processing of CLOSE Packets ๐
When the host receives a CLOSE message, it responds with a CLOSE_ACK message and moves to the CLOSED state. (The authenticity of the CLOSE message is verified using both HIP_MAC and SIGNATURE.) This processing applies whether or not the HIP association state is CLOSING, so that simultaneous CLOSE messages from both ends that cross in flight are handled ๐ (iconic, honestly).
The HIP association is not discarded before the host moves to the UNASSOCIATED state ๐งบ.
Once the closing process has started, any new need to send data packets triggers the creation and establishment of a new HIP association, starting with sending an I1 packet ๐.
If there is no corresponding HIP association, the CLOSE packet is dropped ๐๏ธ.
6.15. Processing of CLOSE_ACK Packets ๐
When a host receives a CLOSE_ACK message, it verifies that it is in the CLOSING or CLOSED state and that the CLOSE_ACK was in response to the CLOSE. A host can map CLOSE_ACK messages to CLOSE messages by comparing the value of ECHO_REQUEST_SIGNED (in the CLOSE packet) to the value of ECHO_RESPONSE_SIGNED (in the CLOSE_ACK packet) ๐งฉ.
The CLOSE_ACK contains the HIP_MAC and the SIGNATURE parameters for verification. The state is discarded when the state changes to UNASSOCIATED. After that, the host MAY respond with an ICMP Parameter Problem to an incoming CLOSE message (see Section 5.4.4) ๐งน.
6.16. Handling State Loss ๐
In the case of a system crash and unanticipated state loss, the system SHOULD delete the corresponding HIP state, including the keying material. That is, the state SHOULD NOT be stored in long-term storage ๐ซ . If the implementation does drop the state (as RECOMMENDED), it MUST also drop the peer's R1 generation counter value, unless a local policy explicitly defines that the value of that particular host is stored. An implementation MUST NOT store a peer's R1 generation counters by default, but storing R1 generation counter values, if done, MUST be configured by explicit HITs ๐. Privacy queen behavior, honestly ๐.
7. HIP Policies ๐
There are a number of variables that will influence the HIP base exchanges that each host must support. All HIP implementations MUST support more than one simultaneous HI, at least one of which SHOULD be reserved for anonymous usage. Although anonymous HIs will be rarely used as Responders' HIs, they will be common for Initiators ๐ถ๏ธ. Support for more than two HIs is RECOMMENDED ๐ .
Initiators MAY use a different HI for different Responders to provide basic privacy ๐ฆ. Whether such private HIs are used repeatedly with the same Responder, and how long these HIs are used, are decided by local policy and depend on the privacy requirements of the Initiator ๐ง .
The value of #K used in the HIP R1 must be chosen with care ๐. Values of #K that are too high will exclude clients with weak CPUs, because these devices cannot solve the puzzle within a reasonable amount of time ๐ฉ. #K should only be raised if a Responder is under high load, i.e., it cannot process all incoming HIP handshakes any more. If a Responder is not under high load, #K SHOULD be 0 ๐ง.
Responders that only respond to selected Initiators require an Access Control List (ACL), representing for which hosts they accept HIP base exchanges, and the preferred transport format and local lifetimes ๐. Wildcarding SHOULD be supported for such ACLs, and also for Responders that offer public or anonymous services ๐โจ.
8. Security Considerations โจ
okay bestie, this is where HIP gets real about its own security drama ๐ HIP is designed to give hosts secure authentication ๐, and it also tries to limit how exposed a host is to denial-of-service (DoS) and man-in-the-middle (MitM) attacks ๐ก๏ธ. BUT, plot twist: HIP itself can be hit by its own DoS and MitM attacks, and those could be even more damaging to a host's ability to just do business as usual ๐ญ
DoS attacks love to exploit asymmetries in what it costs to start an association ๐ง. One example is that the Responder has to store local state, while a sneaky Initiator can just stay stateless ๐. HIP doesn't try to make it more expensive for the Initiator to start state ๐, but it does make an effort to make it cheaper for the Responder ๐. The trick is that the Responder starts the 3-way exchange instead of the Initiator, which makes the HIP exchange 4 packets long โจ. So the first packet from the Responder, R1, becomes a 'stock' packet ๐ฆ that the Responder MAY use many times, until some Initiator has sent a valid response to that R1 packet ๐ .
During an I1 packet storm, the host may also reuse the same DH value, even if some Initiator already sent a valid response using that particular DH value ๐ซ . Still, that behavior is discouraged and should be avoided ๐
โโ๏ธ. Reusing the same Diffie-Hellman values and random puzzle #I value has some risks, and those risks need to be balanced against a potential storm of HIP I1 packets โ๏ธ.
This shift of the start-of-state cost onto the Initiator, who creates the I2 HIP packet, opens up another DoS attack ๐ฌ. The attacker can spoof the I1 packet, and then the Responder sends out an R1 HIP packet. That could conceivably tie up the 'Initiator' with evaluating the R1 HIP packet and creating the I2 packet ๐ฅฒ. The defense is to simply ignore any R1 packet where a corresponding I1 packet was not sent (as defined in Section 6.8, step 1) ๐.
The R1 packet is considerably larger than the I1 packet ๐, and that asymmetry can be exploited in a reflection attack ๐ช. A malicious attacker could spoof a victim's IP address and send a flood of I1 messages to a powerful Responder. For each tiny I1 packet, the Responder would send a bigger R1 packet to the victim ๐. That size difference can amplify a flooding attack against the victim even more ๐ค. To avoid reflection attacks, the Responder SHOULD rate-limit the sending of R1 packets in general or SHOULD rate-limit the sending of R1 packets to a specific IP address ๐ฆ.
Floods of forged I2 packets are a second kind of DoS attack ๐. Once the attacking Initiator has solved the puzzle, it can send packets with spoofed IP source addresses that have either an invalid HIP signature or an invalid encrypted HIP payload (in the ENCRYPTED parameter) ๐ฅด. That makes the Responder burn resources just to find out the I2 packet can't be fully processed ๐ฉ.
The defense here: after N bad I2 packets with the same puzzle solution, the Responder discards any I2 packets that contain that solution, and that shuts the attack down ๐. The attacker then has to request another R1 packet and use that to launch a new attack ๐. The Responder could also increase the value of #K while under attack ๐.
Keeping a list of solutions from malformed packets means the Responder has to keep state for those malformed I2 packets ๐๏ธ. That state has to be kept until the R1 counter is increased ๐ข. Malformed packets are generally filtered out by their checksum before signature verification, so only solutions in packets forged to pass the checksum and puzzle get put on the blacklist ๐ต๏ธ. Plus, a valid puzzle is required before a new list entry is created, so attackers who want to flood the blacklist have to solve puzzles first ๐งฉ.
A third form of DoS attack is emulating the restart of state after a reboot of one of the peers ๐. A restarting host would send an I1 packet to the peers, and they would respond with an R1 packet even if they were in the ESTABLISHED state. If the I1 packet were spoofed, the resulting R1 packet would be received unexpectedly by the spoofed host and would be dropped, same as in the first case above ๐๏ธ.
A fourth form of DoS attack is emulating the closing of the HIP association ๐ช. HIP relies on timers and a CLOSE/CLOSE_ACK handshake to explicitly signal the end of a HIP association. Because both CLOSE and CLOSE_ACK messages contain a HIP_MAC, an outsider cannot close a connection ๐. The presence of an additional SIGNATURE lets middleboxes inspect these messages and discard the associated state (for example, for firewalling, SPI-based NATing, etc.) ๐งฑ. However, the optional behavior of replying to CLOSE with an ICMP Parameter Problem packet (as described in Section 5.4.4) might let an attacker spoofing the source IP address send CLOSE messages to launch reflection attacks ๐ฌ.
A fifth form of DoS attack is replaying R1s to make the Initiator solve stale puzzles and fall out of sync with the Responder โณ. The R1 generation counter is a monotonically increasing counter designed to protect against this attack, as described in Section 4.1.4 ๐ก๏ธ.
Man-in-the-middle attacks are hard to defend against without third-party authentication ๐ฅท. A skillful MitM could easily handle all parts of HIP, but HIP indirectly provides the following protection from a MitM attack ๐ . If the Responder's HI is retrieved from a signed DNS zone, a certificate, or through some other secure means, the Initiator can use that to validate the R1 HIP packet โ .
Likewise, if the Initiator's HI is in a secure DNS zone, a trusted certificate, or otherwise securely available, the Responder can retrieve the HI (after getting the I2 HIP packet) and verify that the HI can really be trusted ๐ซถ.
The HIP "opportunistic mode" concept has been introduced in this document, but this document does not specify what the semantics of such a connection setup are for applications ๐คทโโ๏ธ. There are certain concerns with opportunistic mode, as discussed in Section 4.1.8 โ ๏ธ.
NOTIFY messages are only used for informational purposes, and they are unacknowledged ๐ญ. A HIP implementation cannot rely solely on the information received in a NOTIFY message, because the packet may have been replayed ๐. An implementation SHOULD NOT change any state information purely based on a received NOTIFY message ๐ โโ๏ธ.
Since not all hosts will ever support HIP, ICMP Destination Protocol Unreachable messages are to be expected, and they may be used for a DoS attack ๐. Against an Initiator, the attack would look like the Responder doesn't support HIP, but shortly after receiving the ICMP message, the Initiator would get a valid R1 HIP packet. So, to protect against this attack, an Initiator SHOULD NOT react to an ICMP message until a reasonable delta time has passed to get the real Responder's R1 HIP packet โฐ.
A similar attack against the Responder is more involved ๐ธ๏ธ. Normally, if an I1 message received by a Responder was a bogus one sent by an attacker, the Responder may receive an ICMP message from the IP address the R1 message was sent to. But a sophisticated attacker can try to take advantage of that and break up the HIP base exchange by sending such an ICMP message to the Responder before the Initiator has a chance to send a valid I2 message ๐. Hence, the Responder SHOULD NOT act on such an ICMP message. Especially, it SHOULD NOT remove any minimal state created when it sent the R1 HIP packet (if it did create one). Instead, it should wait for either a valid I2 HIP packet or the natural timeout (that is, if R1 packets are tracked at all) โณ.
Likewise, the Initiator SHOULD ignore any ICMP message while waiting for an R2 HIP packet, and SHOULD delete any pending state only after a natural timeout ๐งนโจ
9. IANA Considerations ๐
okay bestie, IANA is the keeper of all the registries, so this section is basically the to-do list for them ๐
IANA reserved protocol number 139 for the Host Identity Protocol and put it in the "IPv6 Extension Header Types" registry [RFC7045] and the "Assigned Internet Protocol Numbers" registry. The reference in both of those registries has been updated from [RFC5201] to this specification โจ
The reference to the 128-bit value under the CGA Message Type namespace [RFC3972] of "0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA" has been changed from [RFC5201] to this specification ๐ฆ
The "Host Identity Protocol (HIP) Parameters" registries got a bunch of glow-ups. Most of the changes are just updating the reference from [RFC5201] to this specification, but there are some differences, which I'll spill below ๐ซถ Allocation terminology comes from [RFC5226], so any existing references to "IETF Consensus" can be replaced with "IETF Review" as per [RFC5226] ๐
HIP Version
This document adds the value "2" to the existing registry. The value of "1" has been left with a reference to [RFC5201] ๐ธ
Packet Type
The 7-bit Packet Type field in a HIP protocol packet describes the type of a HIP protocol message. It is defined in Section 5.1. All existing values referring to [RFC5201] have been updated to refer to this specification. Other values have been left unchanged ๐
HIT Suite ID
This specification creates a new registry for "HIT Suite ID". This is different than the existing registry for "Suite ID", which can be left unmodified for version 1 of the protocol ([RFC5201]). The registry has been closed to new registrations ๐
The four-bit HIT Suite ID uses the OGA ID field in the ORCHID to express the type of the HIT. This document defines three HIT Suites (see Section 5.2.10) ๐ง
The HIT Suite ID is also carried in the four higher-order bits of the ID field in the HIT_SUITE_LIST parameter. The four lower-order bits are reserved for future extensions of the HIT Suite ID space beyond 16 values โจ
Okay, this part is lowkey important. For the time being, the HIT Suite uses only four bits because these bits have to be carried in the HIT. Using more bits for the HIT Suite ID reduces the cryptographic strength of the HIT. HIT Suite IDs must be allocated carefully to avoid namespace exhaustion. Moreover, deprecated IDs should be reused after an appropriate time span. If 15 Suite IDs (the zero value is initially reserved) prove to be insufficient and more HIT Suite IDs are needed concurrently, more bits can be used for the HIT Suite ID by using one HIT Suite ID (0) to indicate that more bits should be used. The HIT_SUITE_LIST parameter already supports 8-bit HIT Suite IDs, should longer IDs be needed. However, RFC 7343 [RFC7343] does not presently support such an extension. We suggest trying the rollover approach described in Appendix E first. Possible extensions of the HIT Suite ID space to accommodate eight bits and new HIT Suite IDs are defined through IETF Review ๐ฅ
Requests to register reused values should include a note that the value is being reused after a deprecation period, to ensure appropriate IETF review and approval. ๐
Parameter Type
The 16-bit Type field in a HIP parameter describes the type of the parameter. It is defined in Section 5.2.1. The current values are defined in Sections 5.2.3 through 5.2.23. The existing "Parameter Types" registry has been updated as follows ๐
A new value (129) for R1_COUNTER has been introduced, with a reference to this specification, and the existing value (128) for R1_COUNTER has been left in place with a reference to [RFC5201]. This documents the change in value that has occurred in version 2 of this protocol. For clarity, the name for the value 128 has been changed from "R1_COUNTER" to "R1_Counter (v1 only)" ๐
A new value (579) for a new Parameter Type HIP_CIPHER has been added, with reference to this specification. This Parameter Type functionally replaces the HIP_TRANSFORM Parameter Type (value 577), which has been left in the table with the existing reference to [RFC5201]. For clarity, the name for the value 577 has been changed from "HIP_TRANSFORM" to "HIP_TRANSFORM (v1 only)" ๐
A new value (715) for a new Parameter Type HIT_SUITE_LIST has been added, with reference to this specification โญ
A new value (2049) for a new Parameter Type TRANSPORT_FORMAT_LIST has been added, with reference to this specification ๐ฆ
The name of the HMAC Parameter Type (value 61505) has been changed to HIP_MAC. The name of the HMAC_2 Parameter Type (value 61569) has been changed to HIP_MAC_2. The reference has been changed to this specification ๐ซง
All other Parameter Types that reference [RFC5201] have been updated to refer to this specification, and Parameter Types that reference other RFCs are unchanged ๐
The Type codes 32768 through 49151 (not 49141: a value corrected from a previous version of this table) have been Reserved for Private Use. Implementors SHOULD select types in a random fashion from this range, thereby reducing the probability of collisions. A method employing genuine randomness (such as flipping a coin) SHOULD be used ๐ฒ
Where the existing ranges once stated "First Come First Served with Specification Required", this has been changed to "Specification Required" ๐
Group ID
The eight-bit Group ID values appear in the DIFFIE_HELLMAN parameter and the DH_GROUP_LIST parameter and are defined in Section 5.2.7. This registry has been updated based on the new values specified in Section 5.2.7; values noted as being DEPRECATED can be left in the table with reference to [RFC5201]. New values are assigned through IETF Review ๐ธ
HIP Cipher ID
The 16-bit Cipher ID values in a HIP_CIPHER parameter are defined in Section 5.2.8. This is a new registry. New values from either the reserved or unassigned space are assigned through IETF Review ๐ง
DI-Type
The four-bit DI-Type values in a HOST_ID parameter are defined in Section 5.2.9. New values are assigned through IETF Review. All existing values referring to [RFC5201] have been updated to refer to this specification ๐
HI Algorithm
The 16-bit Algorithm values in a HOST_ID parameter are defined in Section 5.2.9. This is a new registry. New values from either the reserved or unassigned space are assigned through IETF Review ๐
ECC Curve Label
When the HI Algorithm values in a HOST_ID parameter are defined to the values of either "ECDSA" or "ECDSA_LOW", a new registry is needed to maintain the values for the ECC Curve Label as defined in Section 5.2.9. This might be handled by specifying two algorithm-specific subregistries named "ECDSA Curve Label" and "ECDSA_LOW Curve Label". New values are to be assigned through IETF Review ๐
Notify Message Type
The 16-bit Notify Message Type values in a NOTIFICATION parameter are defined in Section 5.2.19 ๐
Notify Message Type values 1-10 are used for informing about errors in packet structures, values 11-20 for informing about problems in parameters containing cryptographic related material, and values 21-30 for informing about problems in authentication or packet integrity verification. Parameter numbers above 30 can be used for informing about other types of errors or events ๐ซถ
The existing registration procedures have been updated as follows ๐
- The range from 1-50 can remain as "IETF Review".
- The range from 51-8191 has been marked as "Specification Required".
- Values 8192-16383 remain as "Reserved for Private Use".
- Values 16384-40959 have been marked as "Specification Required".
- Values 40960-65535 remain as "Reserved for Private Use".
The following updates to the values have been made to the existing registry. All existing values referring to [RFC5201] have been updated to refer to this specification ๐
INVALID_HIP_TRANSFORM_CHOSENhas been renamed toINVALID_HIP_CIPHER_CHOSENwith the same value (17).- A new value of 20 for the type
UNSUPPORTED_HIT_SUITEhas been added. HMAC_FAILEDhas been renamed toHIP_MAC_FAILEDwith the same value (28).SERVER_BUSY_PLEASE_RETRYhas been renamed toRESPONDER_BUSY_PLEASE_RETRYwith the same value (44).
10. Differences from RFC 5201 โจ
okay bestie, this section is the glow-up recap from [RFC5201] ๐ it's informational, meant to help anyone who already knows HIP Version 1. if anything here ever disagrees with the rest of the spec, the text outside this section wins ๐ซถ
HIP Version 2 is not interoperable with HIP Version 1, so this is a whole new era ๐ฆ the big changes are extra cryptographic agility features and a refresh of which algorithms are mandatory and which are optional. that includes Elliptic Curve support through ECDSA and ECDH โญ the mandatory implementations got updated too: HMAC-SHA-1 is out and HMAC-SHA-256 is in, RSA/SHA-1 signatures are replaced by RSASSA-PSS, and ECDSA joins RSA as a mandatory public key type ๐ฅ this version is also lined up with the ORCHID revision in [RFC7343] ๐ธ
Here's what changed in the protocol operation:
- Section 4.1.3 has the new Diffie-Hellman group negotiation flow (an agility feature, obviously ๐). the Initiator may state a preference for a DH group in the I1 packet and can suggest several options. the Responder answers with its own preference, based on local policy and what the Initiator offered. if the Responder's pick is unsuitable (unsupported algorithms), the Initiator may restart the base exchange ๐
- you can now use different cryptographic hash functions to generate the HIT ๐ that's where the Responder's HIT hash algorithm (RHASH) terminology comes in. HIT Suites were also introduced to bundle together the algorithms used for public key signature, hash function, and hash truncation. because of this, the combinations get constrained, which is honestly a relief ๐ง HIT Suite IDs are related to the ORCHID OGA ID field ([RFC7343]) ๐
- the puzzle mechanism got a little tweak ๐งฉ the #I parameter now depends on the RHASH that was selected, and the spec now advises against reusing the same #I value for the same Initiator. more details are in Sections 4.1.2 and 5.2.4) ๐
- Section 4.1.4 now covers what happens when the R1 generation counter rolls over or gets reset ๐
- Section 4.1.6 is brand new and describes how to abort a HIP base exchange ๐ โโ๏ธ
- Section 4.1.7 gives guidance on avoiding downgrade attacks on the cryptographic algorithms ๐ก๏ธ
- Section 4.1.8, the opportunistic mode section, got updated so it accounts for cryptographic agility by adding HIT selection procedures ๐ฆ
- the HIP KEYMAT generation was updated (see Section 6.5) so the key derivation function is now a negotiable part of the protocol ๐
- processing for the I1, R1, and I2 packets was updated to handle the new parameters ๐ฆ
- this specification adds a requirement that hosts MUST support processing ACK parameters that carry several SEQ sequence numbers, even if they don't support sending such parameters themselves ๐จ
- the document now makes it clear that several ECHO_REQUEST_UNSIGNED parameters may show up in an R1, and several ECHO_RESPONSE parameters may show up in an I2 ๐
- there are now procedures for answering version mismatches with an ICMP Parameter Problem ๐
- the security considerations (Section 8) got a cleanup and no longer list attacks that stopped being applicable ๐
- the Anonymous bit, which hides the sender's Host Identity, is now supported in packets other than R1 and I2 ๐ซฅ
- NULL HIP CIPHER support is now explicitly limited to debugging and testing HIP. it's no longer a mandatory algorithm to support โ ๏ธ
the NULL HIP CIPHER is strictly a debugging and testing thing now, so please don't treat it like a real option ๐ โโ๏ธ
Here's what changed in the parameter types and encodings (Section 5.2):
- four new parameter types joined the party: DH_GROUP_LIST, HIP_CIPHER, HIT_SUITE_LIST, and TRANSPORT_FORMAT_LIST ๐
- two parameter types got new names: HMAC is now HIP_MAC, and HMAC2 is now HIP_MAC_2 ๐
- HIP_TRANSFORM is deprecated ๐ญ it's been replaced by HIP_CIPHER, which works a bit differently. the hashes were removed from it and are now determined by RHASH
- the TRANSPORT_FORMAT_LIST parameter lets transports get negotiated using the list, rather than by their order in the HIP packet ๐ฆ
- the type code for R1_COUNTER changed from 128 to 129 ๐ข this is because it's now a Critical parameter and must be echoed when it's present in R1
- PUZZLE and SOLUTION lengths are now variable and depend on the RHASH length ๐งฉ
- the supported Diffie-Hellman Group IDs were updated ๐ธ
- the HOST_ID parameter now requires an Algorithm to be specified ๐ชช
- the NOTIFICATION parameter supports new Notify Message Type values ๐
- the HIP_SIGNATURE algorithm field went from 8 bits to 16 bits so it lines up with the HOST_ID parameters ๐
- the spec now makes it clear that the SEQ parameter always holds one update ID, but the ACK parameter may acknowledge several update IDs ๐
- the rule that only one ECHO_RESPONSE_UNSIGNED parameter could be present in each HIP packet is gone ๐
- a new type range was allocated for parameters that only get covered by a signature if a signature is actually present, and the newly created DH_GROUP_LIST parameter is placed in it โจ
- the document clarifies that several NOTIFY parameters may be present in a packet ๐
Here's what changed in the packet contents (Section 5.3):
- the I1 packet now carries the Initiator's DH_GROUP_LIST ๐ง
- the R1 packet now carries HIP_CIPHER, HIT_SUITE_LIST, DH_GROUP_LIST, and TRANSPORT_FORMAT_LIST ๐
- the I2 packet now carries HIP_CIPHER and TRANSPORT_FORMAT_LIST ๐
- UPDATE packets that contain neither a SEQ nor an ACK parameter are invalid, and the document says so clearly now ๐ซ
11. References ๐
11.1. Normative References
These are the references the spec leans on, listed exactly as they're written in the document:
[FIPS.180-4.2012]
National Institute of Standards and Technology, "Secure
Hash Standard (SHS)", FIPS PUB 180-4, March 2012,
<http://csrc.nist.gov/publications/fips/fips180-4/
fips-180-4.pdf>.
[NIST.800-131A.2011]
National Institute of Standards and Technology,
"Transitions: Recommendation for Transitioning the Use of
Cryptographic Algorithms and Key Lengths", NIST
SP 800-131A, January 2011, <http://csrc.nist.gov/
publications/nistpubs/800-131A/sp800-131A.pdf>.
[RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
August 1980, <http://www.rfc-editor.org/info/rfc768>.
[RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, September 1981, <http://www.rfc-editor.org/
info/rfc793>.
[RFC1035] Mockapetris, P., "Domain names - implementation and
specification", STD 13, RFC 1035, November 1987,
<http://www.rfc-editor.org/info/rfc1035>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within
ESP and AH", RFC 2404, November 1998,
<http://www.rfc-editor.org/info/rfc2404>.
[RFC2410] Glenn, R. and S. Kent, "The NULL Encryption Algorithm and
Its Use With IPsec", RFC 2410, November 1998,
<http://www.rfc-editor.org/info/rfc2410>.
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
(IPv6) Specification", RFC 2460, December 1998,
<http://www.rfc-editor.org/info/rfc2460>.
[RFC2536] Eastlake 3rd, D., "DSA KEYs and SIGs in the Domain Name
System (DNS)", RFC 2536, March 1999,
<http://www.rfc-editor.org/info/rfc2536>.
[RFC3110] Eastlake 3rd, D., "RSA/SHA-1 SIGs and RSA KEYs in the
Domain Name System (DNS)", RFC 3110, May 2001,
<http://www.rfc-editor.org/info/rfc3110>.
[RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP)
Diffie-Hellman groups for Internet Key Exchange (IKE)",
RFC 3526, May 2003, <http://www.rfc-editor.org/
info/rfc3526>.
[RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher
Algorithm and Its Use with IPsec", RFC 3602,
September 2003, <http://www.rfc-editor.org/info/rfc3602>.
[RFC3972] Aura, T., "Cryptographically Generated Addresses (CGA)",
RFC 3972, March 2005, <http://www.rfc-editor.org/
info/rfc3972>.
[RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., and S.
Rose, "Resource Records for the DNS Security Extensions",
RFC 4034, March 2005, <http://www.rfc-editor.org/
info/rfc4034>.
[RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The
Network Access Identifier", RFC 4282, December 2005,
<http://www.rfc-editor.org/info/rfc4282>.
[RFC4443] Conta, A., Deering, S., and M. Gupta, "Internet Control
Message Protocol (ICMPv6) for the Internet Protocol
Version 6 (IPv6) Specification", RFC 4443, March 2006,
<http://www.rfc-editor.org/info/rfc4443>.
[RFC4754] Fu, D. and J. Solinas, "IKE and IKEv2 Authentication Using
the Elliptic Curve Digital Signature Algorithm (ECDSA)",
RFC 4754, January 2007, <http://www.rfc-editor.org/
info/rfc4754>.
[RFC4868] Kelly, S. and S. Frankel, "Using HMAC-SHA-256,
HMAC-SHA-384, and HMAC-SHA-512 with IPsec", RFC 4868,
May 2007, <http://www.rfc-editor.org/info/rfc4868>.
[RFC5702] Jansen, J., "Use of SHA-2 Algorithms with RSA in DNSKEY
and RRSIG Resource Records for DNSSEC", RFC 5702,
October 2009, <http://www.rfc-editor.org/info/rfc5702>.
[RFC6724] Thaler, D., Draves, R., Matsumoto, A., and T. Chown,
"Default Address Selection for Internet Protocol Version 6
(IPv6)", RFC 6724, September 2012,
<http://www.rfc-editor.org/info/rfc6724>.
[RFC7343] Laganier, J. and F. Dupont, "An IPv6 Prefix for Overlay
Routable Cryptographic Hash Identifiers Version 2
(ORCHIDv2)", RFC 7343, September 2014,
<http://www.rfc-editor.org/info/rfc7343>.
[RFC7402] Jokela, P., Moskowitz, R., and J. Melen, "Using the
Encapsulating Security Payload (ESP) Transport Format with
the Host Identity Protocol (HIP)", RFC 7402, April 2015,
<http://www.rfc-editor.org/info/rfc7402>.
11.2. Informative References โจ
okay so these are the bonus reads, the stuff the spec points to for extra context but doesn't strictly need ๐
[AUR05]Aura, T., Nagarajan, A., and A. Gurtov, "Analysis of the HIP Base Exchange Protocol", in Proceedings of the 10th Australasian Conference on Information Security and Privacy, July 2005. ๐[CRO03]Crosby, S. and D. Wallach, "Denial of Service via Algorithmic Complexity Attacks", in Proceedings of the 12th USENIX Security Symposium, Washington, D.C., August 2003. ๐[DIF76]Diffie, W. and M. Hellman, "New Directions in Cryptography", IEEE Transactions on Information Theory Volume IT-22, Number 6, pages 644-654, November 1976. ๐[FIPS.186-4.2013]National Institute of Standards and Technology, "Digital Signature Standard (DSS)", FIPS PUB 186-4, July 2013,<http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf>. โ๏ธ[FIPS.197.2001]National Institute of Standards and Technology, "Advanced Encryption Standard (AES)", FIPS PUB 197, November 2001,<http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf>. ๐[HIP-ARCH]Moskowitz, R., Ed., and M. Komu, "Host Identity Protocol Architecture", Work in Progress, draft-ietf-hip-rfc4423-bis-09, October 2014. ๐๏ธ[HIP-DNS-EXT]Laganier, J., "Host Identity Protocol (HIP) Domain Name System (DNS) Extension", Work in Progress, draft-ietf-hip-rfc5205-bis-06, January 2015. ๐[HIP-HOST-MOB]Henderson, T., Ed., Vogt, C., and J. Arkko, "Host Mobility with the Host Identity Protocol", Work in Progress, draft-ietf-hip-rfc5206-bis-08, January 2015. ๐งณ[HIP-REND-EXT]Laganier, J. and L. Eggert, "Host Identity Protocol (HIP) Rendezvous Extension", Work in Progress, draft-ietf-hip-rfc5204-bis-05, December 2014. ๐ค[KAU03]Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS protection for UDP-based protocols", in Proceedings of the 10th ACM Conference on Computer and Communications Security, October 2003. ๐ก๏ธ[KRA03]Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach to Authenticated Diffie-Hellman and Its Use in the IKE Protocols", in Proceedings of CRYPTO 2003, pages 400-425, August 2003. ๐ง[RFC0792]Postel, J., "Internet Control Message Protocol", STD 5, RFC 792, September 1981,<http://www.rfc-editor.org/info/rfc792>. ๐ก[RFC2785]Zuccherato, R., "Methods for Avoiding the "Small-Subgroup" Attacks on the Diffie-Hellman Key Agreement Method for S/MIME", RFC 2785, March 2000,<http://www.rfc-editor.org/info/rfc2785>. ๐ซง[RFC2898]Kaliski, B., "PKCS #5: Password-Based Cryptography Specification Version 2.0", RFC 2898, September 2000,<http://www.rfc-editor.org/info/rfc2898>. ๐๏ธ[RFC3447]Jonsson, J. and B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, February 2003,<http://www.rfc-editor.org/info/rfc3447>. ๐[RFC3849]Huston, G., Lord, A., and P. Smith, "IPv6 Address Prefix Reserved for Documentation", RFC 3849, July 2004,<http://www.rfc-editor.org/info/rfc3849>. ๐งช[RFC5201]Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, "Host Identity Protocol", RFC 5201, April 2008,<http://www.rfc-editor.org/info/rfc5201>. ๐[RFC5226]Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 5226, May 2008,<http://www.rfc-editor.org/info/rfc5226>. ๐[RFC5338]Henderson, T., Nikander, P., and M. Komu, "Using the Host Identity Protocol with Legacy Applications", RFC 5338, September 2008,<http://www.rfc-editor.org/info/rfc5338>. ๐งฉ[RFC5533]Nordmark, E. and M. Bagnulo, "Shim6: Level 3 Multihoming Shim Protocol for IPv6", RFC 5533, June 2009,<http://www.rfc-editor.org/info/rfc5533>. ๐ธ[RFC5737]Arkko, J., Cotton, M., and L. Vegoda, "IPv4 Address Blocks Reserved for Documentation", RFC 5737, January 2010,<http://www.rfc-editor.org/info/rfc5737>. ๐งช[RFC5869]Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)", RFC 5869, May 2010,<http://www.rfc-editor.org/info/rfc5869>. ๐[RFC5903]Fu, D. and J. Solinas, "Elliptic Curve Groups modulo a Prime (ECP Groups) for IKE and IKEv2", RFC 5903, June 2010,<http://www.rfc-editor.org/info/rfc5903>. ๐[RFC6090]McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic Curve Cryptography Algorithms", RFC 6090, February 2011,<http://www.rfc-editor.org/info/rfc6090>. ๐ง[RFC6253]Heer, T. and S. Varjonen, "Host Identity Protocol Certificates", RFC 6253, May 2011,<http://www.rfc-editor.org/info/rfc6253>. ๐[RFC7045]Carpenter, B. and S. Jiang, "Transmission and Processing of IPv6 Extension Headers", RFC 7045, December 2013,<http://www.rfc-editor.org/info/rfc7045>. ๐งท[RFC7296]Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. Kivinen, "Internet Key Exchange Protocol Version 2 (IKEv2)", STD 79, RFC 7296, October 2014,<http://www.rfc-editor.org/info/rfc7296>. ๐[RSA]Rivest, R., Shamir, A., and L. Adleman, "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems", Communications of the ACM 21 (2), pp. 120-126, February 1978. ๐[SECG]SECG, "Recommended Elliptic Curve Domain Parameters", SEC 2 Version 2.0, January 2010,<http://www.secg.org/>. ๐
Appendix A. Using Responder Puzzles ๐งฉ
okay so remember Section 4.1.1? the Responder is allowed to hold off on creating state and still toss out most fake I2 packets, and it does that with a bunch of pre-calculated R1 packets plus a local selection function. this appendix walks through one possible way to build it, just so implementers have a picture of how it fits together. if your version is based on this, it MAY have some local tweaks that make an attacker's life way harder ๐
The Responder makes a secret value S and regenerates it every so often. It has to hang onto the two most recent values of S. Every time S gets regenerated, the R1 generation counter goes up by one. ๐
The Responder also generates a pre-signed R1 packet. The signature on those pre-generated R1s must be recalculated whenever the Diffie-Hellman key gets recomputed or when the R1_COUNTER value changes because S was regenerated. ๐
When the Initiator sends an I1 packet to start a connection, the Responder grabs the HIT and IP address out of it and makes an #I value for the puzzle. The #I value is set to the pre-signed R1 packet. โจ
#I value calculation:
#I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), n)
where n = RHASH_len
The RHASH algorithm is the same one used to generate the Responder's HIT value. ๐ธ
Later, from an incoming I2 packet, the Responder gets everything it needs to validate the puzzle: the HITs, the IP addresses, and which S value was used, pulled from the R1_COUNTER. With those, it can regenerate #I and check it against the #I that came in the I2 packet. If the #I values match, it can verify the solution using #I, #J, and the difficulty #K. If they don't match, the I2 gets dropped. ๐ โโ๏ธ
puzzle_check:
V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), #K )
if V != 0, drop the packet
If the puzzle solution checks out, the #I and #J values get stored for later. They're used as input material when keying material is generated. ๐
Whether the Responder keeps any state about failed puzzle solutions is up to the implementation. It's possible to keep nothing at all, but the Responder may still choose to keep some to protect itself against certain attacks (see Section 4.1.1). ๐ก๏ธ
Appendix B. Generating a Public Key Encoding from an HI ๐๏ธ
this pseudo-code shows how to make a public key encoding from an HI, for both RSA and DSA. it's a little dense but very satisfying once it clicks ๐ฅน
The symbol ":=" means assignment, and the symbol "+=" means appending. The pseudo-function "encode_in_network_byte_order" takes two things, an integer (bignum) and a length in bytes, and gives back the integer packed into a byte string of that length. ๐ง
switch ( HI.algorithm )
{
case RSA:
buffer := encode_in_network_byte_order ( HI.RSA.e_len,
( HI.RSA.e_len > 255 ) ? 3 : 1 )
buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len )
buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len )
break;
case DSA:
buffer := encode_in_network_byte_order ( HI.DSA.T , 1 )
buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 )
buffer += encode_in_network_byte_order ( HI.DSA.P , 64 +
8 * HI.DSA.T )
buffer += encode_in_network_byte_order ( HI.DSA.G , 64 +
8 * HI.DSA.T )
buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 +
8 * HI.DSA.T )
break;
}
Appendix C. Example Checksums for HIP Packets ๐งฎ
the HIP checksum for HIP packets is covered in Section 5.1.1. Checksums for TCP and UDP packets running over HIP-enabled security associations are covered in Section 4.5.1. The examples below use [RFC3849] and [RFC5737] addresses, plus HITs that start with 2001:20, followed by zeros, then a decimal 1 or 2, depending on which one it is. ๐ฆ
This example is only there for testing the checksum calculation, so don't go using it for anything else ๐
C.1. IPv6 HIP Example (I1 Packet) ๐
Source Address: 2001:db8::1
Destination Address: 2001:db8::2
Upper-Layer Packet Length: 48 0x30
Next Header: 139 0x8b
Payload Protocol: 59 0x3b
Header Length: 5 0x5
Packet Type: 1 0x1
Version: 2 0x2
Reserved: 1 0x1
Control: 0 0x0
Checksum: 6750 0x1a5e
Sender's HIT: 2001:20::1
Receiver's HIT: 2001:20::2
DH_GROUP_LIST type: 511 0x1ff
DH_GROUP_LIST length: 3 0x3
DH_GROUP_LIST Group IDs: 3,4,8
C.2. IPv4 HIP Packet (I1 Packet) โจ
bestie, here's the IPv4 checksum value for the example I1 packet ๐งฎ it's giving neat little worked example energy
Source Address: 192.0.2.1
Destination Address: 192.0.2.2
Upper-Layer Packet Length: 48 0x30
Next Header: 139 0x8b
Payload Protocol: 59 0x3b
Header Length: 5 0x5
Packet Type: 1 0x1
Version: 2 0x2
Reserved: 1 0x1
Control: 0 0x0
Checksum: 61902 0xf1ce
Sender's HIT: 2001:20::1
Receiver's HIT: 2001:20::2
DH_GROUP_LIST type: 511 0x1ff
DH_GROUP_LIST length: 3 0x3
DH_GROUP_LIST Group IDs: 3,4,8
C.3. TCP Segment ๐ฆ
okay so no matter if you're on IPv6 or IPv4, the TCP and UDP sockets use the IPv6 pseudo header format [RFC2460], and the HITs get used in place of the IPv6 addresses ๐ main character energy for those HITs ngl
Sender's HIT: 2001:20::1
Receiver's HIT: 2001:20::2
Upper-Layer Packet Length: 20 0x14
Next Header: 6 0x06
Source port: 65500 0xffdc
Destination port: 22 0x0016
Sequence number: 1 0x00000001
Acknowledgment number: 0 0x00000000
Data offset: 5 0x5
Flags: SYN 0x02
Window size: 65535 0xffff
Checksum: 28586 0x6faa
Urgent pointer: 0 0x0000
Appendix D. ECDH and ECDSA 160-Bit Groups ๐
ngl the ECDH and ECDSA 160-bit group SECP160R1 is rated at 80 bits symmetric strength ๐ญ this was once considered appropriate for one year of security. today these groups should be used only when the host is not powerful enough (e.g., some embedded devices) and when security requirements are low (e.g., long-term confidentiality is not required). so not the vibe for anything serious ๐
Appendix E. HIT Suites and HIT Generation ๐ง
okay so the HIT as an ORCHID [RFC7343] has three parts: a 28-bit prefix, a 4-bit encoding of the ORCHID generation algorithm (OGA), and a hash that includes the Host Identity and a context ID. the OGA is an index pointing to the specific algorithm that generates the public key and the 96-bit hashed encoding. it's protocol specific and is to be interpreted as defined below for all protocols that use the same context ID as HIP. HIP groups sets of valid combinations of signature and hash algorithms into HIT Suites ๐ and those get addressed by an index that's transmitted in the OGA ID field of the ORCHID.
the set of used HIT Suites will be extended to keep up with progress in computation capabilities and vulnerabilities in the algorithms being used ๐ฅ the whole point is to introduce a new HIT Suite and phase out an old one before it becomes insecure. ngl this is the part that matters: since the 4-bit OGA ID field only permits 15 HIT Suites to be used at the same time (the HIT Suite with ID 0 is reserved), phased-out HIT Suites must be reused at some point. when that happens there's a rollover of the HIT Suite ID, and the next newly introduced HIT Suite starts with a lower HIT Suite index than the previously introduced one. the rollover effectively deprecates the reused HIT Suite ๐ฅ and for a smooth transition, the HIT Suite should be deprecated a considerable time before the HIT Suite index is reused.
since the number of HIT Suites is tightly limited to 16, the HIT Suites must be assigned carefully ๐ซถ so sets of suitable algorithms are grouped together in a HIT Suite.
the HIT Suite of the Responder's HIT determines the RHASH and the hash function used for the HMAC in HIP packets, as well as the signature algorithm family used for generating the HI โจ the list of HIT Suites is defined in Table 10.
Acknowledgments ๐ซถ
the drive to create HIP came together after attending the MALLOC meeting at the 43rd IETF meeting ๐ Baiju Patel and Hilarie Orman really gave the original author, Bob Moskowitz, the assist to get HIP beyond 5 paragraphs of ideas. it matured a lot since the early versions thanks to extensive input from IETFers. most importantly, its design goals are articulated and are different from other efforts in this direction. particular shoutout to the members of the NameSpace Research Group of the IRTF ๐ญ Noel Chiappa gave valuable input at early stages of discussions about identifier handling, and Keith Moore gave the impetus to provide resolvability. Steve Deering provided encouragement to keep working, since a solid proposal can act as a proof of ideas for a research group.
many others contributed too ๐ extensive security tips came from Steve Bellovin. Rob Austein kept the DNS parts on track. Paul Kocher taught Bob Moskowitz how to make the puzzle exchange expensive for the Initiator to respond to, but easy for the Responder to validate. Bill Sommerfeld supplied the Birthday concept, which later evolved into the R1 generation counter to simplify reboot management. Erik Nordmark supplied the CLOSE-mechanism for closing connections. Rodney Thayer and Hugh Daniels provided extensive feedback. in the early times of this document, John Gilmore kept Bob Moskowitz challenged to provide something of value.
during the later stages of this document, when the editing baton was transferred to Pekka Nikander, input from the early implementors was invaluable ๐ without actual implementations, this document would not be on the level it is now.
in the usual IETF fashion, a large number of people contributed to the actual text or ideas ๐ง the list includes Jeff Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Xin Gu, Rene Hummen, Miika Komu, Mika Kousa, Julien Laganier, Andrew McGregor, Jan Melen, Henrik Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka Ylitalo. our apologies to anyone whose name is missing ๐
once the HIP Working Group was founded in early 2004, a number of changes were introduced through the working group process. most notably, the original document was split in two: one containing the base exchange, and the other defining how to use ESP ๐ฆ some modifications to the protocol proposed by Aura, et al. [AUR05] were added at a later stage.
Authors' Addresses ๐ธ
Robert Moskowitz (editor)
HTT Consulting, Oak Park, MI, United States
EMail: rgm@labs.htt-consult.com
Tobias Heer
Hirschmann Automation and Control, Stuttgarter Strasse 45-51, Neckartenzlingen 72654, Germany
EMail: tobias.heer@belden.com
Petri Jokela
Ericsson Research NomadicLab, Jorvas FIN-02420, Finland
Phone: +358 9 299 1
EMail: petri.jokela@nomadiclab.com
Thomas R. Henderson
University of Washington, Campus Box 352500, Seattle, WA, United States
EMail: tomhend@u.washington.edu
๐ฆ where this page comes from
- ietf: rfc7401 2015-04
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms