idnits 2.17.1 draft-ietf-cbor-network-addresses-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (9 March 2021) is 1143 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 163 == Unused Reference: 'BCP14' is defined on line 232, but no explicit reference was found in the text -- Duplicate reference: RFC8174, mentioned in 'RFC8174', was also mentioned in 'BCP14'. Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CBOR Working Group M. Richardson 3 Internet-Draft Sandelman Software Works 4 Intended status: Standards Track 9 March 2021 5 Expires: 10 September 2021 7 CBOR tags for IPv4 and IPv6 addresses and prefixes 8 draft-ietf-cbor-network-addresses-02 10 Abstract 12 This document describes two CBOR Tags to be used with IPv4 and IPv6 13 addresses and prefixes. 15 RFC-EDITOR-please remove: This work is tracked at 16 https://github.com/mcr/cbor-network-address.git 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on 10 September 2021. 35 Copyright Notice 37 Copyright (c) 2021 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 42 license-info) in effect on the date of publication of this document. 43 Please review these documents carefully, as they describe your rights 44 and restrictions with respect to this document. Code Components 45 extracted from this document must include Simplified BSD License text 46 as described in Section 4.e of the Trust Legal Provisions and are 47 provided without warranty as described in the Simplified BSD License. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 52 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 2 53 3. Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . 2 54 3.1. IPv6 . . . . . . . . . . . . . . . . . . . . . . . . . . 2 55 3.2. IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . 3 56 4. Encoder Consideration for prefixes . . . . . . . . . . . . . 3 57 5. Decoder Considerations for prefixes . . . . . . . . . . . . . 4 58 6. Security Considerations . . . . . . . . . . . . . . . . . . . 5 59 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 60 7.1. TBD1 - IPv6 . . . . . . . . . . . . . . . . . . . . . . . 5 61 7.2. TBD2 - IPv4 . . . . . . . . . . . . . . . . . . . . . . . 5 62 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5 63 9. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 5 64 10. Normative References . . . . . . . . . . . . . . . . . . . . 5 65 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 6 67 1. Introduction 69 [RFC8949] defines a number of CBOR Tags for common items. 71 Not included are ones to indicate if the item is an IPv4 or IPv6 72 address, or if it is an address plus prefix length. This document 73 defines them. 75 2. Terminology 77 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 78 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 79 "OPTIONAL" in this document are to be interpreted as described in 80 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 81 capitals, as shown here. 83 3. Protocol 85 These tags can applied to byte strings to represent a single address. 87 When applied to an array, the represent a CIDR-style prefix. When a 88 byte string (without prefix) appears in a context where a prefix is 89 expected, then it is to be assumed that all bits are relevant. That 90 is, for IPv4, a /32 is implied, and for IPv6, a /128 is implied. 92 3.1. IPv6 94 IANA has allocated tag TBD1 for IPv6 uses. 96 An IPv6 address is to be encoded as a sixteen-byte byte string 97 ([RFC8949] section, 3.1, major type 2), prefixed with tag TBD1. 99 An IPv6 prefix, such as 2001:db8:1234::/48 is to be encoded as a two 100 element array, with the length of the prefix first. Trailing zero 101 octets MUST be omitted. 103 For example: 105 TBD1([ 48, h'20010db81234']) 107 3.2. IPv4 109 IANA has allocated tag TBD2 for IPv4 uses. 111 An IPv4 address is to be encoded as a four-byte byte string 112 ([RFC8949] section, 3.1, major type 2), prefixed with tag TBD2. 114 An IPv4 prefix, such as 192.0.2.1/24 is to be encoded as a two 115 element array, with the length of the prefix first. Trailing zero 116 octets MUST be omitted. 118 For example: 120 TBD2([ 24, h'C00002']) 122 4. Encoder Consideration for prefixes 124 An encoder may omit as many right-hand (trailing) bytes which are all 125 zero as it wishes. 127 There is no relationship between the number of bytes omitted and the 128 prefix length. For instance, the prefix 2001:db8::/64 is optimally 129 encoded as: 131 TBD1([64, h'20010db8']) 133 An encoder MUST take care to set all trailing bits to zero. While 134 decoders are expected to ignore them, such garbage entities could be 135 used as a covert channel, or may reveal the state of what would 136 otherewise be private memory contents. So for example, 137 2001:db8:1230::/44 MUST be encoded as: 139 TBD1([44, h'20010db81230']) 141 even though variations like: 143 TBD1([44, h'20010db81233']) WRONG 144 TBD1([45, h'20010db8123f']) WRONG 146 would be parsed in the exact same way. 148 The same considerations apply to IPv4 prefixes. 150 5. Decoder Considerations for prefixes 152 A decoder MUST consider all bits to the right of the prefix length to 153 be zero. 155 A decoder MUST handle the case where a prefix length specifies that 156 more bits are relevant than are actually present in the byte-string. 157 As a pathological case, ::/128 can be encoded as 159 TBD1([0, h'']) 161 (EDNOTE: do we want to support: 163 [0] 165 or 167 [0, null] 169 (EDNOTE: what if the array has more than 2 members? Is this a 170 convert channel, or is this a possible extension point?) 172 A recommendation for implementation is to first create an array of 16 173 (or 4) bytes in size, set it all to zero. 175 Then looking at the length of the included byte-string, and of the 176 prefix-length, rounded up to the next multiple of 8, and taking 177 whichever is smaller, copy that many bytes from the byte-string into 178 the array. 180 Finally, looking at the last three bits of the prefix-length (that 181 is, the prefix-length modulo 8), use a static array of 8 values to 182 force the lower bits, non-relevant bits to zero. 184 A particularly paranoid decoder could examine the lower non-relevant 185 bits to determine if they are non-zero, and reject the prefix. This 186 would detect non-compliant encoders, or a possible covert channel. 188 6. Security Considerations 190 Identifying which byte sequences in a protocol are addresses may 191 allow an attacker or eavesdropper to better understand what parts of 192 a packet to attack. 194 Reading the relevant RFC may provide more information, so it would 195 seem that any additional security that was provided by not being able 196 to identify what are IP addresses falls into the security by 197 obscurity category. 199 The right-hand bits of the prefix, after the prefix-length, are 200 ignored by this protocol. A malicious party could use them to 201 transmit covert data in a way that would not affect the primary use 202 of this encoding. Such abuse would be detected by examination of the 203 raw protocol bytes. Users of this encoding should be aware of this 204 possibility. 206 7. IANA Considerations 208 IANA is asked to allocate two tags from the Specification Required 209 area of the Concise Binary Object Representation (CBOR) Tags, in the 210 ("1+1") area. 212 7.1. TBD1 - IPv6 214 Data Item: byte string and array 215 Semantics: IPv6 or [prefixlen,IPv6] 217 7.2. TBD2 - IPv4 219 Data Item: byte string and array 220 Semantics: IPv4 or [prefixlen,IPv4] 222 8. Acknowledgements 224 none yet 226 9. Changelog 228 * 01 added security considerations about covert channel 230 10. Normative References 232 [BCP14] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 233 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 234 May 2017, . 236 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 237 Requirement Levels", BCP 14, RFC 2119, 238 DOI 10.17487/RFC2119, March 1997, 239 . 241 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 242 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 243 May 2017, . 245 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 246 Representation (CBOR)", STD 94, RFC 8949, 247 DOI 10.17487/RFC8949, December 2020, 248 . 250 Author's Address 252 Michael Richardson 253 Sandelman Software Works 255 Email: mcr+ietf@sandelman.ca