<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Christopher Ney on Medium]]></title>
        <description><![CDATA[Stories by Christopher Ney on Medium]]></description>
        <link>https://medium.com/@christopherney?source=rss-9f2b44764fcb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f4rTKkaB_oYXOlFxGlpyxA.jpeg</url>
            <title>Stories by Christopher Ney on Medium</title>
            <link>https://medium.com/@christopherney?source=rss-9f2b44764fcb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 21:07:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@christopherney/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Protect Android App against reverse engineering]]></title>
            <link>https://medium.com/@christopherney/protect-android-app-against-reverse-engineering-with-enigma-string-obfuscation-plugin-11687022cbef?source=rss-9f2b44764fcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/11687022cbef</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[obfuscation]]></category>
            <category><![CDATA[proguard]]></category>
            <dc:creator><![CDATA[Christopher Ney]]></dc:creator>
            <pubDate>Wed, 04 Dec 2019 14:56:23 GMT</pubDate>
            <atom:updated>2020-03-18T09:30:43.371Z</atom:updated>
            <content:encoded><![CDATA[<p>A simple way to attack an Android App is to <strong>decompile</strong> the APK and read the <a href="https://source.android.com/devices/tech/dalvik/dalvik-bytecode">Bytecode</a> to retrieve <strong><em>interesting Strings</em></strong> such as: <strong>URLs, API secrets, user name, passwords</strong>…</p><p>The following picture show you a simple example of <a href="https://source.android.com/devices/tech/dalvik/dalvik-bytecode"><strong>Bytecode</strong></a> obtain by decompiling an Android sample App with the famous <a href="https://ibotpeaches.github.io/Apktool/"><strong>apktool</strong></a> program. As you can see, you can easily in few minutes get et <strong>secret key 😈</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZX3GolaPHVCXLFyAqR82tw.png" /><figcaption>Bytecode WITHOUT ProGuard &amp; Enigma vs. WITH ProGuard &amp; Enigma</figcaption></figure><p>In this case, of course the hacking job looks very easy because the developer (in this case me), forget to enable an essential tool which is <a href="https://www.guardsquare.com/en/products/proguard"><strong>ProGuard</strong></a>. ProGuard is a great tool natively integrated in Android Studio. To enable it, a simple line of code in the <strong>build.gradle</strong> file 🔧 :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7992b8a8df1bb4accc8a49fee366d83e/href">https://medium.com/media/7992b8a8df1bb4accc8a49fee366d83e/href</a></iframe><p>By enabling ProGuard (or <a href="https://android.googlesource.com/platform/external/r8/">R8</a>) you get a Bytecode harder to re️ad 🕵️‍♂️, but unfortunately the secret value is still readable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*O1OdgjVzjzySoOfXhYqKmQ.png" /><figcaption>Bytecode generated with ProGuard enabled</figcaption></figure><p>A way to protect sensitive data, is to <strong>encrypt it</strong>. For example you code will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAh2Q9tdH-4PP9WorlZk_w.png" /><figcaption>The secret key is encrypted with AES algorithm</figcaption></figure><p>That is the job of <strong>Enigma</strong> plugin! Enigma will automatically at the compilation time, <strong>encrypt your strings</strong>, and <strong>inject fake secret keys </strong>into your code to attract hackers on the wrong way (<a href="https://en.wikipedia.org/wiki/Honeypot_(computing)">honeypot</a>).</p><p>Below an example of the generated Bytecode with Enigma Plugin activated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*jTGI7Z6UpCKC0OsvJWQnLA.png" /><figcaption>Bytecode generated with ProGuard enabled &amp; Enigma enabled</figcaption></figure><h3>How implement it ?</h3><p>To implement <strong>Enigma Plugin</strong> in your project follow the 3 steps 👨‍💻:</p><p>1- In the <strong>build.gradle</strong> project file, add the following lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bd4585a87091a9ad47c6c5e572fbfaf/href">https://medium.com/media/4bd4585a87091a9ad47c6c5e572fbfaf/href</a></iframe><p>2- In the <strong>build.gradle</strong> module file, add the following lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/310d5db4c634f6b630ceb9d1d5143899/href">https://medium.com/media/310d5db4c634f6b630ceb9d1d5143899/href</a></iframe><blockquote>Options documentation: <a href="https://github.com/christopherney/Enigma">https://github.com/christopherney/Enigma</a></blockquote><p>3- And finally, compile ⚙️ ! Nothing else to do !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*IeirfhpTEF_YFWKc4oxIZQ.png" /></figure><p>Congrats 🎉 ! Your source code has strings encrypted 🔒!</p><h3>How Enigma is working ?</h3><p><a href="https://plugins.gradle.org/plugin/com.chrisney.enigma">Enigma</a> is a <a href="https://plugins.gradle.org/plugin/com.chrisney.enigma">Gradle Plugin</a>. Each time that you compile your source code (debug or release), Enigma will execute his own Tasks upstream of classic compilation tasks. Enigma Tasks are the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*8nKFP8ASqA6JpfI4XYPSEA.png" /><figcaption>Enigma pipeline</figcaption></figure><p>Below a example of source code that Enigma will encrypt automatically:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPwNqDf8fHhxOkhyqpFKZA.png" /><figcaption>Sample source code</figcaption></figure><p>Next screenshot, the source code encrypted by Enigma during the compilation time. This part is fully transparent for you!<br><strong><em>Warning: You should not modify your string values by yourself. The example below is just a sample of what does Enigma for you.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1jvYzfQciwJHc22IShk-w.png" /><figcaption>Source code obfuscated with Enigma (during compilation time, no developer action)</figcaption></figure><p>In the last screenshot, Enigma has <strong>encrypted all string values</strong> and encode it in <strong>bytes array</strong> (harder to parse). At the same time a <strong>fake strin</strong>g was injected: <strong><em>TDFXQMLZND</em></strong>.</p><h3>Pro &amp; Cons</h3><p><strong>Pro:</strong><br>- Super easy to integrate<br>- Zero impact on source code for developers<br>- Your source code stay readable during development<br>- Makes sensitive data harder to retrieve via reverse engineering attack<br>- Inject fake data to attract hackers on the wrong way (<a href="https://en.wikipedia.org/wiki/Honeypot_(computing)">honeypot</a>)<br>- Can be enabled anytime during development lifecycle, even at the end 😜</p><p><strong>Cons:</strong><br>- Works only with JAVA (no Kotlin yet)<br>- Useless if ProGuard (or R8) not activated<br>- Can slowdown the app performance if there is too much data to decrypt</p><p>GitHub: <a href="https://github.com/christopherney/Enigma">https://github.com/christopherney/Enigma</a><br>Gradle Plugin: <a href="https://plugins.gradle.org/plugin/com.chrisney.enigma">https://plugins.gradle.org/plugin/com.chrisney.enigma</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11687022cbef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Android O with a Mac]]></title>
            <link>https://medium.com/@christopherney/building-android-o-with-a-mac-da07e8bd94f9?source=rss-9f2b44764fcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/da07e8bd94f9</guid>
            <category><![CDATA[nexus]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[bullhead]]></category>
            <category><![CDATA[flash]]></category>
            <category><![CDATA[aosp]]></category>
            <dc:creator><![CDATA[Christopher Ney]]></dc:creator>
            <pubDate>Mon, 26 Mar 2018 16:27:07 GMT</pubDate>
            <atom:updated>2019-03-21T09:19:29.942Z</atom:updated>
            <content:encoded><![CDATA[<p>After spending several hours to analyse dozens of posts and articles to compile Android O MR1 AOSP, I decided to write a short manual to help you to build your AOSP effortlessly ;-)</p><p>This article is based on Official Android documentation: <a href="https://source.android.com/setup/requirements">https://source.android.com/setup/requirements</a></p><h3>My Environment</h3><ul><li><strong>OS:</strong> macOS Sierra 10.12.5</li><li><strong>CPU:</strong> 2,9 GHz Intel Core i5 (influence the speed compilation)</li><li><strong>RAM:</strong> 8 GB 1867 MHz DDR3 (8GB minimum, recommended 16GB)</li><li><strong>Disk:</strong> 200GB free space (after AOSP sources downloaded — minimum 200GB)</li><li><strong>Device:</strong> Nexus 5X (bullhead)</li></ul><h3>Setup your Build Environment</h3><ul><li>Install Xcode: <a href="https://developer.apple.com/xcode/">https://developer.apple.com/xcode/</a></li><li>Install <strong>Xcode command line</strong> tools with:</li></ul><pre>xcode-select --install</pre><ul><li>Install <strong>Homebrew</strong> with:</li></ul><pre>/usr/bin/ruby -e &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;</pre><ul><li>Install <strong>JDK</strong> with: <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html">https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html</a></li><li>Check your Java version:</li></ul><pre>$ java -version<br>&gt; java version &quot;1.8.0_144&quot;</pre><ul><li>Install <strong>GIT</strong> with:</li></ul><pre>brew install git</pre><ul><li>Install <strong>Python</strong> with:</li></ul><pre>brew install python</pre><ul><li>Install <strong>Make</strong> with:</li></ul><pre>brew install make</pre><h3>Creating a case-sensitive disk image</h3><p>Case sensitive volume of 200GB with the following command line:</p><pre>hdiutil create -type SPARSE -fs &#39;Case-sensitive Journaled HFS+&#39; -size 200g ~/android.dmg</pre><p><strong>Install tools and libraries via MacPort</strong></p><p>Install MacPorts: <a href="https://www.macports.org/install.php">https://www.macports.org/install.php</a> then type the following command line:</p><pre>POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg</pre><p>Then create and edit the <strong>.bash_profile</strong> file with the following code:</p><pre>cd ~<br>nano .bash_profile</pre><pre># set the number of open files to be 1024<br>ulimit -S -n 1024</pre><pre># Compiler cache<br>export USE_CCACHE=1</pre><pre># mount the android file image<br>function mountAndroid { hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android; }</pre><pre># unmount the android file image<br>function umountAndroid() { hdiutil detach /Volumes/android; }</pre><pre>export PATH=&quot;/opt/local/bin:/opt/local/sbin:$PATH&quot;<br>export PATH=~/bin:$PATH<br>export ANDROID_JAVA_HOME=$(/usr/libexec/java_home -v 1.8)<br>export PATH=$ANDROID_JAVA_HOME/bin:$PATH</pre><h3>Download AOSP source code</h3><p>To identify the right <strong>branch </strong>to download<strong>, </strong>check the<strong> Build number </strong>of the target device. In our case <strong>OPM5.171019.017</strong> which isncorresponding to the branch <strong>android-8.1.0_r18</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*CGx-ss76uIiUvIcIWOywgQ.png" /></figure><p>Branches and Builds codename: <a href="https://source.android.com/source/build-numbers#source-code-tags-and-builds">https://source.android.com/source/build-numbers#source-code-tags-and-builds</a></p><blockquote><strong><em>Warning: when you choose a branch be sure that the branch support the targeted device!</em></strong></blockquote><p>Select the targeted AOSP version with the <strong>branch</strong> with<strong> -b</strong> parameter: <strong>android-8.1.0_r18</strong></p><pre>source ~/.bash_profile<br>mkdir ~/bin<br>curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ~/bin/repo<br>chmod a+x ~/bin/repo<br><br>mountAndroid<br>cd /Volumes/android<br>mkdir WORKING_DIRECTORY<br>cd WORKING_DIRECTORY<br><br>git config --global user.name &quot;Your Name&quot;<br>git config --global user.email &quot;you@example.com&quot;<br><br>repo init -u <a href="https://android.googlesource.com/platform/manifest">https://android.googlesource.com/platform/manifest</a><br>repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r1<br>repo sync</pre><h3>Building ASOP source code</h3><p>Open terminal:</p><pre>cd /Volumes/android/WORKING_DIRECTORY/ </pre><pre># Set ccache<br>prebuilts/misc/darwin-x86/ccache/ccache -M 50G </pre><pre># Clean out directory<br>make clobber </pre><pre># Jack server configuration<br>export JACK_SERVER_VM_ARGUMENTS=&quot;-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx6g&quot;<br>./prebuilts/sdk/tools/jack-admin kill-server<br>./prebuilts/sdk/tools/jack-admin start-server </pre><pre># Setup environment <br>source build/envsetup.sh</pre><p>Select the device target with <strong>lunch</strong> command, then build the sources with <strong>make </strong>command:</p><pre># Select device target<br>lunch</pre><pre># Build sources (cofee time)<br>make -j4</pre><p>When the build process if finished you get the following message:</p><pre>[100% 7091/7091] Install system fs image: out/target/product/generic/system.img</pre><pre>out/target/product/generic/system.img+ maxsize=1918388736 blocksize=2112 total=1879048192 reserve=19379712</pre><pre>#### make completed successfully (02:52:17 (hh:mm:ss)) ####</pre><h3>Install new Android Build on Device</h3><p>Connect the Device in <strong>USB</strong>, enable the <strong>Developer Mode</strong>, then input the following command lines in you Terminal:</p><pre>cd out/target/product/&lt;product_name&gt; <br>adb reboot bootloader</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*wZ4ukgkkR9DCmhnxChWZzA.jpeg" /></figure><pre>fastboot oem unlock <br>fastboot flashall -w</pre><h3>Restore Android Image</h3><p>To restore an official Android Image please download the target Image and follow the instructions:</p><ul><li>Download Android Image: <a href="https://developers.google.com/android/images">https://developers.google.com/android/images</a></li><li>Unzip the archive</li><li>Execute the following command lines:</li></ul><pre>cd ~/Downloads/bullhead-opm5.171019.017/</pre><pre>adb reboot bootloader</pre><pre>fastboot oem unlock<br>./flash-all.sh</pre><h3>Rebuild a single package</h3><p>To rebuild a single package (example: Dialer App) instead of rebuild the entire baseline, use the following command lines:</p><pre>cd WORKING_DIRECTORY<br>source build/envsetup.sh </pre><pre># Select device target<br>lunch<br># Rebuil single pacage (exemple Dialer)<br>mmm packages/apps/dialer/</pre><p>The output APK path will be prompt by the console, or located at the following path:</p><pre># Recompiled package output<br>cd /out/target/product/&lt;device_targeted&gt;/obj/APPS/&lt;app_name&gt;_intermediates</pre><p><strong>How to install it</strong></p><pre>adb install -r out/target/product/&lt;device_targeted&gt;/system/priv-app/&lt;app_name&gt;/&lt;app_name&gt;.apk</pre><pre>adb reboot</pre><h3>System UI</h3><p>Build System UI only:</p><pre>cd WORKING_DIRECTORY<br>source build/envsetup.sh</pre><pre># Select device target<br>lunch<br># Rebuil single pacage (exemple Dialer)<br>mmm frameworks/base/packages/SystemUI/</pre><p><strong>How to install it</strong></p><pre>adb install -r out/target/product/&lt;device_targeted&gt;/system/priv-app/SystemUI/SystemUI.apk</pre><pre>adb reboot</pre><h3>Android Framework</h3><ul><li>Build Framework JAR only: <strong>mmm framework/base/</strong></li><li>Build Framework Resources only: <strong>mmm framework/base/core/res/</strong></li></ul><p><strong>How to install it</strong></p><pre># Root the device<br>adb root<br>adb disable-verity<br>adb reboot<br>adb remount</pre><pre># Remove older framework<br>adb shell<br>cd /system/framework/<br>rm framework-res.apk<br>exit</pre><pre># Push the new Framework<br>adb push out/target/product/&lt;device_targeted&gt;/system/framework/framework-res.apk /system/framework/</pre><pre># Reboot the device<br>adb reboot</pre><h3>Signing Build</h3><p>The standard Android build uses four keys, all of which reside in build/target/product/security:</p><ul><li><strong>testkey</strong>: Generic default key for packages that do not otherwise specify a key.</li><li><strong>platform</strong>: Test key for packages that are part of the core platform.</li><li><strong>shared</strong>: Test key for things that are shared in the home/contacts process.</li><li><strong>media</strong>: Test key for packages that are part of the media/download system.</li></ul><pre>cd /build/target/product/security/</pre><p>Source: <a href="https://source.android.com/devices/tech/ota/sign_builds#certificates-keys">https://source.android.com/devices/tech/ota/sign_builds#certificates-keys</a></p><p>To sign an app with one of the existing key, use the following instruction (<strong>LOCAL_CERTIFICATE</strong>) into the associated makefile <strong>Android.mk</strong>:</p><p><strong>Android.mk</strong></p><pre>LOCAL_CERTIFICATE := platform</pre><h3>Troubleshooting</h3><h4>Can not find Mac SDK or Required minimum for the macosx platform</h4><p>Download and uncompress the exact missing Mac SDK version into the following directory:</p><ul><li>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/</li></ul><p>Download Mac SDKs: <a href="https://github.com/phracker/MacOSX-SDKs/releases">https://github.com/phracker/MacOSX-SDKs/releases</a></p><h4>Error: could not find jdk tools.jar</h4><p>Need to defined $ANDROID_JAVA_HOME used in ~/build/core/find-jdk-tools-jar.sh</p><pre>export ANDROID_JAVA_HOME=$(/usr/libexec/java_home -v 1.8)</pre><pre>echo $ANDROID_JAVA_HOME<br>/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home</pre><p>Download and install JDK before : <a href="http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html#jdk-8u45-oth-JPR">http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html#jdk-8u45-oth-JPR</a></p><h4>Make error — already defined</h4><p>If you got the following error during the AOSP compilation:</p><pre>including ./go/src/github.com/google/gapid/third_party/khronos/SPIRV-Cross/jni/Android.mk ...</pre><pre>build/core/base_rules.mk:183: *** go/src/github.com/google/gapid/third_party/khronos/SPIRV-Cross/jni: MODULE.TARGET.STATIC_LIBRARIES.spirv-cross already defined by go/src/github.com/google/gapid/third_party/SPIRV-Cross/jni.</pre><pre>make: *** [out/build-aosp_arm.ninja] Error 1</pre><p>Go to the already defined directory and rename simply the <strong>Android.mk</strong> file to <strong>Android_old.mk</strong></p><h4>GC overhead limit exceeded</h4><pre>GC overhead limit exceeded. Try increasing heap size with java option &#39;-Xmx&lt;size&gt;&#39;.</pre><pre>FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp</pre><pre>Out of memory error (version 1.2-rc4 &#39;Carnac&#39; (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).</pre><pre>GC overhead limit exceeded.</pre><pre>Try increasing heap size with java option &#39;-Xmx&lt;size&gt;&#39;.</pre><pre>Warning: This may have produced partial or corrupted output.</pre><p>To increase the the heap size use the following command lines:</p><pre>export JACK_SERVER_VM_ARGUMENTS=&quot;-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx6g&quot;</pre><pre>./prebuilts/sdk/tools/jack-admin kill-server</pre><pre>./prebuilts/sdk/tools/jack-admin start-server</pre><h4><strong>Case-insensitive filesystem</strong></h4><p>You are building on a case-insensitive filesystem.</p><pre>************************************************************<br>You are building on a case-insensitive filesystem.<br>Please move your source tree to a case-sensitive filesystem.<br>************************************************************<br>Case-insensitive filesystems not supported.</pre><p>Creating a case-sensitive disk image: <a href="https://source.android.com/source/initializing#setting-up-a-mac-os-x-build-environment">https://source.android.com/source/initializing#setting-up-a-mac-os-x-build-environment</a></p><h4>Fatal error file not found</h4><p>If the following error is raised during the Android building process:</p><pre>external/iptables/extensions/../include/linux/netfilter_ipv4/ipt_ECN.h:13:10: fatal error: &#39;linux/netfilter/xt_DSCP.h&#39; file not found</pre><pre>#include &lt;linux/netfilter/xt_DSCP.h&gt;</pre><p>Please check the filename user or lower case. Remember that the Android building process is case-sensitive.</p><p>In this case create a symbolic name <strong>xt_dscp.h</strong> for the original file <strong>xt_DSCP.h</strong> with the following command lines:</p><pre>cd external/iptables/extensions/../include/linux/netfilter</pre><pre>ln -s xt_dscp.h xt_DSCP.h</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*xVESc3SPRHNCIQkf-IcQTQ.jpeg" /></figure><h4>No space left on device</h4><p>If the case-sensitive partition become full (no free space available):</p><pre>[ 25% 2/8] build out/target/product/generic/obj/JAVA_...RARIES/SystemUI-proto-tags_intermediates/classes.jackninja: error: mkdir(out/target/product/generic/obj/JAVA_LIBRARIES/SystemUI-proto-tags_intermediates): No space left on device</pre><p>Open Terminal and increase the partition size:</p><pre>umountAndroid<br>hdiutil resize -size &lt;new-size-you-want&gt;g ~/android.dmg.sparseimage<br>mountAndroid</pre><h4>Missing and no known rule to make it</h4><p>If the flowing error is raised during a single package compilation thought <strong>mm</strong> or <strong>mmm</strong> command:</p><pre>ninja: error: &#39;out/target/common/obj/JAVA_LIBRARIES/metrics-helper-lib_intermediates/link_type&#39;, needed by &#39;out/target/common/obj/APPS/SystemUITests_intermediates/link_type&#39;, missing and no known rule to make it</pre><pre>12:39:35 ninja failed with: exit status 1</pre><pre>make: *** [run_soong_ui] Error 1</pre><p>Compile the bidding library <strong>metrics-helper</strong>:</p><pre>mma platform_testing/libraries/metrics-helper/</pre><p><strong>OR</strong>, go to the main makefile <strong>Android.mk</strong> and disable the <strong>Unit tests</strong> project compilation by commenting the <strong>include</strong> line:</p><p><strong>Android.mk</strong></p><pre>include $(BUILD_PACKAGE)<br># disable the sub-project makefile: ./tests/Android.mk<br># include $(call all-makefiles-under,$(LOCAL_PATH))</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da07e8bd94f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notification Listener Service Vulnerability]]></title>
            <link>https://medium.com/@christopherney/notification-listener-service-vulnerability-8d0c586f88d5?source=rss-9f2b44764fcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d0c586f88d5</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Christopher Ney]]></dc:creator>
            <pubDate>Sat, 09 Apr 2016 12:19:01 GMT</pubDate>
            <atom:updated>2019-03-21T09:21:37.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aF_JQ7AjoOdLA33IrsYzLA.jpeg" /></figure><h3>Android Security — Notification Listener Service Vulnerability</h3><p>During an Android development project I had to use <strong>Notification Listener Service </strong>. This is a simple Service which is able to listen and catch all received push notifications, only if the user accept to switch on this permission.</p><p>For example the <a href="https://play.google.com/store/apps/details?id=mobi.drupe.app"><strong>Drupe App</strong></a> using this Service Listener to catch notifications sent by third Apps, and displayed the list of the latest received messages on your device.</p><p>The screen capture below, shows you en example of this Notification Service activation of the Drupe App…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*21CJ30hlbVHRPP_jrROSRQ.png" /><figcaption>Allow notification access for a third App</figcaption></figure><p>The <strong>Listener Service</strong> return a <em>Notification object</em> for each received notification. You can obtains different information into this object like:</p><ul><li><strong>package name</strong> (to know which application received a notification),</li><li>the <strong>title</strong> and <strong>text</strong> display displayed by the<em> Notification Center</em></li><li>and sometimes many others information like: <strong>phone number</strong> (for SMS) or the <strong>contact name</strong> (from the phone book of your devices)…</li></ul><h4>How it works</h4><p>To implement a <strong>Notification Listener Service</strong>, you just have to add a few lines of code into your project:</p><ul><li>Declare the service into your <em>manifest</em> file with the <strong>BIND_NOTIFICATON_LISTENER_SERVICE</strong> permission:</li></ul><pre>&lt;service android:name=&quot;.MyNotificationListener&quot;<br>          android:label=&quot;@string/service_name&quot;<br>          android:permission=&quot;android.permission.BIND_NOTIFICATION_LISTENER_SERVICE&quot;&gt;<br>     &lt;intent-filter&gt;<br>         &lt;action android:name=&quot;android.service.notification.NotificationListenerService&quot; /&gt;<br>     &lt;/intent-filter&gt;<br> &lt;/service&gt;</pre><p>And then, create a <em>simple Service</em> which extend the <strong>NotificationListenerService</strong>:</p><pre>package com.example.service;<br><br>import android.service.notification.NotificationListenerService;<br>import android.service.notification.StatusBarNotification;<br>import android.util.Log;<br><br>public class MyNotificationListener extends NotificationListenerService {<br><br>    public static String <em>TAG </em>= MyNotificationListener.class.getSimpleName();<br><br>    @Override<br>    public void onNotificationPosted(StatusBarNotification sbn) {<br><br>        Log.<em>i</em>(<em>TAG</em>, &quot;ID:&quot; + sbn.getId());<br>        Log.<em>i</em>(<em>TAG</em>, &quot;Posted by:&quot; + sbn.getPackageName());<br>        Log.<em>i</em>(<em>TAG</em>, &quot;tickerText:&quot; + sbn.getNotification().tickerText);<br><br>        for (String key : sbn.getNotification().extras.keySet()) {<br>            Log.<em>i</em>(<em>TAG</em>, key + &quot;=&quot; + sbn.getNotification().extras.get(key).toString());<br>        }<br>    }<br><br>}</pre><h4>What I’ve discovered !?!</h4><p>During my development, I was need to reset one of my password account (in my case: <a href="http://portail.free.fr/">free.fr</a> a biggest Internet Provider in France).</p><p>After click on <strong>Reset my password </strong>button, I’ve received a mail where I found my <em>login</em> and <em>new random generated password</em>.</p><p>Of course, my <a href="https://play.google.com/store/apps/details?id=com.google.android.gm"><strong>Gmail</strong> <strong>App</strong></a> displayed a notification on my Android device for this new mail.</p><p>But at the same time, into my <em>Logcat</em> (screen capture below), big surprise! The entire <em>Notification object</em>, has been printed with <strong>mail body</strong> and all my <strong>private information</strong>…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtY6hgVLsd9zanRO-fdHwg.png" /><figcaption>Android Studio Logcat</figcaption></figure><p>With a few simple lines of code, you can get the following private information:</p><ul><li>applicationInfo: <strong>com.google.android.gm</strong> (Package Name of Google Gmail App)</li><li>subText: <strong>the end-user Gmail address</strong></li><li>bibText: <strong>login + password</strong></li></ul><p>So now, imagine an application which listing <strong>all your mails</strong> and <strong>SMS</strong> notifications and then <strong>send the content to a web server</strong> !</p><blockquote>Easy to know a lot of information about your life and hack your web accounts…</blockquote><h4>Advises for this vulnerability</h4><p><strong>If you are an end-user:</strong></p><ul><li>Be carful before accept a new App could read your notifications; be sure that you can trust this App (Manufacturer App, Google/Android App…)</li></ul><p><strong>If you are a web developer:</strong></p><ul><li>Remember a very simple rule: never send a password into a mail, even if the user has forgot his password.</li></ul><p><strong>If you are an Android developer:</strong></p><ul><li>Never include some private or critical information into your Notification object such as: <em>login, password, secret user ID…</em></li><li>In case of Gmail App, if it’s really important to display the mail body, try at first to analyse if the body contains keywords like: <em>password, login</em>…. before to print the body into your Notification <em>(but this solution is not totally secured…)</em></li></ul><h4>Links</h4><ul><li><a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html">http://developer.android.com/guide/topics/ui/notifiers/notifications.html</a></li><li><a href="http://developer.android.com/reference/android/service/notification/NotificationListenerService.html">http://developer.android.com/reference/android/service/notification/NotificationListenerService.html</a></li><li><a href="http://developer.android.com/reference/android/app/NotificationManager.html">http://developer.android.com/reference/android/app/NotificationManager.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d0c586f88d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>