idnits 2.17.1 draft-ietf-cbor-network-addresses-01.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 (7 March 2021) is 1145 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 159 == Unused Reference: 'BCP14' is defined on line 228, 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 7 March 2021 5 Expires: 8 September 2021 7 CBOR tags for IPv4 and IPv6 addresses and prefixes 8 draft-ietf-cbor-network-addresses-01 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 8 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 . . . . . . . . . . . . . . . . . . . 4 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 up to sixteen-byte byte string 97 ([RFC8949] section, 3.1, major type 2), prefixed with tag TBD1. 98 Trailing zero octets MAY be omitted. 100 An IPv6 prefix, such as 2001:db8:1234::/48 is to be encoded as a two 101 element array, with the length of the prefix first: 103 TBD1([ 48, h'20010db81234']) 105 3.2. IPv4 107 IANA has allocated tag TBD2 for IPv4 uses. 109 An IPv4 address is to be encoded as a four-byte byte string 110 ([RFC8949] section, 3.1, major type 2), prefixed with tag TBD2. 111 Trailing zero octets MAY be omitted. 113 An IPv4 prefix, such as 192.0.2.1/24 is to be encoded as a two 114 element array, with the length of the prefix first: 116 TBD2([ 24, h'C0000201']) 118 4. Encoder Consideration for prefixes 120 An encoder may omit as many right-hand (trailing) bytes which are all 121 zero as it wishes. 123 There is no relationship between the number of bytes omitted and the 124 prefix length. For instance, the prefix 2001:db8::/64 is optimally 125 encoded as: 127 TBD1([64, h'20010db8']) 129 An encoder MUST take care to set all trailing bits to zero. While 130 decoders are expected to ignore them, such garbage entities could be 131 used as a covert channel, or may reveal the state of what would 132 otherewise be private memory contents. So for example, 133 2001:db8:1230::/44 MUST be encoded as: 135 TBD1([44, h'20010db81230']) 137 even though variations like: 139 TBD1([44, h'20010db81233']) WRONG 140 TBD1([45, h'20010db8123f']) WRONG 142 would be parsed in the exact same way. 144 The same considerations apply to IPv4 prefixes. 146 5. Decoder Considerations for prefixes 148 A decoder MUST consider all bits to the right of the prefix length to 149 be zero. 151 A decoder MUST handle the case where a prefix length specifies that 152 more bits are relevant than are actually present in the byte-string. 153 As a pathological case, ::/128 can be encoded as 155 TBD1([0, h'']) 157 (EDNOTE: do we want to support: 159 [0] 161 or 163 [0, null] 165 (EDNOTE: what if the array has more than 2 members? Is this a 166 convert channel, or is this a possible extension point?) 168 A recommendation for implementation is to first create an array of 16 169 (or 4) bytes in size, set it all to zero. 171 Then looking at the length of the included byte-string, and of the 172 prefix-length, rounded up to the next multiple of 8, and taking 173 whichever is smaller, copy that many bytes from the byte-string into 174 the array. 176 Finally, looking at the last three bits of the prefix-length (that 177 is, the prefix-length modulo 8), use a static array of 8 values to 178 force the lower bits, non-relevant bits to zero. 180 A particularly paranoid decoder could examine the lower non-relevant 181 bits to determine if they are non-zero, and reject the prefix. This 182 would detect non-compliant encoders, or a possible covert channel. 184 6. Security Considerations 186 Identifying which byte sequences in a protocol are addresses may 187 allow an attacker or eavesdropper to better understand what parts of 188 a packet to attack. 190 Reading the relevant RFC may provide more information, so it would 191 seem that any additional security that was provided by not being able 192 to identify what are IP addresses falls into the security by 193 obscurity category. 195 The right-hand bits of the prefix, after the prefix-length, are 196 ignored by this protocol. A malicious party could use them to 197 transmit covert data in a way that would not affect the primary use 198 of this encoding. Such abuse would be detected by examination of the 199 raw protocol bytes. Users of this encoding should be aware of this 200 possibility. 202 7. IANA Considerations 204 IANA is asked to allocate two tags from the Specification Required 205 area of the Concise Binary Object Representation (CBOR) Tags, in the 206 ("1+1") area. 208 7.1. TBD1 - IPv6 210 Data Item: byte string and array 211 Semantics: IPv6 or [prefixlen,IPv6] 213 7.2. TBD2 - IPv4 215 Data Item: byte string and array 216 Semantics: IPv4 or [prefixlen,IPv4] 218 8. Acknowledgements 220 none yet 222 9. Changelog 224 * 01 added security considerations about covert channel 226 10. Normative References 228 [BCP14] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 229 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 230 May 2017, . 232 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 233 Requirement Levels", BCP 14, RFC 2119, 234 DOI 10.17487/RFC2119, March 1997, 235 . 237 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 238 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 239 May 2017, . 241 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 242 Representation (CBOR)", STD 94, RFC 8949, 243 DOI 10.17487/RFC8949, December 2020, 244 . 246 Author's Address 248 Michael Richardson 249 Sandelman Software Works 251 Email: mcr+ietf@sandelman.ca