Android App滲透測試工具匯總


網上搜集了一些App安全學習教程及工具,項目地址:https://github.com/Brucetg/App_Security

 

一. drozer簡介

drozer(以前稱為Mercury)是一款Android安全測試框架。

drozer允許您通過承擔應用程序的角色並與Dalvik VM,其他應用程序的IPC端點和底層操作系統進行交互來搜索應用程序和設備中的安全漏洞。

drozer提供工具來幫助您使用,共享和理解公共Android漏洞。它可以幫助您通過開發或社會工程將drozer Agent部署到設備。使用weasel(MWR的高級開發負載)drozer能夠通過安裝完整代理,將有限代理注入正在運行的進程或連接反向shell以充當遠程訪問工具(RAT)來最大化其可用權限。

項目地址:https://github.com/mwrlabs/drozer

Mac 安裝drozer

1. 安裝Python 2.7(系統自帶)

2. 安裝Protobuf 2.6 or greater

sudo pip install protobuf

3. 安裝Pyopenssl 16.2 or greater

sudo pip install pyopenssl

4. 安裝Twisted 10.2 or greater

sudo pip install twisted

5. 安裝JDK 1.7

這里我安裝的是JDK 1.8,最后也安裝成功了。

6. 安裝Python的service_identity模塊(不安裝的話后面運行drozer時總會顯示警告)

sudo pip install service_identity

7. 安裝 adb(Android Debug Bridge)

可以去 https://developer.android.com/studio/releases/platform-tools下載相應平台上的安裝包,解壓后配置下環境變量即可,這里僅演示Mac下的安裝方式:

安裝homebrew(已安裝的話可跳過)

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

安裝adb

brew install android-platform-tools

測試是否安裝成功

adb devices

如果不報錯就說明安裝成功啦。

8. 安裝drozer

到 https://labs.mwrinfosecurity.com/tools/drozer/ 下載相應平台的安裝包:

這里我下載的是drozer(Python .whl)

然后進入文件所在目錄,執行以下命令:

sudo pip install drozer-2.x.x-py2-none-any.whl

注意:這里的2.x.x要替換成自己下載的版本,比如這里下載的是2.4.4,就替換成2.4.4

安裝成功后,執行drozer命令后輸出如下:

Windows和Linux平台上的安裝大體上類似,就不一一測試了。

客戶端安裝

同樣到:https://labs.mwrinfosecurity.com/tools/drozer/ 下載客戶端,也就是drozer(Agent .apk only),然后安裝到手機或者模擬器上就好。

使用

使用Android模擬器:

如果使用Android模擬器,則需要設置合適的端口,以便PC可以連接到模擬器內部或設備上的代理打開的TCP套接字。默認情況下,drozer使用端口31415:

列出所有設備:

adb devices

啟動drozer服務端:

drozer server start

接着執行:

adb connect 192.168.56.101:5555 #連接到模擬器 adb forward tcp:31415 tcp:31415 #進行端口轉發

啟動移動設備中的drozer agent,將右下角的關閉置為打開狀態:

然后,使用drozer控制台進行連接,在PC終端中執行以下命令:

drozer console connect --server 192.168.56.101

如果連接成功,PC終端效果如下:

此時,Android客戶端狀態如下:

常用命令:

run app.package.list #列出設備中安裝的包 run app.package.list -f app名稱 #不一定非得是完整的包名 run app.package.info #獲取安裝的包的信息 run app.package.info -a com.android.browser #列舉指定包的信息 run app.package.info -p android.permission.INTERNET #列出具有相應權限的包

run app.activity.info #列舉設備上所有的activity run app.activity.info -f 包名 #搜索包的activity

run app.provider.info #列舉設備上所有的provider run app.service.info #列舉設備上所有的service run app.broadcast.info #列舉設備上所有的廣播 run app.package.attacksurface com.android.browser #查看設備上某包的受攻擊面 run app.activity.info -a 包名 #列出包的所有Activity

#運行activity run app.activity.start --action 【activity 設置的intent filter的action屬性】 --category 【activity 設置的intent filter的category 屬性】--component 【package 名字】 【component 屬性】 例如: run app.activity.start --action android.intent.action.MAIN --category android.intent.category.LAUNCHER --component com.android.browser com.android.browser.BrowserActivity
#根據指定的intent action和intent category來查看activity run app.activity.forintent --action 【intent action】 --category 【intent category】 run app.activity.forintent --action android.intent.action.VIEW --category android.intent.category.DEFAULT

其他用法如下:

Dex是Android系統中可以在Dalvik虛擬機上直接運行的文件格式。java源代碼經過ADT的復雜編譯后轉換成Dex文件,這是一個逐步優化的過程。Dex文件的指令碼就是Dalvik虛擬機專有的一套指令集,專門為嵌入式系統優化過,相比標准java的.class文件,它體積小,運行效率高。

$ run app.activity.forintent                   // Find activities that can handle the given intent                               
$ run app.activity.info                        // Gets information about exported activities.                                   
$ run app.activity.start                       // Start an Activity $ run app.broadcast.info // Get information about broadcast receivers $ run app.broadcast.send // Send broadcast using an intent $ run app.broadcast.sniff // Register a broadcast receiver that can sniff particular intents $ run app.package.attacksurface // Get attack surface of package $ run app.package.backup // Lists packages that use the backup API (returns true on FLAG_ALLOW_BACKUP) $ run app.package.debuggable // Find debuggable packages $ run app.package.info // Get information about installed packages $ run app.package.launchintent // Get launch intent of package $ run app.package.list // List Packages $ run app.package.manifest // Get AndroidManifest.xml of package $ run app.package.native // Find Native libraries embedded in the application. $ run app.package.shareduid // Look for packages with shared UIDs $ run app.provider.columns // List columns in content provider $ run app.provider.delete // Delete from a content provider $ run app.provider.download // Download a file from a content provider that supports files $ run app.provider.finduri // Find referenced content URIs in a package $ run app.provider.info // Get information about exported content providers $ run app.provider.insert // Insert into a Content Provider $ run app.provider.query // Query a content provider $ run app.provider.read // Read from a content provider that supports files $ run app.provider.update // Update a record in a content provider $ run app.service.info // Get information about exported services $ run app.service.send // Send a Message to a service, and display the reply $ run app.service.start // Start Service $ run app.service.stop // Stop Service $ run auxiliary.webcontentresolver // Start a web service interface to content providers. $ run exploit.jdwp.check // Open @jdwp-control and see which apps connect $ run exploit.pilfer.general.apnprovider // Reads APN content provider $ run exploit.pilfer.general.settingsprovider // Reads Settings content provider $ run information.datetime // Print Date/Time $ run information.deviceinfo // Get verbose device information $ run information.permissions // Get a list of all permissions used by packages on the device $ run scanner.activity.browsable // Get all BROWSABLE activities that can be invoked from the web browser $ run scanner.misc.native // Find native components included in packages $ run scanner.misc.readablefiles // Find world-readable files in the given folder $ run scanner.misc.secretcodes // Search for secret codes that can be used from the dialer $ run scanner.misc.sflagbinaries // Find suid/sgid binaries in the given folder (default is /system). $ run scanner.misc.writablefiles // Find world-writable files in the given folder $ run scanner.provider.finduris // Search for content providers that can be queried from our context. $ run scanner.provider.injection // Test content providers for SQL injection vulnerabilities. $ run scanner.provider.sqltables // Find tables accessible through SQL injection vulnerabilities. $ run scanner.provider.traversal // Test content providers for basic directory traversal vulnerabilities. $ run shell.exec // Execute a single Linux command. $ run shell.send // Send an ASH shell to a remote listener. $ run shell.start // Enter into an interactive Linux shell. $ run tools.file.download // Download a File $ run tools.file.md5sum // Get md5 Checksum of file $ run tools.file.size // Get size of file $ run tools.file.upload // Upload a File $ run tools.setup.busybox // Install Busybox. $ run tools.setup.minimalsu // Prepare 'minimal-su' binary installation on the device.

二. Androguard

Androguard簡介:

Androguard是一款使用Python編寫的跨平台的Android逆向工具,它可以在 Linux/Windows/OSX上運行。使用它可以反編譯android應用,也可以用來做android app的靜態分析(static analysis)。

安裝Androguard:

sudo pip install -U androguard

Androguard的使用:

主要文件:

androarsc.py androauto.py androaxml.py androdd.py androgui.py androlyze.py androsign.py androcg.py androdis.py
1. androarsc.py #直接從給定文件或APK中解碼resources.arsc

2. androauto.py #使用該文件可進入自動模式

使用方法:

3. androaxml.py #從指定的APK中解析或直接解析AndroidManifest.xml並以XML格式打印出來或者保 存到文件中,這個程序也可用於處理任何AXML編碼的文件,比如來自布局目錄中的文件。

使用方法:

4. androdd.py #反編譯APK並創建控制流圖

使用方法:

5. androgui.py #androguard的圖形化界面文件,需要安裝PyQT5

使用方法:

6. androlyze.py #打開一個IPython終端並開始逆向工程

使用方法:

7. androsign.py #返回APK中所有證書的指紋

使用方法:

8. androcg.py #基於數據分析創建調用圖並將其導出為圖形格式

使用方法:

9. androdis.py #該文件是DEX文件的反匯編程序

使用方法:

實例:

androarsc.py -i crackme0502.apk -o crackme0502.arsc

androdd.py -i crackme0502.apk -o crackme0502

執行完該命令后,所有輸出均在crackme0502中

androsign.py --hash SHA1 -a -s crackme0502.apk

androcg.py -s crackme0502.apk

如果上述執行上述命令后報錯:AttributeError: ‘DiGraph’ object has no attribute ‘edge’

只需要安裝networkx低版本即可(最新版2.2),改為1.9后程序正常運行:

sudo pip install networkx==1.9

更詳細的使用方法請參考: https://media.readthedocs.org/pdf/androguard/latest/androguard.pdf

常用的Android 滲透測試框架除了文章中提到的,還有好幾個,不過這里限於篇幅原因就先寫這么多吧!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM