该漏洞的描述见链接文章:http://www.cnxhacker.com/2015/01/07/5603.html
主要的原因是使用了Intent中getSerializableExtra() 的API,如果攻击程序使用了app未定义的序列化类,该方法抛出异常,如果未捕获该异常,则导致应用不断crash。如果Activity不需要对外暴漏,则将exported置为false即可。此外,就是针对API的所有使用都加入try
catch。
但在上周的发布中,差点因为这个改动导致线上问题。当使用pendingIntent建立的notification拉起Activity时,如果将其设置为false,则该Activity不会响应,因为pendingIntent为系统application。
Android下Activity通过UI总线对外暴露的三个层次
1.
不对外暴露:应设置android:exported="false",如: |
<activity
android:name=".HomeActivity" android:exported="false"> |
<action
android:name="android.intent.action.VIEW" /> |
<data
android:scheme="http" android:host="m.taobao.com" android:path="/index.htm" /> |
<category
android:name="android.intent.category.DEFAULT" /> |
2.
对外部暴露:需要从非手淘的其它App(含二方、三方)中通过URL方式唤起。应设置android:exported="true",且含有配置了URL规则的<intent-filter>,如: |
<activity
android:name=".HomeActivity" android:exported="true"> |
<action
android:name="android.intent.action.VIEW" /> |
<data
android:scheme="http" android:host="m.taobao.com" android:path="/index.htm" /> |
<category
android:name="android.intent.category.DEFAULT" /> |
3.
浏览器可跳入:在浏览器中访问到与URL规则匹配的网址时,浏览器将弹出选择提示,用户可选择使用手淘App或是继续用浏览器打开。由于存在一定的用户叨扰,所以须慎用,控制在尽可能小的范围内。 |
设置
android:exported="true",并在URL规则
的<intent-filter> 中添加BROWSABLE这个category,如: |
<activity
android:name=".HomeActivity" android:exported="true"> |
<action
android:name="android.intent.action.VIEW" /> |
<data
android:scheme="http" android:host="m.taobao.com" android:path="/index.htm" /> |
<category
android:name="android.intent.category.DEFAULT" /> |
<category
android:name="android.intent.category.BROWSABLE" /> |
android中通用拒绝服务漏洞
原文:http://blog.csdn.net/yuanyl/article/details/43703013