<?xml version="1.0" ?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:planet="http://planet.intertwingly.net/"><id>tag:blogger.com,1999:blog-3437301763614556691.post-7771939573109816762</id><link href="https://blog.achernya.com/feeds/7771939573109816762/comments/default" rel="replies" title="Post Comments" type="application/atom+xml"/><link href="https://blog.achernya.com/2015/12/tracking-down-hidden-malware-on-android.html#comment-form" rel="replies" title="0 Comments" type="text/html"/><link href="https://www.blogger.com/feeds/3437301763614556691/posts/default/7771939573109816762" rel="edit" type="application/atom+xml"/><link href="https://www.blogger.com/feeds/3437301763614556691/posts/default/7771939573109816762" rel="self" type="application/atom+xml"/><link href="https://blog.achernya.com/2015/12/tracking-down-hidden-malware-on-android.html" rel="alternate" title="Tracking down hidden malware on Android" type="text/html"/><title>Tracking down hidden malware on Android</title><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">I've always heard stories about nasty Android malware that throws full-screen advertisements at inopportune times, but I'd never seen it myself until a family member handed me their Galaxy Note 5. The malware certainly exits, it triggers in any application and shows a full-screen advertisement, probably in a WebView. The recent applications list shows no identifying marks, and trying to switch to it just returns to the home screen. Figuring this one out is going to require <span style="font-family: Courier New, Courier, monospace;">adb</span>.<br/>
<div>
<br/></div>
<div>
As a first attempt, I tried to watch <span style="font-family: Courier New, Courier, monospace;">adb logcat</span> while using the phone to see which activity was getting focus. This produced way too much output for anything interesting to be noticeable. After some poking around with top and ls, I decided to try asking for the window with focus directly using <span style="font-family: Courier New, Courier, monospace;">dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'</span> and got back the extremely surprising result of</div>
<div>
<br/></div>
<div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">mCurrentFocus=Window{2e181dbf u0 d0 com.android.panel.settings/a.b.c.d.Boost}  </span></div>
<div class="p1">
<br/></div>
<div class="p1">
which made no sense to me, as anything under com.android should be part of the system, but <span style="font-family: Courier New, Courier, monospace;">a.b.c.d.Boost</span> was extremely suspicious, especially as it had no reasonable Google search results. Looking for the app with <span style="font-family: Courier New, Courier, monospace;">pm list packages -f</span>, I found the full path of the installed malware, <span style="font-family: Courier New, Courier, monospace;">package:/data/app/com.android.panel.settings-1/base.apk=com.android.panel.settings</span>, which proved it's not a core system application, but something that was installed after-the-fact as it was in <span style="font-family: Courier New, Courier, monospace;">/data</span>. I pulled the base.apk file to my laptop for analysis, and uninstalled the application with <span style="font-family: Courier New, Courier, monospace;">pm uninstall com.android.panel.settings</span>.</div>
<div class="p1">
<br/></div>
<div class="p1">
Now that the phone was clean, I tried to trigger the malware and could no longer do so. Great! Time for analysis. Using <a href="https://ibotpeaches.github.io/Apktool/">apktool</a>, I decompiled the application and looked for interesting strings. Sure enough, <span style="font-family: Courier New, Courier, monospace;">a.b.c.d.Boost</span> was the main entry point of the application, and it contained a WebView. I read through some of the smali-decompiled source to see what else the application was doing, and cross-referenced it with the manifest and resources. It seems the application listens for a variety of system intents, like WiFi status changing, or battery level notifications, and uses that to trigger the advertisement. That's consistent with my experience trying to get the ads to come up---the more power you draw (e.g., playing a game) the more frequently you get an ad.</div>
<div class="p1">
<br/></div>
<div class="p1">
The most interesting data was in <span style="font-family: Courier New, Courier, monospace;">res/values/strings.xml,</span> which identifies the malware authors:</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">&lt;resources&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;adv_key&quot;&gt;ZWMwMDBhMDBjZTAwMDJlNDAwMDAwMmY1MDAwMmY1MDAwMmY1NDkxOWQzZGI0Nw==&lt;/string&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;app_name&quot;&gt;Music Player&lt;/string&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;app_name_ex&quot;&gt;Panel Settings&lt;/string&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;file_ext&quot; /&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;url_part&quot;&gt;http://setup.phoneadsmobile.net&lt;/string&gt;</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">    &lt;string name=&quot;url_part1&quot;&gt;http://setup.phoneadsmobile.net&lt;/string&gt;</span></div>
<div class="p1">
</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">&lt;/resources&gt;</span></div>
<div class="p1">
<br/></div>
<div class="p1">
I've <a href="https://www.virustotal.com/en/file/06dee8adbb56e08ab3460e4576ae073b3a8400cef0550c422ff5edbd641ee78b/analysis/">submitted the file to VirusTotal</a> to cross-reference my findings. This adware/malware is particularly sneaky, disguising itself as part of the Android System, making it hard to identify and remove. None of the mobile antivirus products I tried identified the issue, and identification on the VirusTotal database is also fairly low. Suspicious behavior is always worth looking into, especially when the automated tools fail; <span style="font-family: Courier New, Courier, monospace;">adb</span> and friends are good things to have in your toolbox. </div>
</div></div></content><updated planet:format="December 22, 2015 01:16 AM">2015-12-22T01:16:42Z</updated><published planet:format="December 22, 2015 12:52 AM">2015-12-22T00:52:00Z</published><author><name>Alex Chernyakhovsky</name><email>noreply@blogger.com</email><uri>http://www.blogger.com/profile/11975049716533800589</uri></author><source><id>tag:blogger.com,1999:blog-3437301763614556691</id><author><name>Alex Chernyakhovsky</name><email>noreply@blogger.com</email><uri>http://www.blogger.com/profile/11975049716533800589</uri></author><link href="https://blog.achernya.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/><link href="https://www.blogger.com/feeds/3437301763614556691/posts/default" rel="self" type="application/atom+xml"/><link href="https://blog.achernya.com/" rel="alternate" type="text/html"/><link href="http://pubsubhubbub.appspot.com/" rel="hub" type="text/html"/><title>Alex Chernyakhovsky</title><updated planet:format="October 24, 2024 03:12 PM">2024-10-24T15:12:40Z</updated><planet:format>atom10</planet:format><planet:http_etag>W/&quot;b9560f01078294003119e3f65e1a161abcb19a55264a5e7f77bec04138bc5da6&quot;</planet:http_etag><planet:days_per_page>0</planet:days_per_page><planet:http_last_modified>Thu, 24 Oct 2024 15:12:40 GMT</planet:http_last_modified><planet:bozo>false</planet:bozo><planet:encoding>utf-8</planet:encoding><planet:items_per_page>60</planet:items_per_page><planet:css-id>alex-chernyakhovsky</planet:css-id><planet:name>Alex Chernyakhovsky</planet:name><planet:http_location>https://blog.achernya.com/feeds/posts/default</planet:http_location><planet:http_status>301</planet:http_status></source></entry>