idnits 2.17.1 draft-ietf-cbor-network-addresses-03.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 (25 March 2021) is 1128 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) == Unused Reference: 'BCP14' is defined on line 222, 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 (==), 2 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 25 March 2021 5 Expires: 26 September 2021 7 CBOR tags for IPv4 and IPv6 addresses and prefixes 8 draft-ietf-cbor-network-addresses-03 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 26 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. Tag 54 - IPv6 . . . . . . . . . . . . . . . . . . . . . . 5 61 7.2. Tag 52 - 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 54 for IPv6 uses. (Note that this is the 95 ASCII code for '6') 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(54). 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 54([ 48, h'20010db81234']) 107 3.2. IPv4 109 IANA has allocated tag 54 for IPv4 uses. (Note that this is the 110 ASCII code for '4') 112 An IPv4 address is to be encoded as a four-byte byte string 113 ([RFC8949] section, 3.1, major type 2), prefixed with Tag(52). 115 An IPv4 prefix, such as 192.0.2.1/24 is to be encoded as a two 116 element array, with the length of the prefix first. Trailing zero 117 octets MUST be omitted. 119 For example: 121 52([ 24, h'C00002']) 123 4. Encoder Consideration for prefixes 125 An encoder may omit as many right-hand (trailing) bytes which are all 126 zero as it wishes. 128 There is no relationship between the number of bytes omitted and the 129 prefix length. For instance, the prefix 2001:db8::/64 is optimally 130 encoded as: 132 54([64, h'20010db8']) 134 An encoder MUST take care to set all trailing bits to zero. While 135 decoders are expected to ignore them, such garbage entities could be 136 used as a covert channel, or may reveal the state of what would 137 otherewise be private memory contents. So for example, 138 2001:db8:1230::/44 MUST be encoded as: 140 52([44, h'20010db81230']) 142 even though variations like: 144 54([44, h'20010db81233']) WRONG 145 54([45, h'20010db8123f']) WRONG 147 would be parsed in the exact same way. 149 The same considerations apply to IPv4 prefixes. 151 5. Decoder Considerations for prefixes 153 A decoder MUST consider all bits to the right of the prefix length to 154 be zero. 156 A decoder MUST handle the case where a prefix length specifies that 157 more bits are relevant than are actually present in the byte-string. 158 As a pathological case, ::/128 can be encoded as 160 54([128, h'']) 162 A recommendation for implementation is to first create an array of 16 163 (or 4) bytes in size, set it all to zero. 165 Then looking at the length of the included byte-string, and of the 166 prefix-length, rounded up to the next multiple of 8, and taking 167 whichever is smaller, copy that many bytes from the byte-string into 168 the array. 170 Finally, looking at the last three bits of the prefix-length (that 171 is, the prefix-length modulo 8), use a static array of 8 values to 172 force the lower bits, non-relevant bits to zero. 174 A particularly paranoid decoder could examine the lower non-relevant 175 bits to determine if they are non-zero, and reject the prefix. This 176 would detect non-compliant encoders, or a possible covert channel. 178 6. Security Considerations 180 Identifying which byte sequences in a protocol are addresses may 181 allow an attacker or eavesdropper to better understand what parts of 182 a packet to attack. 184 Reading the relevant RFC may provide more information, so it would 185 seem that any additional security that was provided by not being able 186 to identify what are IP addresses falls into the security by 187 obscurity category. 189 The right-hand bits of the prefix, after the prefix-length, are 190 ignored by this protocol. A malicious party could use them to 191 transmit covert data in a way that would not affect the primary use 192 of this encoding. Such abuse would be detected by examination of the 193 raw protocol bytes. Users of this encoding should be aware of this 194 possibility. 196 7. IANA Considerations 198 IANA is asked to allocate two tags from the Specification Required 199 area of the Concise Binary Object Representation (CBOR) Tags, in the 200 ("1+1") area. 202 7.1. Tag 54 - IPv6 204 Data Item: byte string and array 205 Semantics: IPv6 or [prefixlen,IPv6] 207 7.2. Tag 52 - IPv4 209 Data Item: byte string and array 210 Semantics: IPv4 or [prefixlen,IPv4] 212 8. Acknowledgements 214 none yet 216 9. Changelog 218 * 01 added security considerations about covert channel 220 10. Normative References 222 [BCP14] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 223 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 224 May 2017, . 226 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 227 Requirement Levels", BCP 14, RFC 2119, 228 DOI 10.17487/RFC2119, March 1997, 229 . 231 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 232 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 233 May 2017, . 235 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 236 Representation (CBOR)", STD 94, RFC 8949, 237 DOI 10.17487/RFC8949, December 2020, 238 . 240 Author's Address 242 Michael Richardson 243 Sandelman Software Works 245 Email: mcr+ietf@sandelman.ca