<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21715/require-ble-4-2-key-exchange-but-not-mitm</link><description>I have an application which requires protection from passive eavesdropping, but not man in the middle attacks. I want to enforce the use of diffie hellman key exchange. 
 Security Mode 1 Level 4 does enforce diffie hellman key exchange, but it also enforces</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 May 2017 13:43:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21715/require-ble-4-2-key-exchange-but-not-mitm" /><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85300?ContentTypeID=1</link><pubDate>Thu, 04 May 2017 13:43:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bd24342-6c9d-40e0-90c6-13f39b6cbe1b</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Excellent. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85299?ContentTypeID=1</link><pubDate>Thu, 04 May 2017 07:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecc34db4-aa7f-4304-b0f3-d4f88c179031</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;As long as you react to the BLE_GAP_EVT_SEC_PARAMS_REQUEST before Peer Manager you should be fine. If both devpaices support LESC iring, then LESC pairing shall be used, and it should not fall back to legacy pairing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85298?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 20:39:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b810d786-2d7e-4491-9f46-51d2b5495050</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;One of the services I wanted to secure was the Nordic UART service. ble_nus.c hard codes the security to OPEN. I&amp;#39;ll make another question to request that ble_nus be updated to take the security modes as initialization options.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85297?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 20:37:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b3fc0a1-9614-4990-8adc-7f6f834c411a</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Thanks, Peter.&lt;/p&gt;
&lt;p&gt;I now check the lesc bit of the event data in my handler for BLE_GAP_EVT_SEC_PARAMS_REQUEST. I call pm_sec_params_set() to enable or disable pairing based on the lesc bit.&lt;/p&gt;
&lt;p&gt;In order to affect peer manager&amp;#39;s handling of the same BLE_GAP_EVT_SEC_PARAMS_REQUEST, I called my handler first in ble_evt_dispatch(). Actually, I was concerned that some of the other events depend on the existing order, so I made a second application event handler just for BLE_GAP_EVT_SEC_PARAMS_REQUEST and called that handler before pm_on_ble_evt().&lt;/p&gt;
&lt;p&gt;Then I used BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM for all of my secured characteristics.&lt;/p&gt;
&lt;p&gt;My only remaining concern: is it possible for both nodes to support LESC but still fall back to legacy mode in any case? I&amp;#39;m technically not checking that LESC was actually used -- only that it was supported.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85296?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 13:07:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d56e1abc-0369-4881-9f34-c574d413b9b4</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I&amp;#39;m very very sorry, I was totally mistaken. If you do LESC just works you actually end up in security level 2, which actually makes sense, since it is unauthenticated.&lt;/p&gt;
&lt;p&gt;It is a bit cumbersome to know if legacy pairing just works or LESC pairing just works have been performed, but you can check that the LESC flag when you get the BLE_GAP_EVT_SEC_PARAMS_REQUEST event, and then sd_ble_gap_sec_params_reply() will also need to have the LESC flag set (which Peer Manager will do for you if you tell it to in peer_manager_init()).&lt;/p&gt;
&lt;p&gt;Also, when doing LESC you will get the BLE_GAP_EVT_LESC_DHKEY_REQUEST event, but not in legacy.&lt;/p&gt;
&lt;p&gt;I think this information should be available when you get the BLE_GAP_EVT_AUTH_STATUS event, and I have reported this internally.&lt;/p&gt;
&lt;p&gt;Again, sorry for misinforming you. Let me know if anything is unclear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85295?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 14:04:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d56f410-5594-4493-8069-6314dda754cb</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;I tried the ble_app_multirole_example on a pca10040. I get the same behavior if I define  LESC_MITM_NC to 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85294?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 13:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31517542-eb13-4af9-a3c7-50119670d608</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;The SDK macro to require level 4 is named BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM, and there is no corresponding macro for LESC_ENC_NO_MITM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85293?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 13:19:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:634ac7fa-7bae-4cc5-88fa-3fdf81cf506a</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Ok, then I guess my question becomes: why am I not getting mode 1 level 4?
I&amp;#39;m using nRF Connect as the central node. I perform a pair with the &amp;quot;Enable LE Secure Connection pairing&amp;quot; option checked. The resulting security level is 2.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve integrated LESC support from the ble_app_multirole_lesc example. I can see from the nRF logs that the LESC key is generated. I get a PM_EVT_CONN_SEC_SUCCEEDED with a procedure of 2. Then I get a BLE_GAP_EVT_AUTH_STATUS with mode 1 level 2. Would the nRF Connect log be helpful?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85292?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 12:58:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:585d4326-17f9-48bf-b510-a612e3f44f8c</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;You will not get security level 2 with ECDH key exchange, you will get security level 4. If you end up in security level 2 you are doing legacy pairing (with just works). If you don&amp;#39;t have any I/O capabilites you can use LESC Just Works, it protects against passive eavesdropping.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85291?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 12:39:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad898884-f19a-4355-b1ee-be215607958e</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;My application sets I/O capabilities to None. Even with ECDH key exchange, I only get security mode 1 level 2. This level is acceptable for my application, but I need to distinguish it from a legacy key exchange mode 1 level 2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Require BLE 4.2 key exchange but not MITM</title><link>https://devzone.nordicsemi.com/thread/85290?ContentTypeID=1</link><pubDate>Tue, 02 May 2017 10:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74463a47-162c-4c8b-8830-9cac2ada44fe</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;If ECDH key agreement is used the connection will be in security level 4. Security mode 2 is legacy pairing using just works, which doesn&amp;#39;t provide protection against passive eavesdroppers if there is an attack during the pairing process.&lt;/p&gt;
&lt;p&gt;Why are you checking the LESC field? I don&amp;#39;t get what you want to achieve.&lt;/p&gt;
&lt;p&gt;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST is related to authorization, is that what you want to do? It does not protect against passive eavesdroppers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>