Skip to main content

Hacking - Best OF Reverse Engineering - Part24

Android.Bankun And Other Android Obfuscation Tactics: A New Malware Era

There’s one variant of Android.Bankun that is particularly interesting to me. When you look
at the manifest it doesn’t have even one permission. Even the most simple apps have at least
internet permissions. Having no permissions isn’t a red flag for being malicious though.
In fact, it may even make you lean towards it being legitimate. However, there is one thing
that gives Android.Bankun a red flag though. The package name of com.google.bankun
instantly makes me think something is fishy.

To the average user the word‚ Google’ is seen as a word to be trusted. This is especially true when it comes to the Android operating system which is of course created by the search engine giant. Malware authors now this and heavily use it to disguise their malicious intent. Mobile threat researchers like myself also know this and end up looking twice whenever we see ‚Google’ being used. Diving into the code, we see a simple application whose code all resides in one plainly named default class, MainActivity. A great place to start is on the “onCreate” function which is run whenever the app is opened. Let’s take a look (Figure 1). Looking at the code, we can see that it calls “isAvilible” with parameters of different package names. The “isAvilible” function looks to see if that package name is installed and returns ‘true’ if it is installed which triggers the “if...else” statement to be ran. Let’s look at the first “if...else” statement with “com.kbcard. kbkookmincard”. If you look in the Google Play market you’ll see that “com kbcard.kbkookmincard” is an app called “KB Kookmin Card Mobile Home”. It appears to be a Korean banking app. Whenever “KB Kookmin Card Mobile Home” exists, the malicious app will uninstall the app using the “uninstallApk” function after getting root access from the “getRootAhth” function. It then calls “installZxingApk” with the
value of ‘i’ which is ‘1’ for this “if...else” statement. Let’s look at the “installZxingApk” function (Figure 2).










































Under the “installZxingApk” function, it appears to be grabbing a file in the assets folder. The name of the file is the parameter variable that was used to call “installZxingApk”. For our example, we know that the value is ‘1’ from the “if...else” statement in class “MainActivity”. In other words, a file named “1.apk” located in the assets folder is being called and then installed. So, let’s see if there is an APK in the assets folder of the malicious app named “1.apk” (Figure 3).














There it is! Along with several other APKs for other “if...else” statements to use.

To test this malicious app out, I grabbed the legitimate “KB Kookmin Card Mobile Home” and installed it. Here it is sitting in my test phone’s memory (Figure 4).











Then ran the malicious app and this popped up (Figure 5).





















There’s the app getting root access. Now, you should probably say “what in the...” and click ‘Deny’,
but that’s no fun so let’s click ‘Allow’. We then get this (Figure 6).

What’s this? Maybe an update of my banking app “KB Kookmin Card Mobile Home?” Lets click ‘Install’. Looking at the icon for this app nothing looks different:


Now let’s look in the phone’s memory again (Figure 7). The APK “com.kbcard.kbkookmincard-1.apk” has been replaced with “com.googles.smsservicesone-1.apk”, or better known as “1.apk” from our malicious apps asset folder. So what does “1.apk” do? It’s another malicious app that pretends to be “KB Kookmin Card Mobile Home” (Figure 8). Not only does this nasty app steal sensitive banking info, it also does several other malicious activities.
































It listens for any incoming SMS and phone calls and when one comes in, it gathers information such as time of call/SMS, telephone number, SMS message body, call length time, etc. It also steals your contact list and adds contact entries, sends SMS messages in the background, steals email through gmail and who knows what else. All of this from an APK that has no permissions.

Android.Bankun is just one example of how malware authors evade detection. A typical user may not
think twice when they see something starting with the name “com.google”, even if it asking for superuser permissions. Malware authors are ‘banking’ on this (pun intended). The most common evasion tactic is using the same package name as a legitimate app. In many cases, the app will run just like the legitimate version, but do something malicious in the background. Turning function and class names into something generic like “a”, “b”, “c” and so forth, also makes it tougher to track down malicious code. Using encoding/decoding tactics within the code also makes it harder to see what the true intent may be. Android.Bankun didn’t use any obfuscation to hide the APKs in the assets folder, but other malware authors will part the APK files out into multiple files in the assets folder with generic file types. The malicious app then puts the files back together into a malicious APK before installing it.

Mobile malware is evolving rapidly. We are coming into a new era where the typical user may not own a laptop anymore, but instead several Android devices like a tablet and mobile phone. You better believe that malware authors see this trend. They are only getting started with new ways to attempt to evade us all.

Popular posts from this blog

Haking On Demand_WireShark - Part 5

Detect/Analyze Scanning Traffic Using Wireshark “Wireshark”, the world’s most popular Network Protocol Analyzer is a multipurpose tool. It can be used as a Packet Sniffer, Network Analyser, Protocol Analyser & Forensic tool. Through this article my focus is on how to use Wireshark to detect/analyze any scanning & suspect traffic. Let’s start with Scanning first. As a thief studies surroundings before stealing something from a target, similarly attackers or hackers also perform foot printing and scanning before the actual attack. In this phase, they want to collect all possible information about the target so that they can plan their attack accordingly. If we talk about scanning here they want to collect details like: • Which IP addresses are in use? • Which port/services are active on those IPs? • Which platform (Operating System) is in use? • What are the vulnerabilities & other similar kinds of information. • Now moving to some popular scan methods and ho

Bypassing Web Application Firewall Part - 2

WAF Bypassing with SQL Injection HTTP Parameter Pollution & Encoding Techniques HTTP Parameter Pollution is an attack where we have the ability to override or add HTTP GET/POST parameters by injecting string delimiters. HPP can be distinguished in two categories, client-side and server-side, and the exploitation of HPP can result in the following outcomes:  •Override existing hardcoded HTTP parameters  •Modify the application behaviors   •Access and potentially exploit uncontrollable variables  • Bypass input validation checkpoints and WAF rules HTTP Parameter Pollution – HPP   WAFs, which is the topic of interest, many times perform query string parsing before applying the filters to this string. This may result in the execution of a payload that an HTTP request can carry. Some WAFs analyze only one parameter from the string of the request, most of the times the first or the last, which may result in a bypass of the WAF filters, and execution of the payload in the server.  Let’s e

Bypassing Web Application Firewall Part - 4

Securing WAF and Conclusion DOM Based XSS DOM based XSS is another type of XSS that is also used widely, and we didn’t discuss it in module 3. The DOM, or Document Object Model, is the structural format used to represent documents in a browser. The DOM enables dynamic scripts such as JavaScript to reference components of the document such as a form field or a session cookie, and it is also a security feature that limits scripts on different domains from obtaining cookies for other domains. Now, the XSS attacks based on this is when the payload that we inject is executed as a result of modifying the DOM environment in the victim’s browser, so that the code runs in an unexpected way. By this we mean that in contrast with the other two attacks, here the page that the victim sees does not change, but the injected code is executed differently because of the modifications that have been done in the DOM environment, that we said earlier. In the other XSS attacks, we saw the injected code was