drozer-Android安全测试基本使用教程(Windows10)_drozer官网(1)

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化的资料的朋友,可以戳这里获取

(2)python2.7
(3)android sdk
确保配置了adb、java环境变量

1.2 Window10安装drozer

2、 下载drozer
https://labs.mwrinfosecurity.com/tools/drozer/ (下载drozer (RPM))
解压得到以下目录
这里写图片描述
进入E:\drozer-2.4.4-1\usr\bin启动 drozer.bat
这里写图片描述
3、手机/模拟器上安装agent.apk
将agent.apk下载后,手机通过cmd安装,如下:

adb install 安装路径/agent.apk

4、手机端/模拟器安装sieve.apk
将sieve.apk下载后,手机通过cmd安装,如下:

adb install 安装路径/sieve.apk

sieve.apk为官网给的测试apk,上面自带各种漏洞,后面的案例以sieve.apk为例演示

二、开始drozer之旅

2.1 启动session

现在我们已经配好了PC端的drozer环境,以及在手机上安装了drozer agent。但是我们需要将这两者之间联系起来建立通信,我们可以使用嵌入在drozer agen中的服务器来完成此操作。首先,我们需要设置一个合适的端口,以便我们的PC可以连接到由模拟器内部的代理,或手机上的代理。默认情况下,drozer使用端口31415:

现在,启动drozer agent,点击【 Embedded Server】,点击【Enable】启动服务器。能看到服务器启动的通知。
这里写图片描述

这里写图片描述

在终端(cmd)中输入:

adb forward tcp:31415 tcp:31415

这里写图片描述

然后,在PC上,使用drozer控制台进行连接:

$ drozer console connect

因为我们是Windows10版本,需要通过以下方式进行连接:

1、进入drozer安装目录
2、运行drozer.bat console connect

这里写图片描述

为什么我们要先进入drozer目录,因为如果我们直接运行“安装目录/drozer.bat console connect”,极有可能会出现“unknown module: ‘app.package.list’”,为了避免麻烦,我们直接进入drozer安装目录

2.2 使用drozer进行安全评估
2.2.1 配置sieze

1、前面我们在手机端安装了Sieve.apk,为了我们后面的安全案例讲解,我们需要先配置Sieve。
(1)安装好后,打开sieve,第一次进入需要输入16位的密码和确认密码,提交后需要创建4位数的PIN(我的密码为1234567890123456,PIN为1234)
(2)输入PIN后进入“Your Passwords”页面,添加某些应用的密码
然后进入了下面页面:
这里写图片描述

一定要记住开始设置的16位密码和PIN,这个是不可改的

(3)在sieve中添加“Your Passwords”,可添加多个,后面测试跳过登录直接进入这个页面有用
这里写图片描述

2.2.2 基本命令的使用

1、检索包的包名:run app.package.list -f (安装后的app名称)

dz>  run app.package.list -f sieve
com.mwr.example.sieve (Sieve)

2、查看包的详细信息:app.package.info
包含的内容有:版本号,数据存放在手机上的路径,安装时关于应用程序允许的权限的详细信息。

dz> run app.package.info -a com.mwr.example.sieve
Package: com.mwr.example.sieve
  Application Label: Sieve
  Process Name: com.mwr.example.sieve
  Version: 1.0
  Data Directory: /data/user/0/com.mwr.example.sieve
  APK Path: /data/app/com.mwr.example.sieve-SUwLMRYMpLSx46cH5qdr1A==/base.apk
  UID: 10223
  GID: [3003]
  Shared Libraries: null
  Shared User ID: null
  Uses Permissions:
  - android.permission.READ_EXTERNAL_STORAGE
  - android.permission.WRITE_EXTERNAL_STORAGE
  - android.permission.INTERNET
  Defines Permissions:
  - com.mwr.example.sieve.READ_KEYS
  - com.mwr.example.sieve.WRITE_KEYS

3、识别攻击面
在此,我们将只考虑通过Android的内置机制的进程间通信(IPC)暴露漏洞。这些漏洞通常导致敏感数据泄漏到安装在同一设备上的其他应用程序。

我们可以通过drozer报告sieze的攻击面:

dz> run app.package.attacksurface com.mwr.example.sieve
Attack Surface:
  3 activities exported
  0 broadcast receivers exported
  2 content providers exported
  2 services exported
    is debuggable

上面结果说明我们有很多潜在的问题,这个app上的 ‘exports’ 有的几个让其他应用程序可以访问的activities(应用程序使用的屏幕)、内容提供者(数据库对象)、服务(后台工作者)。同时有一点,该服务是可调试的,这意味着我们可以使用ADB逐步通过代码将调试器附加到进程。

4、启用页面的activity:Launching Activities
通过 app.activity.info 我们可以知道哪些activity是可以导出的

dz>  run app.activity.info -a com.mwr.example.sieve
Package: com.mwr.example.sieve
  com.mwr.example.sieve.FileSelectActivity
    Permission: null
  com.mwr.example.sieve.MainLoginActivity
    Permission: null
  com.mwr.example.sieve.PWList
    Permission: null

只有启动页是我们希望有的activity,其余两个都不希望有,因为这些activity是可以导出的,而不需要任何许可(如登录时输入密码),我们可以通过drozer启动它,如下:

dz>  run app.activity.start --component  com.mwr.example.sieve com.mwr.example.sieve.PWList

这里写图片描述

当调用 app.activity.start可以构建更复杂的用途,与所有的drozer模块一样,你可以请求更多的使用信息:

dz> help app.activity.start
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

5、从内容提供者读取
接下来,我们可以收集有关应用程序可导出的内容提供者的更多信息。

dz>  run app.provider.info -a com.mwr.example.sieve
Package: com.mwr.example.sieve
  Authority: com.mwr.example.sieve.DBContentProvider
    Read Permission: null
    Write Permission: null
    Content Provider: com.mwr.example.sieve.DBContentProvider
    Multiprocess Allowed: True
    Grant Uri Permissions: False
    Path Permissions:
      Path: /Keys
        Type: PATTERN_LITERAL
        Read Permission: com.mwr.example.sieve.READ_KEYS
        Write Permission: com.mwr.example.sieve.WRITE_KEYS
  Authority: com.mwr.example.sieve.FileBackupProvider
    Read Permission: null
    Write Permission: null
    Content Provider: com.mwr.example.sieve.FileBackupProvider
    Multiprocess Allowed: True
    Grant Uri Permissions: False

这儿显示了前面攻击的两个可导出的内容提供者
(1)Database-backed Content Providers (数据泄露)
drozer提供了一个扫描模块,它汇集了各种猜测路径,并列出了一个可访问的列表,可扫描出哪些

dz>  run scanner.provider.finduris -a com.mwr.example.sieve
Scanning com.mwr.example.sieve...
Unable to Query  content://com.mwr.example.sieve.DBContentProvider/
Unable to Query  content://com.mwr.example.sieve.FileBackupProvider/
Unable to Query  content://com.mwr.example.sieve.DBContentProvider
Able to Query    content://com.mwr.example.sieve.DBContentProvider/Passwords/
Able to Query    content://com.mwr.example.sieve.DBContentProvider/Keys/
Unable to Query  content://com.mwr.example.sieve.FileBackupProvider
Able to Query    content://com.mwr.example.sieve.DBContentProvider/Passwords
Unable to Query  content://com.mwr.example.sieve.DBContentProvider/Keys

Accessible content URIs:
  content://com.mwr.example.sieve.DBContentProvider/Keys/
  content://com.mwr.example.sieve.DBContentProvider/Passwords
  content://com.mwr.example.sieve.DBContentProvider/Passwords/

(2)现在我们可以使用其他的drozer模块从这些内容URI中检索信息,甚至修改数据库中的数据:
查询数据库中的信息:

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

[外链图片转存中…(img-se2YBfBU-1715058832474)]
[外链图片转存中…(img-YkDPH400-1715058832474)]

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 25
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值