<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-manet-nhdp-sec-02" ipr="trust200902">
	<front>
		<title abbrev="Using ICVs and Timestamps in NHDP">
			Using Integrity Check Values and Timestamps For Router Admittance in NHDP
		</title>
		<author fullname="Ulrich Herberg" initials="U" surname="Herberg">
			<organization>Fujitsu Laboratories of America</organization>
			<address>
				<postal>
					<street>1240 E. Arques Ave.</street>
					<city>Sunnyvale, CA, 94085</city>
					<region/>
					<country>USA</country>
				</postal>
				<email>ulrich@herberg.name</email>
				<uri>http://www.herberg.name/</uri>
			</address>
		</author>
		<author fullname="Thomas Heide Clausen" initials="T" surname="Clausen">
			<organization>LIX, Ecole Polytechnique</organization>
			<address>
				<postal>
					<street/>
					<city>91128 Palaiseau Cedex</city>
					<region/>
					<country>France</country>
				</postal>
				<phone>+33 6 6058 9349</phone>
				<email>T.Clausen@computer.org</email>
				<uri>http://www.thomasclausen.org/</uri>
			</address>
		</author>
		<date/>
		<area/>
		<workgroup>Mobile Ad hoc Networking (MANET)</workgroup>
		<keyword>MANET</keyword>
		<keyword>Draft</keyword>
		<abstract>
			<t>
				This document specifies a security extension to the MANET Neighborhood Discovery Protocol (NHDP). The extension introduces the use of Integrity Check Values (ICVs) and Timestamps in HELLO messages in order to provide a router admittance mechanism, and therefore to counter a selection of security threats to NHDP.
			</t>
		</abstract>
	</front>
	<middle>
		<section title="Introduction">
			<t>
				This document specifies the use of Integrity Check Values (ICVs) for router admittance in the MANET Neighborhood Discovery Protocol (NHDP) <xref target="RFC6130"/>. It specifies the use of such ICVs for validating the identity of the originator of a HELLO message, for validating of the content (i.e., the links being advertised) of a HELLO message, and for validating the message integrity.
			</t>
			
			<t>
				This document uses the TLVs defined in <xref target="RFC6622"/> within NHDP HELLO messages, and specifies extensions (as enabled by Section 16 in <xref target="RFC6130"/>) to the HELLO message processing.
			</t>
			<t>
				Schematically, the mechanism specified in this document inserts itself between <xref target="RFC6130"/> processing/generation of HELLO messages and <xref target="RFC5444"/> encoding/decoding as illustrated in <xref target="schematics"/>.
			</t>	
<figure anchor="schematics" title="Relationship with RFC5444 and RFC6130.">
				<artwork>
               Incoming  |                          |  Outgoing
          HELLO Message  |                         /|\ HELLO Message
                         |                          |
                         |                          |
                        \|/                         |
                         |                          |
                      +--------------------------------+
                      |                                |
                      |   RFC5444 Parser / Generator   |
                      |                                |
                      +--------------------------------+
                          |                          |
           Hello Message \|/                        /|\ RFC6622 ICVs
                  Parsed  |                          |  added
D                     +--------------------------------+
R  /_________________ |                                |
O  \ICV not           |       This Specification       |
P   Verified          |                                |
                      +--------------------------------+
                         |                          |
          ICV verified  \|/                        /|\ HELLO Message
                         |                          |  Generated
                      +--------------------------------+
                      |                                |
                      |            RFC6130             |
                      |      Processing/Generation     |
                      +--------------------------------+				
				</artwork>
</figure>			
		</section>
<section title="Terminology">
	<t>
		The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
	</t>
	<t>
		Additionally, this document uses the terminology of <xref target="RFC5444"/>,  <xref target="RFC6130"/>, and <xref target="RFC6622"/>.
	</t>
	<t>
      	Additionally, this document introduces the following terminology:
      	<list style="hanging">
      		<t hangText="NHDP Router:"><vspace blankLines="0"/>
      			A MANET router, running NHDP as specified in <xref target="RFC6130"/>.
      		</t>
      	</list>
	</t>	
</section>
<section title="Applicability Statement">

	<t>
		<xref target="RFC6130"/> enables extensions to recognize additional reasons for rejecting a message as "badly formed and therefore invalid for processing", and mentions security as an explicit example.
	</t>

	<t>
		This document:
		<list style="symbols">
			<t>
				Specifies an extension to <xref target="RFC6130"/> by providing a framework for associating ICVs to messages and for using such invalid ICVs as one such "additional reason" for rejecting a message as "badly formed and therefore invalid for processing".
			</t>
			<t>
				Uses the containers for carrying ICVs and timestamps, as well as the registries for cryptographic code-points,  specified in <xref target="RFC6622"/>. 
			</t>
			
			<t>
				Is applicable where ICVs are an appropriate security solution. Note that the choice of the cryptographic function are to be made for each given deployment, and that the choice of such is out of scope for this document.
			</t>	
			<t>
				Assumes that a router which is able to generate correct ICVs (e.g., has valid cryptographic keys), is considered trusted.
			</t>
			<t>
				Assumes that the TLV type extension of the ICV Message TLV, as defined in <xref target="RFC6622"/> is 1, i.e., that an ICV is composed of a cryptographic function over a hash value of the message as defined in Section 12 of <xref target="RFC6622"/>.
			</t>
		</list>
	</t>

	<t>
		This document does NOT:
		<list style="symbols">
			<t>
				Specify how to distribute cryptographic keys, shared secrets, parameters for cryptographic functions, etc.
			</t>
			<t>
				Specify how to detect compromised routers with valid keys.
			</t>
			<t>
				Specify how to handle compromised routers with valid keys, i.e., key-revocation etc.
			</t>
		</list>
	</t>
</section>
		
<section title="Protocol Overview and Functioning">

	<t>
		The framework presented in this document provides two functionalities:
		<list style="symbols">
			<t>
				Generation of an ICV for an outgoing HELLO message.
			</t>
      		<t>
      			Verification of an ICV in order to determine if an incoming HELLO message MUST be rejected as "badly formed and therefore invalid for processing" <xref target="RFC6130"/>.
      		</t>
      	</list>
      		
			When an NHDP Router generates a HELLO message on an interface, this extension:
      		
      		<list style="symbols">
      			<t>
      				Specifies how to calculate an ICV for the message.
      			</t>
      			<t>
      				Specifies how to include that ICV by way of a TLV.
      			</t>
      		</list>
      		The framework allows for adding several ICVs with different hash and cryptographic functions.
		</t>
      		
		<t>
      		<xref target="RFC6130"/> allows for rejecting incoming HELLO messages prior to processing by NHDP. This extension specifies that for each ICV TLV in the Message TLV Block of an incoming message, the message MUST be rejected if the ICV can not be verified.
      	</t>
		</section>
			
<section title="HELLO Message Content" anchor="HELLO Message Content">
	<t>
		HELLO messages MUST have the content as specified in <xref target="RFC6130"/>. In addition, in order to conform to this specification, each HELLO message MUST contain:
		
		<list style="symbols">
			<t>
				A &lt;msg-orig-addr&gt; element (as specified in <xref target="RFC5444"/>).
			</t>
			<t>
				A &lt;msg-seq-num&gt; element (as specified in <xref target="RFC5444"/>).
			</t>
			<t>
				One or more ICV TLVs (as specified in <xref target="RFC6622"/>), generated according to <xref target="sign"/>.
			</t>
		</list>
	</t>
	<t>
		If protection against replay attacks is desired, then a HELLO message MUST also contain:
		<list style="symbols">
			<t>
				A TIMESTAMP TLV (as specified in <xref target="RFC6622"/>).
			</t>
		</list>
	</t>

</section>
<section title="HELLO Message Generation" anchor="sign">
	<t>
		After HELLO message generation (<xref target="RFC6130"/> Section 11.1) and before HELLO message transmission (<xref target="RFC6130"/> Section 11.2), as permitted by <xref target="RFC6130"/> Section 12.1,  the additional elements specified in <xref target="HELLO Message Content"/> MUST (unless already present) be added to an outgoing HELLO message.
	</t>
	
	<t>
		The following processing steps MUST be taken for each cryptographic algorithm that is used for generating ICVs for a HELLO message:
		<list style="numbers">
        	<t>
        		All existing TLVs (if any) of type ICV are temporarily removed from the message. Any temporarily removed TLVs MUST be stored, for being reinserted into the message in step 5.
        	</t>
        	<t>
        		The message size is recalculated to the size of the message without the temporarily removed ICV TLVs.
        	</t>
        	<t>
        		The ICV value is calculated over the whole message (as resulting after step 2) according to the chosen hash and cryptographic function and according to Section 12.1 of <xref target="RFC6622"/>.
        	</t>
        	<t>
        		A TLV of type ICV and with type extension 1 is added in the Message TLV block, with the content according to Section 12.1 of <xref target="RFC6622"/>.
        	</t>
        	<t>
        		All other ICV TLVs that have been temporary removed, are restored.
        	</t>
        	<t>
        		The message size is recalculated, including the new ICV TLV as well as any restored temporarily removed ICV TLVs.
        	</t>
        </list>
	</t>
</section>
		
<section title="HELLO Message Processing" anchor="HELLO Message Processing">
	<t>
		<xref target="RFC6130"/> specifies that:
		<list style="hanging">
			<t>
				"On receiving a HELLO message, a router MUST first check if the message is invalid for processing by this router"
			</t>
      	</list>
   		<xref target="RFC6130"/> proceeds to give a number of conditions that, each, will lead to a rejection of the HELLO message as "badly formed and therefore invalid for processing". This document adds the following conditions to that list which, if true, MUST cause NHDP to consider the HELLO message as invalid for processing:
     	<list style="symbols">
			<t>
				The HELLO message does not include a &lt;msg-orig-addr&gt; element.
			</t>
			<t>
				The HELLO message does not include a  &lt;msg-seq-num&gt; element.
			</t>
			<t>
				The Message TLV block of the HELLO message contains more than one TIMESTAMP TLV with the same type extension.
			</t>
			<t>
				Validation of ICVs in the Message TLV block of the HELLO message fails, according to <xref target="validate_icv"/>.
			</t>
			<t>
				If protection against replay attacks is desired, validation of the TIMESTAMP TLV of the message fails, according to <xref target="validate_timestamp"/>.
			</t>
     	</list>
	</t>
	
	<section title="Invalidating a Message Based on ICVs" anchor="validate_icv">
	<t>
		<list style="numbers">
			<t>
				For each ICV Message TLV in the HELLO message, the ICV TLV is temporarily removed if:
					<list style="symbols">
						<t>
							The ICV Message TLV type extension is not equal to 1; OR
						</t>
						<t>
							The ICV Message TLV type extension is equal to 1, AND the hash function and the cryptographic function indicated in that ICV Messsage TLV are unknown to the NHDP Router.
						</t>
					</list>
			</t>
          	<t>
          		If no ICV Message TLVs remain after step 1, then validation fails: 								
          		<list style="symbols">
					<t>
						The HELLO message MUST be considered "badly formed and therefore invalid for processing", and MUST be discarded.
					</t>
				</list>
          	</t>
          	<t>
          		Otherwise, the HELLO message with the remaining ICV Message TLVs (henceforth: "Known ICV Message TLVs") is processed as follows:
          		<list style="numbers">
					<t>
						All Known ICV Message TLVs are temporarily removed from the message, and the message size is recalculated.
					</t>
					<t>
						Each of the temporarily removed Known ICV Message TLVs from the step above is, then, processed as follows:
						<list style="symbols">
							<t>
								Calculate the message-hash-value over the HELLO message, using the hash function indicated by &lt;hash-function&gt; in the Known ICV Message TLV.
							</t>
							<t>
								Calculate the message-ICV-Value over the resulting message-hash-value, using the cryptographic function, and the key ID, indicated by &lt;cryptographic-function&gt; and &lt;key-id&gt; in the Known ICV Message TLV.
							</t>
							<t>
								If message-ICV-Value differs from the value of &lt;ICV-data&gt; in the Known ICV Message TLV, then validation fails:
								<list style="symbols">
									<t>
										The HELLO message MUST be considered "badly formed and therefore invalid for processing", and MUST be discarded.
									</t>
								</list>
							</t>
						</list>
					</t>
				</list>
          	</t>
          	<t>
				Otherwise, the message is considered (with respect to this specification) "valid for processing", and:
				<list style="letters">
					<t>
						All temporarily removed ICV Message TLVs (i.e., all ICV TLVs temporarily removed in both step 1 and step 3) are restored.
					</t>
					<t>
						The message size is restored.
					</t>
            	</list>
          	</t>

		</list>  
	</t>
</section>
		
<section title="Invalidating a Message Based on Timestamps" anchor="validate_timestamp">
<!--
	<t>
		If an NHDP Router is configured to require protection against replay attacks, then TIMESTAMP TLVs in incoming HELLO messages MUST be validated. Unless this validation succeeds, the HELLO message MUST be discarded.
	</t>
-->
	<t>
		An NHDP Router which requires protection against replay attacks MUST:
		<list style="symbols">
			<t>
				Be configured with a list of TIMESTAMP type extensions, which it supports.
			</t>
			<t>
				For each of these TIMESTAMP type extensions, define MAX_TIMESTAMP_DIFF as the maximum allowed difference between the "expected timestamp value" and the "timestamp value" encoded in the TIMESTAMP TLV of an incoming HELLO message (e.g., to accommodate for propagation delays across a network).
			</t>
		</list>
		
	</t>
	<t>
		A HELLO message MUST be considered "badly formed and therefore invalid for processing", and MUST be discarded if either of the two following conditions are true:
		
		<list style="symbols">
			<t>
				The Message TLV Block of the HELLO message does not contain a TIMESTAMP TLV with a type extension matching (one of) the timestamp types, known by the receiving NHDP Router.
			</t>
			<t>
				The Message TLV Block of the HELLO message does contain a TIMESTAMP TLV with a type extension matching (one of) the timestamp types, known by the receiving NHDP Router, but where the value of that TIMESTAMP TLV differs from the expected value by more than MAX_TIMESTAMP_DIFF.	
			</t>
		</list>
	</t>
</section>
		

</section>
		
<!--
<section title="Parameters and Constants">
			<t>This document specifies the following parameters and constants:
			<list style="symbols">
				<t>MAX_TIMESTAMP_DIFF - The maximum age a message that is to be validated may have. If the current POSIX time of the router validating the message minus the timestamp indicated in the TIMESTAMP TLV of the message is greater than MAX_TIMESTAMP_DIFF, the message will be discarded.</t>
			</list>
			
			The following constraints apply to these parameters:
			<list style="symbols">
				<t>MAX_TIMESTAMP_DIFF &gt; 0</t>
			</list>
			</t>
		</section>
-->
<section title="Provisioning of NHDP Routers">
	<t>
		Before an NHDP Router is able to generate ICVs or validate messages, it  MUST acquire the cryptographic key(s) and any parameters of the cryptographic function from all other routers that are to participate in the network. This document does not specify how a router acquires the cryptographic keys and parameters used in the MANET. 
	</t>
</section>
<section title="Summary of NHDP Interaction">

	<t>
		When using the NHDP security extension, specified in this document, the following MUST be observed:
		
		<list style="symbols">
			<t>
				HELLO messages MUST be generated according to <xref target="RFC6130"/>.
			</t>
				
			<t>
				Outgoing HELLO messages, generated by <xref target="RFC6130"/>, MUST be processed according to <xref target="sign"/> after their generation and prior to their transmission by <xref target="RFC6130"/>, in order that (an) ICV TLV(s) can be generated and inserted, as allowed by Section 16 in <xref target="RFC6130"/>.
			</t>
				
			<t>
				Any other extension to <xref target="RFC6130"/> which adds information to a HELLO message MUST do so prior to the HELLO message being handed off for ICV generation according to this specification.
			</t>
				
			<t>
				An incoming HELLO message MUST be processed according to <xref target="HELLO Message Processing"/> prior to processing by <xref target="RFC6130"/> as allowed in Section 16 in <xref target="RFC6130"/>.
			</t>
				
			<t>
				Any other NHDP extension, which has added information to a HELLO message and which wishes that the HELLO message is rejected if an ICV is not valid, MUST likewise process the HELLO message only after its processing according to this specification.
			</t>
		</list>
	</t>
</section>
		<section anchor="IANA" title="IANA Considerations">
			<t>This document has no actions for IANA.</t>
		</section>
		
<section anchor="Security" title="Security Considerations">
	<t>
		This document specifies a protocol extension to NHDP which allows for alleviating some of the security threats of NHDP analyzed in <xref target="NHDP-sec-threats"/>.
	</t>
	
	<section title="Alleviated Attacks">
		<t>This section briefly summarizes which of the security threats, from among those detailed in <xref target="NHDP-sec-threats"/>, that are alleviated by the framework presented in this document.</t>
		
		<section anchor="identity_spoofing" title="Identity Spoofing">
			<t>
				As only NHDP Routers possessing valid cryptographic keys are able to add ICV TLVs HELLO messages, in a way which permits that these be validated successfully, identity spoofing is counteracted.
			</t>
		</section>
			
		<section title="Link Spoofing">
			<t>
				Link spoofing is counteracted by the framework specified in this document, with the same argument as in <xref target="identity_spoofing"/>. A router without access to valid cryptographic keys cannot generate valid ICVs for inclusion in a HELLO message.
			</t>
		</section>
			
		<section title="Replay Attack">
			<t>
				Replay attacks are only counteracted if TIMESTAMP TLVs are included in HELLO messages. This is optional, and depends on synchronized clocks of all routers in the MANET. An attacker which records messages to replay them later can only do so in the time interval between the timestamp that is contained in the TIMESTAMP TLV and MAX_TIMESTAMP_DIFF later. As an attacker cannot modify the content of the TIMESTAMP TLV (since it does not possess the valid cryptographic keys for generating valid ICV TLVs), it cannot replay messages after this time interval. Within this time interval, however, it is still possible to perform replay attacks.
			</t>
		</section>
	</section>
			
	<section title="Limitations">
		<t>
			Since jamming is a physical layer issue, it cannot be alleviated by protocols on the routing layer. This framework does not counteract jamming attacks.
		</t>

	
		<t>
			If no synchronized clocks are available in the MANET, replay attacks cannot be counteracted by the framework provided by this document.
		</t>
			
		<t>
			The framework provided by this document does not avoid or detect security attacks by routers possessing the cryptographic keys that are used to generate ICVs for messages.
		</t>
			
		<t>
			This document depends on the quality of the used cipher algorithm and hash function, and is as such subject the same security considerations as applies to these.
		</t>
			
		<t>
			This document relies on an out-of-band protocol or mechanism for distributing keys and cryptographic parameters. The security considerations of such protocol or mechanism also apply.
		</t>
		
		<t>
		This document does also not provide a key revocation mechanism.
		</t>
	</section>
	
	

</section>
<section title="Acknowledgments">

	<t>
		The authors would like to thank Jiazi Yi (Ecole Polytechnique) for his review and comments  to this document.
	</t>
</section>
		
	</middle>
	<back>
		<references title="Normative References">
			<reference anchor="RFC6622">
				<front>
					<title>Integrity Check Value and Timestamp TLV Definitions for Mobile Ad Hoc Networks (MANETs)</title>
					<author fullname="Ulrich Herberg" initials="U" surname="Herberg">
						<organization>Fujitsu Laboratories of America</organization>
					</author>
					<author fullname="Thomas Heide Clausen" initials="T" surname="Clausen">
						<organization>LIX, Ecole Polytechnique</organization>
					</author>
					<date year="2012" month="May"/>
				</front>
				<seriesInfo name="RFC" value="6622"/>
			</reference>
			
			
			<reference anchor="RFC2119">
				<front>
					<title abbrev="RFC Key Words">Key words for use in RFCs to Indicate Requirement Levels</title>
					<author initials="S." surname="Bradner" fullname="Scott Bradner">
						<organization>Harvard University</organization>
					</author>
					<date year="1997" month="March"/>
				</front>
				<seriesInfo name="BCP" value="14"/>
				<seriesInfo name="RFC" value="2119"/>
				<format type="TXT" octets="4723" target="ftp://ftp.isi.edu/in-notes/rfc2119.txt"/>
				<format type="HTML" octets="17491" target="http://xml.resource.org/public/rfc/html/rfc2119.html"/>
				<format type="XML" octets="5777" target="http://xml.resource.org/public/rfc/xml/rfc2119.xml"/>
			</reference>
			
			
			<reference anchor="RFC6130">
				<front>
					<title>Mobile Ad Hoc Network (MANET) Neighborhood Discovery Protocol (NHDP)</title>
					<author initials="T." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">LIX, Ecole Polytechnique</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="Christopher Dearlove">
						<organization>BAE Systems ATC</organization>
					</author>
					<author initials="J." surname="Dean" fullname="Justin W. Dean">
						<organization abbrev="NRL">Naval Research Laboratory</organization>
					</author>
					<date month="March" year="2011"/>
				</front>
				<seriesInfo name="RFC" value="6130"/>
			</reference>
			

			
			
			<reference anchor="RFC5444">
				<front>
					<title abbrev="RFC5444">Generalized MANET Packet/Message Format</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">Ecole Polytechnique, France</organization>
					</author>
					<author initials="C.M." surname="Dearlove" fullname="Christopher Dearlove">
						<organization abbrev="BAE">BAE Systems Advanced Technology Centre, UK</organization>
					</author>
					<author initials="J.W." surname="Dean" fullname="Justin W. Dean">
						<organization abbrev="NRL">Naval Research Laboratory, USA</organization>
					</author>
					<author initials="C." surname="Adjih" fullname="Cedric Adjih">
						<organization>INRIA Rocquencourt</organization>
					</author>
					<date month="February" year="2009"/>
				</front>
				<seriesInfo name="RFC" value="5444"/>
			</reference>
		</references>
	
		<references title="Informative References">

			<reference anchor="NHDP-sec-threats">
				<front>
					<title>Security Threats for NHDP</title>
					<author initials="U." surname="Herberg" fullname="Ulrich Herberg">
						<organization abbrev="FLA">Fujitsu Laboratoris of America</organization>
					</author>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">LIX, Ecole Polytechnique, France</organization>
					</author>
					<author initials="J." surname="Yi" fullname="Jiazi Yi">
						<organization abbrev="X">LIX, Ecole Polytechnique, France</organization>
					</author>

					<date month="April" year="2012"/>
				</front>
				<seriesInfo name="work in progress" value="draft-ietf-manet-nhdp-sec-threats-00.txt"/>
			</reference>
		</references>
		
		<!--
    	<section title="Appendix">
      		<t></t>
    	</section>
    	-->
	</back>
</rfc>
