android master key

来源:互联网 发布:淘宝上比较好的店铺 编辑:程序博客网 时间:2024/04/30 06:16

我也来说说android master key 漏洞,官方称为ANDROID-8219321

先是在看雪上看到android master key的漏洞,这个号称可以控制95%以上的

android手机(理论上会影响2013年5月以前的android系统,大概是4.3之前的android)。So crazy!不得了,赶紧研究一下。主要参考了以下文章:

http://bbs.pediy.com/showthread.php?p=1197239

http://www.kanxue.com/bbs/showthread.php?t=175129

 

先看看2013年3月和5月官方给出的说法是

3月:

 

Improper installation of unsigned code

ID: ANDROID-8219321

Severity: High

Affected versions: Android 2.0 and greater

 

An inconsistency in the handling of zipfiles during application installation may lead to the installation andexecution of unsigned code in a privileged context.

 

This issue will be publicly disclosed in 90days. A CTS test will be included in the next CTS release.

 

 

5月:

 

Insertion of arbitrary code withoutchanging package signature due to incorrect parsing of APKs (update to previousbulletin)

First published: March 4th, 2013

Last Updated: May 31st, 2013

ID: ANDROID-8219321

Severity: High

Affected Android Versions: all

 

Arbitrary code can be inserted into an APKand pass signature verification due to incorrect parsing of APKs. A maliciouslycrafted classes.dex can be inserted before a legitimately signed classes.dex inan APK. Signature verification will be performed on the second, legitimateclasses.dex, but the first, malicious classes.dex is installed for applicationuse.

 

Update: This issue will be publiclypresented at Blackhat 2013. Please seehttp://www.blackhat.com/us-13/briefings.html#Forristal for more details. Atthat time, we expect active public exploitation of this issue outside of GooglePlay.

 

(一)原理

原理就是恶意apk可以绕过android签名验证机制,进而直接控制手机上的apk.


漏洞修复前后比对:(luni/src/main/java/java/util/zip/ZipFile.java

在漏洞修复前Android未考虑到APK压缩文件中的重复entryName问题,这样恶意软件制作者就可以制作特定的APK包绕过Android APK包证书认证。

 

(二)修复

2013年7月3号bluebox在官网发文该漏洞,详见http://bluebox.com/corporate-blog/bluebox-uncovers-android-master-key/

2013年7月7号大名鼎鼎的cyanogenmod 发布修复补丁。详见:http://review.cyanogenmod.org/#/c/45251/

具体的修复方法,作者还没去实践。

(三)利用

1、将原本的apk中的文件解压出来。分成两个文件夹,orgin_dex和orgin_nodex。其中orgin_dex仅放解压出来的classes.dex文件,orgin_nodex放剩余的所有文件。

2、创建第三个文件夹dirty_dex,放修改之后编译出的classes.dex文件。

3、利用ant打包。build.xml如下:

<?xml version="1.0"encoding="UTF-8"?>

<project name="MyProject"default="init" basedir=".">

      <zipdestfile="evil.apk" duplicate="add">

        <filesetdir="D:\\ant\\orgin_nodex\\"/>

        <filesetdir="D:\\ant\\dirty_dex\\"/>

        <filesetdir="D:\\ant\\orgin_dex\\"/>

      </zip>

      <targetname="init" depends="">

      </target>

</project>

 

cracked-neteasy3.5.apk网易新闻客户端就是本人cracked过的apk,运行后弹出提心信息“cracked by xiaoqiang“.

注意:

1.如何反编译、修改、重建class.dex 本文就不啰嗦了。

2.Ant的打包,直接在eclispse右键build.xml文件就可以了。

3.最后你可以用7-zip查看cracked-neteasy3.5.apk,发现目录下有两个class.dex文件。

 

OK!完事,突然就发现android好玩了起来。


附件: http://download.csdn.net/detail/baolong47/6717861

0 0