上一篇介绍了安卓安全测试框架--drozer环境搭建,这篇呢,我们开始用实际的例子去实战,有真实的实战才是我们掌握一个工具的最佳途径。这里呢,是我用的我学习用的apk,当然了,大家还可以在网上找,推荐大家用这个https://github.com/liwanlei/bilibili-android-client,一个不错的开源的apk。
我们链接后,直接输入list看看api
代码语言:javascript复制Drozer基本命令
列出模拟器设备中所有已经安装的App包列表代码语言:javascript复制run app.package.list 如果找不到app,我们可以用adb 查看
代码语言:javascript复制adb shell pm list packages列举APP的详细信息
利用关键词“example”进行搜索得出包名:
代码语言:javascript复制run app.package.list -f example结果如下
列举所有信息
代码语言:javascript复制run app.package.info -a com.example.studayappp结果如下:
因为这个app是我自己写的,我确认了权限都正确
Drozer安全测试
查看sieve的可攻击点
代码语言:javascript复制run app.package.attacksurface com.example.studayappp结果如下:
activity组件
应用程序中,一个Activity通常就是一个单独的屏幕,它上面可以显示一些控件也可以监听并处理用户的事件做出响应。Activity之间通过Intent进行通信。在Intent的描述结构中,有两个最重要的部分:动作和动作对应的数据。
activity相关的一个问题如何解决呢。
如果我们有源码可以直接看,没有源码的可以用apktool 反编译AndroidManifest.xml
可看到将activity的exported设置为true
查看对外的activity组件信息
代码语言:javascript复制run app.activity.info -a com.example.studayappp使用app.activity.start进行漏洞测试
越权漏洞--绕过登录界面导致可直接访问主界面,说明存在越权漏洞
代码语言:javascript复制run app.activity.start --component com.example.studayappp com.example.studayappp.MainActivity启动后呢,停留在了login界面,说明无法越权。
我们还可以看看pp.activity.start的其他方法,输入:
代码语言:javascript复制help app.activity.start展示如下
代码语言:javascript复制usage: run app.activity.start [-h] [--action ACTION] [--category CATEGORY [CATEGORY ...]]
[--component PACKAGE COMPONENT] [--data-uri DATA_URI]
[--extra TYPE KEY VALUE] [--flags FLAGS [FLAGS ...]]
[--mimetype MIMETYPE]
Starts an Activity using the formulated intent.
Examples:
Start the Browser with an explicit intent:
dz> run app.activity.start
--component com.android.browser
com.android.browser.BrowserActivity
--flags ACTIVITY_NEW_TASK
If no flags are specified, drozer will add the ACTIVITY_NEW_TASK flag. To launch
an activity with no flags:
dz> run app.activity.start
--component com.android.browser
com.android.browser.BrowserActivity
--flags 0x0
Starting the Browser with an implicit intent:
dz> run app.activity.start
--action android.intent.action.VIEW
--data-uri http://www.google.com
--flags ACTIVITY_NEW_TASK
For more information on how to formulate an Intent, type 'help intents'.
Last Modified: 2012-11-06
Credit: MWR InfoSecurity (@mwrlabs)
License: BSD (3 clause)
optional arguments:
-h, --help
--action ACTION specify the action to include in the Intent
--category CATEGORY [CATEGORY ...]
specify the category to include in the Intent
--component PACKAGE COMPONENT
specify the component name to include in the Intent
--data-uri DATA_URI specify a Uri to attach as data in the Intent
--extra TYPE KEY VALUE
add an field to the Intent's extras bundle
--flags FLAGS [FLAGS ...]
specify one-or-more flags to include in the Intent
--mimetype MIMETYPE specify the MIME type to send in the Intent Broadcast组件
BroadcastReceive广播接收器应用可以使用它对外部事件进行过滤只对感兴趣的外部事件(如当电话呼入时,或者数据网络可用时) 进行接收并做出响应。广播接收器没有用户界面。然而,它们可以启动一个activity或serice 来响应它们收到的信息, 或者用NotificationManager来通知用户。通知可以用很多种方式来吸引用户的注意力──闪动背灯、震动、播放声音等。一般来说是在状态栏上放一个持久的图标,用户可以打开它并获取消息。
我们可以看下Broadcast的信息
代码语言:javascript复制run app.package.attacksurface com.example.studayappp结果如下
我们可以解决下AndroidManifest.xml的对应的Broadcast。
有两个广播receiver的exported设置未进行设置
Broadcast可能会存在越权问题,可发送恶意广播,伪造消息等等。
后续会持续更新,后续内容。
我是雷子,如果你感觉介绍的对你有帮助,请点亮在看很关键。