<?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>Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124416/authenticated-debug-access-approtect</link><description>We are preparing a product for production and have enabled authenticated debug access on the NRF52840. Because authenticated debug access is not described in any Nordic documentation or security notices, we are seeking review of our implementation to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Sep 2025 19:35:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124416/authenticated-debug-access-approtect" /><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549352?ContentTypeID=1</link><pubDate>Fri, 19 Sep 2025 19:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2beddbe-ae42-4e36-9bf2-ac24bbb662dd</guid><dc:creator>Raymond</dc:creator><description>&lt;p&gt;Thanks Einar.&amp;nbsp; I appreciate the help.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549258?ContentTypeID=1</link><pubDate>Fri, 19 Sep 2025 06:42:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26677640-388e-4cc3-93c4-6438fb8e70a7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="9938" url="~/f/nordic-q-a/124416/authenticated-debug-access-approtect/549222"]It seems like that may be incorrect.&amp;nbsp; The UICR.APPROTECT register is set to &amp;quot;disabled&amp;quot;&amp;nbsp; when 0xFF, meaning the device is unsecured.&amp;nbsp;[/quote]
&lt;p&gt;That applies to the old revision 1 and 2, with hardware only based protection. For revision 3 devices with AP protect controlled by hardware and software,&amp;nbsp;the magic word 0x5A (named HwDisabled in the table) is the only value that disables AP protect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549222?ContentTypeID=1</link><pubDate>Thu, 18 Sep 2025 17:46:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:142ba19f-c021-4e6d-b29b-f093e3c740e8</guid><dc:creator>Raymond</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;,&amp;nbsp; &amp;nbsp;I&amp;#39;m working with &lt;a href="https://devzone.nordicsemi.com/members/j.p.-hutchins"&gt;J.P. Hutchins&lt;/a&gt;&amp;nbsp;on this project.&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Firstly, thank you for the detailed responses and providing clarification!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding your comment about &amp;quot;PS: There&amp;#39;s a twist here&amp;quot;&amp;nbsp; extra level of protection:&amp;nbsp; It seems like that may be incorrect.&amp;nbsp; The UICR.APPROTECT register is set to &amp;quot;disabled&amp;quot;&amp;nbsp; when 0xFF, meaning the device is unsecured.&amp;nbsp; So when left in this state, the firmware would only be able to set the device to &amp;quot;HwDisabled&amp;quot;&amp;nbsp; or &amp;quot;Enabled&amp;quot; (secured) by clearing bits.&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1758217437915v1.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549113?ContentTypeID=1</link><pubDate>Thu, 18 Sep 2025 06:56:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fff1fe56-ac73-431d-a683-85d64689ab34</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="J.P. Hutchins"]Our present approach of unconditionally writing &amp;quot;Disabled&amp;quot; to the UICR, via the factory HEX, is OK[/quote]
&lt;p&gt;Yes, that is OK and a requierment for implementing authenticated debug. (If&amp;nbsp;UICR.APPROTECT does nto have the magic word to unlock it, there is no way software can open the debug interface).&lt;/p&gt;
[quote user="J.P. Hutchins"]Which seems to write NRF_APPROTECT-&amp;gt;DISABLE using the UICR. It&amp;#39;s confusing, because if UICR is &amp;quot;doing something on its own&amp;quot;, why is there this (disabled) runtime code to write the NRF_APPROTECT-&amp;gt;DISABLE with it?[/quote]
&lt;p&gt;This is&amp;nbsp;mostly just a way of implementing it, the point is to write the magic word&amp;nbsp;0x5A. When doe like this, the correct magic word is only writen to&amp;nbsp;NRF_APPROTECT-&amp;gt;DISABLE if it is also in&amp;nbsp;UICR.APPROTECT. I do not see a funcional difference if you had written a hard coded magic word not read from UICR (particularily as you know the magic word will always be present in UICR in your case as it is&amp;nbsp;requiered when implementing authenticated debugging.&amp;nbsp;&lt;/p&gt;
[quote user="J.P. Hutchins"]Does this mean that there would be a brief window at reset where the DAP is unlocked, unless UICR.APPROTECT is set to &amp;quot;Enabled&amp;quot;?[/quote]
&lt;p&gt;No, the debug interface is locked down unless &lt;em&gt;both&lt;/em&gt; the HW and SW path opens it up. However, we state i&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/dif.html#d402e184"&gt;n the product specification&lt;/a&gt; that you&amp;nbsp;must lock both the UICR and SW path and recommend also writing to&amp;nbsp;APPROTECT.FORCEPROTECT. However, this will make authenticated debugging impossible as there will be no way to unlock the debug interface.&lt;/p&gt;
[quote user="J.P. Hutchins"]So we need to know exactly what firmware function this is referring to to avoid the &amp;quot;&lt;strong&gt;device may appear locked but it will not be completely protected&amp;quot;&amp;nbsp;&lt;/strong&gt;state that the article warns of.[/quote]
&lt;p&gt;This goes back to tha the article and the product specification specifies that you shall lock &lt;em&gt;both&lt;/em&gt; the HW and FW path and this is to be on the safe side, in case one of the paths is compromized by a hypotetical attack. But by design, locking one path is enough. And again, it is the only way you can implement authenticated debuggign.&lt;/p&gt;
&lt;p&gt;PS: There is a twist here. You can write to the UICR and flip bits from 1 to 0 during the lifetime of the product (but not the other way around as that would requier a full chip erase). That should make it&amp;nbsp;possible to leave UICR.APPROTECT 0xFF and then when you have doen your authentication procedure and want to open the debug interface first write the magic word 0x5A to&amp;nbsp;UICR.APPROTECT and perform a reset (which is requiered for UICR changes to take effect). After that authenticate again and proceee with opening the debug interface via NRF_APPROTECT-&amp;gt;DISABLE. This would then keep&amp;nbsp;UICR.APPROTECT alo locked until the first authenticate debug session (at which poit tthe device is probably no longer out in the field).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549098?ContentTypeID=1</link><pubDate>Wed, 17 Sep 2025 23:16:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e666ace0-ff58-4fe6-a974-f0dcc72a006f</guid><dc:creator>J.P. Hutchins</dc:creator><description>&lt;p&gt;HI&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;Thank you for confirming the approach! Just a few more clarifications:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/124416/authenticated-debug-access-approtect/549045"]UICR.APPROTECT need to be written to to open the debug interface.[/quote]
&lt;p&gt;Our present approach of unconditionally writing &amp;quot;Disabled&amp;quot; to the UICR, via the factory HEX, is OK because it is only one half of the lock, the other half being NRF_APPROTECT-&amp;gt;DISABLE? Would it be more secure to write &amp;quot;Enabled&amp;quot; via the factory HEX and then write &amp;quot;Disabled&amp;quot;/&amp;quot;Enabled&amp;quot; along with the authenticated application code that alters the NRF_APPROTECT-&amp;gt;DISABLE?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Re: UICR, we are not setting APPPROTECT USE UICR, and because of our patch, we would never hit this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;        #else
            if (nrf52_configuration_249())
            {
                /* Load APPROTECT soft branch from UICR.
                   If UICR-&amp;gt;APPROTECT is disabled, POWER-&amp;gt;APPROTECT will be disabled. */
                NRF_APPROTECT-&amp;gt;DISABLE = NRF_UICR-&amp;gt;APPROTECT;
            }
        #endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/11f57e578c7feea13f21c79ea0efab2630ac68c7/mdk/system_nrf52_approtect.h#L50-L57"&gt;https://github.com/NordicSemiconductor/nrfx/blob/11f57e578c7feea13f21c79ea0efab2630ac68c7/mdk/system_nrf52_approtect.h#L50-L57&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which seems to write NRF_APPROTECT-&amp;gt;DISABLE using the UICR. It&amp;#39;s confusing, because if UICR is &amp;quot;doing something on its own&amp;quot;, why is there this (disabled) runtime code to write the NRF_APPROTECT-&amp;gt;DISABLE with it?&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/124416/authenticated-debug-access-approtect/549045"]The debug interface will be locked by default after reset even if allowed in the UICR, and will not be open until&amp;nbsp;NRF_APPROTECT-&amp;gt;DISABLE. So until tha tis writte to, debug is not possible.[/quote]
&lt;p&gt;That is what we&amp;#39;ve been assuming, but it seems to contradict this article:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect"&gt;Working with the nRF52 Series&amp;#39; improved APPROTECT&lt;/a&gt;&amp;nbsp;(emphasis mine)&lt;/p&gt;
&lt;p&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The new access port protection mechanism is configured in two steps: in the &lt;strong&gt;hardware&lt;/strong&gt; and in the &lt;strong&gt;firmware&lt;/strong&gt;. &lt;strong&gt;At reset, the UICR.APPROTECT value is fetched in hardware.&lt;/strong&gt; Then a function in MDK version 8.45.0 (or newer) is executed during startup to complete the firmware step. &lt;strong&gt;If the firmware step is skipped then the device may appear locked but it will not be completely protected.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If this quote is correct, then it indicates some problems for our approach, I think.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;We have set UICR.APPROTECT to &amp;quot;Disabled&amp;quot; (0x5A), instead of &amp;quot;Enabled&amp;quot; (0x00) as suggested in the article. It says that UICR is fetched by the &lt;strong&gt;hardware&lt;/strong&gt; at startup. Does this mean that there would be a brief window at reset where the DAP is unlocked, unless UICR.APPROTECT is set to &amp;quot;Enabled&amp;quot;?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;It says &amp;quot;&lt;span&gt;Then a function in MDK version 8.45.0 (or newer) is executed during startup to complete the firmware step.&amp;quot; I think that we are OK as long as that firmware step is not the function that we have patched into a NOP. So we need to know exactly what firmware function this is referring to to avoid the &amp;quot;&lt;strong&gt;device may appear locked but it will not be completely protected&amp;quot;&amp;nbsp;&lt;/strong&gt;state that the article warns of.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Thanks again for your time!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;JP&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/549045?ContentTypeID=1</link><pubDate>Wed, 17 Sep 2025 13:42:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b1dfa52-3dde-42e8-8e94-fad8b6078cad</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for sharing. I would like to start by a disclaimer, as I cannot guarantee the security of you design. But I can comment if I see any issues.&amp;nbsp;Fundamentally the approach looks good. Revision 3 of the nRF52840 with the updated AP Protech mechanism has the requiered hardware features to implement authenticated debuging, as you have done.&lt;/p&gt;
[quote user=""]Thereby preventing unauthorized access to the integrated flash. &lt;strong&gt;Is this correct?&lt;/strong&gt;[/quote]
&lt;p&gt;Yes, this is a correct understanding. When debug is allowed in the UICR, it is up to software to enable/disable and potentially lock the debug interface which can be used to implement authenticated debugging.&lt;/p&gt;
[quote user=""]Is this simply an incomplete statement and it is in fact possible to safely unlock the debug access using the NRF_APPROTECT register described above?[/quote]
&lt;p&gt;Yes, you are right. That block post covers the most typical use case of AP protection, and not does not cover or authenticated debugging in to account. The relevat features is documented in the product specification, though, under &lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/dif.html#d402e184"&gt;Access port protection controlled by hardware and software&lt;/a&gt;.&lt;/p&gt;
[quote user=""] &lt;strong&gt;Does this&amp;nbsp;mean that authenticated debug is not possible on NRF52 or simply unimplemented and/or undocumented by Nordic?&lt;/strong&gt;[/quote]
&lt;p&gt;It is not supported in the sense that we do not provide any official guidance or tools for it, other than the description of the hardware features itself in the product specification. So implementing it will be up to you and it is your responsibility to ensure that it meets your requierments with regards to functionality and security.&lt;/p&gt;
&lt;p&gt;As you have seen,&amp;nbsp;CONFIG_NRF_APPROTECT_USER_HANDLING is not implemented for the nRF52 series devices (this goes all the way down to the &lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/6541dc3a175ef8cd0970f7d8f1d954928e6bde8c/nrfx/mdk/system_nrf52_approtect.h#L34-L37"&gt;MDK implementation&lt;/a&gt;, which does not support it, unlike for newer devices. However, your implementation of this looks good, and I do not have any comments regarding that.&lt;/p&gt;
[quote user=""]Looking at this now, I am concerned that it&amp;#39;s DISABLING the APPROTECT on startup rather than ENABLING it. I think this is important because it is what mitigates the vulnerability in previous revisions? [/quote]
&lt;p&gt;The debug interface will be locked by default after reset even if allowed in the UICR, and will not be open until&amp;nbsp;NRF_APPROTECT-&amp;gt;DISABLE. So until tha tis writte to, debug is not possible.&lt;/p&gt;
[quote user=""]&amp;quot;Step 2: Setting UICR.APPROTECT&amp;quot; from&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect"&gt;Working with the nRF52 Series&amp;#39; improved APPROTECT&lt;/a&gt;&amp;nbsp;&amp;nbsp;suggests writing this in the app (and bootloader?) and I suppose we should do that to make sure UICR is always &amp;quot;correct&amp;quot; - though, the app does not touch UICR, presently.[/quote]
&lt;p&gt;&lt;span&gt;UICR.APPROTECT need to be written to to open the debug interface. You can either do that in firmware, or via a debugger. For instance if you use &amp;quot;nrfutil device recover&amp;quot; that will among other things write to the UICR to open the debug interface (it will also write a small pice of firmware tha twrites to NRF_APPROTECT-&amp;gt;DISABLE so that the device can subsequently be programmed via the debug interface without needing a new recover operation, but that is less relevant here).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The remaining point which I assume you have implemened but not share he details for is how you authenticate before opening the debug interface from the nRF. That needs to be doen in a secure manner, typically using some asyncroneous cryptography so that the firmware on the nRF can authenticate the debugger before opening up for debugging. I do not have specific advice there, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Authenticated Debug Access (APPROTECT)</title><link>https://devzone.nordicsemi.com/thread/548945?ContentTypeID=1</link><pubDate>Tue, 16 Sep 2025 21:21:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cca1c52-6b12-4111-8bc8-1ba4dfd54c75</guid><dc:creator>J.P. Hutchins</dc:creator><description>&lt;p&gt;Corrections:&lt;br /&gt;&lt;br /&gt;&amp;quot;&lt;span&gt;which does not meet our requirements for authenticated debug access with erasing flash.&amp;quot; should be&amp;nbsp;&amp;quot;which does not meet our requirements for authenticated debug access &lt;strong&gt;without&lt;/strong&gt; erasing flash.&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;If I am understanding correctly, then this should be &amp;quot;Disabled&amp;quot;, not &amp;quot;Enabled&amp;quot; - or &amp;quot;HwDisabled&amp;quot;?&amp;quot; should be&amp;nbsp;&amp;quot;If I am understanding correctly, then this &lt;strong&gt;should be &amp;quot;Enabled&amp;quot;, not &amp;quot;Disabled&amp;quot; or &amp;quot;HwDisabled&amp;quot;&lt;/strong&gt;?&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>