<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>U2F on irq5 test</title><link>https://irq5-7854a1fdb9f4.pages.dev/tag/u2f/</link><description>Recent content in U2F on irq5 test</description><language>en-us</language><lastBuildDate>Fri, 02 Jul 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://irq5-7854a1fdb9f4.pages.dev/tag/u2f/feed/" rel="self" type="application/rss+xml"/><item><title>Using U2F for Door Access Control Systems</title><link>https://irq5-7854a1fdb9f4.pages.dev/2021/07/using-u2f-for-door-access-control-systems/</link><pubDate>Fri, 02 Jul 2021 00:00:00 +0000</pubDate><guid>https://irq5-7854a1fdb9f4.pages.dev/2021/07/using-u2f-for-door-access-control-systems/</guid><description>&lt;p>I was looking at trying to &lt;em>securely&lt;/em> implement a door access control system.
This usually involves some kind of card that you tap at a reader and the door unlocks.&lt;/p>&lt;p>Because it uses NFC, the NFC reader and electronics can be
located safely on the inside, leaving no exposed DIY electronics on the outside for attackers to fiddle around with.
Here&amp;rsquo;s an example project using a 3D-printed enclosure:&lt;/p>&lt;p>&lt;picture>&lt;source srcset=/posts/2021/img/nfc-lock-qtechknow-FFOTW1TI7L6T5HL.jpg.webp type=image/webp>&lt;img src=https://irq5-7854a1fdb9f4.pages.dev/posts/2021/img/nfc-lock-qtechknow-FFOTW1TI7L6T5HL.jpg alt="photo of a DIY NFC door lock found on Instructables.com, with all the electronics &amp; parts on the interior side of the door" width=1620 height=1080>&lt;/picture>&lt;/p>&lt;p>A lot of those DIY projects &lt;em>work&lt;/em>, but they are just not secure:&lt;/p>&lt;ul>&lt;li>&lt;a href=http://www.instructables.com/NFC-Door-Lock-with-the-Qduino-Mini-under-100/ rel=noopener target=_blank class=external>NFC Door Lock With the Qduino Mini &amp;ndash; Instructables.com&lt;/a>&lt;/li>&lt;li>&lt;a href=http://keyduino.forumsactifs.com/t4-nfc-drawer-lock rel=noopener target=_blank class=external>NFC drawer lock&lt;/a>&lt;/li>&lt;li>&lt;a href=https://www.makeuseof.com/tag/diy-smart-lock-arduino-rfid/ rel=noopener target=_blank class=external>DIY Smart Lock with Arduino and RFID&lt;/a>&lt;/li>&lt;/ul>&lt;p>Just look at the code and you will see what I mean.
They generally look like this:&lt;/p>&lt;div class=highlight role=region aria-label="code block" translate=no>&lt;pre tabindex=0 class=chroma>&lt;code class=language-c data-lang=c>&lt;span class=line>&lt;span class=cl>&lt;span class=kt>uint32_t&lt;/span> &lt;span class=n>uid&lt;/span> &lt;span class=o>=&lt;/span> &lt;span class=n>nfc&lt;/span>&lt;span class=p>.&lt;/span>&lt;span class=n>readCardId&lt;/span>&lt;span class=p>();&lt;/span> &lt;span class=c1 translate>// read the card&amp;#39;s unique ID
&lt;/span>&lt;/span>&lt;/span>&lt;span class=line>&lt;span class=cl>&lt;span class=c1 translate>&lt;/span>&lt;span class=k>if&lt;/span> &lt;span class=p>(&lt;/span>&lt;span class=n>uid&lt;/span> &lt;span class=o>==&lt;/span> &lt;span class=mh>0xAAAAAAAA&lt;/span> &lt;span class=o>||&lt;/span> &lt;span class=n>uid&lt;/span> &lt;span class=o>==&lt;/span> &lt;span class=mh>0xBBBBBBBB&lt;/span> &lt;span class=o>||&lt;/span> &lt;span class=p>...)&lt;/span> &lt;span class=p>{&lt;/span>
&lt;/span>&lt;/span>&lt;span class=line>&lt;span class=cl> &lt;span class=n>unlock&lt;/span>&lt;span class=p>();&lt;/span> &lt;span class=c1 translate>// YES!!
&lt;/span>&lt;/span>&lt;/span>&lt;span class=line>&lt;span class=cl>&lt;span class=c1 translate>&lt;/span>&lt;span class=p>}&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Unfortunately, consumer smart locks like a Yale or Samsung do pretty much the same thing,
without hard-coding UIDs of course.
When you enroll cards, the door lock will simply record the UID and will unlock
when you present a card (or tag) with that UID.
&lt;a href=https://learn.adafruit.com/adafruit-pn532-rfid-nfc/mifare rel=noopener target=_blank class=external>MIFARE Classic cards&lt;/a>
are commonly used for this purpose because they are very inexpensive.
They are factory-programmed with a unique identifier stored in sector 0,
which is read-only.&lt;/p>&lt;p>&lt;a href="https://irq5-7854a1fdb9f4.pages.dev/2021/07/using-u2f-for-door-access-control-systems/#more">Continue reading…&lt;/a>&lt;/p></description></item></channel></rss>