<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base=""  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Michael Roland&#039;s blog</title>
 <link>/blog/68</link>
 <description></description>
 <language>en</language>
<item>
 <title>JRC u&#039;smile concluded</title>
 <link>/blog/jrc-usmile-concluded</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;After 5 years of research in mobile security, the Josef Ressel Center for User-friendly Secure Mobile Environments (u&#039;smile) was successfully concluded on September 29th, 2017.&lt;/p&gt;
&lt;p&gt;The mission of this Josef Ressel Center for User-friendly Secure Mobile Environments (u&#039;smile) was the analysis of security issues in current and future mobile applications; the design, development, and evaluation of concepts, methods, protocols, and prototypical implementations for addressing them; and communication and co-ordination with industry partners and standardization organizations towards establishing globally accepted standards for secure, interoperable, mobile services. Broadly summarizing, JRC u&#039;smile succeeded with many specific contributions towards this vision, and in producing a final prototype of the Austrian mobile driving license on Android smartphones, which brings together the lines of research pursued within the 5 years. In the following report, we summarize these research directions by work packages, focusing on innovations since the two-term evaluation report. Detailed research results have been presented in peer-reviewed publications as well as technical reports, which form an appendix to this summary report. Over the last 5 years we published 18 journal articles, 61 papers in conference proceedings, 5 PhD theses, 2 books, and 22 technical reports and specification documents summarizing our findings and introducing new concepts, methods, and protocols to overcome security issues in mobile devices and applications, and to improve usability of security mechanisms on mobile devices both for end-users and developers. Further, a total number of 24 master&#039;s and 14 bachelor&#039;s theses have been completed within the scope of the JRC u&#039;smile. Moreover, we were able to present the project and its results to a broad audience by organizing the Android Security Symposium in 2015 and 2017. Additional indicators of success are numerous invitations to talks - including keynote speeches at academic conferences and other events as well as TEDxLinz -, media articles, invitations to participate in discussions with policy makers, and an increased international recognition of Austrian research contributions in the area of mobile device security. JRC u&#039;smile was split into two modules:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;Module 1 (Hardware, Platform, and Protocol Security Support for Mobile Devices)&lt;/em&gt; aimed to analyze and improve the current state-of-the-art of security in mobile devices specifically on the hardware, middleware, API, network protocol, and user interaction levels. Major contributions within all 5 years include significant advances in biometric, token, and multi-device based authentication methods for smart phones, a comprehensive analysis and protocol design towards an open ecosystem for tamper-resistant hardware in mobile devices, high-level results on securing mobile user interactions, and the integrative research on digital identities for real-world interaction, demonstrated in the Austrian mobile Driving License (AmDL) system.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Module 2 (Security Support for Mobile Services, Libraries and Applications)&lt;/em&gt; aimed to improve application security on the higher layers of the smartphone stack, complementing module 1 in tackling the whole stack across the JRC. The work in this module resulted in improvements to users security and privacy, enhancements for secure network communications of applications, self-defense of users concerning security and privacy issues in applicatins and the creation of analysis tools to detect implementation flaws as well as malicious applications.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;As predicted in the original project proposal, the mobile landscape is changing rapidly and mobile device security has experienced significant developments beyond the JRC u&#039;smile over the last few years. While the initial motivations and visions remained valid and continued to drive the overall focus of the JRC u&#039;smile, new fields - particularly in the areas of user and cross-device authentication as well as network level privacy implications - have opened, public interest in certain areas - such as digital identities - has dramatically increased, and requirements have changed. At the same time, some of the initially proposed research areas - most prominently virtualization on smart phones - had to be abandoned due to the shift of resources into new directions and due to unforeseen inaccessibility of proprietary technologies based on competitive market forces. We are happy to report that most milestones were met and that the critical path of our planned research has been fulfilled despite these rapid and often unpredictable developments in the mobile domain. Nevertheless, several changes to the original project plan proposed in the project application were necessary:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Some work packages in both modules were merged in order to account for tight relationships and to benefit from improved outcomes through a holistic approach.&lt;/li&gt;
&lt;li&gt;A new industry partner - Österreichische Staatsdruckerei GmbH - could be acquired in the area of digital identity use-cases. This allowed us to install a new work package focusing on providing digital identity documents and services on/with mobile devices.&lt;/li&gt;
&lt;li&gt;The original concept of virtualization on smart phones to compartmentalize single devices into multiple &#039;security zones&#039; was successfully prototyped and evaluated on the user interaction level to give guidance on future products, but could unfortunately not be implemented in a full-stack prototype due to unavailable low-level access to the boot loader and TrustZone layers.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The addition of the new work package on digital identities also resulted in an additional project outcome: the Austrian Mobile Driving License (AmDL), a prototype of a privacy-preserving mobile driving license. This shared demonstrator successfully integrates and show-cases results spanning across all work packages and across both modules of the JRC u&#039;smile. Moreover, with this demonstrator we achieved the goal of the initial motivating vision of the JRC u&#039;smile: to - globally, securely, and intuitively usably - substitute current wallets and key chains by suitable services and applications on mobile phones. Finally, specific follow-up projects with partners from the JRC u&#039;smile include the &lt;a href=&quot;https://digidow.eu/&quot; target=&quot;_blank&quot;&gt;proposal for a new Christian Doppler Laboratory &#039;Digidow&#039;&lt;/a&gt; to extend the JRC vision of digital identities far beyond mobile devices and into cloud services, and the extension of the JRC TARGET with a third module to transfer our collected knowledge on application analysis and system security improvements.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Fri, 23 Aug 2019 13:07:24 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">351 at </guid>
 <comments>/blog/jrc-usmile-concluded#comments</comments>
</item>
<item>
 <title>Rainhard Findling received the Fred Margulies Award 2015</title>
 <link>/blog/fred-margulies-award-2015</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;After being awarded the &lt;a href=&quot;/blog/ocg-incentive-award-fh-2015&quot;&gt;OCG Incentive Award FH 2014&lt;/a&gt;, our co-worker Rainhard Findling has also been awarded the &lt;a href=&quot;http://www.ifac-austria.at/html/englisch/fredmargulies.html&quot;&gt;Fred Margulies Award 2015&lt;/a&gt; (the award ceremony was on October 14th, 2016) for his master&#039;s thesis &lt;a href=&quot;/node/110&quot;&gt;&quot;Pan Shot Face Unlock: Towards Unlocking Personal Mobile Devices using Stereo Vision and Biometric Face Information from multiple Perspectives&quot;&lt;/a&gt;. The Fred Margulies award is awarded annually by the International Federation of Automatic Control (IFAC) Advisory Board Austria (German: IFAC Beirat Österreich) for outstanding Austrian scientific work in the field of automation, with special emphasis on social aspects. Laureates are selected by an international jury based on innovation, scientific content, economic and social relevance, and interdisciplinarity.&lt;/p&gt;
&lt;div style=&quot;text-align: center; width: 100%;&quot;&gt;
&lt;div style=&quot;width: 400px; height: 278px; margin-left: auto; margin-right: auto; padding-bottom: 0px; margin-bottom: 0px; text-align: left;&quot;&gt;&lt;a href=&quot;/sites/default/files/blog/fred_margulies_award_findling_2048.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img title=&quot;&quot; src=&quot;/sites/default/files/blog/fred_margulies_award_findling_400.jpg&quot; alt=&quot;&quot; width=&quot;400&quot; height=&quot;278&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;width: 400px; margin-left: auto; margin-right: auto; padding-top: 0px; margin-top: 0px; text-align: left; font-size: 75%;&quot;&gt;Photo: Copyright FH OÖ&lt;/div&gt;
&lt;/div&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_perspectives.svg&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right; margin: 5px 5px 15px 5px; clear: right;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_perspectives.png&quot; alt=&quot;&quot; width=&quot;187&quot; height=&quot;105&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_panshot.svg&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right; margin: 5px 20px 15px 20px; clear: none;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_panshot.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;105&quot; /&gt;&lt;/a&gt;The thesis investigates the pan shot face unlock: a mobile device face unlock, where users slide their device - with the device camera pointing towards them - 180 degrees from one side of their head over the face to the other side (&quot;pan shot&quot;). The approach combines 2D and 3D visual face data (grayscale and range camera images, if available) from different perspectives of the 180 degree swipe with sensoric information (device rotation from devices&#039; built-in gyroscope sensors). The combination of these measurements is used to determine if the face swipe was done by the legitimate user or an illegitimate user, trying to get unauthorized access to the device.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_range_0_00_00_best_match_small_without_full.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: left; clear: left; margin: 5px 20px 5px 0px;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_range_0_00_00_best_match_small_without.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;102&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_range_90_00_00_best_match_small_without_full.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: left; clear: left; margin: 5px 20px 15px 0px;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_range_90_00_00_best_match_small_without.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;102&quot; /&gt;&lt;/a&gt;In terms of cognitive load, the approach is conceptually more user-friendly than currently widespread unlock approaches, such as PIN, password or unlock patterns. It does not require users to remember a secret to unlock their devices (which would get more complicated with an increasing amount of devices owned per user). In comparison to traditional face unlock approaches, the pan shot face unlock is harder to circumvent using photo or video attacks. Traditional face unlock approaches usually only utilize frontal face information - which can easily be obtained by attackers today (e.g. pictures from social media platforms). These can be used to circumvent the unlock using a photo attack (attacker presenting the images or videos to the device to unlock it). With the pan shot face unlock, an attacker would be required to obtain 2D and 3D face data of the legitimate user from multiple perspectives, and to present that data to the locked device while rotating it accordingly - which significantly raises the effort for a successful attack.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&quot;The question of today&#039;s high-tech society no longer is, if we want to use some new technology, but how long we can afford not to use it. Therefore, it is of paramount importance to design technology in a sustainable, secure and safe way - including the increasing amount of mobile devices we all own,&quot; says Rainhard Findling. Rainhard further wants to thank his supervisor René Mayrhofer for the in-depth support throughout the studies, employment and thesis, as well as his colleagues and his family for their steady support.&lt;/p&gt;
&lt;h5 class=&quot;header&quot; style=&quot;clear: both;&quot;&gt;Links&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/node/110&quot;&gt;Rainhard Findling&#039;s master&#039;s thesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ifac-austria.at/html/englisch/FM%20Preistr%C3%A4ger.pdf&quot;&gt;List of Fred Margulies laureates (in German)&lt;/a&gt;&lt;/li&gt;
&lt;!-- &lt;li&gt;&lt;a href=&quot;http://TODO/&quot; target=&quot;_blank&quot;&gt;Press announcement by the University of Applied Sciences Upper Austria (in German)&lt;/a&gt;&lt;/li&gt; --&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 06 Dec 2016 14:31:27 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">240 at </guid>
 <comments>/blog/fred-margulies-award-2015#comments</comments>
</item>
<item>
 <title>Open Mobile API implementations affected by code injection vulnerability [CVE-2015-6606]</title>
 <link>/blog/open-mobile-api-implementations-affected-by-code-injection-vulnerability</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;We recently found a severe weakness in implementations of the Open Mobile API deployed on several Android devices. The vulnerability allows arbitrary code coming from a specially crafted Android application package (APK) to be injected into and executed by the smartcard system service component (the middleware component of the Open Mobile API implementation). This can be exploited to gain elevated capabilities, such as privileges protected by signature- and system-level permissions assigned to this service. The affected source code seems to originate from the SEEK-for-Android open-source project and was adopted by various vendor-specific implementations of the Open Mobile API, including the one that is used on the Nexus 6 (as of Android version 5.1). Several Android devices as well as the open source implementation SEEK-for-Android (only versions before 4.0.0) are affected.&lt;/p&gt;
&lt;p&gt;We initially reported this issue to affected parties starting end of June 2015 and it was initially announced in the &lt;a href=&quot;http://source.android.com/security/bulletin/2015-10-01.html&quot; target=&quot;_blank&quot;&gt;October 2015 Nexus Security Bulletin&lt;/a&gt;. The Common Vulnerability and Exposures ID (CVE) identifier &lt;strong&gt;CVE-2015-6606&lt;/strong&gt; has been assigend to this issue.&lt;/p&gt;
&lt;p&gt;Today, we published our report &lt;a href=&quot;http://arxiv.org/abs/1601.05833&quot; target=&quot;_blank&quot;&gt;&lt;em&gt;Executing Arbitrary Code in the Context of the Smartcard System Service&lt;/em&gt; (arXiv:1601.05833 [cs.CR])&lt;/a&gt; describing this vulnerability in full detail. Further, we published &lt;a href=&quot;https://github.com/michaelroland/omapi-cve-2015-6606-exploit&quot; target=&quot;_blank&quot;&gt;example exploit code to reproduce the issue on GitHub&lt;/a&gt;. Patches that fix the issue by disabling add-on terminal loading are available from our website: &lt;a href=&quot;/sites/default/files/blog/seek_3_1_0_CVE-2015-6606.patch&quot; target=&quot;_blank&quot;&gt;for SEEK 3.1.0&lt;/a&gt; and &lt;a href=&quot;/sites/default/files/blog/seek_3_0_0_CVE-2015-6606.patch&quot; target=&quot;_blank&quot;&gt;for SEEK 3.0.0&lt;/a&gt;. Where possible, we strongly advise to upgrade to SEEK version 4.0.0 which contains a completely redesigned add-on terminal loading concept and is consequently no longer affected by this vulnerability.&lt;/p&gt;
&lt;p&gt;Further reading:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://arxiv.org/abs/1601.05833&quot; target=&quot;_blank&quot;&gt;M. Roland: &quot;&lt;em&gt;Executing Arbitrary Code in the Context of the Smartcard System Service&lt;/em&gt;,&quot; arXiv:1601.05833 [cs.CR], Computing Research Repository (CoRR), arXiv.org/corr, University of Applied Sciences Upper Austria, JR-Center u&#039;smile, January 2016&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://arxiv.org/abs/1601.03027&quot; target=&quot;_blank&quot;&gt;M. Roland and M. Hölzl: &quot;&lt;em&gt;Open Mobile API: Accessing the UICC on Android Devices&lt;/em&gt;,&quot; arXiv:1601.03027 [cs.CR], Computing Research Repository (CoRR), arXiv.org/corr, University of Applied Sciences Upper Austria, JR-Center u&#039;smile, January 2016&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Useful links:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://seek-for-android.github.io/&quot; target=&quot;_blank&quot;&gt;SEEK-for-Android project&lt;/a&gt; on GitHub&lt;/li&gt;
&lt;li&gt;Google: &lt;a href=&quot;http://source.android.com/security/bulletin/2015-10-01.html&quot; target=&quot;_blank&quot;&gt;Nexus Security Bulletin - October 2015&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/michaelroland/omapi-cve-2015-6606-exploit&quot; target=&quot;_blank&quot;&gt;Example exploit code for CVE-2015-6606&lt;/a&gt; on GitHub&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 25 Jan 2016 11:01:57 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">233 at </guid>
 <comments>/blog/open-mobile-api-implementations-affected-by-code-injection-vulnerability#comments</comments>
</item>
<item>
 <title>OeSD joins u&#039;smile consortium</title>
 <link>/blog/oesterreichische-staatsdruckerei-joins-usmile-consortium</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Österreichische Staatsdruckerei recently joined the u&#039;smile project consortium.&lt;/p&gt;
&lt;div style=&quot;text-align: center; width: 100%;&quot;&gt;
&lt;div style=&quot;width: 650px; height: 200px; margin-left: auto; margin-right: auto; padding-bottom: 0px; margin-bottom: 0px; text-align: left;&quot;&gt;&lt;img title=&quot;&quot; src=&quot;/sites/default/files/blog/usmileundoesd1-650x200.jpg&quot; alt=&quot;&quot; width=&quot;650&quot; height=&quot;200&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://www.staatsdruckerei.at/news/oesterreichische-staatsdruckerei-setzt-sich-fuer-mehr-sicherheit-bei-smartphones-und-tablets-ein/&quot;&gt;https://www.staatsdruckerei.at/news/oesterreichische-staatsdruckerei-set...&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;http://futurezone.at/science/staatsdruckerei-will-smartphone-sicherheit-erhoehen/137.792.049&quot;&gt;http://futurezone.at/science/staatsdruckerei-will-smartphone-sicherheit-...&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 29 Jun 2015 13:39:58 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">202 at </guid>
 <comments>/blog/oesterreichische-staatsdruckerei-joins-usmile-consortium#comments</comments>
</item>
<item>
 <title>Rainhard Findling received the OCG Incentive Award FH 2014</title>
 <link>/blog/ocg-incentive-award-fh-2015</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;On 9. June 2015 our co-worker &lt;a href=&quot;/user/3&quot;&gt;Rainhard Findling&lt;/a&gt; has been awarded the OCG Incentive Award FH 2014 (German: OCG Förderpreis-FH) by the Austrian Computer Society (OCG) for his master&#039;s thesis &quot;&lt;a href=&quot;/node/110&quot;&gt;Pan Shot Face Unlock: Towards Unlocking Personal Mobile Devices using Stereo Vision and Biometric Face Information from multiple Perspectives&lt;/a&gt;&quot;. The OCG Incentive Award FH is awarded annually to Austria&#039;s best master&#039;s theses at Universities of Applied Sciences in the field of computer science and information management. This is the second time in a row that this award goes to a student at the University of Applied Sciences in Hagenberg.  Rainhard studied at the Department of Mobile Computing, University of Applied Sciences Upper Austria. He wrote his thesis during his time as a junior researcher at the Josef Ressel Center for User-Friendly Secure Mobile Environments (u&#039;smile).&lt;/p&gt;
&lt;div style=&quot;text-align: center; width: 100%;&quot;&gt;
&lt;div style=&quot;width: 400px; height: 267px; margin-left: auto; margin-right: auto; padding-bottom: 0px; margin-bottom: 0px; text-align: left;&quot;&gt;&lt;a href=&quot;/sites/default/files/blog/ocg_foerderpreis_findling_2048.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img title=&quot;&quot; src=&quot;/sites/default/files/blog/ocg_foerderpreis_findling_400.jpg&quot; alt=&quot;&quot; width=&quot;400&quot; height=&quot;267&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;width: 400px; margin-left: auto; margin-right: auto; padding-top: 0px; margin-top: 0px; text-align: left; font-size: 75%;&quot;&gt;Photo: Copyright &lt;a href=&quot;http://www.ocg.at/&quot; target=&quot;_blank&amp;quot;&quot;&gt;OCG&lt;/a&gt; / &lt;a href=&quot;http://www.danielaklemencic.com/&quot; target=&quot;_blank&quot;&gt;Daniela Klemencic&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_perspectives.svg&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right; margin: 5px 5px 15px 5px; clear: right;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_perspectives.png&quot; alt=&quot;&quot; width=&quot;187&quot; height=&quot;105&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_panshot.svg&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right; margin: 5px 20px 15px 20px; clear: none;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_panshot.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;105&quot; /&gt;&lt;/a&gt;The thesis investigates the pan shot face unlock: a mobile device face unlock, where users slide their device - with the device camera pointing towards them - 180 degrees from one side of their head over the face to the other side (&quot;pan shot&quot;). The approach combines 2D and 3D visual face data (grayscale and range camera images, if available) from different perspectives of the 180 degree swipe with sensoric information (device rotation from devices&#039; built-in gyroscope sensors). The combination of these measurements is used to determine if the face swipe was done by the legitimate user or an illegitimate user, trying to get unauthorized access to the device.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_range_0_00_00_best_match_small_without_full.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: left; clear: left; margin: 5px 20px 5px 0px;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_range_0_00_00_best_match_small_without.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;102&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/sites/default/files/articles/userauthentication_face_range_90_00_00_best_match_small_without_full.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: left; clear: left; margin: 5px 20px 15px 0px;&quot; title=&quot;&quot; src=&quot;/sites/default/files/articles/userauthentication_face_range_90_00_00_best_match_small_without.png&quot; alt=&quot;&quot; width=&quot;130&quot; height=&quot;102&quot; /&gt;&lt;/a&gt;In terms of cognitive load, the approach is conceptually more user-friendly than currently widespread unlock approaches, such as PIN, password or unlock patterns. It does not require users to remember a secret to unlock their devices (which would get more complicated with an increasing amount of devices owned per user). In comparison to traditional face unlock approaches, the pan shot face unlock is harder to circumvent using photo or video attacks. Traditional face unlock approaches usually only utilize frontal face information - which can easily be obtained by attackers today (e.g. pictures from social media platforms). These can be used to circumvent the unlock using a photo attack (attacker presenting the images or videos to the device to unlock it). With the pan shot face unlock, an attacker would be required to obtain 2D and 3D face data of the legitimate user from multiple perspectives, and to present that data to the locked device while rotating it accordingly - which significantly raises the effort for a successful attack.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&quot;The question of today&#039;s high-tech society no longer is, if we want to use some new technology, but how long we can afford not to use it. Therefore, it is of paramount importance to design technology in a sustainable, secure and safe way - including the increasing amount of mobile devices we all own,&quot; says Rainhard Findling. Rainhard further wants to thank his supervisor René Mayrhofer for the in-depth support throughout the studies, employment and thesis, as well as his colleagues and his family for their steady support.&lt;/p&gt;
&lt;h5 class=&quot;header&quot; style=&quot;clear: both;&quot;&gt;Links&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/node/110&quot;&gt;Rainhard Findling&#039;s master&#039;s thesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ocg.at/de/f%C3%B6rderpreis-fh-der-%C3%B6sterreichischen-computer-gesellschaft-geht-rainhard-findling&quot; target=&quot;_blank&quot;&gt;Announcement by the OCG (in German)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.fh-ooe.at/campus-hagenberg/aktuelles/fh-ooe-news-hagenberg/fh-ooe-news-hagenberg/article/fh-ooe-absolvent-mit-ocg-foerderpreis-ausgezeichnet/&quot; target=&quot;_blank&quot;&gt;Press announcement by the University of Applied Sciences Upper Austria (in German)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Wed, 10 Jun 2015 09:55:35 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">201 at </guid>
 <comments>/blog/ocg-incentive-award-fh-2015#comments</comments>
</item>
<item>
 <title>Book Security Issues in Mobile NFC Devices published by Springer</title>
 <link>/blog/book-security-issues-in-mobile-nfc-devices-published</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;img style=&quot;float: right; margin: 5px 0px 5px 20px;&quot; title=&quot;Book cover: Security Issues in Mobile NFC Devices (Springer)&quot; src=&quot;/sites/default/files/blog/20150326_SecurityIssuesInMobileNFCDevices_cover_200x301.png&quot; alt=&quot;&quot; width=&quot;200&quot; height=&quot;301&quot; /&gt;The revised version of my PhD thesis &lt;em&gt;Security Issues in Mobile NFC Devices&lt;/em&gt; was published by Springer in the series &lt;a href=&quot;http://www.springer.com/series/10013&quot; target=&quot;_blank&quot;&gt;T-Labs Series in Telecommunication Services&lt;/a&gt; this month. It is available as an e-book and in hardcover.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;The book provides an assessment of the current state of Near Field Communication (NFC) security, it reports on new attack scenarios, and offers concepts and solutions to overcome unresolved issues. The work describes application-specific security aspects of NFC based on exemplary use-case scenarios and uses these to focus on the interaction with NFC tags and on card emulation. The current security architectures of NFC-enabled cellular phones are evaluated with regard to the identified security aspects.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Get more information on &lt;a href=&quot;http://www.springer.com/engineering/signals/book/978-3-319-15487-9&quot; target=&quot;_blank&quot;&gt;Springer.com&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;read it on &lt;a href=&quot;http://dx.doi.org/10.1007/978-3-319-15488-6&quot; target=&quot;_blank&quot;&gt;Springer Link&lt;/a&gt;, or&lt;/li&gt;
&lt;li&gt;buy it on &lt;a href=&quot;http://www.amazon.com/dp/3319154877&quot; target=&quot;_blank&quot;&gt;Amazon.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;h3 class=&quot;header&quot;&gt;Abstract&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;The recent emergence of Near Field Communication (NFC) enabled smart phones lead to an increasing interest in NFC technology and its applications by equipment manufacturers, service providers, developers, and end-users. Nevertheless, frequent media reports about security and privacy issues of electronic passports, contactless credit cards, asset tracking systems, NFC-enabled mobile phones, and proprietary contactless technologies suggest that NFC is a potentially unsafe technology whose main beneficiaries are thieves. While these weaknesses are often bound to specific applications and products, they boost the fear that NFC technology as a whole is dangerous, threatens our privacy and helps identity theft and fraud. In order to defend their own products and services, manufacturers and service providers often position themselves on the opposite extreme, stating that their products and services incorporate sufficient countermeasures.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;This work aims for assessing the actual state of NFC security, for discovering new attack scenarios and for providing concepts and solutions to overcome any identified unresolved issues. Based on exemplary use-case scenarios, application-specific security aspects of NFC are extracted. The current security architectures of NFC-enabled mobile phones are evaluated with regard to the identified security aspects. As a result of the exemplary use-cases, this research focuses on the interaction with NFC tags and on card emulation. For each of these two modes of NFC, this thesis reveals attack scenarios that are possible despite existing security concepts. For the interaction with NFC tags, a new attack scenario is introduced that allows modification of tag content even though its authenticity and integrity were supposedly guaranteed by a digital signature scheme. Moreover, potential privacy issues and remaining problems have been identified in the NFC Forum&#039;s signature scheme specification. For the card emulation scenario, the mobile phone itself is identified as a significant, yet unconsidered, threat. Specifically, the well-known concept of relay attacks on smartcards is extended to the mobile phone platform. By using the phone&#039;s processing capabilities and communication facilities, relay attacks can be mounted in a significantly easier and less obvious way. These assumptions are verified through prototypical implementations. Possible solutions and workarounds to overcome these issues are outlined and evaluated with regard to their advantages and disadvantages.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 26 Mar 2015 15:20:47 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">182 at </guid>
 <comments>/blog/book-security-issues-in-mobile-nfc-devices-published#comments</comments>
</item>
<item>
 <title>How to root Android 5.0.1 on your Sony SmartWatch 3 (SWR50)</title>
 <link>/blog/how-to-root-android-5-on-sony-smartwatch-3-swr50</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;In &lt;a title=&quot;Is there NFC on Sony SmartWatch 3 (SWR50)?&quot; href=&quot;/blog/is-there-nfc-on-sony-smartwatch-3-swr50&quot;&gt;my previous post&lt;/a&gt; I started to dissect the NFC functionality of our Sony SmartWatch 3 (SWR50). Unfortunately, without having root access it is pretty much impossible to explore the whole file system of the watch. More specifically, the interesting parts of the file system (device files under &lt;code&gt;/dev&lt;/code&gt; and certain application binaries under &lt;code&gt;/system/bin&lt;/code&gt;) are concealed from the adb shell user by SELinux. Therefore, we aimed for getting root access on our SWR50.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Luckily, there was already a guide for rooting the SWR50 available on XDA Developers: &lt;a title=&quot;[GUIDE][ROOT] Smartwatch 3 KNX01V&quot; href=&quot;http://forum.xda-developers.com/smartwatch-3/orig-development/guide-smartwatch-3-knx01v-t2932759&quot; target=&quot;_blank&quot;&gt;[GUIDE][ROOT] Smartwatch 3 KNX01V&lt;/a&gt;. This guide worked like a charm on our watch that was still running Android 4.4W (KNX01V). Unfortunately, we then upgraded to Android 5.0.1 (LWX48P) and, eventhough the &lt;code&gt;su&lt;/code&gt; binaries survived the upgrade, the &lt;code&gt;su&lt;/code&gt; command no longer managed to gain root permissions. As a first shot we tried to re-run the rooting boot image from the guide. This wasn&#039;t a good idea though. &lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;strong&gt;BE WARNED!&lt;/strong&gt;&lt;/span&gt; Booting the watch with that boot image soft-&lt;strong&gt;bricked&lt;/strong&gt; our device. The device still booted into Android but never started the Android UI due to haning in an endless loop. After I recovered from that shock and after some time (hours?!) of debugging, I — &lt;strong&gt;luckily&lt;/strong&gt; — managed to recover from that soft-brick by (simply) wiping the data partition.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;So why did this happen?&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;In order to find out what happened, I downloaded the &lt;a title=&quot;[DEV][TOOL] Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux]&quot; href=&quot;http://forum.xda-developers.com/showthread.php?t=2073775&quot; target=&quot;_blank&quot;&gt;Android Image Kitchen toolchain&lt;/a&gt; and extracted the root file system from the rooting boot image. After analyzing the startup scripts of the rooting boot image, the answer to this question was rather simple: This happened because the &lt;code&gt;init&lt;/code&gt; scripts of the boot image perform a whole bunch of modifications on the data partition of the watch. While these modifications were just the same that are performed during a regular boot of KNX01V, these modifications were incompatible with the new layout of the data partition in Android 5. Hence, Android 5.0.1 (LWX48P) got stuck in a boot loop.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;Creating a less intrusive rooting boot image&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;I, then, decided to create a less intrusive version of the rooting boot image by removing all unneccessary parts of the &lt;code&gt;init&lt;/code&gt; scripts. The new image only mounts the system partition, starts a minimal set of system components and (as the original rooting boot image) executes a script (&lt;code&gt;/sbin/superuser.sh&lt;/code&gt; in the root file system of the image) containing the commands to install the &lt;code&gt;su&lt;/code&gt; binaries. Particularly, the new version no longer touches the data partition. You can download this image &lt;a title=&quot;SWR50-rootboot-for-KNX01V-byMR&quot; href=&quot;https://github.com/mobilesec/swr50-tools/blob/74a6cdcce3c79fe1de4cf850a0e8697f1ab5f469/rootboot/SWR50-rootboot-for-KNX01V-byMR.img?raw=true&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. However, this does not solve the problem of getting root privileges on Android 5.0.1. The method of rooting included into that image is simply incapable of obtaining root privileges on Android 5.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;Getting root on the SWR50 with Android 5.0.1 (LWX48P)&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Consequently, I decided to digg a bit deeper into the prerequisites of rooting Android 5. Luckily, &lt;a title=&quot;Chainfire on XDA Developers&quot; href=&quot;http://forum.xda-developers.com/member.php?u=631273&quot; target=&quot;_blank&quot;&gt;Chainfire&lt;/a&gt; already did a great job on creating &lt;a title=&quot;SuperSU on XDA Developers&quot; href=&quot;http://forum.xda-developers.com/showthread.php?t=1538053&quot; target=&quot;_blank&quot;&gt;SuperSU&lt;/a&gt; for Android and making it available as an &lt;a title=&quot;Recovery mode installable SuperSU&quot; href=&quot;http://download.chainfire.eu/supersu&quot; target=&quot;_blank&quot;&gt;update.zip&lt;/a&gt; ready to be installed through recovery mode. So all I had to do was to extract the installation script and the installable files from the UPDATE-SuperSU-v2.40.zip file. I used version 2.40, which was the most current version at that time. I then ported the installation script to the &lt;a title=&quot;superuser.sh for installing SuperSU&quot; href=&quot;https://github.com/mobilesec/swr50-tools/blob/74a6cdcce3c79fe1de4cf850a0e8697f1ab5f469/rootboot/SWR50-rootboot-for-LWX48P-byMR/ramdisk/sbin/superuser.sh&quot; target=&quot;_blank&quot;&gt;&lt;code&gt;/sbin/superuser.sh&lt;/code&gt;&lt;/a&gt; shell script of the rooting boot image. Moreover, I reduced the SuperSU installation to only the core components necessary to gain root access through &lt;code&gt;adb shell&lt;/code&gt;. Specifically, I included the su binaries for the SWR50 hardware platform only and skipped the installation of the SuperSU UI app. You can download this new image &lt;a title=&quot;SWR50-rootboot-for-LWX48P-byMR&quot; href=&quot;https://github.com/mobilesec/swr50-tools/blob/74a6cdcce3c79fe1de4cf850a0e8697f1ab5f469/rootboot/SWR50-rootboot-for-LWX48P-byMR.img?raw=true&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; (and &lt;a title=&quot;SWR50-rootboot-for-LWX48P-byMR source files&quot; href=&quot;https://github.com/mobilesec/swr50-tools/tree/74a6cdcce3c79fe1de4cf850a0e8697f1ab5f469/rootboot/SWR50-rootboot-for-LWX48P-byMR&quot; target=&quot;_blank&quot;&gt;this repository&lt;/a&gt; contains the source files for image creation using Android Image Kitchen). A quick test (boot that rooting boot image and wait until the watch reboots into Android) revealed that SuperSU 2.40 is capable of obtaining root privileges on LWX48P.&lt;/p&gt;
&lt;h2 class=&quot;header&quot;&gt;I want root too! — A step-by-step tutorial&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;So I already got root and, when you read so far, certainly want to know how to get root on your SWR50 too. Therefore, I created this step-by-step tutorial (heavily based on &lt;a title=&quot;[GUIDE][ROOT] Smartwatch 3 KNX01V&quot; href=&quot;http://forum.xda-developers.com/smartwatch-3/orig-development/guide-smartwatch-3-knx01v-t2932759&quot; target=&quot;_blank&quot;&gt;XorZone&#039;s original guide on XDA Developers&lt;/a&gt;):&lt;/p&gt;
&lt;h4 class=&quot;header&quot;&gt;Prerequisites&lt;/h4&gt;
&lt;ul&gt;&lt;li&gt;Have a current version of the &lt;code&gt;adb&lt;/code&gt; and &lt;code&gt;fastboot&lt;/code&gt; binaries on your computer (e.g. by installing an up-to-date version of the &lt;a title=&quot;Android SDK Tools&quot; href=&quot;http://developer.android.com/sdk/index.html#Other&quot; target=&quot;_blank&quot;&gt;Android SDK Tools&lt;/a&gt;) and have them on your path.&lt;/li&gt;
&lt;li&gt;Download the rooting boot image &lt;a title=&quot;SWR50-rootboot-for-LWX48P-byMR&quot; href=&quot;https://github.com/mobilesec/swr50-tools/blob/74a6cdcce3c79fe1de4cf850a0e8697f1ab5f469/rootboot/SWR50-rootboot-for-LWX48P-byMR.img?raw=true&quot; target=&quot;_blank&quot;&gt;SWR50-rootboot-for-LWX48P-byMR.img&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;h4 class=&quot;header&quot;&gt;Step 1&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Enable the &lt;strong&gt;Developer options&lt;/strong&gt; for your watch (go to &lt;em&gt;Settings&lt;/em&gt; -&amp;gt; &lt;em&gt;About&lt;/em&gt; and quickly tap the Build number 7 times in a row).&lt;/p&gt;
&lt;h4 class=&quot;header&quot;&gt;Step 2&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Enable ADB debugging (under &lt;em&gt;Settings&lt;/em&gt; -&amp;gt; &lt;em&gt;Developer options&lt;/em&gt;). The watch will request confirmation to allow ADB debugging through the &lt;em&gt;companion app on your phone&lt;/em&gt; the first time you use the &lt;code&gt;adb&lt;/code&gt; tool from your computer.&lt;/p&gt;
&lt;h4 class=&quot;header&quot;&gt;Step 3&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;You may need to install the Android ADB Composite Interface device driver for your watch.&lt;/p&gt;
&lt;h4 class=&quot;header&quot;&gt;Step 4&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Use the &lt;code&gt;adb reboot&lt;/code&gt; command to boot into fastboot boot loader mode:&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;adb reboot bootloader&lt;/pre&gt;&lt;h4 class=&quot;header&quot; style=&quot;padding-top: 15px;&quot;&gt;Step 5 (conditional)&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;If the bootloader of your watch is not already unlocked, you will need to unlock it. On our watch the bootloader was already unlocked by default, so we could simply skip this step.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;strong&gt;BE WARNED: This step will wipe all your data from the watch.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;fastboot oem unlock
fastboot oem unlock
fastboot format cache
fastboot format userdata
fastboot reboot&lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;After the device rebooted, you have to boot it into fastboot boot loader mode again:&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;adb reboot bootloader&lt;/pre&gt;&lt;h4 class=&quot;header&quot; style=&quot;padding-top: 15px;&quot;&gt;Step 6&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Boot the rooting boot image:&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;adb boot SWR50-rootboot-for-LWX48P-byMR.img&lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;The image will boot into a screen &quot;SmartWatch 3&quot; and will stay there for several seconds. When the rooting boot image completed its tasks it will automatically reboot into the regular Android system.&lt;/p&gt;
&lt;h4 class=&quot;header&quot;&gt;Step 7&lt;/h4&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;You can now test if rooting succedded by starting &lt;code&gt;adb shell&lt;/code&gt; and executing the &lt;code&gt;su&lt;/code&gt; binary:&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;adb shell
shell@tetra:/ $ su
root@tetra:/ # &lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;You can then check if you really got root privileges (and are not locked out by SELinux) by typing &lt;code&gt;ls -l /data&lt;/code&gt; which should result in a directory listing like the following:&lt;/p&gt;
&lt;pre class=&quot;content-script&quot;&gt;root@tetra:/ # ls -l /data
ls -l /data
adb
app
app-asec
app-lib
app-private
bugreports
dalvik-cache
data
dontpanic
drm
gps
local
lost+found
media
mediadrm
misc
property
resource-cache
security
system
tombstones
user
root@tetra:/ #&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;There is an alternative approach too!&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;We are not the only ones playing around with the Sony SmartWatch3 SWR50. Hence, while preparing this post there appeared an alternative approach for rooting the watch. &lt;a title=&quot;User perpe on GitHub&quot; href=&quot;https://github.com/perpe/&quot; target=&quot;_blank&quot;&gt;Perpe&lt;/a&gt; did a great job in &lt;a title=&quot;[RECOVERY][Unofficial][tetra] TWRP 2.8.3.0 for Sony Smartwatch 3&quot; href=&quot;http://forum.xda-developers.com/smartwatch-3/development/recovery-twrp-2-8-3-0-sony-smartwatch-3-t2986907&quot; target=&quot;_blank&quot;&gt;porting the TWRP recovery to the SWR50&lt;/a&gt;. Therefore, an alternative approach for rooting is to flash (or just to boot) that recovery image and then install the SuperSU update.zip package.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 29 Jan 2015 16:38:23 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">176 at </guid>
 <comments>/blog/how-to-root-android-5-on-sony-smartwatch-3-swr50#comments</comments>
</item>
<item>
 <title>Is there NFC on Sony SmartWatch 3 (SWR50)?</title>
 <link>/blog/is-there-nfc-on-sony-smartwatch-3-swr50</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;We recently received our brand new &lt;a href=&quot;http://www.sonymobile.com/global-en/products/smartwear/smartwatch-3-swr50/&quot; target=&quot;_blank&quot;&gt;Sony SmartWatch 3 SWR50&lt;/a&gt; (powered by Android Wear). We intend to use them in our research on &lt;a href=&quot;/research/user-authentication&quot; target=&quot;_self&quot;&gt;ShakeUnlock&lt;/a&gt; where we try to transfer authentication state transfer between two devices equipped with accelerometers by briefly shaking both devices together. Until then, I decided to explore that device to find out what else we could possibly do with it. As my research focus is (among other mobile security topics) on Near Field Communication (NFC), I was really happy to see that the &lt;a href=&quot;http://www.sonymobile.com/global-en/products/smartwear/smartwatch-3-swr50/specifications/&quot; target=&quot;_blank&quot;&gt;specs&lt;/a&gt; read &quot;&lt;em&gt;Connectors: NFC&lt;/em&gt;&quot;. Particularly when it comes to access control scenarios (e.g. door access) or payment, using a smart watch instead of (or in addition to) a regular smartcard or a mobile phone could be very convenient. So I was hoping to see host-based card emulation (HCE) functionality. Moreover, I would love to see my &lt;a href=&quot;https://play.google.com/store/apps/details?id=at.mroland.android.apps.nfctaginfo&quot; target=&quot;_blank&quot;&gt;NFC TagInfo&lt;/a&gt; app running on a smart watch and being able to scan tags with the watch.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;About a month ago, a &lt;a href=&quot;http://stackoverflow.com/q/26769864/2425802&quot; target=&quot;_blank&quot;&gt;question (and its answer) on StackOverflow&lt;/a&gt; already revealed a &lt;a href=&quot;http://www-support-downloads.sonymobile.com/swr50/whitepaper_EN_swr50_smartwatch3_2.pdf&quot; target=&quot;_blank&quot;&gt;white paper&lt;/a&gt; by Sony that states that the SWR50 only supports NFC &quot;&lt;em&gt;to power on the SWR50 and [to] start the Android Wear host application&lt;/em&gt;&quot;. If that was really the case, the watch would not be usable for the above scenarios.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;So let&#039;s see what we found...&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;NFC Tag&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;First, I started by scanning the SWR50 with another smart phone using my &lt;a href=&quot;https://play.google.com/store/apps/details?id=at.mroland.android.apps.nfctaginfo&quot; target=&quot;_blank&quot;&gt;NFC TagInfo&lt;/a&gt; app.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;NFC TagInfo identified the SWR50 as an NFC Forum Type 2 Tag. The ATQA (answer-to-request) of the tag is &lt;code&gt;0x0044&lt;/code&gt; and the SAK (select acknowledge) is &lt;code&gt;0x00&lt;/code&gt;. This indicates that the tag supports a proprietary protocol on top of ISO/IEC 14443-3 (e.g. Type 2 Tag platform) but that it does neither support ISO-DEP (ISO/IEC 14443-4) nor NFC-DEP (NFC peer-to-peer mode).&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;The 7-byte-UID of the NFC tag of our watch is &lt;code&gt;2e020d00000000&lt;/code&gt; (and it remains the same after rebooting the device). So the manufacturer ID (&lt;code&gt;0x2e&lt;/code&gt;) identifies Broadcom as the chip manufacturer. This information (in combination with the fact that this is a Type 2 Tag) is interesting for two reasons:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;I did not find any information that Broadcom manufactures Type 2 Tags.&lt;/li&gt;
&lt;li&gt;The UID contains a rather unusual number of zero bytes.&lt;/li&gt;
&lt;/ol&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Both make me think that this NFC tag might actually be emulated using a Broadcom NFC controller.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Just to make sure that my NFC TagInfo app did not miss anything, I decided to also scan the watch with NXP&#039;s &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.nxp.taginfolite&quot; target=&quot;_blank&quot;&gt;TagInfo&lt;/a&gt; app. And, in fact, NXP&#039;s app found something very interesting: Even though the SAK byte does not indicate support for ISO-DEP, the watch returns an ATS (answer-to-select) in response to a RATS (request answer-to-select) command. The ATS is &lt;code&gt;0578808002&lt;/code&gt; and codes&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;FSCI = 8: Maximum frame size from reader to tag is 256 bytes.&lt;/li&gt;
&lt;li&gt;TA(1) = 80: Only 106 kbps supported in both directions.&lt;/li&gt;
&lt;li&gt;TB(1) = 80: Frame waiting time is 77.33 ms. Start-up frame guard time is 302 us.&lt;/li&gt;
&lt;li&gt;TC(1) = 02: CID (card identifier) supported, NAD (node addressing) not supported.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Hence, this further backs my hypothesis that the Type 2 Tag is actually emulated using an NFC controller that supports more than just being a Type 2 memory tag.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;Tag Memory&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;The tag 488 bytes of memory in total (split into 122 blocks with 4 bytes each) filled with the following data:&lt;/p&gt;
&lt;pre class=&quot;content-output&quot;&gt;     0: 2E 02 0D 0C     1: 00 00 00 00
     2: 00 00 FF FF     3: E1 11 3C 0F
     4: 00 00 00 01     5: 03 78 30 35
     6: 03 31 D4 0F     7: 1F 61 6E 64
     8: 72 6F 69 64     9: 2E 63 6F 6D
    10: 3A 70 6B 67    11: 63 6F 6D 2E
    12: 67 6F 6F 67    13: 6C 65 2E 61
    14: 6E 64 72 6F    15: 69 64 2E 77
    16: 65 61 72 61    17: 62 6C 65 2E
    18: 61 70 70 FE    19: FF FF FF FF
    20: 30 A8 DB F2    21: 43 1C FF FF
    22: 30 A8 DB F5    23: 2A 78 FF FF
    24: 14 39 2D 4D    25: F2 6A 91 40
    26: FF FF FF FF    27: FF FF FF FF
   ...: FF FF FF FF   ...: FF FF FF FF
   120: FF FF FF FF   121: FF FF FF FF&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The static lock bits (block 2, bytes 2 and 3) are all set (indicates locked state).&lt;/li&gt;
&lt;li&gt;Block 3 contains a capability container for a Type 2 tag (magic byte &lt;code&gt;0xE1&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;However, the mapping version number 1.1 (&lt;code&gt;0x11&lt;/code&gt;) does &lt;strong&gt;not&lt;/strong&gt; comply to any of the current mapping version documents provided by the NFC Forum! The only mapping version number that is currently defined (as of version 1.2 of the NFC Forum Type 2 Tag Operation specification) is 1.0.&lt;/li&gt;
&lt;li&gt;Block 4 contains 3 NULL TLVs (&lt;code&gt;0x00&lt;/code&gt;) and the first byte of a Lock Control TLV (tag &lt;code&gt;0x01&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The Lock Control TLV indicates that there are 48 lock bits located starting at byte position 232 (= 7 * 2&lt;sup&gt;5&lt;/sup&gt; + 8). I.e. 6 bytes starting at block 58, so they are all set (&lt;code&gt;FF FF FF FF FF FF&lt;/code&gt;). Each lock bit locks 3 bytes, so they indicate that blocks 16 to 51 are locked.&lt;/li&gt;
&lt;li&gt;Block 6 contains the start of an NDEF Message TLV (tag &lt;code&gt;0x03&lt;/code&gt;, length &lt;code&gt;0x31&lt;/code&gt;). The NDEF message consists of a single NDEF record (Android Application Record for app &lt;code&gt;com.google.android.wearable.app&lt;/code&gt;):&lt;/li&gt;
&lt;/ul&gt;&lt;pre class=&quot;content-output&quot;&gt;+--------------------------------------------+
| TNF:  EXTERNAL TYPE                        |
| Type: urn:nfc:ext:android.com:pkg          |
+--------------------------------------------+
| Payload: com.google.android.wearable.app   |
+--------------------------------------------+
&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Block 18 contains a Terminator TLV (tag &lt;code&gt;0xFE&lt;/code&gt;) indicating the last TLV block within the tag memory area.&lt;/li&gt;
&lt;li&gt;Blocks 20 and 21 (first 2 bytes) contain the device Bluetooth address.&lt;/li&gt;
&lt;li&gt;Blocks 22 and 23 (first 2 bytes) contain something that looks like a Bluetooth address too.&lt;/li&gt;
&lt;li&gt;Blocks 24 and 25 contain the device serial number.&lt;/li&gt;
&lt;li&gt;The remaining blocks are all filled with &lt;code&gt;FF FF FF FF&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;To summarize this, the NFC tag contains a static NDEF message that is used to launch the companion app on an NFC-enabled Android smart phone and to discover the peer Bluetooth address of the smart watch. Moreover, there are some hints that this NFC tag might be emulated using a full-blown NFC controller.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;NFC API&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Next, I wanted to dig into the NFC capabilities that are provided to app developers through the Android API. Unfortunately, requesting an instance of the NFC adapter fails as the &lt;code&gt;getDefaultAdapter()&lt;/code&gt; method returns &lt;code&gt;null&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;content-code&quot;&gt;NfcManager nfcMgr = (NfcManager)mContext.getSystemService(Context.NFC_SERVICE);
NfcAdapter nfcAdapter = nfcMgr.getDefaultAdapter();  // -&amp;gt; null&lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;This is a clear indication that there is no Android NFC stack available on the device. In addition there is a log message that the device does not support NFC:&lt;/p&gt;
&lt;pre class=&quot;content-output&quot;&gt;V/NFC: this device does not have NFC support&lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Moreover, looking at the NFC system features, none of the NFC system features are available:&lt;/p&gt;
&lt;pre class=&quot;content-code&quot;&gt;PackageManager pkgMgr = mContext.getPackageManager();
boolean featureNfc = pkgMgr.hasSystemFeature(&quot;android.hardware.nfc&quot;);      // -&amp;gt; false
boolean featureHce = pkgMgr.hasSystemFeature(&quot;android.hardware.nfc.hce&quot;);  // -&amp;gt; false&lt;/pre&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;As both, &lt;code&gt;featureNfc&lt;/code&gt; and &lt;code&gt;featureHce&lt;/code&gt;, are &lt;code&gt;false&lt;/code&gt;, neither NFC (android.hardware.nfc) nor HCE (android.hardware.nfc.hce) are available.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Consequently, there currently is no NFC API available on the SWR50.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;Firmware / Android System&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;Last, I decided to run &lt;code&gt;adb shell&lt;/code&gt; to analyze the file system of the smart watch Android firmware. The interesting things that I found are:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;There is a file named &lt;code&gt;BCM43341B0_002.001.014.0122.0174.hcd&lt;/code&gt; under &lt;code&gt;/system/vendor/firmware&lt;/code&gt;, so it seems that the watch contains &lt;a href=&quot;http://www.broadcom.com/products/Bluetooth/Bluetooth-RF-Silicon-and-Software-Solutions/BCM43341&quot; target=&quot;_blank&quot;&gt;Broadcom&#039;s BCM43341 quad-radio chip&lt;/a&gt; which also contains an NFC controller.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/proc/misc&lt;/code&gt; lists a &lt;code&gt;bcm2079x&lt;/code&gt; device driver. The &lt;a href=&quot;http://www.broadcom.com/products/NFC/NFC-Solutions/BCM2079x-Family&quot; target=&quot;_blank&quot;&gt;BCM2079x family&lt;/a&gt; is Broadcom&#039;s family of NFC controllers. This is also the type of NFC controller that&#039;s integrated into the BCM43341. Consequently, it seems that the low-level driver necessary to interact with the NFC controller (that is supposedly integrated into the smart watch) is compiled into the kernel. This does not necessarily mean that the driver can actually be used to communicate with the NFC controller though.&lt;/li&gt;
&lt;li&gt;There is no NFC service app (&lt;code&gt;Nfc*.apk&lt;/code&gt;) on the &lt;code&gt;/system&lt;/code&gt; partition. This confirms what we already found out with our analysis of the NFC API: There is no NFC stack integrated into the Android system and, consequently, there is no NFC functionality accessible from apps.&lt;/li&gt;
&lt;/ul&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;So, even though there &lt;em&gt;might&lt;/em&gt; be support for NFC from the hardware side and the kernel side, the user-space part of the NFC stack is missing. Though, the kernel driver might just as well point to nowhere (i.e. might not represent a device that is actually backed by hardware). And the firmware of the BCM43341 might be coded in a way that the NFC controller simply emulates the Type 2 tag while being inaccessible from the operating system.&lt;/p&gt;
&lt;h3 class=&quot;header&quot;&gt;Summary&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;After some hands-on experimenting, testing and exploring the file system of the Android OS on the watch, it seems that, unfortunately, the description in the white paper is right. At least for now, the smart watch exposes only an NFC tag with a static NDEF message that is used to launch the companion app for the watch. No NFC functionality is accessible through apps. However, seeing that the watch contains a BCM43341 featuring a full-blown NFC controller as well as the fact that the bcm2079x device driver is compiled into the kernel give us a bit of hope that the watch may support more NFC functionality in the future (either through an official firmware upgrade or through some custom ROM).&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 15 Dec 2014 17:41:21 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">167 at </guid>
 <comments>/blog/is-there-nfc-on-sony-smartwatch-3-swr50#comments</comments>
</item>
<item>
 <title>UICC access with SEEK in CyanogenMod on Galaxy S2/S3</title>
 <link>/blog/cyanogenmod-seek-uicc-s2-s3</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;In our last blog post &lt;a href=&quot;/blog/seek-galaxys3&quot; target=&quot;_self&quot;&gt;SEEK adaptations in RIL for Galaxy S3&lt;/a&gt;, we analyzed the &lt;a title=&quot;Radio Interface Layer&quot; href=&quot;#&quot;&gt;RIL&lt;/a&gt; commands for &lt;a title=&quot;Application Protocol Data Unit (smartcard command)&quot; href=&quot;#&quot;&gt;APDU&lt;/a&gt;-based access to the &lt;a title=&quot;Universal Integrated Circuit Card (SIM card)&quot; href=&quot;#&quot;&gt;UICC&lt;/a&gt; on Samsung&#039;s Galaxy S3 and provided some first details on how we implemented this functionality in our SuperNexus-based &lt;a href=&quot;/misc/downloads&quot; target=&quot;_self&quot;&gt;SuperSmile Android ROM&lt;/a&gt;. Now we want to go a step further and provide step-by-step instructions on how to integrate this functionality into CyanogenMod for Samsung&#039;s Galaxy S2 and Galaxy S3 (and possibly other devices based on Exynos 4).&lt;/p&gt;
&lt;p&gt;First of all, you need to grab the &lt;a href=&quot;http://wiki.cyanogenmod.org/w/Development&quot; target=&quot;_blank&quot;&gt;CyanogenMod source&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush:bash;gutter:false;toolbar:false;&quot;&gt;$ mkdir cm-10.1
$ cd cm-10.1
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1&lt;/pre&gt;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; We also provide a patch for CM 10.2, so you may use &lt;tt&gt;-b cm-10.2&lt;/tt&gt; as well.&lt;/p&gt;
&lt;pre class=&quot;brush:bash;gutter:false;toolbar:false;&quot;&gt;$ repo sync
$ cd vendor/cm
$ ./get-prebuilts
$ cd ../..
$ source build/envsetup.sh
$ breakfast i9300&lt;/pre&gt;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Instead of (or in addition to) i9300 (Galaxy S3) you can also get the device specific code for Galaxy S2 (i9100) using &lt;tt&gt;breakfast i9100&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;When you got your working copy of the CyanogenMod repository ready, you can apply SEEK&#039;s SmartCard API patches (download them &lt;a href=&quot;https://code.google.com/p/seek-for-android/downloads&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;, you find them in &lt;tt&gt;smartcard-api-3_0_0.tgz&lt;/tt&gt;):&lt;/p&gt;
&lt;pre class=&quot;brush:bash;gutter:false;toolbar:false;&quot;&gt;$ curl -O https://seek-for-android.googlecode.com/files/smartcard-api-3_0_0.tgz
$ tar zxf smartcard-api-3_0_0.tgz
$ patch -p1 &amp;lt; smartcard-api-3_0_0/smartcard-api.patch
$ patch -p1 &amp;lt; smartcard-api-3_0_0/uicc.patch
$ patch -p1 &amp;lt; smartcard-api-3_0_0/emulator.patch&lt;/pre&gt;&lt;p&gt;Now we have the CyanogenMod source tree with SEEK. While SEEK already provides patches for APDU-based access to the UICC through the RIL (uicc.patch and emulator.patch), these patches only work for the Android emulator and not for real devices. Therefore, we need to modify the RIL interface to permit APDU exchange with the UICC on real devices. Both, the Galaxy S2 and the Galaxy S3 are based on the Exynos 4 SoC platform. Their RIL interface is encapsulated in &lt;tt&gt;SamsungExynos4RIL.java&lt;/tt&gt; (in &lt;tt&gt;frameworks/opt/telephony/src/java/com/android/internal/telephony/&lt;/tt&gt;). So all we need to do is implement the Exynos 4-specific versions of the commands for UICC access in &lt;tt&gt;SamsungExynos4RIL.java&lt;/tt&gt;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;tt&gt;iccOpenChannel(...)&lt;/tt&gt; for opening a communication channel to an applet on the UICC,&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;iccExchangeAPDU(...)&lt;/tt&gt; for sending APDU commands to the UICC, and&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;iccCloseChannel(...)&lt;/tt&gt; for closing a previously opened communication channel.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;First, we define some constants to tag the responses to the above commands so we can later detect them in the response message handler:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    private static final int RIL_OEM_HOOK_RAW_EVENT_EXCHANGE_APDU_DONE = 1;
    private static final int RIL_OEM_HOOK_RAW_EVENT_OPEN_CHANNEL_DONE  = 2;
    private static final int RIL_OEM_HOOK_RAW_EVENT_CLOSE_CHANNEL_DONE = 3;
&lt;/pre&gt;&lt;p&gt;Then, we add the methods to invoke the three commands (see our previous &lt;a href=&quot;/blog/seek-galaxys3&quot; target=&quot;_self&quot;&gt;blog post&lt;/a&gt; for details on the implementation of these commands, the command message formats and the response message formats):&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    @Override
    public void iccOpenChannel(String AID, Message result) {
&lt;/pre&gt;&lt;pre class=&quot;brush:java;collapse:true;first-line:3;&quot;&gt;        if (AID == null) {
            AID = &quot;&quot;;
        }
        
        byte[] aidBytes = new byte[AID.length() / 2];
        for (int i = 0; i &amp;lt; aidBytes.length; ++i) {
            aidBytes[i] = (byte) Integer.parseInt(AID.substring(2 * i, 2 + 2 * i), 16);
        }
        
        ByteArrayOutputStream commandByteStream = new ByteArrayOutputStream();
        DataOutputStream commandOutputStream = new DataOutputStream(commandByteStream);
        try {
            commandOutputStream.writeByte(21);
            commandOutputStream.writeByte(9);
            commandOutputStream.writeShort(4 + aidBytes.length);
            commandOutputStream.write(aidBytes);
        } catch (IOException ex) {
            Log.e(LOG_TAG, &quot;CMD_OPEN_CHANNEL: open failed&quot;, ex);
        }
        
        if (RILJ_LOGD) riljLog(&quot;sendRawRequest/iccOpenChannel: AID=&quot; + AID);
        
        // inform response handler that this is an open channel request
        result.arg1 = RIL_OEM_HOOK_RAW_EVENT_OPEN_CHANNEL_DONE;
        
        invokeOemRilRequestRaw(commandByteStream.toByteArray(), result);
    }
&lt;/pre&gt;&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    @Override
    public void iccExchangeAPDU(int cla, int command, int channel,
                                int p1, int p2, int p3, String data,
                                Message result) {
&lt;/pre&gt;&lt;pre class=&quot;brush:java;collapse:true;first-line:5;&quot;&gt;        ByteArrayOutputStream commandByteStream = new ByteArrayOutputStream();
        DataOutputStream commandOutputStream = new DataOutputStream(commandByteStream);
        try {
            commandOutputStream.writeByte(21);
            
            int commandLength = 12;
            if (p3 == -1) {
                commandOutputStream.writeByte(12);
            } else {
                commandOutputStream.writeByte(11);
                ++commandLength;
            }
            
            byte[] dataBytes = null;
            if (data != null) {
                dataBytes = new byte[data.length() / 2];
                commandLength += dataBytes.length;
                for (int i = 0; i &amp;lt; dataBytes.length; ++i) {
                    dataBytes[i] = (byte) Integer.parseInt(data.substring(2 * i, 2 + 2 * i), 16);
                }
            }
            
            commandOutputStream.writeShort(commandLength);
            commandOutputStream.writeByte(cla);
            commandOutputStream.writeByte(command);
            commandOutputStream.writeByte(p1);
            commandOutputStream.writeByte(p2);
            if (p3 != -1) {
                commandOutputStream.writeByte(p3);
            }
            commandOutputStream.writeInt(channel);
            if (dataBytes != null) {
                commandOutputStream.write(dataBytes);
            }
        } catch (IOException ex) {
            Log.e(LOG_TAG, &quot;CMD_ECHANGE_APDU: send failed&quot;, ex);
        }
        
        if (RILJ_LOGD) riljLog(&quot;sendRawRequest/iccExchangeAPDU: &quot; +
                               &quot;channel=0x&quot; + Integer.toHexString(channel) +
                               &quot;, cla=0x&quot; + Integer.toHexString(cla) +
                               &quot;, command=0x&quot; + Integer.toHexString(command) +
                               &quot;, p1=0x&quot; + Integer.toHexString(p1) +
                               &quot;, p2=0x&quot; + Integer.toHexString(p2) +
                               &quot;, p3=0x&quot; + Integer.toHexString(p3) +
                               &quot;, data=&quot; + data);

        // inform response handler that this is an exchange APDU request
        result.arg1 = RIL_OEM_HOOK_RAW_EVENT_EXCHANGE_APDU_DONE;
        
        invokeOemRilRequestRaw(commandByteStream.toByteArray(), result);
    }
&lt;/pre&gt;&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    @Override
    public void iccCloseChannel(int channel, Message result) {
&lt;/pre&gt;&lt;pre class=&quot;brush:java;collapse:true;first-line:3;&quot;&gt;        ByteArrayOutputStream commandByteStream = new ByteArrayOutputStream();
        DataOutputStream commandOutputStream = new DataOutputStream(commandByteStream);
        try {
            commandOutputStream.writeByte(21);
            commandOutputStream.writeByte(10);
            if (channel != 0) {
                commandOutputStream.writeShort(8);
                commandOutputStream.writeInt(channel);
            } else {
                commandOutputStream.writeShort(4);
            }
        } catch (IOException ex) {
            Log.e(LOG_TAG, &quot;CMD_CLOSE_CHANNEL: close failed&quot;, ex);
        }
        
        if (RILJ_LOGD) riljLog(&quot;sendRawRequest/iccCloseChannel: channel=0x&quot; + Integer.toHexString(channel));
        
        //inform response handler that this is a close channel request
        result.arg1 = RIL_OEM_HOOK_RAW_EVENT_CLOSE_CHANNEL_DONE;
        
        invokeOemRilRequestRaw(commandByteStream.toByteArray(), result);
    }
&lt;/pre&gt;&lt;p&gt;Now we can send smartcard commands to the UICC. Next, we need to detect and decode the responses to the above commands. All three commands are wrapped inside an &lt;tt&gt;OEM_HOOK_RAW&lt;/tt&gt; RIL request. We, therefore, need to intercept the response to this request and decode the responses to our new commands into the format expected by SEEK.&lt;/p&gt;
&lt;p&gt;First, we want to intercept the response to &lt;tt&gt;OEM_HOOK_RAW&lt;/tt&gt;. We, therefore, change the default handler for &lt;tt&gt;RIL_REQUEST_OEM_HOOK_RAW&lt;/tt&gt; from &lt;tt&gt;responseRaw(...)&lt;/tt&gt; to our customized handler &lt;tt&gt;responseRawCheckRequest(...)&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;highlight: [9];&quot;&gt;    @Override
    protected void processSolicited (Parcel p) {
        [...]
        if (error == 0 || p.dataAvail() &amp;gt; 0) {
            // either command succeeds or command fails but with data payload
            try {switch (rr.mRequest) {
            [...]
            case RIL_REQUEST_RESET_RADIO: ret =  responseVoid(p); break;
            case RIL_REQUEST_OEM_HOOK_RAW: ret =  responseRawCheckRequest(p, rr.mResult); break;
            case RIL_REQUEST_OEM_HOOK_STRINGS: ret =  responseStrings(p); break;
            [...]
&lt;/pre&gt;&lt;p&gt;Within our new method &lt;tt&gt;responseRawCheckRequest(...)&lt;/tt&gt;, we need to check if the corresponding &lt;tt&gt;OEM_HOOK_RAW&lt;/tt&gt; request was tagged with one of our &lt;tt&gt;RIL_OEM_HOOK_RAW_EVENT_*&lt;/tt&gt; constants. If we find a tag, we need to decode the response into the format expected by SEEK, otherwise we pass the response to the original &lt;tt&gt;responseRaw(...)&lt;/tt&gt; method:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    protected Object responseRawCheckRequest(Parcel p, Message mResult) {
        if (mResult == null || p == null) return responseRaw(p);
        
        Object ret = null;
        byte[] responseByteArray;
        int channel = 0;

        switch(mResult.arg1) {
&lt;/pre&gt;&lt;p&gt;For the &lt;tt&gt;iccExchangeAPDU(...)&lt;/tt&gt; command, the response APDU (byte array) needs to be converted into an IccIoResult object (by splitting the R-APDU into the data field and the two bytes of the status word):&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;first-line:9;&quot;&gt;            case RIL_OEM_HOOK_RAW_EVENT_EXCHANGE_APDU_DONE:
                if (RILJ_LOGD) riljLog(&quot;iccExchangeAPDU done&quot;);
                
                responseByteArray = p.createByteArray();
                if (responseByteArray != null) {
                    if (RILJ_LOGD) riljLog(&quot;iccExchangeAPDU: received response byte array: &quot; + IccUtils.bytesToHexString(responseByteArray));
                    if (responseByteArray.length &amp;gt;= 2) {
                        ret = new IccIoResult(
                            responseByteArray[responseByteArray.length - 2] &amp;amp; 0x0ff,
                            responseByteArray[responseByteArray.length - 1] &amp;amp; 0x0ff,
                            Arrays.copyOf(responseByteArray, responseByteArray.length - 2));
                    }
                }
                break;
&lt;/pre&gt;&lt;p&gt;For the &lt;tt&gt;iccOpenChannel(...)&lt;/tt&gt; command, the response contains the assigned channel ID and the R-APDU that was received in response to the applet selection command. SEEK currently only processes the channel ID and does not expect a select response. Therefore, we extract the channel number and drop the select response. Note, however, that the SEEK SmartCard API contains a method to get the select response. Therefore, we should forward this select response to SEEK in a future implementation. For now the &lt;tt&gt;getSelectResponse()&lt;/tt&gt; method will return &lt;tt&gt;null&lt;/tt&gt; even if a response had been received.&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;first-line:23;&quot;&gt;            case RIL_OEM_HOOK_RAW_EVENT_OPEN_CHANNEL_DONE:
                if (RILJ_LOGD) riljLog(&quot;iccOpenChannel done&quot;);
                
                responseByteArray = p.createByteArray();
                if (responseByteArray != null) {
                    if (RILJ_LOGD) riljLog(&quot;iccOpenChannel: received response byte array: &quot; + IccUtils.bytesToHexString(responseByteArray));
                    if (responseByteArray.length &amp;gt; 0) {
                        int channelLength = responseByteArray[0] &amp;amp; 0x0ff;
                        if (responseByteArray.length &amp;gt; channelLength) {
                            for (int i = channelLength; i &amp;gt; 0; --i) {
                                channel &amp;lt;&amp;lt;= 8;
                                channel |= responseByteArray[i] &amp;amp; 0x0ff;
                            }
                        }
                    }
                }
                ret = new int[]{ channel };
                break;
&lt;/pre&gt;&lt;p&gt;For the &lt;tt&gt;iccCloseChannel(...)&lt;/tt&gt; command, SEEK does not process the response, so we simply forward any received response byte arrays:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;first-line:41;&quot;&gt;            case RIL_OEM_HOOK_RAW_EVENT_CLOSE_CHANNEL_DONE:
                if (RILJ_LOGD) riljLog(&quot;iccCloseChannel done&quot;);
                
                responseByteArray = p.createByteArray();
                if (responseByteArray != null) {
                    if (RILJ_LOGD) riljLog(&quot;iccCloseChannel: received response byte array: &quot; + IccUtils.bytesToHexString(responseByteArray));
                }
                
                ret = responseByteArray;
                break;
&lt;/pre&gt;&lt;p&gt;If this response to &lt;tt&gt;OEM_HOOK_RAW&lt;/tt&gt; is not the result of any of our three new commands, we pass the response to the original &lt;tt&gt;responseRaw(...)&lt;/tt&gt; method:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;first-line:51;&quot;&gt;            default:
                ret = responseRaw(p);
                break;
        }
        
        return ret;
    }
&lt;/pre&gt;&lt;p&gt;Finally, we have to account for differently numbered error codes between the SEEK implementation and the actual behavior of Samsung&#039;s Exynos 4 RIL. We define the error code constants for Exynos 4:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;&quot;&gt;    private static final int RIL_OEM_ERROR_MISSING_RESOURCE  = 29;
    private static final int RIL_OEM_ERROR_NO_SUCH_ELEMENT   = 30;
    private static final int RIL_OEM_ERROR_INVALID_PARAMETER = 27;
&lt;/pre&gt;&lt;p&gt;Then, we check any received error codes for these values and translate them to the values expected by SEEK:&lt;/p&gt;
&lt;pre class=&quot;brush:java;toolbar:false;highlight: [9,10,11,12,13,14];&quot;&gt;    @Override
    protected void processSolicited (Parcel p) {
        [...]
        if (error != 0) {
            switch (rr.mRequest) {
                [...]
            }

            switch (error) {
                case RIL_OEM_ERROR_MISSING_RESOURCE:  error = MISSING_RESOURCE;  break;
                case RIL_OEM_ERROR_NO_SUCH_ELEMENT:   error = NO_SUCH_ELEMENT;   break;
                case RIL_OEM_ERROR_INVALID_PARAMETER: error = INVALID_PARAMETER; break;
                default: break;
            }

            rr.onError(error, ret);
            rr.release();
            return;
        }
&lt;/pre&gt;&lt;p&gt;Now you can compile your CyanogenMod ROM with APDU-based UICC access through SEEK (comparable to the stock ROM on Galaxy S3 and some versions of the Galaxy S2) for your Galaxy S2 or your Galaxy S3.&lt;/p&gt;
&lt;p&gt;You can grab the patches here:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;for &lt;a title=&quot;uicc_on_seek_on_cm10_1_for_S2_S3.diff&quot; href=&quot;/sites/default/files/blog/uicc_on_seek_on_cm10_1_for_S2_S3.diff&quot;&gt;CyanogenMod 10.1&lt;/a&gt; and&lt;/li&gt;
&lt;li&gt;for &lt;a title=&quot;uicc_on_seek_on_cm10_2_for_S2_S3.diff&quot; href=&quot;/sites/default/files/blog/uicc_on_seek_on_cm10_2_for_S2_S3.diff&quot;&gt;CyanogenMod 10.2&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Thanks to &lt;a href=&quot;http://nelenkov.blogspot.com/&quot; target=&quot;_blank&quot;&gt;Nikolay&lt;/a&gt; for debugging, testing with his S2 and the lively discussion.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 10 Sep 2013 13:47:06 +0000</pubDate>
 <dc:creator>mroland</dc:creator>
 <guid isPermaLink="false">101 at </guid>
 <comments>/blog/cyanogenmod-seek-uicc-s2-s3#comments</comments>
</item>
</channel>
</rss>
