# AVD - Android Virtual Device {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} Thank you very much to [**@offsecjay**](https://twitter.com/offsecjay) for his help while creating this content. ## What is Android Studio๋Š” **APK๋ฅผ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Android์˜ ๊ฐ€์ƒ ๋จธ์‹ ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค**. ์ด๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‹ค์Œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค: * **Android SDK ๋„๊ตฌ** - [์—ฌ๊ธฐ์—์„œ ๋‹ค์šด๋กœ๋“œ](https://developer.android.com/studio/releases/sdk-tools). * ๋˜๋Š” **Android Studio** (Android SDK ๋„๊ตฌ ํฌํ•จ) - [์—ฌ๊ธฐ์—์„œ ๋‹ค์šด๋กœ๋“œ](https://developer.android.com/studio). Windows์—์„œ๋Š” (์ œ ๊ฒฝ์šฐ) **Android Studio๋ฅผ ์„ค์น˜ํ•œ ํ›„** **SDK ๋„๊ตฌ๊ฐ€**: `C:\Users\\AppData\Local\Android\Sdk\tools`์— ์„ค์น˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Mac์—์„œ๋Š” **SDK ๋„๊ตฌ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ ** PATH์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: ```bash brew tap homebrew/cask brew install --cask android-sdk ``` ๋˜๋Š” **Android Studio GUI**์—์„œ [https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a](https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a)์—์„œ ์–ธ๊ธ‰๋œ ๋Œ€๋กœ ์„ค์น˜ํ•˜๋ฉด `~/Library/Android/sdk/cmdline-tools/latest/bin/` ๋ฐ `~/Library/Android/sdk/platform-tools/` ๋ฐ `~/Library/Android/sdk/emulator/`์— ์„ค์น˜๋ฉ๋‹ˆ๋‹ค. Java ๋ฌธ์ œ์— ๋Œ€ํ•ด: ```java export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home ``` ## GUI ### ๊ฐ€์ƒ ๋จธ์‹  ์ค€๋น„ Android Studio๋ฅผ ์„ค์น˜ํ–ˆ๋‹ค๋ฉด, ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ ๋ทฐ๋ฅผ ์—ด๊ณ  ๋‹ค์Œ ๊ฒฝ๋กœ๋กœ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: _**Tools**_ --> _**AVD Manager.**_
๊ทธ๋Ÿฐ ๋‹ค์Œ, _**Create Virtual Device**_๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
_**์‚ฌ์šฉํ• ** ์ „ํ™”๊ธฐ๋ฅผ ์„ ํƒ_ํ•˜๊ณ  _**Next.**_๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. {% hint style="warning" %} Play Store๊ฐ€ ์„ค์น˜๋œ ์ „ํ™”๊ธฐ๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด Play Store ์•„์ด์ฝ˜์ด ์žˆ๋Š” ๊ฒƒ์„ ์„ ํƒํ•˜์„ธ์š”! {% endhint %} ํ˜„์žฌ ๋ทฐ์—์„œ๋Š” **์ „ํ™”๊ธฐ๊ฐ€ ์‹คํ–‰ํ•  Android ์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•˜๊ณ  ๋‹ค์šด๋กœ๋“œ**ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
๋”ฐ๋ผ์„œ ์„ ํƒํ•˜๊ณ  ๋‹ค์šด๋กœ๋“œ๋˜์ง€ ์•Š์•˜๋‹ค๋ฉด ์ด๋ฆ„ ์˜†์˜ _**Download**_ ๊ธฐํ˜ธ๋ฅผ ํด๋ฆญํ•˜์„ธ์š” (**์ด์ œ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ค์šด๋กœ๋“œ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ์„ธ์š”).**\ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ค์šด๋กœ๋“œ๋˜๋ฉด **`Next`**์™€ **`Finish`**๋ฅผ ์„ ํƒํ•˜์„ธ์š”. ๊ฐ€์ƒ ๋จธ์‹ ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ด์ œ **AVD ๋งค๋‹ˆ์ €์— ์ ‘๊ทผํ•  ๋•Œ๋งˆ๋‹ค ํ•ญ์ƒ ์กด์žฌํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.** ### ๊ฐ€์ƒ ๋จธ์‹  ์‹คํ–‰ **์‹คํ–‰**ํ•˜๋ ค๋ฉด _**Start button**_์„ ๋ˆ„๋ฅด์„ธ์š”. ![](<../../.gitbook/assets/image (518).png>) ## ๋ช…๋ น์ค„ ๋„๊ตฌ ๋จผ์ € **์‚ฌ์šฉํ•  ์ „ํ™”๊ธฐ๋ฅผ ๊ฒฐ์ •**ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ€๋Šฅํ•œ ์ „ํ™”๊ธฐ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ์„ ์‹คํ–‰ํ•˜์„ธ์š”: ``` C:\Users\\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list device d: 0 or "automotive_1024p_landscape" Name: Automotive (1024p landscape) OEM : Google Tag : android-automotive-playstore --------- id: 1 or "Galaxy Nexus" Name: Galaxy Nexus OEM : Google --------- id: 2 or "desktop_large" Name: Large Desktop OEM : Google Tag : android-desktop --------- id: 3 or "desktop_medium" Name: Medium Desktop OEM : Google Tag : android-desktop --------- id: 4 or "Nexus 10" Name: Nexus 10 OEM : Google [...] ``` ๊ธฐ๊ธฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ•œ ํ›„, **์ด ๊ธฐ๊ธฐ์—์„œ ์‹คํ–‰ํ•  Android ์ด๋ฏธ์ง€๋ฅผ ๊ฒฐ์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.**\ `sdkmanager`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋“  ์˜ต์…˜์„ ๋‚˜์—ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: ```bash C:\Users\\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat --list ``` ๊ทธ๋ฆฌ๊ณ  **๋‹ค์šด๋กœ๋“œ** ํ•˜์„ธ์š” ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์€ ๊ฒƒ(๋˜๋Š” ๋ชจ๋‘)์„ ์œ„ํ•ด: {% code overflow="wrap" %} ```bash C:\Users\\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat "platforms;android-28" "system-images;android-28;google_apis;x86_64" ``` {% endcode %} ์›ํ•˜๋Š” Android ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•œ ํ›„์—๋Š” ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ **๋‹ค์šด๋กœ๋“œํ•œ ๋ชจ๋“  Android ์ด๋ฏธ์ง€๋ฅผ ๋‚˜์—ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**: ``` C:\Users\\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list target ---------- id: 1 or "android-28" Name: Android API 28 Type: Platform API level: 28 Revision: 6 ---------- id: 2 or "android-29" Name: Android API 29 Type: Platform API level: 29 Revision: 4 ``` ์ด ์ˆœ๊ฐ„ ๋‹น์‹ ์€ ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” ์žฅ์น˜๋ฅผ ๊ฒฐ์ •ํ•˜์˜€๊ณ  Android ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜์˜€์œผ๋ฏ€๋กœ **๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐ€์ƒ ๋จธ์‹ ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**: {% code overflow="wrap" %} ```bash C:\Users\\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat -v create avd -k "system-images;android-28;google_apis;x86_64" -n "AVD9" -d "Nexus 5X" ``` {% endcode %} ๋งˆ์ง€๋ง‰ ๋ช…๋ น์–ด์—์„œ **"_AVD9_"๋ผ๋Š” ์ด๋ฆ„์˜ VM์„ ์ƒ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค** **๊ธฐ๊ธฐ** "_Nexus 5X_"์™€ **์•ˆ๋“œ๋กœ์ด๋“œ ์ด๋ฏธ์ง€** "_system-images;android-28;google\_apis;x86\_64_"๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ.\ ์ด์ œ ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ์ƒ์„ฑํ•œ **๊ฐ€์ƒ ๋จธ์‹  ๋ชฉ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**: ```bash C:\Users\\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list avd Name: AVD9 Device: Nexus 5X (Google) Path: C:\Users\cpolo\.android\avd\AVD9.avd Target: Google APIs (Google Inc.) Based on: Android API 28 Tag/ABI: google_apis/x86_64 The following Android Virtual Devices could not be loaded: Name: Pixel_2_API_27 Path: C:\Users\cpolo\.android\avd\Pixel_2_API_27_1.avd Error: Google pixel_2 no longer exists as a device ``` ### ๊ฐ€์ƒ ๋จธ์‹  ์‹คํ–‰ ์šฐ๋ฆฌ๋Š” ์ด๋ฏธ ์ƒ์„ฑ๋œ ๊ฐ€์ƒ ๋จธ์‹ ์„ ๋‚˜์—ดํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์•˜์ง€๋งŒ **๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋‚˜์—ดํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค**: ```bash C:\Users\\AppData\Local\Android\Sdk\tools\emulator.exe -list-avds AVD9 Pixel_2_API_27 ``` ๋‹น์‹ ์€ ๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ **์ƒ์„ฑ๋œ ๋ชจ๋“  ๊ฐ€์ƒ ๋จธ์‹ ์„ ๊ฐ„๋‹จํžˆ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**: {% code overflow="wrap" %} ```bash C:\Users\\AppData\Local\Android\Sdk\tools\emulator.exe -avd "VirtualMachineName" C:\Users\\AppData\Local\Android\Sdk\tools\emulator.exe -avd "AVD9" ``` {% endcode %} ๋” ๊ณ ๊ธ‰ ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ€์ƒ ๋จธ์‹ ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: {% code overflow="wrap" %} ```bash C:\Users\\AppData\Local\Android\Sdk\tools\emulator.exe -avd "AVD9" -http-proxy 192.168.1.12:8080 -writable-system ``` {% endcode %} ### Command line options ๊ทธ๋Ÿฌ๋‚˜ **๊ฐ€์ƒ ๋จธ์‹ ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐ ์œ ์šฉํ•œ ๋‹ค์–‘ํ•œ ๋ช…๋ น์ค„ ์˜ต์…˜์ด ๋งŽ์ด ์žˆ์Šต๋‹ˆ๋‹ค**. ์•„๋ž˜์—์„œ ๋ช‡ ๊ฐ€์ง€ ํฅ๋ฏธ๋กœ์šด ์˜ต์…˜์„ ์ฐพ์„ ์ˆ˜ ์žˆ์ง€๋งŒ [**์—ฌ๊ธฐ์—์„œ ์ „์ฒด ๋ชฉ๋ก์„ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**](https://developer.android.com/studio/run/emulator-commandline) **Boot** * `-snapshot name` : VM ์Šค๋ƒ…์ƒท ์‹œ์ž‘ * `-snapshot-list -snapstorage ~/.android/avd/Nexus_5X_API_23.avd/snapshots-test.img` : ๊ธฐ๋ก๋œ ๋ชจ๋“  ์Šค๋ƒ…์ƒท ๋ชฉ๋ก **Network** * `-dns-server 192.0.2.0, 192.0.2.255` : VM์— DNS ์„œ๋ฒ„๋ฅผ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. * **`-http-proxy 192.168.1.12:8080`** : ์‚ฌ์šฉํ•  HTTP ํ”„๋ก์‹œ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (Burp๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋ž˜ํ”ฝ์„ ์บก์ฒ˜ํ•˜๋Š” ๋ฐ ๋งค์šฐ ์œ ์šฉํ•จ) * `-port 5556` : ์ฝ˜์†” ๋ฐ adb์— ์‚ฌ์šฉ๋˜๋Š” TCP ํฌํŠธ ๋ฒˆํ˜ธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. * `-ports 5556,5559` : ์ฝ˜์†” ๋ฐ adb์— ์‚ฌ์šฉ๋˜๋Š” TCP ํฌํŠธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. * **`-tcpdump /path/dumpfile.cap`** : ํŒŒ์ผ์— ๋ชจ๋“  ํŠธ๋ž˜ํ”ฝ์„ ์บก์ฒ˜ํ•ฉ๋‹ˆ๋‹ค. **System** * `-selinux {disabled|permissive}` : Linux ์šด์˜ ์ฒด์ œ์—์„œ ๋ณด์•ˆ ๊ฐ•ํ™” Linux ๋ณด์•ˆ ๋ชจ๋“ˆ์„ ๋น„ํ™œ์„ฑํ™” ๋˜๋Š” ํ—ˆ์šฉ ๋ชจ๋“œ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. * `-timezone Europe/Paris` : ๊ฐ€์ƒ ์žฅ์น˜์˜ ์‹œ๊ฐ„๋Œ€๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. * `-screen {touch(default)|multi-touch|o-touch}` : ์—๋ฎฌ๋ ˆ์ด์…˜๋œ ํ„ฐ์น˜ ์Šคํฌ๋ฆฐ ๋ชจ๋“œ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. * **`-writable-system`** : ์—๋ฎฌ๋ ˆ์ด์…˜ ์„ธ์…˜ ๋™์•ˆ ์“ฐ๊ธฐ ๊ฐ€๋Šฅํ•œ ์‹œ์Šคํ…œ ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์ด ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค. `adb root; adb remount`๋„ ์‹คํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์‹œ์Šคํ…œ์— ์ƒˆ ์ธ์ฆ์„œ๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฐ ๋งค์šฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ## Rooting a Play Store device Play Store๊ฐ€ ์žˆ๋Š” ์žฅ์น˜๋ฅผ ๋‹ค์šด๋กœ๋“œํ•œ ๊ฒฝ์šฐ ์ง์ ‘ ๋ฃจํŠธ ๊ถŒํ•œ์„ ์–ป์„ ์ˆ˜ ์—†์œผ๋ฉฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ``` $ adb root adbd cannot run as root in production builds ``` Using [rootAVD](https://github.com/newbit1/rootAVD) with [Magisk](https://github.com/topjohnwu/Magisk) I was able to root it (follow for example [**this video**](https://www.youtube.com/watch?v=Wk0ixxmkzAI) **or** [**this one**](https://www.youtube.com/watch?v=qQicUW0svB8)). ## Burp ์ธ์ฆ์„œ ์„ค์น˜ ์‚ฌ์šฉ์ž ์ •์˜ CA ์ธ์ฆ์„œ๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ ํŽ˜์ด์ง€๋ฅผ ํ™•์ธํ•˜์„ธ์š”: {% content-ref url="install-burp-certificate.md" %} [install-burp-certificate.md](install-burp-certificate.md) {% endcontent-ref %} ## ๋ฉ‹์ง„ AVD ์˜ต์…˜ ### ์Šค๋ƒ…์ƒท ์ฐ๊ธฐ ์–ธ์ œ๋“ ์ง€ VM์˜ ์Šค๋ƒ…์ƒท์„ ์ฐ์œผ๋ ค๋ฉด **GUI๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค**: ![](<../../.gitbook/assets/image (234).png>) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}