<?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>NRF9160 Secure Access Token storage, Non-Secure vs Secure Boot, Key Management Unit etc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52887/nrf9160-secure-access-token-storage-non-secure-vs-secure-boot-key-management-unit-etc</link><description>Hi, 
 
 I&amp;#39;m looking for some design guidance on how to properly secure the device, code, access tokens etc. 
 
 - Does secure boot protect the device from being re-flashed and used for another purpose? - Does secure boot prevent an acquired device from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Oct 2019 12:33:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52887/nrf9160-secure-access-token-storage-non-secure-vs-secure-boot-key-management-unit-etc" /><item><title>RE: NRF9160 Secure Access Token storage, Non-Secure vs Secure Boot, Key Management Unit etc</title><link>https://devzone.nordicsemi.com/thread/214367?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2019 12:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c7372b2-1bcf-4dc2-8cc0-907b1d3ef74e</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;&lt;em&gt;To add on what is mentioned in the blog:&amp;nbsp;&lt;a href="https://blog.nordicsemi.com/getconnected/why-trustzone-matters-in-iot" rel="noopener noreferrer" target="_blank"&gt;Why TrustZone Matters for IoT&lt;/a&gt;&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I asked internally and got a extensive reply from an expert for this technology.&lt;/em&gt;&lt;/p&gt;
[quote user="GJSea"]&amp;nbsp;I was wondering if you could expand on the kinds of attacks that a secure application would protect against,&amp;nbsp;if I&amp;#39;m interpreting correctly an attack done remotely over the network interface in order to reflash it for another purpose, and/or an exploit it to steal secrets from memory?[/quote]
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;&lt;strong&gt;What can we guard against with Trustzone-M?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Based on what is portioned into secure firmware, the contents of the secure firmware are guarded against tamper and access from the non-secure side of unauthorized application/services.&lt;/p&gt;
&lt;p&gt;The unauthorized access may be from a remote service on the network, or malicious access through peripherals if the peripherals have been marked to be non-secure.&lt;/p&gt;
&lt;p&gt;Some functions of the secure firmware, by design, are made available to the non-secure side, for example, the crypto APIs.&lt;/p&gt;
&lt;p&gt;If correctly designed, the APIs can protect the assets (Long Term and Short Term keys), while making the operations of confidentiality, authentication, and integrity made available to the user of these APIs.&lt;/p&gt;
&lt;p&gt;Ensuring the availability of these services, is also a matter of design, remember that the interrupts and interrupt priorities are shared between the secure and non-secure applications. Hence, the availability of certain functionalities is critical, then, this must be catered for.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Coming to the reflashing of the firmware, the download of malicious firmware may be hard to prevent, however, the use of malicious firmware can be prevented, and this applies both for the secure and non-secure partitions of the firmware.&lt;/p&gt;
&lt;p&gt;The bootloader can verify the signature and integrity of the firmware before booting it.&lt;/p&gt;
&lt;p&gt;The asset to be guarded here is the public key or its hash against tamper.&lt;/p&gt;
&lt;p&gt;The firmware signature and integrity checks are performed only on boot, hence, if an adversary managed to inject code and execute it from RAM, then, the bootloader can neither detect or prevent this. The usual guards of making the RAM non-executable apply here.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;To summarize:&lt;br /&gt;&lt;/strong&gt;Trustzone-M facilitates additional privilege levels in the system apart from the conventional privileged and unprivileged modes.&lt;/p&gt;
&lt;p&gt;Another contribution if the ability to guard against peripherals that have the ability to DMA into any part of the memory overriding the MPU configurations.&lt;/p&gt;
&lt;p&gt;A Non-secure application can no longer access memory marked as secure.&lt;/p&gt;
&lt;p&gt;Its is up to the system designer to consider the assets and threats and to identify the privilege or access rights of each component in the system given the toolbox of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&amp;nbsp;The four privilege levels in the system (secure - privilege, secure unprivileged, non-secure privileged, non-secure unprivileged)&lt;/li&gt;
&lt;li&gt;The MPU configurations in secure and non-secure domains. Note that there are opportunities to lock the MPU configurations if desired to protect against change, however, this may or may not be useful based on user threads in the OS.&lt;/li&gt;
&lt;li&gt;The read, write, execute permissions on SRAM and FLASH.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I hope this answered your question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Secure Access Token storage, Non-Secure vs Secure Boot, Key Management Unit etc</title><link>https://devzone.nordicsemi.com/thread/214179?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2019 13:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9422ad39-6025-49dc-a8bf-076ced4fcf66</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi GJsea,&lt;br /&gt;&lt;br /&gt;I will have to come back to you on some parts of your questions to give you a good answer.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;But I would recommend checking out this Blog: &lt;a href="https://blog.nordicsemi.com/getconnected/why-trustzone-matters-in-iot" rel="noopener noreferrer" target="_blank"&gt;Why TrustZone Matters for IoT&lt;/a&gt;&amp;nbsp;which include some good information about the Secure/non-secure domain.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;hr /&gt;[quote user="GJSea"]It seems that APPPROTECT would prevent physical hacking/reverse engineering of the device, so secrets couldn&amp;#39;t be stolen or anything reverse engineered over SWD. Clearly&amp;nbsp;possession of the device and a complete flash erase gets it back to&amp;nbsp;a zero-firmware state in which case it is useless bar its physical $$ value.[/quote]
&lt;p&gt;&amp;nbsp;That is true, but if you enable ERASEPROTECT before APPROTECT you should be covered in that case as well. (ref.&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=/ps_nrf9160/chapters/dif/ctrl-ap.html&amp;amp;cp=2_0_0_8_1_3&amp;amp;anchor=ctrlap_unlocking"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fchapters%2Fdif%2Fctrl-ap.html&amp;amp;cp=2_0_0_8_1_3&amp;amp;anchor=ctrlap_unlocking&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;I do not think we have an official sample using KMU, but I will see we have something that can be of assistance.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Secure Access Token storage, Non-Secure vs Secure Boot, Key Management Unit etc</title><link>https://devzone.nordicsemi.com/thread/213793?ContentTypeID=1</link><pubDate>Tue, 08 Oct 2019 06:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6041d9c7-8b55-4aa4-bea1-8ae8e83cccf5</guid><dc:creator>GJSea</dc:creator><description>&lt;p&gt;Thanks Martin,&amp;nbsp;I was wondering if you could expand on the kinds of attacks that a secure application would protect against,&amp;nbsp;if I&amp;#39;m interpreting correctly an attack done remotely over the network interface in order to reflash it for another purpose, and/or an exploit it to steal secrets from memory?&lt;/p&gt;
&lt;p&gt;It seems that APPPROTECT would prevent physical hacking/reverse engineering of the device, so secrets couldn&amp;#39;t be stolen or anything reverse engineered over SWD. Clearly&amp;nbsp;possession of the device and a complete flash erase gets it back to&amp;nbsp;a zero-firmware state in which case it is useless bar its physical $$ value.&lt;/p&gt;
&lt;p&gt;Do you have any C examples using KMU functionality?&lt;/p&gt;
&lt;p&gt;Thx!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Secure Access Token storage, Non-Secure vs Secure Boot, Key Management Unit etc</title><link>https://devzone.nordicsemi.com/thread/213638?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 11:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45cbd388-ab12-4d55-a9ca-b546cf0b5b6e</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hello GJSea,&lt;br /&gt;Just for your information, what was once known as &amp;quot;Secure Boot&amp;quot; is now called &amp;quot;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/spm/README.html" rel="noopener noreferrer" target="_blank"&gt;Secure Partition Manager&lt;/a&gt;&amp;quot; to comply with the ARM specification, so I will refer to this as &lt;strong&gt;SPM&lt;/strong&gt; in this post.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;em&gt;- Does&amp;nbsp;SPM protect the device from being re-flashed and used for another purpose?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;- Does SPM prevent an acquired device from being debugged using JTAG, can a hacker view running code and variables in memory?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The SPM does not protect the device from being re-flashed.&lt;/p&gt;
&lt;p&gt;The SPMs task is to&lt;span&gt;&amp;nbsp;configure the permissions and resources of the non-secure app and then booting it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-a0a5ad171e1245de808089387d7b4178/pastedimage1570446652122v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For additional information about this&amp;nbsp;please check the &amp;quot;&lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/nrf-connect-sdk-tutorial#h100sjwm551634uoal2fr9zwynnptkq" rel="noopener noreferrer" target="_blank"&gt;secure vs. non-secure&amp;quot; section in the NCS tutorial.&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;How to actually prevent anyone from re-flashing the device can be done by&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fuicr.html&amp;amp;anchor=register.APPROTECT" rel="noopener noreferrer" target="_blank"&gt;&amp;nbsp;enabling APPROTECT&lt;/a&gt;. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This will block debuggers to have read/write access to all CPU registers and memory-mapped addresses.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fnvmc.html&amp;amp;cp=2_0_0_3_3" rel="noopener noreferrer" target="_blank"&gt;&lt;em&gt;Non-volatile memory controller Documentation&lt;/em&gt;&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;span&gt;One option you can use is to store keys/credentials, is in the modem flash as we have done with the nRF Cloud Certificates to be able to connect to the nrfcloud.com (aws_server).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(The samples e.g. the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/asset_tracker/README.html" rel="noopener noreferrer" target="_blank"&gt;Asset_tracker&lt;/a&gt;/&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/lte_ble_gateway/README.html" rel="noopener noreferrer" target="_blank"&gt;LTE sensor Getaway&lt;/a&gt;&amp;nbsp;uses these credentials to connect to the cloud)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;To provision credentials to the modem flash, you can use the&amp;nbsp;utilize the&amp;nbsp;use the&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/bsdlib/doc/api.html#nrf91-inbuilt-key-management" rel="noopener noreferrer" target="_blank"&gt; &lt;em&gt;nrf_inbuilt_key&lt;/em&gt; AP&lt;/a&gt;Is (&lt;a href="https://github.com/NordicPlayground/nrfxlib/blob/master/bsdlib/include/nrf_inbuilt_key.h" rel="noopener noreferrer" target="_blank"&gt;see the nrf_inbuilt_key.h file in the nrfxlib repository&lt;/a&gt;).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Please check &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/net/download_client.html#https" rel="noopener noreferrer" target="_blank"&gt;this code snippet on how you can do this.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;The provisioned credentials cannot be read out from the application side once it&amp;#39;s in the modem flash, so they are safe.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You also have some other ways of keeping your data/keys secure:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fcryptocell.html&amp;amp;cp=2_0_0_5_0" rel="noopener noreferrer" target="_blank"&gt;CRYPTOCELL — ARM&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; TrustZone&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; CryptoCell 310&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fkmu.html&amp;amp;cp=2_0_0_5_7" rel="noopener noreferrer" target="_blank"&gt;KMU — Key management unit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/bsdlib/README.html" rel="noopener noreferrer" target="_blank"&gt;BSD library&lt;/a&gt;&amp;nbsp;has to run in the non-secure area as seen in the figure above.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;With regard to the last question I would recommend checking out the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/net/aws_fota.html#lib-aws-fota" rel="noopener noreferrer" target="_blank"&gt;AWS FOTA documentation&lt;/a&gt; as well as the &amp;quot;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_multi_image.html" rel="noopener noreferrer" target="_blank"&gt;&lt;em&gt;multiple-images builds&amp;quot; documentation&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;(&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/aws_fota/README.html" rel="noopener noreferrer" target="_blank"&gt;AWS FOTA sample&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope I&amp;#39;ve understood your questions correctly. If something is unclear please let me know.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>