<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" category="std" consensus="true" docName="draft-ietf-lisp-sec-29" number="9303" ipr="trust200902" obsoletes="" updates="" xml:lang="en" tocInclude="true" tocDepth="3" symRefs="true" sortRefs="true" version="3">

  <!-- xml2rfc v2v3 conversion 3.13.0 -->
  <front>
    <title abbrev="LISP-SEC">Locator/ID Separation Protocol Security (LISP-SEC)</title>
    <seriesInfo name="RFC" value="9303"/>
    <author fullname="Fabio Maino" initials="F" surname="Maino">
      <organization>Cisco Systems</organization>
      <address>
        <postal>
          <street></street>
          <city>San Jose</city>
          <code></code>
          <region>CA</region>
          <country>United States of America</country>
        </postal>
        <email>fmaino@cisco.com</email>
      </address>
    </author>
    <author fullname="Vina Ermagan" initials="V" surname="Ermagan">
      <organization>Google, Inc.</organization>
      <address>
        <postal>
          <street>1600 Amphitheatre Parkway</street>
          <city>Mountain View</city>
          <region>CA</region>
	  <code>94043</code>
          <country>United States of America</country>
        </postal>
        <email>ermagan@gmail.com</email>
      </address>
    </author>
    <author fullname="Albert Cabellos" initials="A" surname="Cabellos">
      <organization>Universitat Politecnica de Catalunya</organization>
      <address>
        <postal>
          <street>c/ Jordi Girona s/n</street>
          <city>Barcelona</city>
          <code>08034</code>
          <region/>
          <country>Spain</country>
        </postal>
        <email>acabello@ac.upc.edu</email>
      </address>
    </author>
    <author fullname="Damien Saucez" initials="D" surname="Saucez">
      <organization>Inria</organization>
      <address>
        <postal>
          <street>2004 route des Lucioles - BP 93</street>
          <city>Sophia Antipolis</city>
          <code/>
          <region/>
          <country>France</country>
        </postal>
        <email>damien.saucez@inria.fr</email>
      </address>
    </author>
    <date year="2022" month="October"/>
    <area>rtg</area>
    <workgroup>lisp</workgroup>
    <keyword>LISP</keyword>
    <keyword>deployment</keyword>
    <abstract>
      <t>This memo specifies Locator/ID Separation Protocol Security (LISP-SEC), a set of security mechanisms
      that provides origin authentication, integrity, and anti-replay protection to the 
      LISP's Endpoint-ID-to-Routing-Locator (EID-to-RLOC) mapping data conveyed via the mapping lookup process.
      LISP-SEC also enables verification of authorization on EID-Prefix claims
      in Map-Reply messages.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="default">
      <name>Introduction</name>
      <t>The Locator/ID Separation Protocol (LISP) <xref target="RFC9300" format="default"/> <xref target="RFC9301" format="default"/> is a network-layer-based protocol
      that enables separation of IP addresses into two new numbering spaces:
      Endpoint Identifiers (EIDs) and Routing Locators (RLOCs). EID-to-RLOC
      mappings are stored in a database and the LISP Mapping System, and they are made
      available via the Map-Request/Map-Reply lookup process. If these
      EID-to-RLOC mappings, carried through Map-Reply messages, are
      transmitted without integrity protection, an adversary can manipulate
      them and hijack the communication, impersonate the requested EID, or
      mount Denial-of-Service (DoS) or Distributed Denial-of-Service (DDoS) attacks. Also,
      if the Map-Reply message is transported unauthenticated, an adversarial
      LISP entity can overclaim an EID-Prefix and maliciously redirect traffic. The LISP-SEC threat model,
      described in <xref target="threat-model" format="default"/>, is built on top of the LISP
      threat model defined in <xref target="RFC7835" format="default"/>, which includes a
      detailed description of an "overclaiming" attack.</t>
      <t>This memo specifies LISP-SEC, a set of security mechanisms that
      provides origin authentication, integrity, and anti-replay protection to
      LISP's EID-to-RLOC mapping data conveyed via the mapping lookup process.
      LISP-SEC also enables verification of authorization on EID-Prefix claims
      in Map-Reply messages, ensuring that the sender of a Map-Reply that
      provides the location for a given EID-Prefix is entitled to do so
      according to the EID-Prefix registered in the associated Map-Server.
      Map-Register/Map-Notify security, including the right for a LISP entity
      to register an EID-Prefix or to claim presence at an RLOC, is out of the
      scope of LISP-SEC, as those protocols are protected by the security
      mechanisms specified in <xref target="RFC9301" format="default"/>.
      However, LISP-SEC extends the Map-Register message to allow an Ingress Tunnel
      Router (ITR) to
      downgrade to non-LISP-SEC Map-Requests. Additional security
      considerations are described in <xref target="security"/>.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Requirements Notation</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>",
    "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>", "<bcp14>MAY</bcp14>", and
    "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described in  BCP 14
    <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/> when, and only when, they
    appear in all capitals, as shown here.
      </t>
    </section>
    <!-- Requirements Notation -->

    <section anchor="terms" numbered="true" toc="default">
      <name>Definitions of Terms</name>
      <dl newline="false">
        <dt>One-Time Key (OTK):</dt>
	<dd>An ephemeral randomly generated key that must
          be used for a single Map-Request/Map-Reply exchange.</dd>
          <dt>ITR One-Time Key (ITR-OTK):</dt>
	  <dd>The One-Time Key generated at the
          Ingress Tunnel Router (ITR).</dd>
          <dt>MS One-Time Key (MS-OTK):</dt>
	  <dd>The One-Time Key generated at the
          Map-Server.</dd>
          <dt>Authentication Data (AD):</dt>
	  <dd>Metadata that is included either in a
          LISP Encapsulated Control Message (ECM) header as defined in <xref
	  target="RFC9301" format="default"/>, or in a Map-Reply message to
          support confidentiality, integrity protection, and verification of
          EID-Prefix authorization.</dd>
          <dt>OTK Authentication Data (OTK-AD):</dt>
	  <dd>The portion of ECM
          Authentication Data that contains a One-Time Key.</dd>
          <dt>EID Authentication Data (EID-AD):</dt>
	  <dd>The portion of ECM and
          Map-Reply Authentication Data used for verification of EID-Prefix
          authorization.</dd>
          <dt>Packet Authentication Data (PKT-AD):</dt>
	  <dd>The portion of Map-Reply
          Authentication Data used to protect the integrity of the Map-Reply
          message.</dd>
      </dl>
      <t>For definitions of other terms, notably Map-Request, Map-Reply,
      Ingress Tunnel Router (ITR), Egress Tunnel Router (ETR), Map-Server
      (MS), and Map-Resolver (MR), please consult the LISP specification <xref target="RFC9301" format="default"/>.</t>
    </section>
    <section anchor="threat-model" numbered="true" toc="default">
      <name>LISP-SEC Threat Model</name>
      <t>LISP-SEC addresses the control plane threats, described in Sections
      <xref target="RFC7835" section="3.7" sectionFormat="bare"/> and 
      <xref target="RFC7835" section="3.8" sectionFormat="bare"/> of <xref
      target="RFC7835" format="default"/>, that target EID-to-RLOC
      mappings, including manipulations of Map-Request and Map-Reply messages
      and malicious ETR EID-Prefix overclaiming. LISP-SEC makes two main
      assumptions: (1) the LISP Mapping System is expected to deliver a
      Map-Request message to their intended destination ETR as identified by
      the EID, and (2) no on-path attack can be mounted
      within the LISP Mapping System. How the Mapping System is protected from
      on-path attacks depends on the particular Mapping System used and is
      out of the scope of this memo. Furthermore, while LISP-SEC enables
      detection of EID-Prefix overclaiming attacks, it assumes that
      Map-Servers can verify the EID-Prefix authorization at registration time.
      </t>
      <t>According to the threat model described in <xref target="RFC7835" format="default"/>,
      LISP-SEC assumes that any kind of attack, including on-path attacks, can be
      mounted outside of the boundaries of the LISP Mapping System. An on-path
      attacker outside of the LISP Mapping System can, for example, hijack
      Map-Request and Map-Reply messages, spoofing the identity of a LISP
      node. Another example of an on-path attack, called an overclaiming attack, can
      be mounted by a malicious ETR by overclaiming
      the EID-Prefixes for which it is authoritative. In this way, the ETR can
      maliciously redirect traffic.</t>
    </section>
    <section anchor="operations" numbered="true" toc="default">
      <name>Protocol Operations</name>
      <t>The goal of the security mechanisms defined in <xref target="RFC9301" format="default"/> is to prevent unauthorized insertion
      of mapping data by providing origin authentication and integrity
      protection for the Map-Register and by using the nonce to detect an
      unsolicited Map-Reply sent by off-path attackers.</t>
      <t>LISP-SEC builds on top of the security mechanisms defined in <xref target="RFC9301" format="default"/> to address the threats described in
      <xref target="threat-model" format="default"/> by leveraging the trust relationships
      existing among the LISP entities <xref target="RFC9301" format="default"/> participating in the exchange of the Map-Request/Map-Reply messages.
      Those trust relationships (see also <xref target="security" format="default"/> and <xref target="RFC9301" format="default"/>) are used to securely distribute, as described in <xref target="wrap" format="default"/>, a per-message One-Time Key (OTK) that provides origin authentication, integrity, and anti-replay protection to mapping data conveyed via the
      mapping lookup process and that effectively prevents overclaiming
      attacks. The processing of security parameters during the
      Map-Request/Map-Reply exchange is as follows:</t>
      <ul spacing="normal">
        <li>Per each Map-Request message, a new ITR-OTK is generated and
          stored at the ITR and is securely transported to the Map-Server.</li>
        <li>The Map-Server uses the ITR-OTK to compute a Hashed Message Authentication Code (HMAC) <xref target="RFC2104" format="default"/> that protects
          the integrity of the mapping data known to the Map-Server to prevent
          overclaiming attacks. The Map-Server also derives a new OTK, the
          MS-OTK, that is passed to the ETR by applying a Key Derivation
          Function (KDF) (e.g., <xref target="RFC5869" format="default"/>) to the ITR-OTK.</li>
        <li>The ETR uses the MS-OTK to compute an HMAC that protects the
          integrity of the Map-Reply sent to the ITR.</li>
        <li>Finally, the ITR uses the stored ITR-OTK to verify the integrity
          of the mapping data provided by both the Map-Server and the ETR, and
          to verify that no overclaiming attacks were mounted along the path
          between the Map-Server and the ITR.</li>
      </ul>
      <t><xref target="encap" format="default"/> provides the detailed description of the
      LISP-SEC control messages and their processing, while the rest of this
      section describes the flow of LISP protocol operations at each entity
      involved in the Map-Request/Map-Reply exchange:</t>
      <ol spacing="normal" type="1">
	<li>The ITR, upon needing to transmit a Map-Request message,
        generates and stores an OTK (ITR-OTK). This ITR-OTK is encrypted and
	included into the Encapsulated Control Message (ECM) that contains the
	Map-Request sent to the Map-Resolver. </li>
        <li>The Map-Resolver decapsulates the ECM, decrypts the
          ITR-OTK (if needed), and forwards through the Mapping System the
          received Map-Request and the ITR-OTK, as part of a new ECM.
          The LISP Mapping System delivers the ECM to the appropriate
          Map-Server, as identified by the EID destination address of the
          Map-Request. </li>
        <li>The Map-Server is configured with the location mappings and
          policy information for the ETR responsible for the EID destination
          address. Using this preconfigured information, the Map-Server, after
          the decapsulation of the ECM, finds the longest-match
          EID-Prefix that covers the requested EID in the received
          Map-Request. The Map-Server adds this EID-Prefix, together with an
          HMAC computed using the ITR-OTK, to a new ECM
          that contains the received Map-Request.</li>
        <li>The Map-Server derives a new OTK, the MS-OTK, by applying a KDF to the ITR-OTK. This MS-OTK is included in
          the ECM that the Map-Server uses to forward
          the Map-Request to the ETR. </li>
        <li>If the Map-Server is acting in proxy mode, as specified in <xref target="RFC9301" format="default"/>, the ETR is not involved in the
          generation of the Map-Reply and steps 6 and 7 are skipped. In this
          case, the Map-Server generates the Map-Reply on behalf of the ETR, as
          described in <xref target="proxy" format="default"/>.</li>
        <li>The ETR, upon receiving the ECM-Encapsulated Map-Request from the
          Map-Server, decrypts the MS-OTK (if needed), and originates a
          Map-Reply that contains the EID-to-RLOC mapping information as
          specified in <xref target="RFC9301" format="default"/>.</li>
        <li>The ETR computes an HMAC over the Map-Reply, keyed with MS-OTK to
          protect the integrity of the whole Map-Reply. The ETR also copies
          the EID-Prefix authorization data that the Map-Server included in
          the ECM-Encapsulated Map-Request into the Map-Reply message. The ETR
          then sends the complete Map-Reply message to the requesting ITR.</li>
        <li>The ITR, upon receiving the Map-Reply, uses the locally stored
          ITR-OTK to verify the integrity of the EID-Prefix authorization data
          included in the Map-Reply by the Map-Server. The ITR computes the
          MS-OTK by applying the same KDF (as specified in the ECM-Encapsulated
	  Map-Reply) used by the Map-Server and verifies the
          integrity of the Map-Reply. </li>
      </ol>
    </section>
    <section anchor="encap" numbered="true" toc="default">
      <name>LISP-SEC Control Messages Details</name>
      <t>LISP-SEC metadata associated with a Map-Request is transported within
      the Encapsulated Control Message that contains the Map-Request.</t>
      <t>LISP-SEC metadata associated with the Map-Reply is transported within
      the Map-Reply itself.</t>
      <t>These specifications use an HMAC in various places (as described in the following). The HMAC function AUTH-HMAC-SHA-256-128 <xref target="RFC6234" format="default"/> <bcp14>MUST</bcp14> be supported in LISP-SEC implementations. LISP-SEC deployments <bcp14>SHOULD</bcp14> use the AUTH-HMAC-SHA-256-128 HMAC function, except when communicating with older implementations that only support AUTH-HMAC-SHA-1-96 <xref target="RFC2104" format="default"/>. </t>
      <section anchor="ECM_extensions" numbered="true" toc="default">
        <name>Encapsulated Control Message LISP-SEC Extensions</name>
        <t>LISP-SEC uses the ECM defined in <xref target="RFC9301" format="default"/> with the S-bit set to 1 to indicate
        that the LISP header includes Authentication Data (AD). The format of
        the LISP-SEC ECM AD is defined in <xref target="fig-AD" format="default"/>. OTK-AD stands for One-Time Key Authentication Data
        and EID-AD stands for EID Authentication Data.</t>
        <figure anchor="fig-AD">
          <name>LISP-SEC ECM Authentication Data</name>
          <artwork align="center" name="" type="" alt=""><![CDATA[
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ECM AD Type  |   Unassigned  |        Requested HMAC ID      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\
|              OTK Length       |     Key ID    | OTK Wrap. ID  | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|                       One-Time-Key Preamble ...               | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+OTK-AD
|                   ... One-Time-Key Preamble                   | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
~                      One-Time Key (128 bits)                  ~/
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <---+
|           EID-AD Length       |           KDF ID              |     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     |
| Record Count  |E| Unassigned  |         EID HMAC ID           |EID-AD
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\    |
|  Unassigned   | EID mask-len  |           EID-AFI             | |   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Rec |
~                          EID-Prefix ...                       ~ |   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+/    |
~                            EID HMAC                           ~     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <---+
]]></artwork>
        </figure>
        <dl newline="false">
          <dt>ECM AD Type:</dt>
	  <dd>1 (LISP-SEC Authentication Data). See <xref target="IANA" format="default"/>.</dd>
          <dt>Unassigned:</dt>
	  <dd>Set to 0 on transmission and ignored on
          receipt.</dd>
          <dt>Requested HMAC ID:</dt>	  
	  <dd>The HMAC algorithm, which will be used to
          protect the mappings, requested by the ITR. Permitted values are
	  registered in the LISP-SEC Authentication Data HMAC ID (see <xref
	  target="HMAC" format="default"/>). Refer to <xref target="itr"
	  format="default"/> for more details.</dd>
          <dt>OTK Length:</dt>
	  <dd>The length (in bytes) of the OTK Authentication
          Data (OTK-AD), which contains the OTK Preamble and the OTK.</dd>
          <dt>Key ID:</dt>
	  <dd>The identifier of the pre-shared secret shared by an
          ITR and the Map-Resolver, and by the Map-Server and an ETR.
          Per-message keys are derived from the pre-shared secret to
          encrypt, authenticate the origin, and protect the integrity of the
          OTK. The Key ID allows to rotate between multiple pre-shared
          secrets in a nondisruptive way.</dd>
          <dt>OTK Wrapping ID (OTK Wrap.&nbsp;ID):</dt>
	  <dd>The identifier of the Key Derivation Function
          and of the key wrapping algorithm used to encrypt the
          One-Time-Key. Permitted values are registered in the LISP-SEC
	  Authentication Data Key Wrap ID (see <xref target="wrap"
	  format="default"/>). Refer to <xref target="encryption"
	  format="default"/> for more details. </dd>
          <dt>One-Time-Key Preamble:</dt>
	  <dd>Set to 0 if the OTK is not encrypted.
          When the OTK is encrypted, this field <bcp14>MAY</bcp14> carry additional
          metadata resulting from the key wrapping operation. When a 128-bit
          OTK is sent unencrypted by a Map-Resolver, the OTK Preamble is set
          to 0x0000000000000000 (64 bits). See <xref target="null"
	  format="default"/> for details.</dd>
          <dt>One-Time-Key:</dt>
	  <dd>The OTK wrapped as specified by OTK Wrapping ID.
          See <xref target="encryption" format="default"/> for details.</dd>
          <dt>EID-AD Length:</dt>
	  <dd>Length (in bytes) of the EID Authentication Data
          (EID-AD). The ITR <bcp14>MUST</bcp14> set the EID-AD Length to 4 bytes,
	  as it only
          fills the 'KDF ID' field, and all the remaining fields part of the
          EID-AD are not present. An EID-AD <bcp14>MAY</bcp14> contain multiple
          EID-Records. Each EID-Record is 4 bytes long, plus the length of the
          AFI-encoded EID-Prefix.</dd>
          <dt>KDF ID:</dt>
	  <dd>Identifier of the Key Derivation Function used to
          derive the MS-OTK. Permitted values are registered in the LISP-SEC
	  Authentication Data Key Derivation Function ID (see <xref target="kdf"
	  format="default"/>). Refer to <xref target="map-server"
	  format="default"/> for more details. </dd>
          <dt>Record Count:</dt>
	  <dd>As defined in <xref target="RFC9301" section="5.2" sectionFormat="of" format="default"/>. </dd>
          <dt>E:</dt>
	  <dd>ETR-Cant-Sign bit. If this bit is set to 1, it signals to the ITR
          that at least one of the ETRs that is authoritative for the EID-Prefixes
          of this Map-Reply has not enabled LISP-SEC. Only a Map-Server can set
	  this bit. See <xref target="map-server" format="default"/> for more
	  details.</dd>
          <dt>Unassigned:</dt>
	  <dd>Set to 0 on transmission and ignored on
          receipt.</dd>
          <dt>EID HMAC ID:</dt>
	  <dd>Identifier of the HMAC algorithm used to protect
          the integrity of the EID-AD. This field is filled by the Map-Server
          that computed the EID-Prefix HMAC. See <xref target="EID-AD"
	  format="default"/> for more details. </dd>
          <dt>EID mask-len:</dt>
	  <dd>As defined in <xref target="RFC9301" section="5.2" sectionFormat="of" format="default"/>.</dd>
          <dt>EID-AFI:</dt>
	  <dd>As defined in <xref target="RFC9301" section="5.2" sectionFormat="of" format="default"/>.</dd>
          <dt>EID-Prefix:</dt>
	  <dd>As defined in <xref target="RFC9301" section="5.2" sectionFormat="of" format="default"/>.</dd>
          <dt>EID HMAC:</dt>
	  <dd>HMAC of the EID-AD computed and inserted by a
          Map-Server. See <xref target="EID-AD" format="default"/> for more details. 
            </dd>
        </dl>
      </section>
      <section anchor="MR_extensions" numbered="true" toc="default">
        <name>Map-Reply LISP-SEC Extensions</name>
        <t>LISP-SEC uses the Map-Reply defined in <xref target="RFC9301" format="default"/>, with Type set to 2 and S-bit set
        to 1 to indicate that the Map-Reply message includes Authentication
        Data (AD). The format of the LISP-SEC Map-Reply Authentication Data is
        defined in <xref target="map-reply-AD" format="default"/>. PKT-AD is the Packet
        Authentication Data that covers the Map-Reply payload.</t>
        <figure anchor="map-reply-AD">
          <name>LISP-SEC Map-Reply Authentication Data</name>
          <artwork align="center" name="" type="" alt=""><![CDATA[ 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  MR AD Type   |                Unassigned                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <---+
|           EID-AD Length       |           KDF ID              |     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     |
| Record Count  |   Unassigned  |         EID HMAC ID           |EID-AD
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\    |
|  Unassigned   | EID mask-len  |           EID-AFI             | |   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Rec |
~                          EID-Prefix ...                       ~ |   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+/    |
~                            EID HMAC                           ~     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <---+
|         PKT-AD Length         |         PKT HMAC ID           |\
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
~                            PKT HMAC                           ~PKT-AD
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+/
]]></artwork>
        </figure>
        <dl newline="false">
          <dt>MR AD Type:</dt>
	  <dd>1 (LISP-SEC Authentication Data). See <xref target="IANA" format="default"/>.</dd>
          <dt>EID-AD Length:</dt>
	  <dd>Length (in bytes) of the EID-AD (see <xref target="ECM_extensions" format="default"/>). </dd>
          <dt>KDF ID:</dt>
	  <dd>Identifier of the Key Derivation Function used to
          derive MS-OTK (see <xref target="ECM_extensions" format="default"/>).</dd>
          <dt>Record Count:</dt>
	  <dd>The number of records in this Map-Reply message (see <xref target="ECM_extensions" format="default"/>).</dd>
          <dt>Unassigned:</dt>
	  <dd>Set to 0 on transmission and ignored on receipt.</dd>
          <dt>EID HMAC ID:</dt>
	  <dd>Identifier of the HMAC algorithm used to protect
          the integrity of the EID-AD (see <xref target="ECM_extensions" format="default"/>). </dd>
          <dt>EID mask-len:</dt>
	  <dd>Mask length for EID-Prefix (see <xref target="ECM_extensions" format="default"/>).</dd>
          <dt>EID-AFI:</dt>
	  <dd>See <xref target="ECM_extensions" format="default"/>. </dd>
          <dt>EID-Prefix:</dt>
	  <dd>See <xref target="ECM_extensions" format="default"/>. </dd>
          <dt>EID HMAC:</dt>
	  <dd>See <xref target="ECM_extensions" format="default"/>. </dd>
          <dt>PKT-AD Length:</dt>
	  <dd>Length (in bytes) of the Packet Authentication
          Data (PKT-AD).</dd>
          <dt>PKT HMAC ID:</dt>
	  <dd>Identifier of the HMAC algorithm used to protect
          the integrity of the Map-Reply (see <xref target="encryption"
	  format="default"/>).</dd>
          <dt>PKT HMAC:</dt>
	  <dd>HMAC of the whole Map-Reply packet to protect its integrity,
	  including the LISP-SEC Authentication Data (from the 'Map-Reply Type'
	  field to the 'PKT HMAC' field), which allow message authentication.</dd>
        </dl>
      </section>
      <section numbered="true" toc="default">
        <name>Map-Register LISP-SEC Extensions</name>
        <t>The S-bit in the Map-Register message (see <xref target="RFC9301" format="default"/>) indicates to the Map-Server that the registering ETR is LISP-SEC enabled. An ETR that supports LISP-SEC <bcp14>MUST</bcp14> set the S-bit in its Map-Register messages.</t>
      </section>
      <section anchor="itr" numbered="true" toc="default">
        <name>ITR Processing: Generating a Map-Request</name>
        <t>Upon creating a Map-Request, the ITR generates a random ITR-OTK
        that is stored locally, until the corresponding Map-Reply is
        received (see <xref target="itr-receive" format="default"/>), together with the nonce generated as specified in <xref target="RFC9301" format="default"/>.</t>
        <t>The ITR <bcp14>MAY</bcp14> use the 'KDF ID' field to indicate the recommended KDF algorithm according to local policy. The Map-Server can overwrite the KDF ID if it does not support the KDF ID recommended by the ITR (see <xref target="map-server" format="default"/>). A KDF value of NOPREF (0) may be used to specify that the ITR has no preferred KDF ID.
        </t>
        <t>ITR-OTK confidentiality and integrity protection <bcp14>MUST</bcp14> be provided
        in the path between the ITR and the Map-Resolver. This can be achieved
        either by encrypting the ITR-OTK with the pre-shared secret known to
        the ITR and the Map-Resolver (see <xref target="encryption" format="default"/>) or by
        enabling DTLS <xref target="RFC9147" format="default"/> between the ITR and the Map-Resolver.</t>
        <t>The Map-Request (as defined in <xref target="RFC9301" format="default"/>) <bcp14>MUST</bcp14> be encapsulated as a LISP Control Message in an ECM, with the S-bit set to 1, to indicate the presence of Authentication Data. Such a message is also called a "Protected Map-Request" in this memo.</t>
        <t>The ITR-OTK is wrapped with the algorithm specified by the 'OTK Wrapping
        ID' field. See <xref target="encryption" format="default"/> for further details on OTK
        encryption. If the NULL-KEY-WRAP-128 algorithm (see <xref target="wrap" format="default"/>) is selected, and no other encryption mechanism (e.g., DTLS) is enabled in the path between the ITR and the Map-Resolver, the Map-Request <bcp14>MUST</bcp14> be dropped, and an appropriate log action <bcp14>SHOULD</bcp14> be taken. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks.</t>
        <t>The 'Requested HMAC ID' field contains the suggested HMAC algorithm
        to be used by the Map-Server and the ETR to protect the integrity of
        the ECM Authentication Data and of the Map-Reply.  A HMAC ID value of
        NONE (0) <bcp14>MAY</bcp14> be used to specify that the ITR has no preferred HMAC ID.
        </t>
        <t>The 'KDF ID' field specifies the suggested Key Derivation Function to
        be used by the Map-Server to derive the MS-OTK. A KDF value of NONE
        (0) may be used to specify that the ITR has no preferred KDF ID.</t>
        <t>The EID-AD Length is set to 4 bytes, since the Authentication Data
        does not contain EID-Prefix Authentication Data, and the EID-AD
        contains only the 'KDF ID' field.</t>
        <t>If the ITR is directly connected to a Mapping System, such as LISP+ALT <xref target="RFC6836" format="default"/>, it performs the functions of both the ITR and the Map-Resolver, forwarding the Protected Map-Request as described in <xref target="map-resolver" format="default"/>.</t>
        <t>The processing performed by Proxy ITRs (PITRs) is equivalent to the
        processing of an ITR; hence, the procedure described above applies.
        </t>
      </section>
      <section anchor="encryption" numbered="true" toc="default">
        <name>Encrypting and Decrypting an OTK</name>
        <t>MS-OTK confidentiality and integrity protection <bcp14>MUST</bcp14> be provided in
        the path between the Map-Server and the ETR. This can be achieved
        either by enabling DTLS between the Map-Server and the ETR or by
        encrypting the MS-OTK with the pre-shared secret known to the
        Map-Server and the ETR <xref target="RFC9301" format="default"/>.</t>
        <t>Similarly, ITR-OTK confidentiality and integrity protection <bcp14>MUST</bcp14> be
        provided in the path between the ITR and the Map-Resolver. This can be
        achieved either by enabling DTLS between the Map-Server and the ITR
        or by encrypting the ITR-OTK with the pre-shared secret known to the
        ITR and the Map-Resolver. The ITR/Map-Resolver pre-shared key is
        similar to the Map-Server/ETR pre-shared key.</t>
        <t>This section describes OTK processing in the ITR/Map-Resolver path,
        as well as in the Map-Server/ETR path.</t>
        <t>It's important to note that, to prevent ETR's overclaiming attacks,
        the ITR/Map-Resolver pre-shared secret <bcp14>MUST</bcp14> be independent from the
        Map-Server/ETR pre-shared secret.</t>
        <t>The OTK is wrapped using the algorithm specified in the 'OTK
        Wrapping ID' field. This field identifies both the:</t>
        <ul spacing="normal">
          <li>Key Encryption Algorithm used to encrypt the wrapped OTK and</li>
          <li>Key Derivation Function used to derive a per-message encryption
            key.</li>
        </ul>
        <t>
          Implementations of this specification <bcp14>MUST</bcp14> support the OTK
          Wrapping ID AES-KEY-WRAP-128+HKDF-SHA256, which specifies the use of the
          HKDF-SHA256 Key Derivation Function specified in <xref target="RFC5869" format="default"/> to derive a per-message encryption key
          (per-msg-key), as well as the AES-KEY-WRAP-128 key wrap algorithm used
          to encrypt a 128-bit OTK, according to <xref target="RFC3394" format="default"/>.</t>
        <t>Implementations of this specification <bcp14>MUST</bcp14> support OTK
          Wrapping NULL-KEY-WRAP-128. NULL-KEY-WRAP-128 is used to carry an unencrypted 128-bit OTK, with a 64-bit preamble set to 0x0000000000000000 (64 bits).</t>
        <t>The key wrapping process for OTK Wrapping ID
        AES-KEY-WRAP-128+HKDF-SHA256 is described below:
        </t>
        <ol spacing="normal" type="1">
	  <li>The KDF and key wrap algorithms are identified by the value of the 'OTK Wrapping ID' field. The initial values are documented in <xref target="tableKWF" format="default"/>.</li>
          <li>If the NULL-KEY-WRAP-128 algorithm (see <xref target="wrap" format="default"/>) is selected and DTLS is not enabled, the Map-Request
            <bcp14>MUST</bcp14> be dropped and an appropriate log action <bcp14>SHOULD</bcp14> be taken. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks.</li>
          <li>The pre-shared secret used to derive the per-msg-key is
            represented by PSK[Key ID], which is the pre-shared secret
            identified by the 'Key ID'.</li>
          <li>
            <t>The 128-bit-long per-message encryption key is computed as:</t>
              <t indent="3">per-msg-key = KDF( nonce + s + PSK[Key ID] )</t>
            <t>where the nonce is the value in the 'Nonce' field of the
            Map-Request, 's' is the string "OTK-Key-Wrap", and the operation'+'
	    just indicates string concatenation.</t>
          </li>
          <li>The per-msg-key is then used to wrap the OTK with AES-KEY-WRAP-128, as specified in <xref target="RFC3394" format="default" sectionFormat="of" section ="2.2.1"/>. The AES Key Wrap
            Initialization Value <bcp14>MUST</bcp14> be set to 0xA6A6A6A6A6A6A6A6 (64 bits).
            The output of the AES key wrap operation is 192 bits long.
	    The most significant 64 bits
       are copied in the 'One-Time Key Preamble' field, while the 128
       least significant bits are copied in the 'One-Time Key' field of
       the LISP-SEC Authentication Data.</li>
        </ol>
        <t>When decrypting an encrypted OTK, the receiver <bcp14>MUST</bcp14> verify that the
        Initialization Value resulting from the AES key wrap decryption
        operation is equal to 0xA6A6A6A6A6A6A6A6. If this verification fails,
        the receiver <bcp14>MUST</bcp14> discard the entire message.</t>
        <section anchor="null" numbered="true" toc="default">
          <name>Unencrypted OTK</name>
          <t>However, when DTLS is enabled, the OTK <bcp14>MAY</bcp14> be sent unencrypted as
          transport layer security is providing confidentiality and integrity
          protection.</t>
          <t>When a 128-bit OTK is sent unencrypted, the OTK Wrapping ID is set
          to NULL_KEY_WRAP_128, and the OTK Preamble is set to
          0x0000000000000000 (64 bits).</t>
        </section>
      </section>
      <section anchor="map-resolver" numbered="true" toc="default">
        <name>Map-Resolver Processing</name>
        <t>Upon receiving a Protected Map-Request, the Map-Resolver decapsulates the ECM. The ITR-OTK, if encrypted,
        is decrypted as specified in <xref target="encryption" format="default"/>.</t>
        <t>Protecting the confidentiality of the ITR-OTK and, in general, the
        security of how the Map-Request is handed by the Map-Resolver to the
        Map-Server is specific to the particular Mapping System used and is
        outside of the scope of this memo.</t>
        <t>In Mapping Systems where the Map-Server is compliant with <xref target="RFC9301" format="default"/>, the Map-Resolver originates a new
        ECM header with the S-bit set, which contains the unencrypted ITR-OTK,
        as specified in <xref target="encryption" format="default"/>, and the other data
        derived from the ECM Authentication Data of the received Encapsulated
        Map-Request.</t>
        <t>The Map-Resolver then forwards to the Map-Server the received
        Map-Request, which is encapsulated in the new ECM header that includes the
        newly computed 'Authentication Data' fields.</t>
      </section>
      <section anchor="map-server" numbered="true" toc="default">
        <name>Map-Server Processing</name>
        <t>Upon receiving a Protected Map-Request, the Map-Server processes it according to the setting of the S-bit and the P-bit in the Map-Register received from the ETRs authoritative for that prefix, as described below.</t>
        <t>While processing the Map-Request, the Map-Server can overwrite the 'KDF ID' field if it does not support the KDF ID recommended by the ITR.
        Processing of the Map-Request <bcp14>MUST</bcp14> proceed in the order described
        in the table below, applying the process corresponding to the first
        rule that matches the conditions indicated in the first column:</t>
        <table anchor="tableMRP" align="center">
          <name>Map-Request Processing</name>
          <thead>
            <tr>
              <th align="left">Matching Condition</th>
              <th align="left">Processing</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">1. At least one of the ETRs authoritative for the
	      EID-Prefix included in the Map-Request registered with the P-bit set
	      to 1</td>
              <td align="left">The Map-Server <bcp14>MUST</bcp14> generate a
	      LISP-SEC-protected Map-Reply, as
              specified in <xref target="proxy" format="default"/>. The
	      ETR-Cant-Sign E-bit in the
              EID Authentication Data (EID-AD) <bcp14>MUST</bcp14> be set to 0.</td>
            </tr>
            <tr>
              <td align="left">2. At least one of the ETRs authoritative for the
	      EID-Prefix included in the Map-Request registered with the S-bit set
	      to 1</td>
              <td align="left">The Map-Server <bcp14>MUST</bcp14> generate a
	      LISP-SEC-protected Encapsulated
              Map-Request (as specified in <xref target="EID-AD"
	      format="default"/>) to be sent to
              one of the authoritative ETRs that registered with the S-bit set to
              1 (and the P-bit set to 0). If there is at least one ETR that
              registered with the S-bit set to 0, the ETR-Cant-Sign E-bit of the
              EID-AD <bcp14>MUST</bcp14> be set to 1 to signal the ITR that a non-LISP-SEC
	      Map-Request might reach additional ETRs that have LISP-SEC
              disabled.</td>
            </tr>
            <tr>
              <td align="left">3. All the ETRs authoritative for the EID-Prefix
	      included in the
              Map-Request registered with the S-bit set to 0</td>
              <td align="left">The Map-Server <bcp14>MUST</bcp14> send a Negative
	      Map-Reply protected with
              LISP-SEC, as described in <xref target="proxy" format="default"/>.
	      The ETR-Cant-Sign
              E-bit <bcp14>MUST</bcp14> be set to 1 to signal the ITR that a non-LISP-SEC
	      Map-Request might reach additional ETRs that have LISP-SEC
              disabled.</td>
            </tr>
          </tbody>
        </table>
        <t>In this way, the ITR that sent a LISP-SEC-protected Map-Request
        always receives a LISP-SEC-protected Map-Reply. However, the
        ETR-Cant-Sign E-bit set to 1 specifies that a non-LISP-SEC Map-Request
        might reach additional ETRs that have LISP-SEC disabled. This
        mechanism allows the ITR to downgrade to non-LISP-SEC
        requests, which does not protect against threats described in <xref target="threat-model" format="default"/>.</t>
        <section anchor="EID-AD" numbered="true" toc="default">
          <name>Generating a LISP-SEC-Protected Encapsulated Map-Request</name>
          <t>The Map-Server decapsulates the ECM and generates new ECM
          Authentication Data. The Authentication Data includes the OTK-AD and
          the EID-AD, which contains EID-Prefix authorization information that
          are eventually received by the requesting ITR.</t>
          <t>The Map-Server updates the OTK-AD by deriving a new OTK (MS-OTK)
          from the ITR-OTK received with the Map-Request. MS-OTK is derived by
          applying the Key Derivation Function specified in the 'KDF ID' field.
          If the algorithm specified in the 'KDF ID' field is not supported, the
          Map-Server uses a different algorithm to derive the key and updates
          the 'KDF ID' field accordingly.</t>
          <t>The Map-Request <bcp14>MUST</bcp14> be encapsulated in an ECM, with the S-bit
          set to 1, to indicate the presence of Authentication Data.</t>
          <t>MS-OTK is wrapped with the algorithm specified by the 'OTK
          Wrapping ID' field. See <xref target="encryption" format="default"/> for further
          details on OTK encryption. If the NULL-KEY-WRAP-128 algorithm is
          selected and DTLS is not enabled in the path between the Map-Server
          and the ETR, the Map-Request <bcp14>MUST</bcp14> be dropped and an appropriate log
          action <bcp14>SHOULD</bcp14> be taken.</t>
          <t>In the EID-AD, the Map-Server includes in the EID-AD the longest-match-registered
	  EID-Prefix for the destination EID and an HMAC of this
          EID-Prefix. The HMAC is keyed with the ITR-OTK contained in the
          received ECM Authentication Data, and the HMAC algorithm is chosen
          according to the 'Requested HMAC ID' field. If the Map-Server does not
          support this algorithm, the Map-Server uses a different algorithm
          and specifies it in the 'EID HMAC ID' field. The scope of the HMAC
          operation <bcp14>MUST</bcp14> cover the entire EID-AD, from the 'EID-AD Length' field to the 'EID HMAC' field, which <bcp14>MUST</bcp14> be set to 0 before the
          computation.</t>
          <t>The Map-Server then forwards the updated ECM-Encapsulated
          Map-Request, which contains the OTK-AD, the EID-AD, and the received
          Map-Request to an authoritative ETR as specified in <xref target="RFC9301" format="default"/>.</t>
        </section>
        <section anchor="proxy" numbered="true" toc="default">
          <name>Generating a Proxy Map-Reply</name>
          <t>A LISP-SEC proxy Map-Reply is generated according to <xref target="RFC9301" format="default"/>, with the Map-Reply S-bit set
          to 1. The Map-Reply includes the Authentication Data that contains
          the EID-AD computed as specified in <xref target="EID-AD" format="default"/>, as
          well as the PKT-AD computed as specified in <xref target="etr" format="default"/>.</t>
        </section>
      </section>
      <section anchor="etr" numbered="true" toc="default">
        <name>ETR Processing</name>
        <t>Upon receiving an ECM-Encapsulated Map-Request with the S-bit set,
        the ETR decapsulates the ECM. The 'OTK' field, if encrypted, is
        decrypted as specified in <xref target="encryption" format="default"/> to obtain the
        unencrypted MS-OTK.</t>
        <t>The ETR then generates a Map-Reply as specified in <xref target="RFC9301" format="default"/> and includes the Authentication
        Data that contains the EID-AD, as received in the Encapsulated
        Map-Request, as well as the PKT-AD.</t>
        <t>The EID-AD is copied from the Authentication Data of the received
        Encapsulated Map-Request.</t>
        <t>The PKT-AD contains the HMAC of the whole Map-Reply packet, keyed
        with the MS-OTK and computed using the HMAC algorithm specified in the
        'Requested HMAC ID' field of the received Encapsulated Map-Request.
        If the ETR does not support the Requested HMAC ID, it uses a different algorithm and updates the 'PKT HMAC ID' field accordingly.
        The HMAC operation <bcp14>MUST</bcp14> cover the entire Map-Reply, where the 'PKT HMAC' field <bcp14>MUST</bcp14> be set to 0 before the computation.
        </t>
        <t>Finally, the ETR sends the Map-Reply to the requesting ITR as
        specified in <xref target="RFC9301" format="default"/>.</t>
      </section>
      <section anchor="itr-receive" numbered="true" toc="default">
        <name>ITR Processing: Receiving a Map-Reply</name>
        <t>In response to a Protected Map-Request, an ITR expects a Map-Reply with the S-bit set to 1, including an EID-AD and a PKT-AD.  The ITR <bcp14>MUST</bcp14> discard the Map-Reply otherwise.
        </t>
        <t>Upon receiving a Map-Reply, the ITR must verify the integrity of
        both the EID-AD and the PKT-AD and <bcp14>MUST</bcp14> discard the Map-Reply if one
        of the integrity checks fails. After processing the Map-Reply, the ITR
        <bcp14>MUST</bcp14> discard the &lt;nonce,ITR-OTK&gt; pair associated to the
        Map-Reply.</t>
        <t>The integrity of the EID-AD is verified using the ITR-OTK (stored
        locally for the duration of this exchange) to recompute the HMAC of
        the EID-AD using the algorithm specified in the 'EID HMAC ID' field.
        If the ITR did indicate a Requested HMAC ID in the Map-Request and the PKT HAMC ID in the corresponding Map-Reply is different, or if the ITR did not indicate a Requested HMAC ID in the Map-Request and the PKT HMAC ID in the corresponding Map-Reply is not supported, then the ITR <bcp14>MUST</bcp14> discard the Map-Reply and send, according to rate-limitation policies defined in <xref target="RFC9301" format="default"/>, a new Map-Request with a different 'Requested HMAC ID' field, according to ITR's local policy. The scope of the HMAC operation covers the entire EID-AD, from the 'EID-AD Length' field to the 'EID HMAC' field.</t>
        <t>ITR <bcp14>MUST</bcp14> set the 'EID HMAC ID' field to 0 before computing the
        HMAC.</t>
        <t>To verify the integrity of the PKT-AD, first the MS-OTK is derived
        from the locally stored ITR-OTK using the algorithm specified in the
        'KDF ID' field.
        This is because the PKT-AD is generated by the ETR using
        the MS-OTK. If the ITR did indicate a recommended KDF ID in the Map-Request and the KDF ID in the corresponding Map-Reply is different or if the ITR did not indicate a recommended KDF ID in the Map-Request and the KDF ID in the corresponding Map-Reply is not supported, then the ITR <bcp14>MUST</bcp14> discard the Map-Reply and
        send, according to rate-limitation policies defined in <xref target="RFC9301" format="default"/>, a new Map-Request with a
        different KDF ID, according to ITR's local policy.
        The Key Derivation Function HKDF-SHA256 <bcp14>MUST</bcp14> be supported in LISP-SEC implementations. LISP-SEC deployments <bcp14>SHOULD</bcp14> use the HKDF-SHA256 HKDF function, unless older implementations using HKDF-SHA1-128 are present in the same deployment.
         Without consistent configuration of involved entities, extra delays may be experienced.
        However, since HKDF-SHA1-128 and HKDF-SHA256 are supported, the process will eventually converge.
        </t>
        <t>The derived MS-OTK is then used to recompute the HMAC of the
        PKT-AD using the algorithm specified in the 'PKT HMAC ID' field. If the
        'PKT HMAC ID' field does not match the Requested HMAC ID, the ITR <bcp14>MUST</bcp14>
        discard the Map-Reply and send, according to rate-limitation policies defined in <xref target="RFC9301" format="default"/>,
        a new Map-Request with a different Requested HMAC ID, according to
        ITR's local policy or until all HMAC IDs supported by the ITR have
        been attempted. When the 'PKT HMAC ID' field does not match the Requested HMAC ID, it is not possible to validate the Map-Reply.</t>
        <t>Each individual Map-Reply EID-Record is considered valid only if:
        (1) both EID-AD and PKT-AD are valid and (2) the intersection of the
        EID-Prefix in the Map-Reply EID-Record with one of the EID-Prefixes
        contained in the EID-AD is not empty. After identifying the Map-Reply
        record as valid, the ITR sets the EID-Prefix in the Map-Reply record
        to the value of the intersection set computed before and adds the
        Map-Reply EID-Record to its EID-to-RLOC Map-Cache, as described in <xref target="RFC9301" format="default"/>. An example of Map-Reply record
        validation is provided in <xref target="validation" format="default"/>.</t>
        <t><xref target="RFC9301" format="default"/> allows ETRs to send
        Solicit-Map-Requests (SMRs) directly to the ITR. The corresponding SMR-invoked Map-Request will be sent through the Mapping System, hence, secured with the specifications of this memo if in use.
        If an ITR accepts Map-Replies piggybacked in Map-Requests and its content is not already present in its EID-to-RLOC Map-Cache, it <bcp14>MUST</bcp14> send a Map-Request over the Mapping System in order to verify its content with a secured Map-Reply before using the content.</t>
        <section anchor="validation" numbered="true" toc="default">
          <name>Map-Reply Record Validation</name>
          <t>The payload of a Map-Reply may contain multiple EID-Records. The
          whole Map-Reply is signed by the ETR, with the PKT HMAC, to provide
          integrity protection and origin authentication to the EID-Prefix
          records claimed by the ETR. The 'Authentication Data' field of a
          Map-Reply may contain multiple EID-Records in the EID-AD. The EID-AD
          is signed by the Map-Server, with the EID HMAC, to provide integrity
          protection and origin authentication to the EID-Prefix records
          inserted by the Map-Server.</t>
          <t>Upon receiving a Map-Reply with the S-bit set, the ITR first
          checks the validity of both the EID HMAC and of the PKT-AD HMAC. If
          either one of the HMACs is not valid, a log action <bcp14>SHOULD</bcp14> be taken and
          the Map-Reply <bcp14>MUST NOT</bcp14> be processed any further. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks. If both HMACs are
          valid, the ITR proceeds with validating each individual EID-Record
          claimed by the ETR by computing the intersection of each one of the
          EID-Prefixes contained in the payload of the Map-Reply, with each one
          of the EID-Prefixes contained in the EID-AD. An EID-Record is valid
          only if at least one of the intersections is not the empty set; otherwise, a log action <bcp14>MUST</bcp14> be taken and the EID-Record <bcp14>MUST</bcp14> be discarded. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks.</t>
          <t>For instance, the Map-Reply payload contains 3 mapping record
          EID-Prefixes:
          </t>
          <ul empty="true" spacing="normal">
            <li>2001:db8:102::/48</li>
            <li>2001:db8:103::/48</li>
            <li>2001:db8:200::/40</li>
          </ul>
          <t>
          The EID-AD contains two EID-Prefixes:
          </t>
          <ul empty="true" spacing="normal">
            <li>2001:db8:103::/48</li>
            <li>2001:db8:203::/48</li>
          </ul>
          <t>
          The EID-Record with EID-Prefix 2001:db8:102::/48 is not
          eligible to be used by the ITR, since it is not included in any of
          the EID-ADs signed by the Map-Server. A log action <bcp14>MUST</bcp14> be taken, and the EID-Record <bcp14>MUST</bcp14> be
 	   discarded. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks. </t>
          <t>The EID-Record with EID-Prefix 2001:db8:103::/48 is eligible to
          be used by the ITR because it matches the second EID-Prefix
          contained in the EID-AD.</t>
          <t>The EID-Record with EID-Prefix 2001:db8:200::/40 is not eligible
          to be used by the ITR, since it is not included in any of the EID-ADs
          signed by the Map-Server. A log action <bcp14>MUST</bcp14> be taken and the EID-Record <bcp14>MUST</bcp14> be
 	   discarded. Implementations may include mechanisms (which are beyond the scope of this document) to avoid log resource exhaustion attacks. In this last example, the ETR is trying to over claim the EID-Prefix 2001:db8:200::/40, but the Map-Server authorized only
          2001:db8:203::/48; hence, the EID-Record is discarded.</t>
        </section>
      </section>
    </section>
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>This document extends the LISP control plane defined in <xref target="RFC9301" format="default"/>; hence, its security considerations apply to this document  as well.
      </t>
      <section anchor="mapping-system" numbered="true" toc="default">
        <name>Mapping System Security</name>
        <t>The LISP-SEC threat model described in <xref target="threat-model" format="default"/> assumes that the LISP Mapping System is
        working properly and delivers Map-Request messages to a
        Map-Server that is authoritative for the requested EID.</t>
        <t>It is assumed that the Mapping System ensures the confidentiality
        of the OTK and the integrity of the Map-Reply data. However, how the
        LISP Mapping System is secured is out of the scope of this
        document.</t>
        <t>Similarly, Map-Register security, including the right for a LISP
        entity to register an EID-Prefix or to claim presence at an RLOC, is
        out of the scope of LISP-SEC.</t>
      </section>
      <section anchor="random" numbered="true" toc="default">
        <name>Random Number Generation</name>
        <t>The ITR-OTK <bcp14>MUST</bcp14> be generated by a properly seeded pseudo-random
        (or strong random) source. See <xref target="RFC4086" format="default"/> for advice on
        generating security-sensitive random data.</t>
      </section>
      <section anchor="colocation" numbered="true" toc="default">
        <name>Map-Server and ETR Colocation</name>
        <t>If the Map-Server and the ETR are colocated, LISP-SEC does not
        provide protection from overclaiming attacks mounted by the ETR.
        However, in this particular case, since the ETR is within the trust
        boundaries of the Map-Server, ETR's overclaiming attacks are not
        included in the threat model.</t>
      </section>
      <section anchor="deploying" numbered="true" toc="default">
        <name>Deploying LISP-SEC</name>
        <t>Those deploying LISP-SEC according to this memo should carefully
        weigh how the LISP-SEC threat model applies to their particular use
        case or deployment. If they decide to ignore a particular
        recommendation, they should make sure the risk associated with the corresponding threats is well understood.</t>
        <t>As an example, in certain other
        deployments, attackers may be very sophisticated and force the
        deployers to enforce very strict policies in terms of HMAC algorithms
        accepted by an ITR.</t>
        <t>Similar considerations apply to the entire LISP-SEC threat model
        and should guide the deployers and implementors whenever they
        encounter the key word <bcp14>SHOULD</bcp14> across this memo.</t>
      </section>
      <section anchor="provisioning" numbered="true" toc="default">
        <name>Shared Keys Provisioning</name>
        <t>Provisioning of the keys shared between ITR and
        Map-Resolver pairs as well as between ETR and Map-Server pairs should be performed via an orchestration infrastructure, and is out of the scope of this memo. It is recommended that both shared keys be refreshed at periodical intervals to address key aging or attackers gaining unauthorized access to the shared keys. Shared keys should be unpredictable random values.</t>
      </section>
      <section anchor="reply" numbered="true" toc="default">
        <name>Replay Attacks</name>
        <t>An attacker can capture a valid Map-Request and/or Map-Reply and
        replay it; however, once the ITR receives the original Map-Reply, the
        &lt;nonce,ITR-OTK&gt; pair stored at the ITR will be discarded.
           If a replayed Map-Reply arrives at the ITR, there is no &lt;nonce,ITR-OTK&gt;
   that matches the incoming Map-Reply and the replayed Map-Reply will be
   discarded.</t>
        <t>In the case of a replayed Map-Request, the Map-Server, Map-Resolver, and
        ETR will have to do a LISP-SEC computation. This is equivalent, in terms of resources, to a valid LISP-SEC computation and, beyond a risk of DoS attack, an attacker does not obtain any additional effect, since the corresponding Map-Reply is discarded as previously explained.</t>
      </section>
      <section anchor="DTLS" numbered="true" toc="default">
        <name>Message Privacy</name>
        <t>DTLS <xref target="RFC9147" format="default"/> <bcp14>SHOULD</bcp14> be used (conforming to <xref target="RFC7525" format="default"/>) to provide communication privacy and to prevent eavesdropping, tampering, or message forgery to the messages exchanged between the ITR, Map-Resolver, Map-Server, and ETR, unless the OTK is encrypted in another way, e.g., using a pre-shared secret.  DTLS has the responder be verified by the initiator, which enables an ITR to authenticate the Map-Resolver and the Map-Server to authenticate the responding ETR.</t>
      </section>
      <section anchor="dos" numbered="true" toc="default">
        <name>Denial-of-Service and Distributed Denial-of-Service Attacks</name>
        <t>LISP-SEC mitigates the risks of DoS and DDoS attacks by protecting the integrity and
        authenticating the origin of the Map-Request/Map-Reply messages and
        by preventing malicious ETRs from overclaiming EID-Prefixes that could
        redirect traffic directed to a potentially large number of hosts.</t>
      </section>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>IANA has created the subregistries listed in the following sections in the "Locator/ID Separation Protocol (LISP) Parameters" registry.
      </t>
      <t> For all of the subregistries, new values are assigned according to the Specification Required policy defined in <xref target="RFC8126" format="default"/>. Expert Review should assess the security properties of newly added functions so that encryption robustness remains strong. For instance, at the time of this writing, the use of SHA-256-based functions is considered to provide sufficient protection. Consultation with security experts may be needed.
      </t>
      <section anchor="ECM-AD-Type" numbered="true" toc="default">
        <name>ECM AD Type Registry</name>
        <t>IANA has created the "LISP ECM Authentication Data Types"
        registry with values 0-255 for use in the ECM LISP-SEC extensions
        (see <xref target="ECM_extensions" format="default"/>). Initial allocations are shown in <xref target="tableEADT" format="default"/>.
        </t>
        <table anchor="tableEADT" align="center">
          <name>LISP ECM Authentication Data Types</name>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="center">Number</th>
              <th align="left">Defined in</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">Reserved</td>
              <td align="center">0</td>
              <td align="left">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">LISP-SEC-ECM-EXT</td>
              <td align="center">1</td>
              <td align="left">RFC 9303</td>
            </tr>
          </tbody>
        </table>
        <t>Values 2-255 are unassigned. </t>
      </section>
      <section anchor="MR-AD-Type" numbered="true" toc="default">
        <name>Map-Reply AD Types Registry</name>
        <t>IANA has created the "LISP Map-Reply Authentication Data
        Types" registry with values 0-255 for use in the Map-Reply LISP-SEC
        extensions (see <xref target="MR_extensions" format="default"/>). Initial allocations are shown in <xref target="tableADT" format="default"/>.
        </t>
        <table anchor="tableADT" align="center">
          <name>Map-Reply Authentication Data Types</name>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="center">Number</th>
              <th align="left">Defined in</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">Reserved</td>
              <td align="center">0</td>
              <td align="left">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">LISP-SEC-MR-EXT</td>
              <td align="center">1</td>
              <td align="left">RFC 9303</td>
            </tr>
          </tbody>
        </table>
        <t>Values 2-255 are unassigned. </t>
      </section>
      <section anchor="HMAC" numbered="true" toc="default">
        <name>HMAC Functions</name>
        <t>IANA is requested to create the "LISP-SEC Preferred Authentication Data HMAC IDs" registry with values 0-65535 for use as Requested HMAC IDs, EID HMAC IDs, and PKT HMAC IDs in the LISP-SEC Authentication Data. Initial allocations are shown in <xref target="tableHMACF" format="default"/>.
        </t>
        <table anchor="tableHMACF" align="center">
          <name>LISP-SEC Preferred Authentication Data HMAC IDs</name>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="center">Number</th>
              <th align="left">Defined in</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">NOPREF</td>
              <td align="center">0</td>
              <td align="left">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">AUTH-HMAC-SHA-1-96</td>
              <td align="center">1</td>
              <td align="left">
                <xref target="RFC2104" format="default"/></td>
            </tr>
            <tr>
              <td align="left">AUTH-HMAC-SHA-256-128</td>
              <td align="center">2</td>
              <td align="left">
                <xref target="RFC6234" format="default"/></td>
            </tr>
          </tbody>
        </table>
        <t>Values 3-65535 are unassigned.</t>
      </section>
      <section anchor="wrap" numbered="true" toc="default">
        <name>Key Wrap Functions</name>
        <t>IANA has created the "LISP-SEC Authentication Data Key
        Wrap IDs" registry with values 0-65535 for use as OTK key wrap
        algorithm IDs in the LISP-SEC Authentication Data. Initial allocations are shown in <xref target="tableKWF" format="default"/>.</t>
        <table anchor="tableKWF" align="center">
          <name>LISP-SEC Authentication Data Key Wrap IDs</name>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="center">Number</th>
              <th align="left">Key Wrap</th>
              <th align="left">KDF</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">Reserved</td>
              <td align="center">0</td>
              <td align="left">None</td>
              <td align="left">None</td>
              <td align="left">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">NULL-KEY-WRAP-128</td>
              <td align="center">1</td>
              <td align="left">RFC 9303</td>
              <td align="left">None</td>
              <td align="left">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">AES-KEY-WRAP-128+HKDF-SHA256</td>
              <td align="center">2</td>
              <td align="left">
                <xref target="RFC3394" format="default"/></td>
              <td align="left">
                <xref target="RFC4868" format="default"/></td>
              <td align="left">RFC 9303</td>
            </tr>
          </tbody>
        </table>
        <t>Values 3-65535 are unassigned. </t>
      </section>
      <section anchor="kdf" numbered="true" toc="default">
        <name>Key Derivation Functions</name>
        <t>IANA has created the "LISP-SEC Authentication Data Key
        Derivation Function IDs" registry with values 0-65535 for use as KDF IDs.
        Initial allocations are shown in <xref target="tableKDF" format="default"/>.</t>
        <table anchor="tableKDF" align="center">
          <name>LISP-SEC Authentication Data Key Derivation Function IDs</name>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="center">Number</th>
              <th align="center">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">NOPREF</td>
              <td align="center">0</td>
              <td align="center">RFC 9303</td>
            </tr>
            <tr>
              <td align="left">HKDF-SHA1-128</td>
              <td align="center">1</td>
              <td align="center">
                <xref target="RFC5869" format="default"/></td>
            </tr>
            <tr>
              <td align="left">HKDF-SHA256</td>
              <td align="center">2</td>
              <td align="center">
                <xref target="RFC5869" format="default"/></td>
            </tr>
          </tbody>
        </table>
        <t>Values 3-65535 are unassigned. </t>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

<reference anchor='RFC9301' target='https://www.rfc-editor.org/info/rfc9301'>
<front>
<title>Locator/ID Separation Protocol (LISP) Control Plane</title>
<author initials='D' surname='Farinacci' fullname='Dino Farinacci'>
<organization />
</author>
<author initials='F' surname='Maino' fullname='Fabio Maino'>
<organization />
</author>
<author initials='V' surname='Fuller' fullname='Vince Fuller'>
<organization />
</author>
<author initials='A' surname='Cabellos' fullname='Albert Cabellos' role='editor'>
<organization />
</author>
<date year='2022' month='October'/>
</front>
<seriesInfo name="RFC" value="9301"/>
<seriesInfo name="DOI" value="10.17487/RFC9301"/>
</reference>

<reference anchor='RFC9300' target='https://www.rfc-editor.org/info/rfc9300'>
<front>
<title>The Locator/ID Separation Protocol (LISP)</title>
<author initials='D' surname='Farinacci' fullname='Dino Farinacci'>
<organization />
</author>
<author initials='V' surname='Fuller' fullname='Vince Fuller'>
<organization />
</author>
<author initials='D' surname='Meyer' fullname='David Meyer'>
<organization />
</author>
<author initials='D' surname='Lewis' fullname='Darrel Lewis'>
<organization />
</author>
<author initials='A' surname='Cabellos' fullname='Albert Cabellos' role='editor'>
<organization />
</author>
<date year='2022' month='October'/>
</front>
<seriesInfo name="RFC" value="9300"/>
<seriesInfo name="DOI" value="10.17487/RFC9300"/>
</reference>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4868.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9147.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7835.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6234.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5869.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3394.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2104.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7525.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4086.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6836.xml"/>
      </references>
    </references>
    <section anchor="Acknowledgments" numbered="false" toc="default">
      <name>Acknowledgments</name>
      <t>The authors would like to acknowledge <contact fullname="Luigi Iannone"/>, <contact fullname="Pere Monclus"/>, <contact fullname="Dave Meyer"/>, <contact fullname="Dino Farinacci"/>, <contact fullname="Brian Weis"/>, <contact fullname="David McGrew"/>, <contact fullname="Darrel Lewis"/>, and <contact fullname="Landon Curt Noll"/> for their valuable suggestions provided during the preparation of this document.</t>
    </section>
  </back>
</rfc>
