1 IP Security Protocol Working Group (IPSEC) T. Kivinen, M. Stenberg
2 INTERNET-DRAFT SSH Communications Security
3 draft-ietf-ipsec-nat-t-ike-00.txt A. Huttunen
4 Expires: 10 December 2001 F-Secure Corporation
15 Negotiation of NAT-Traversal in the IKE
19 This document is a submission to the IETF IP Security Protocol
20 (IPSEC) Working Group. Comments are solicited and should be
21 addressed to the working group mailing list (ipsec@lists.tislabs.com)
24 This document is an Internet-Draft and is in full conformance
25 with all provisions of Section 10 of RFC2026.
27 Internet-Drafts are working documents of the Internet Engineering
28 Task Force (IETF), its areas, and its working groups. Note that
29 other groups may also distribute working documents as
32 Internet-Drafts are draft documents valid for a maximum of six
33 months and may be updated, replaced, or obsoleted by other
34 documents at any time. It is inappropriate to use Internet-
35 Drafts as reference material or to cite them other than as
38 The list of current Internet-Drafts can be accessed at
39 http://www.ietf.org/ietf/1id-abstracts.txt
41 The list of Internet-Draft Shadow Directories can be accessed at
42 http://www.ietf.org/shadow.html.
46 This document describes how to detect one or more NATs between IPsec
47 hosts, and how to negotiate the use of UDP encapsulation of the IPsec
48 packets through the NAT boxes in IKE.
58 T. Kivinen, et. al. [page 1]
60 INTERNET-DRAFT 10 June 2001
64 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 2
65 2. Specification of Requirements . . . . . . . . . . . . . . . . . 2
66 3. Phase 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
67 3.1. Detecting support of Nat-Traversal . . . . . . . . . . . . . 2
68 3.2. Detecting presense of NAT . . . . . . . . . . . . . . . . . 3
69 4. Quick Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
70 4.1. Negotiation of the NAT-Traversal encapsulation . . . . . . . 5
71 4.2. Sending the original source address . . . . . . . . . . . . 5
72 5. Security Considerations . . . . . . . . . . . . . . . . . . . . 6
73 6. Intellectual property rights . . . . . . . . . . . . . . . . . . 7
74 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 7
75 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
76 9. Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 7
82 This document is split in two parts. The first part describes what is
83 needed in the IKE phase 1 for the NAT-Traversal support. This includes
84 detecting if the other end supports NAT-Traversal, and detecting if
85 there is one or more NAT along the path from host to host.
87 The second part describes how to negotiate the use of UDP encapsulated
88 IPsec packets in the IKE Quick Mode. It also describes how to transmit
89 the original source address to the other end if needed. The original
90 source address can be used to incrementally update the TCP/IP checksums
91 so that they will match after the NAT transform (The NAT cannot do this,
92 because the TCP/IP checksum is inside the UDP encapsulated IPsec
95 The document [Hutt01] describes the details of the UDP encapsulation and
96 the document [Dixon01] provides background information and motivation of
97 the NAT-Traversal in general.
99 2. Specification of Requirements
101 This document shall use the keywords "MUST", "MUST NOT", "REQUIRED",
102 "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED, "MAY", and
103 "OPTIONAL" to describe requirements. They are to be interpreted as
104 described in [RFC-2119] document.
108 The detection of the support for the NAT-Traversal and detection of the
109 NAT along the path happens in the IKE [RFC-2409] phase 1.
111 3.1. Detecting support of Nat-Traversal
113 The NAT-Traversal capability of the remote host is determined by an
114 exchange of vendor strings; in Phase 1 two first messages, the vendor id
117 T. Kivinen, et. al. [page 2]
119 INTERNET-DRAFT 10 June 2001
121 payload for this specification of NAT-Traversal (MD5 hash of "draft-
122 ietf-ipsec-nat-t-ike-00" - ["4485152d 18b6bbcd 0be8a846 9579ddcc"]) MUST
123 be sent if supported (and it MUST be received by both sides) for the
124 NAT-Traversal probe to continue.
126 3.2. Detecting presense of NAT
128 The purpose of the NAT-D payload is twofold, It not only detects the
129 presence of NAT between two IKE peers, it also detects where the NAT is.
130 The location of the NAT device is important in that the keepalives need
131 to initiate from the peer "behind" the NAT.
133 To detect the NAT between the two hosts, we need to detect if the IP
134 address or the port changes along the path. This is done by sending the
135 hashes of IP address and port of both source and destination addresses
136 from each end to another. When both ends calculate those hashes and get
137 same result they know there is no NAT between. If the hashes do not
138 match, somebody translated the address or port between, meaning we need
139 to do NAT-Traversal to get IPsec packet through.
141 If the sender of the packet does not know his own IP address (in case of
142 multiple interfaces, and implementation don't know which is used to
143 route the packet out), he can include multiple local hashes to the
144 packet (as separate NAT-D payloads). In this case the NAT is detected if
145 and only if none of the hashes match.
147 The hashes are sent as a series of NAT-D (NAT discovery) payloads. Each
148 payload contains one hash, so in case of multiple hashes, multiple NAT-D
149 payloads are sent. In normal case there is only two NAT-D payloads.
151 The NAT-D payloads are included in the third and fourth packet in the
152 main mode and second and third packet in the aggressive mode.
154 The format of the NAT-D packet is
156 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
157 +---------------+---------------+---------------+---------------+
158 | Next Payload | RESERVED | Payload length |
159 +---------------+---------------+---------------+---------------+
160 ~ HASH of the address and port ~
161 +---------------+---------------+---------------+---------------+
163 The payload type for the NAT discovery payload is 130 (XXX CHANGE).
165 The HASH is calculated as follows:
167 HASH = HASH(CKY-I | CKY-R | IP | Port)
169 using the negotiated HASH algorithm. All data inside the HASH is in the
170 network byte-order. The IP is 4 octets for the IPv4 address and 16
171 octets for the IPv6 address. The port number is encoded as 2 octet
172 number in network byte-order. The first NAT-D payload contains the
173 remote ends IP address and port (i.e the destination address of the UDP
176 T. Kivinen, et. al. [page 3]
178 INTERNET-DRAFT 10 June 2001
180 packet). The rest of the NAT-D payloads contain possible local end IP
181 addresses and ports (i.e all possible source addresses of the UDP
184 If there is no NAT between then the first NAT-D payload should match one
185 of the local NAT-D packet (i.e the local NAT-D payloads this host is
186 sending out), and the one of the other NAT-D payloads must match the
187 remote ends IP address and port. If the first check fails (i.e first
188 NAT-D payload does not match any of the local IP addresses and ports),
189 then it means that there is dynamic NAT between, and this end should
190 start sending keepalives as defined in the [Hutt01].
192 The CKY-I and CKY-R are the initiator and responder cookies, and they
193 are added to the hash to make precomputation attacks for the IP address
196 An example of phase 1 exchange using NAT-Traversal in main mode
197 (authentication with signatures) is:
200 ------------ ------------
203 HDR, KE, Ni, NAT-D, NAT-D -->
204 <-- HDR, KE, Nr, NAT-D, NAT-D
205 HDR*, IDii, [CERT, ] SIG_I -->
206 <-- HDR*, IDir, [ CERT, ], SIG_R
208 An example of phase 1 exchange using NAT-Traversal in aggressive mode
209 (authentication with signatures) is:
212 ------------ ------------
213 HDR, SA, KE, Ni, IDii, VID -->
214 <-- HDR, SA, KE, Nr, IDir, [CERT, ],
215 VID, NAT-D, NAT-D, SIG_R
216 HDR*, [CERT, ], NAT-D, NAT-D,
221 After the Phase 1 both ends know if there is a NAT present between. The
222 final decision of using the NAT-Traversal is left to the quick mode. The
223 use of NAT-Traversal is negotiated inside the SA payloads of the quick
224 mode. In the quick mode both ends can also send the original source
225 addresses of the IPsec packets (in case of the transport mode) to the
226 other, end so the other end has possibility to fix the TCP/IP checksum
227 field after the NAT transform.
229 This sending of the original source address is optional, and it is not
230 useful in the UDP-Encapsulated-Tunnel mode, as there is going to be
231 proper IP header inside the UDP-Encapsulated packet. In case of only
232 UDP-Encapsulated-Tunnel mode is negotiation then both ends SHOULD NOT
235 T. Kivinen, et. al. [page 4]
237 INTERNET-DRAFT 10 June 2001
239 send original source address.
241 It also might be unnecessary in the transport mode if the other end can
242 turn off TCP/IP checksum verification. If the sending end knows (for
243 example from the vendor id payload) that the other end can turn off
244 TCP/IP checksum verification, he MAY leave the original source address
245 payload away. Otherwise he SHOULD send the original source address.
247 4.1. Negotiation of the NAT-Traversal encapsulation
249 The negoation of the NAT-Traversal happens by adding two new
250 encapsulation modes. These encapsulation modes are:
252 UDP-Encapsulated-Tunnel 61443 (XXX CHANGE)
253 UDP-Encapsulated-Transport 61444 (XXX CHANGE)
255 It is not normally useful to propose both normal tunnel or transport
256 mode and UDP-Encapsulated modes. If there is a NAT box between normal
257 tunnel or transport encapsulations may not work, and if there is no NAT
258 box between, there is no point of wasting bandwidth by adding UDP
259 encapsulation of packets. Because of this initiator SHOULD NOT include
260 both normal tunnel or transport mode and UDP-Encapsulated-Tunnel or UDP-
261 Encapsulated-Transport in its proposals.
263 4.2. Sending the original source address
265 In case of transport mode both ends SHOULD send the original source
266 address to the other end. For the tunnel mode both ends SHOULD NOT send
267 original source address to the other end. In case of AH is negotiated
268 each end MUST send original source address.
270 The original source address of packets put to this transport mode IPsec
271 SA is sent to other end using NAT-OA (NAT Original Address) payload.
273 The NAT-OA payloads are sent inside the first and second packets of the
274 quick mode. The initiator SHOULD send the payload if it proposes any
275 UDP-Encapsulated-Transport mode and the responder SHOULD send the
276 payload only if it selected UDP-Encapsulated-Transport mode. I.e it is
277 possible that initiator send the NAT-OA payload, but proposes both UDP-
278 Encapsulated transport and tunnel mode, and then the responder selectes
279 the UDP-Encapsulated tunnel mode and do not send NAT-OA payload back.
281 A peer MUST NOT fail a negotiation if it does not receive a NAT-OA
282 payload if the NAT-OA payload only would contain redundant information.
283 I.e. only the machine(s) that are actually behind the NAT need to send
284 the NAT-OA payload. A machine with a public, non-changing IP address
285 doesn't need to send the NAT-OA payload.
287 In case of AH negotiation initiator MUST send NAT-OA payload, and the
288 responder MUST reply to it if it selected proposal including AH.
290 The format of the NAT-OA packet is
294 T. Kivinen, et. al. [page 5]
296 INTERNET-DRAFT 10 June 2001
298 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
299 +---------------+---------------+---------------+---------------+
300 | Next Payload | RESERVED | Payload length |
301 +---------------+---------------+---------------+---------------+
302 | ID Type | RESERVED | RESERVED |
303 +---------------+---------------+---------------+---------------+
304 | IPv4 (4 octets) or IPv6 address (16 octets) |
305 +---------------+---------------+---------------+---------------+
307 The payload type for the NAT discovery payload is 131 (XXX CHANGE).
309 The ID type is defined in the [RFC-2407]. Only ID_IPV4_ADDR and
310 ID_IPV6_ADDR types are allowed. The two reserved fields after the ID
313 An example of quick mode using NAT-OA payloads is:
316 ------------ ------------
317 HDR*, HASH(1), SA, Ni, [, KE]
318 [, IDci, IDcr ] [, NAT-OA] -->
319 <-- HDR*, HASH(2), SA, Nr, [, KE]
320 [, IDci, IDcr ] [, NAT-OA]
323 5. Security Considerations
325 Whenever changes to some fundamental parts of a security protocol are
326 proposed, the examination of security implications cannot be skipped.
327 Therefore, here are some observations on the effects, and whether or not
328 these effects matter. This section will be expanded further in future
329 versions of this draft.
331 o IKE probe reveals NAT-Traversal support to everyone. This should not
334 o The value of authentication mechanisms based on IP addresses
335 disappears once NATs are in the picture. That is not necessarily a
336 bad thing (for any real security, other authentication measures than
337 IP addresses should be used). This means that pre-shared-keys
338 authentication cannot be used with the main mode without group shared
339 keys for everybody behind the NAT box, which is huge security risk.
341 o As the internal address space is only 32 bits, and it is usually very
342 sparce, it might be possible for the attacker to find out the
343 internal address used behind the NAT box by trying all possible IP-
344 addresses and trying to find the matching hash. The port numbers are
345 normally fixed to 500, and the other ends IP address is usually also
346 known. This limits the hash calculations down to 2^32. If educated
347 guess of use of private address space is done, then the number of
348 hash calculations needed to find out the internal IP address goes
349 down to the 2^24 + 2 * (2^16).
353 T. Kivinen, et. al. [page 6]
355 INTERNET-DRAFT 10 June 2001
357 o The NAT-D payloads nor the Vendor ID payloads are not authenticated
358 at all in the main mode nor in the aggressive mode. This means that
359 attacker can remove those payloads, modify them or add them. By
360 removing or adding them the attacker can cause Denial Of Service
361 attacks. By modifying the NAT-D packets the attacker can cause both
362 ends to use UDP-Encapsulated modes instead of directly using tunnel
363 or transport mode, thus wasting some bandwidth.
365 o The sending of the original source address in the Quick Mode releveas
366 the internal ip address behind the NAT to the other end. In this case
367 we have already authenticated the other end, and sending of the
368 original source address is only needed in transport mode.
370 6. Intellectual property rights
372 The IETF has been notified of intellectual property rights claimed in
373 regard to some or all of the specification contained in this document.
374 For more information consult the online list of claimed rights.
376 SSH Communications Security Corp has notified the working group of one
377 or more patents or patent applications that may be relevant to this
378 internet-draft. SSH Communications Security Corp has already given a
379 licence for those patents to the IETF. For more information consult the
380 online list of claimed rights.
384 Thanks to Tatu Ylonen, Santeri Paavolainen, and Joern Sierwald who
385 contributed to the drafts used as base for this document.
389 [RFC-2409] Harkins D., Carrel D., "The Internet Key Exchange (IKE)",
392 [RFC-2407] Piper D., "The Internet IP Security Domain Of Interpretation
393 for ISAKMP", November 1998
395 [RFC-2119] Bradner, S., "Key words for use in RFCs to indicate
396 Requirement Levels", March 1997
398 [Hutt01] Huttunen, A. et. al., "UDP Encapsulation of IPsec Packets",
399 draft-ietf-ipsec-udp-encaps-00.txt, June 2001
401 [Dixon01] Dixon, W. et. al., "IPSec over NAT Justification for UDP
402 Encapsulation", draft-ietf-ipsec-udp-encaps-justification-00.txt, June
405 9. Authors' Addresses
408 SSH Communications Security Corp
412 T. Kivinen, et. al. [page 7]
414 INTERNET-DRAFT 10 June 2001
418 E-mail: kivinen@ssh.fi
421 SSH Communications Security Corp
425 E-mail: mstenber@ssh.com
432 E-mail: Ari.Huttunen@F-Secure.com
438 E-mail: wdixon@microsoft.com
444 E-mail: briansw@microsoft.com
451 E-mail: vvolpe@cisco.com
457 ldiburro@nortelnetworks.com
470 T. Kivinen, et. al. [page 8]