ANDROID-8219321漏洞、POC及其他相关信息汇总

这两天这个问题基本已经公之于众了。所以不用再保密了。相关信息及自己研究的一些结果放上来,汇总一下。

首先是3月和5月google官方发出的补丁说明:

3月:

Improper installation of unsigned code
ID: ANDROID-8219321
Severity: High
Affected versions: Android 2.0 and greater

An inconsistency in the handling of zip files during application installation may lead to the installation and execution of unsigned code in a privileged context.

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


5月:

Insertion of arbitrary code without changing package signature due to incorrect parsing of APKs (update to previous bulletin)
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 APK and pass signature verification due to incorrect parsing of APKs. A maliciously crafted classes.dex can be inserted before a legitimately signed classes.dex in an APK. Signature verification will be performed on the second, legitimate classes.dex, but the first, malicious classes.dex is installed for application use. 

Update: This issue will be publicly presented at Blackhat 2013. Please see http://www.blackhat.com/us-13/briefings.html#Forristal for more details. At that time, we expect active public exploitation of this issue outside of Google Play.


官方补丁: patch.rar.



---------------------------------------------------------------------------------


当然大家关注这个问题是在7月3号bluebox在官网发文以后。
发文地址: http://bluebox.com/corporate-blog/bl...id-master-key/


由于问题的严重性,一时间大家开始研究起来。漏洞基本公之于众是在7号cyanogenmod打上补丁之后。
详见: http://review.cyanogenmod.org/#/c/45251/


根据打补丁的代码,大家推测到是apk中存在两个相同的classes.dex文件。于是大家又开始研究POC的问题。我也自己做了尝试,由于打包顺序问题没弄出来(失之毫厘,谬以千里啊~)。今天上班没法弄,之后大家关注到了这个网址:
https://gist.github.com/poliva/36b0795ab79ad6f14fd8


---------------------------------------------------------------------------------


到这本来应该已经完了。结果下午我网上下载了一个网易新闻Android客户端按照上面网址的操作方法,却怎么也安装不上。我曾怀疑是我方法的问题,后来写了一个简单的demo,发现通过这个方法又能成功安装。


这个方法是将原始apk数据全部压缩进修改后的未签名的apk中,体积直接增大了一倍!网站上自己对这个方法的描述也是 “Quick & dirty PoC for Android bug 8219321 discovered by BlueboxSec”。 所以确实存在问题。


经过上述方法的启发,我明白之前的方法问题出在压缩顺序上。应该是先压缩修改后的dex文件,再压缩原本的dex。


于是,比较完善的方法是:


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="dist" basedir=".">
<zip destfile="evil.apk" duplicate="add">
  <fileset dir="D:\\ant\\orgin_nodex\\"/>
  <fileset dir="D:\\ant\\dirty_dex\\"/>
  <fileset dir="D:\\ant\\orgin_dex\\"/>
</zip>
</project>

Linux下可使用这个shell脚本: weir.rar.


---------------------------------------------------------------------------------

最后上传两个按此方法制作的apk包。一个是网易新闻,一个是微信。在启动的时候弹出自定义的Toast信息。可以直接覆盖官方应用安装。(用之前那个POC的方法我试了不能成功安装)


网易新闻下载    微信下载

此帖于 2013-07-10 14:46:42 被 ZhWeir 最后编辑 原因: 提供POC shell脚本

转载于:https://my.oschina.net/zhuzihasablog/blog/143952

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值