Android 애플리케이션 Pentesting
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을 제출하여 해킹 트릭을 공유하세요.
Android 애플리케이션 기초
이 페이지를 먼저 읽어 Android 보안과 Android 애플리케이션에서 가장 위험한 구성 요소와 관련된 가장 중요한 부분을 아는 것을 강력히 권장합니다:
ADB (Android Debug Bridge)
이 도구는 에뮬레이션되었거나 실제인 Android 장치에 연결하는 데 필요한 주요 도구입니다.
ADB를 사용하면 컴퓨터에서 USB 또는 Network를 통해 장치를 제어할 수 있습니다. 이 유틸리티는 파일의 양방향 복사, 앱의 설치 및 제거, 셸 명령의 실행, 데이터의 백업, 로그의 읽기 등 다양한 기능을 제공합니다.
다음 ADB Commands 목록을 확인하여 adb 사용법을 익히세요.
Smali
때로는 애플리케이션 코드를 수정하여 숨겨진 정보(예: 잘 난독화된 비밀번호나 플래그)에 접근하는 것이 흥미로울 수 있습니다. 이 경우 APK를 디컴파일하고 코드를 수정한 다음 다시 컴파일하는 것이 유용할 수 있습니다.
In this tutorial you can learn how to decompile and APK, modify Smali code and recompile the APK with the new functionality. 이는 동적 분석 중에 수행할 여러 테스트의 대안으로 매우 유용할 수 있습니다. 따라서 항상 이 가능성을 염두에 두세요.
Other interesting tricks
- Spoofing your location in Play Store
- Play Integrity attestation spoofing (SafetyNet replacement)
- Android app-level virtualization / app cloning abuse & detection
- Shizuku Privileged API (ADB-based non-root privileged access)
- Exploiting Insecure In-App Update Mechanisms
- Abusing Accessibility Services (Android RAT)
- Android IME / InputMethodService Abuse (Malicious Keyboards)
- NFC/EMV Relay via HCE (Android Tap-to-Pay abuse)
- Download APKs: https://apps.evozi.com/apk-downloader/, https://apkpure.com/es/, https://www.apkmirror.com/, https://apkcombo.com/es-es/apk-downloader/, https://github.com/kiber-io/apkd
Automated multi-source APK acquisition (justapk)
pip install justapk (Python 3.11+). CLI는 JSON을 stdout으로 출력하고 진행 상황은 stderr로 출력합니다(파이프 친화적). 결정적 폴백 체인으로 **APK20 → F-Droid → APKPure (mobile API) → APKMirror (HTML scrape) → Uptodown (mobile API) → APKCombo (HTML scrape)**를 시도합니다. Cloudflare로 보호된 소스는 실제 클라이언트를 모방하고 봇 탐지 차단을 줄이기 위해 curl_cffi와 TLS fingerprint impersonation을 사용합니다.
justapk download <package> # auto fallback
justapk download <package> -s apkpure # pin a source / version / output dir
justapk search telegram
justapk info org.telegram.messenger
justapk convert app.xapk -o output/ # merges splits, re-signs with debug key
convert는 XAPK/split APKs를 병합하고 debug key로 서명하므로 결과 APK의 서명/출처가 원본과 다릅니다 (테스트/분석용, production 설치용 아님).
- 기기에서 APK 추출:
adb shell pm list packages
com.android.insecurebankv2
adb shell pm path com.android.insecurebankv2
package:/data/app/com.android.insecurebankv2-Jnf8pNgwy3QA_U5f-n_4jQ==/base.apk
adb pull /data/app/com.android.insecurebankv2-Jnf8pNgwy3QA_U5f-n_4jQ==/base.apk
- 모든 splits 및 base apks를 APKEditor로 병합하세요:
mkdir splits
adb shell pm path com.android.insecurebankv2 | cut -d ':' -f 2 | xargs -n1 -i adb pull {} splits
java -jar ../APKEditor.jar m -i splits/ -o merged.apk
# after merging, you will need to align and sign the apk, personally, I like to use the uberapksigner
java -jar uber-apk-signer.jar -a merged.apk --allowResign -o merged_signed
Android malware tradecraft (loaders, fileless DEX, persistence)
Native staging + fileless DEX loaders
일부 Android droppers는 네이티브 라이브러리(lib*.so)를 포함해 두 번째 ELF(decrypts and writes a second ELF)(예: l.so)를 임시 경로에 쓰고, JNI를 통해 로드한 다음 dalvik.system.InMemoryDexClassLoader를 사용해 실제 로직을 DEX로 메모리 내에서만 로드합니다. 이렇게 하면 페이로드의 정적 가시성이 줄어들고 classes*.dex를 디스크에 쓰지 않게 됩니다.
실무적인 분류 포인트:
- 매우 초기에
dlopen또는System.loadLibrary를 호출하는 native libs를 찾아보세요. 그런 후 난독화된 스택 문자열(예: 스택에서 XOR로 디코딩됨)을 통해 Java 메서드를 resolve하는지를 확인합니다. - 로그/문자열이나 훅에서
InMemoryDexClassLoader를 감지하세요. 이는 fileless DEX 실행을 나타냅니다.
메모리 내 DEX 버퍼를 덤프하기 위한 간단한 Frida 훅:
Java.perform(() => {
const IM = Java.use('dalvik.system.InMemoryDexClassLoader');
IM.$init.overload('java.nio.ByteBuffer','java.lang.ClassLoader').implementation = function(buf, parent){
const arr = Java.array('byte', buf.array());
const fos = Java.use('java.io.FileOutputStream').$new("/sdcard/memdex.dex");
fos.write(arr); fos.close();
return this.$init(buf, parent);
};
});
Anti-analysis kill-switch
패킹된 로더는 에뮬레이터나 분석 검사에 실패할 때(예: CPU_ABI 검증) 종종 self-terminate 하며 다음과 같이 호출합니다:
android.os.Process.killProcess(android.os.Process.myPid());
foreground service + MediaPlayer 루프를 통한 persistence
경량화된 persistence 패턴은 foreground service를 pinned notification으로 유지하고 MediaPlayer로 거의 들리지 않는 오디오 루프를 연속 재생하는 것이다. 이렇게 하면 프로세스가 “활성” 상태로 유지되어 OS의 비활성화로 인한 종료가 줄어든다. 짧은 자산(대개 몇 초 길이)을 루프하는 ForegroundService + MediaPlayer 사용을 찾아보라.
Accessibility 오버레이 + ACTION_SET_TEXT 하이재킹
사용자가 Accessibility 권한을 허용하면, banking trojans는 foreground app을 모니터링하고 현실적인 오버레이(종종 Base64로 저장된 WebView HTML)를 렌더링하며 AccessibilityNodeInfo.ACTION_SET_TEXT를 사용해 거래 필드를 대체할 수 있다. 피해자는 그럴듯한 UI를 보면서도 수신자 주소가 조용히 대체되는 것이 가능해진다.
Minimal text replacement example:
Bundle args = new Bundle();
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
"ATTACKER_USDT_ADDRESS");
node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
합법적인 푸시 인프라를 C2 게이팅으로 사용
커스텀 소켓 대신 일부 악성코드는 Firebase Cloud Messaging (FCM) 를 C2 채널로 사용합니다. FCM 메시지는 텔레메트리 체크(충전 상태, 배터리 %, 온도, 사용자 비활성) 를 트리거하고 채굴이나 사기 같은 동작을 스텔스하게 게이트(gate) 할 수 있습니다.
파일명에서 유도된 키로 암호화된 네이티브 페이로드 스테이징
네이티브 페이로드는 암호화된 ELF blob로 전달되어 CipherInputStream() 으로 복호화될 수 있으며, 다운로드된 파일명의 SHA‑1에서 유도된 키를 사용합니다. 각 파일명/버전은 고유한 키를 생성하므로 정적 IOC 재사용을 방해합니다.
Jezail rooted Android pentesting toolkit (REST API + web UI)
- 루팅된 기기(Magisk/rootAVD)에서 실행되며 tcp/8080에서 HTTP server를 시작하고 Flutter web UI 및 REST API를 제공합니다.
- 권한과 함께 릴리스 APK 설치:
adb install -g -r jezail.apk, 그런 다음 앱을 실행하세요(서버는 자동 시작됨). - 엔드포인트:
http://<device-ip>:8080/(UI),http://<device-ip>:8080/api/json(API 목록),http://<device-ip>:8080/api/swagger(Swagger). - 에뮬레이터 포트 포워딩으로 호스트에서 UI/API에 접근:
adb forward tcp:8080 tcp:8080후http://localhost:8080접속.
Android Enterprise & Work Profile Attacks
Android Enterprise Work Profile Bypass
Case Studies & Vulnerabilities
Air Keyboard Remote Input Injection
Android Rooting Frameworks Manager Auth Bypass Syscall Hook
Abusing Android Media Pipelines Image Parsers
Firmware Level Zygote Backdoor Libandroid Runtime
Static Analysis
무엇보다도 APK를 분석할 때는 decompiler를 사용하여 Java 코드를 살펴보아야 합니다.
자세한 내용은 다양한 decompiler에 대한 정보를 여기에서 읽어보세요.
흥미로운 정보 찾기
APK의 strings를 살펴보면 비밀번호, URLs (https://github.com/ndelphit/apkurlgrep), api 키, encryption, bluetooth uuids, tokens 등 흥미로운 항목을 찾을 수 있습니다… 코드 실행 백도어나 인증 백도어(앱에 하드코딩된 관리자 자격증명)까지 확인하세요.
Firebase
firebase URLs에 특히 주의하고 잘못 구성되어 있는지 확인하세요. Firebase가 무엇인지와 이를 악용하는 방법에 대한 자세한 정보는 여기.
애플리케이션 기본 이해 - Manifest.xml, strings.xml
애플리케이션의 Manifest.xml 및 strings.xml 파일을 검사하면 잠재적 보안 취약점을 발견할 수 있습니다. 이러한 파일은 decompiler로 접근하거나 APK 파일 확장자를 .zip로 변경한 후 압축을 풀어 확인할 수 있습니다.
Manifest.xml에서 식별되는 취약점에는 다음이 포함됩니다:
- Debuggable Applications: _Manifest.xml_에서
debuggable="true"로 설정된 애플리케이션은 연결 허용으로 인해 악용될 위험이 있습니다. 디버깅 가능한 애플리케이션을 디바이스에서 찾고 악용하는 방법에 대한 튜토리얼을 참조하세요. - Backup Settings: 민감한 정보를 다루는 애플리케이션은
android:allowBackup="false"를 명시적으로 설정하여 usb debugging이 활성화된 경우 adb를 통한 무단 데이터 백업을 방지해야 합니다. - Network Security: _res/xml/_의 커스텀 네트워크 보안 구성(
android:networkSecurityConfig="@xml/network_security_config")은 certificate pin 및 HTTP 트래픽 설정과 같은 보안 세부사항을 지정할 수 있습니다. 예를 들어 특정 도메인에 대해 HTTP 트래픽을 허용하는 설정이 있을 수 있습니다. - Exported Activities and Services: 매니페스트에서 exported된 activity와 service를 식별하면 오용될 수 있는 컴포넌트를 찾을 수 있습니다. 동적 테스트 중 추가 분석으로 이러한 컴포넌트를 어떻게 악용할 수 있는지 밝혀낼 수 있습니다.
- Content Providers and FileProviders: 노출된 content provider는 무단 액세스 또는 데이터 변경을 허용할 수 있습니다. FileProvider 구성도 면밀히 검토해야 합니다.
- Broadcast Receivers and URL Schemes: 이러한 컴포넌트는 악용될 수 있으며, 특히 URL 스킴이 입력 취약성에 어떻게 처리되는지 주의해야 합니다.
- SDK Versions:
minSdkVersion,targetSDKVersion,maxSdkVersion속성은 지원되는 Android 버전을 나타내므로 오래되었거나 취약한 Android 버전 지원 여부가 보안상 중요합니다.
strings.xml 파일에서는 API 키, 커스텀 스킴, 기타 개발자 메모 등 민감한 정보를 발견할 수 있으므로 이러한 리소스를 신중히 검토해야 합니다.
Tapjacking
Tapjacking은 악성 애플리케이션이 실행되어 피해자 애플리케이션 위에 위치하는 공격입니다. 피해자 앱을 시각적으로 가린 후, 악성 앱의 UI는 사용자가 상호작용하도록 유도하면서 실제로는 해당 상호작용을 피해자 앱으로 전달하도록 설계됩니다.
결과적으로 사용자는 자신이 실제로는 피해자 앱에서 동작을 수행하고 있다는 사실을 볼 수 없게 됩니다.
자세한 정보는 다음을 참조하세요:
Task Hijacking
launchMode가 singleTask로 설정되었고 taskAffinity가 정의되지 않은 activity는 Task Hijacking에 취약합니다. 이는 악성 application을 설치하고 실제 애플리케이션보다 먼저 실행하면 실제 애플리케이션의 task를 hijack할 수 있음을 의미합니다(사용자는 자신이 실제 앱을 사용하고 있다고 생각하면서 악성 애플리케이션과 상호작용하게 됩니다).
자세한 내용은:
Insecure data storage
내부 저장소(Internal Storage)
Android에서 내부 저장소에 저장된 파일은 해당 파일을 생성한 앱만 접근할 수 있도록 설계되어 있습니다. 이 보안 조치는 Android 운영체제가 강제하며 대부분의 애플리케이션 보안 요구에 적절합니다. 하지만 개발자가 MODE_WORLD_READABLE 및 MODE_WORLD_WRITABLE 같은 모드를 사용해 파일을 다른 애플리케이션 간에 공유하도록 하는 경우가 있습니다. 이 모드들은 다른 애플리케이션(잠재적으로 악성인 앱 포함)이 이러한 파일에 접근하는 것을 제한하지 않습니다.
- Static Analysis:
MODE_WORLD_READABLE및MODE_WORLD_WRITABLE사용 여부를 꼼꼼히 검토하세요. 이러한 모드는 파일을 의도치 않거나 무단 접근에 노출시킬 수 있습니다.
- Dynamic Analysis:
- 앱이 생성한 파일의 권한 설정을 확인하세요. 특히 파일이 전 세계에서 읽기 또는 쓰기가 가능하도록 설정되어 있는지 확인하세요. 이는 설치된 어떤 애플리케이션이든, 출처나 의도와 관계없이 해당 파일을 읽거나 수정할 수 있게 하므로 큰 보안 위험이 됩니다.
외부 저장소(External Storage)
SD 카드 같은 외부 저장소의 파일을 다룰 때는 다음을 유의하세요:
- 접근성:
- 외부 저장소의 파일은 전역적으로 읽기/쓰기 가능합니다. 즉, 어떤 애플리케이션이나 사용자도 해당 파일에 접근할 수 있습니다.
- 보안 문제:
- 접근이 용이하므로 민감한 정보를 외부 저장소에 저장하지 않는 것이 권장됩니다.
- 외부 저장소는 분리되거나 어떤 애플리케이션이든 접근할 수 있어 보안성이 낮습니다.
- 외부 저장소에서 가져온 데이터 처리:
- 외부 저장소에서 가져온 데이터는 신뢰할 수 없는 소스이므로 항상 **입력 검증(input validation)**을 수행하세요.
- 외부 저장소에 실행 파일이나 class 파일을 저장해 동적으로 로드하는 것은 강력히 권장되지 않습니다.
- 애플리케이션이 외부 저장소에서 실행 파일을 가져와야 할 경우, 동적으로 로드하기 전에 해당 파일이 서명되고 암호학적으로 검증되었는지 확인하세요. 이는 애플리케이션의 보안 무결성을 유지하는 데 중요합니다.
외부 저장소는 /storage/emulated/0 , /sdcard , /mnt/sdcard 에서 접근할 수 있습니다.
Tip
Android 4.4(API 17)부터 SD 카드는 디렉터리 구조를 가지고 있어 앱이 자신의 전용 디렉터리로만 접근을 제한합니다. 이는 악성 애플리케이션이 다른 앱의 파일을 읽거나 쓸 수 없게 방지합니다.
평문으로 저장된 민감한 데이터
- Shared preferences: Android는 각 애플리케이션이
/data/data/<packagename>/shared_prefs/경로에 쉽게 xml 파일을 저장할 수 있도록 허용하며, 때때로 해당 폴더에서 평문으로 저장된 민감한 정보를 찾을 수 있습니다. - Databases: Android는 각 애플리케이션이
/data/data/<packagename>/databases/경로에 sqlite 데이터베이스를 쉽게 저장할 수 있도록 허용하며, 때때로 해당 폴더에서 평문으로 저장된 민감한 정보를 찾을 수 있습니다.
Broken TLS
모든 인증서 수락(Accept All Certificates)
어떤 이유로 개발자가 호스트네임이 일치하지 않더라도 모든 인증서를 수락하는 경우가 있습니다. 예를 들어 다음과 같은 코드 라인들에서 보이는 것처럼:
SSLSocketFactory sf = new cc(trustStore);
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
A good way to test this is to try to capture the traffic using some proxy like Burp without authorising Burp CA inside the device. Also, you can generate with Burp a certificate for a different hostname and use it.
Broken Cryptography
Poor Key Management Processes
일부 개발자는 민감한 데이터를 로컬 스토리지에 저장하고 코드에 하드코딩/예측 가능한 키로 암호화하는 경우가 있습니다. 이렇게 해서는 안 됩니다. 일부 reversing 기법으로 공격자가 기밀 정보를 추출할 수 있습니다.
Use of Insecure and/or Deprecated Algorithms
개발자는 권한 부여 체크, 데이터 저장 또는 전송에 deprecated algorithms를 사용해서는 안 됩니다. 이러한 알고리즘에는 RC4, MD4, MD5, SHA1 등이 있습니다. 예를 들어 비밀번호 저장에 hashes를 사용하는 경우에는 salt와 함께 brute-force에 resistant한 해시 알고리즘을 사용해야 합니다.
Other checks
- It’s recommended to obfuscate the APK to difficult the reverse engineer labour to attackers.
- If the app is sensitive (like bank apps), it should perform it’s own checks to see if the mobile is rooted and act in consequence.
- If the app is sensitive (like bank apps), it should check if an emulator is being used.
- If the app is sensitive (like bank apps), it should check it’s own integrity before executing it to check if it was modified.
- Use APKiD to check which compiler/packer/obfuscator was used to build the APK
React Native Application
Read the following page to learn how to easily access javascript code of React applications:
Xamarin Applications
Read the following page to learn how to easily access C# code of a xamarin applications:
Superpacked Applications
According to this blog post superpacked is a Meta algorithm that compress the content of an application into a single file. The blog talks about the possibility of creating an app that decompress these kind of apps… and a faster way which involves to execute the application and gather the decompressed files from the filesystem.
Automated Static Code Analysis
The tool mariana-trench is capable of finding vulnerabilities by scanning the code of the application. This tool contains a series of known sources (that indicates to the tool the places where the input is controlled by the user), sinks (which indicates to the tool dangerous places where malicious user input could cause damages) and rules. These rules indicates the combination of sources-sinks that indicates a vulnerability.
With this knowledge, mariana-trench will review the code and find possible vulnerabilities on it.
Secrets leaked
An application may contain secrets (API keys, passwords, hidden urls, subdomains…) inside of it that you might be able to discover. You could us a tool such as https://github.com/dwisiswant0/apkleaks
Bypass Biometric Authentication
Bypass Biometric Authentication (Android)
Other interesting functions
- Code execution:
Runtime.exec(), ProcessBuilder(), native code:system() - Send SMSs:
sendTextMessage, sendMultipartTestMessage - Native functions declared as
native:public native, System.loadLibrary, System.load - Read this to learn how to reverse native functions
- In-memory native code execution via JNI (downloaded shellcode → mmap/mprotect → call):
In Memory Jni Shellcode Execution
Other tricks
Dynamic Analysis
First of all, you need an environment where you can install the application and all the environment (Burp CA cert, Drozer and Frida mainly). Therefore, a rooted device (emulated or not) is extremely recommended.
Online Dynamic analysis
You can create a free account in: https://appetize.io/. This platform allows you to upload and execute APKs, so it is useful to see how an apk is behaving.
You can even see the logs of your application in the web and connect through adb.
.png)
Thanks to the ADB connection you can use Drozer and Frida inside the emulators.
Local Dynamic Analysis
Using an emulator
- Android Studio (You can create x86 and arm devices, and according to this latest x86 versions support ARM libraries without needing an slow arm emulator).
- Learn to set it up in this page:
- Genymotion (Free version: Personal Edition, you need to create an account. It’s recommend to download the version WITH VirtualBox to avoid potential errors.)
- Nox (Free, but it doesn’t support Frida or Drozer).
Tip
When creating a new emulator on any platform remember that the bigger the screen is, the slower the emulator will run. So select small screens if possible.
To install google services (like AppStore) in Genymotion you need to click on the red marked button of the following image:
.png)
Also, notice that in the configuration of the Android VM in Genymotion you can select Bridge Network mode (this will be useful if you will be connecting to the Android VM from a different VM with the tools).
Use a physical device
You need to activate the debugging options and it will be cool if you can root it:
- Settings.
- (FromAndroid 8.0) Select System.
- Select About phone.
- Press Build number 7 times.
- Go back and you will find the Developer options.
Once you have installed the application, the first thing you should do is to try it and investigate what does it do, how does it work and get comfortable with it.
I will suggest to perform this initial dynamic analysis using MobSF dynamic analysis + pidcat, so we will be able to learn how the application works while MobSF captures a lot of interesting data you can review later on.
Magisk/Zygisk quick notes (recommended on Pixel devices)
- Patch boot.img with the Magisk app and flash via fastboot to get systemless root
- Enable Zygisk + DenyList for root hiding; consider LSPosed/Shamiko when stronger hiding is required
- Keep original boot.img to recover from OTA updates; re-patch after each OTA
- For screen mirroring, use scrcpy on the host
Unintended Data Leakage
Logging
개발자는 디버깅 정보를 공개적으로 노출하지 않도록 주의해야 합니다. 이는 민감한 데이터의 leak로 이어질 수 있습니다. 애플리케이션 로그를 모니터링하여 민감한 정보를 식별하고 보호하기 위해 pidcat 및 adb logcat 도구를 권장합니다. Pidcat은 사용의 편의성과 가독성 때문에 선호됩니다.
Warning
Note that from later newer than Android 4.0, applications are only able to access their own logs. So applications cannot access other apps logs.
Anyway, it’s still recommended to not log sensitive information.
Copy/Paste Buffer Caching
Android의 clipboard-based 프레임워크는 앱 간 복사-붙여넣기 기능을 제공하지만, 다른 애플리케이션이 클립보드에 접근할 수 있어 민감한 정보가 노출될 위험이 있습니다. 신용카드 정보와 같은 민감한 섹션에 대해서는 복사/붙여넣기 기능을 비활성화하는 것이 중요합니다.
Crash Logs
애플리케이션이 crash하고 로그를 저장하는 경우, 이 로그는 특히 애플리케이션을 리버스엔지니어링할 수 없을 때 공격자에게 도움이 될 수 있습니다. 이 위험을 완화하려면, 크래시 시 로그를 남기지 않도록 하고, 네트워크로 로그를 전송해야 할 경우 SSL 채널을 통해 전송되도록 하십시오.
페네스트로서, try to take a look to these logs.
Analytics Data Sent To 3rd Parties
애플리케이션은 종종 Google Adsense와 같은 서비스를 통합하며, 개발자의 잘못된 구현으로 인해 민감한 데이터가 제3자에게 leak될 수 있습니다. 잠재적 데이터 누출을 식별하려면 애플리케이션의 트래픽을 인터셉트하여 민감한 정보가 제3자 서비스로 전송되는지 확인하는 것이 좋습니다.
SQLite DBs
대부분의 애플리케이션은 정보를 저장하기 위해 internal SQLite databases를 사용합니다. 펜테스트 중에는 생성된 databases, tables와 columns의 이름, 저장된 모든 데이터를 살펴보는 것이 좋습니다. 민감한 정보를 찾을 수 있기 때문입니다 (이는 취약점입니다).
Databases는 /data/data/the.package.name/databases에 위치해야 하며 예: /data/data/com.mwr.example.sieve/databases
데이터베이스가 기밀 정보를 저장하고 있고 암호화되어 있더라도 애플리케이션 내부에서 비밀번호를 찾을 수 있다면 이는 여전히 취약점입니다.
.tables를 사용하여 테이블을 열거하고 .schema <table_name>으로 테이블의 컬럼을 열거하세요.
Drozer (Exploit Activities, Content Providers and Services)
From Drozer Docs: Drozer allows you to assume the role of an Android app and interact with other apps. It can do anything that an installed application can do, such as make use of Android’s Inter-Process Communication (IPC) mechanism and interact with the underlying operating system. .
Drozer is s useful tool to exploit exported activities, exported services and Content Providers as you will learn in the following sections.
Exploiting exported Activities
Read this if you want to refresh what is an Android Activity.
Also remember that the code of an activity starts in the onCreate method.
Authorisation bypass
When an Activity is exported you can invoke its screen from an external app. Therefore, if an activity with sensitive information is exported you could bypass the authentication mechanisms to access it.
Learn how to exploit exported activities with Drozer.
You can also start an exported activity from adb:
- PackageName is com.example.demo
- Exported ActivityName is com.example.test.MainActivity
adb shell am start -n com.example.demo/com.example.test.MainActivity
NOTE: MobSF는 액티비티에서 _singleTask/singleInstance_를 android:launchMode로 사용하는 것을 악성으로 감지합니다, 하지만 this 때문에 이는 구버전(API versions < 21)에서만 위험한 것으로 보입니다.
Tip
Note that an authorisation bypass is not always a vulnerability, it would depend on how the bypass works and which information is exposed.
Sensitive information leakage
Activities can also return results. 만약 export되어 보호되지 않은 activity가 setResult 메서드를 호출하고 민감한 정보를 반환하는 경우, 민감한 정보 누출이 발생합니다.
Tapjacking
Tapjacking이 방지되지 않으면 export된 activity를 악용해 사용자에게 예상치 못한 동작을 수행하게 만들 수 있습니다. 자세한 내용은 what is Tapjacking follow the link을 확인하세요.
Exploiting Content Providers - Accessing and manipulating sensitive information
Read this if you want to refresh what is a Content Provider.
Content providers는 기본적으로 share data에 사용됩니다. 앱에 content providers가 존재하면 그들로부터 extract sensitive 데이터를 얻을 수 있습니다. 또한 잠재적인 SQL injections 및 Path Traversals를 테스트해보는 것도 중요합니다.
Learn how to exploit Content Providers with Drozer.
Exploiting Services
Read this if you want to refresh what is a Service.
Service의 동작은 onStartCommand 메서드에서 시작한다는 점을 기억하세요.
Service는 기본적으로 데이터를 can receive data, process하고 returns(또는 반환하지 않을 수 있음) 응답을 처리하는 것입니다. 따라서 애플리케이션이 일부 서비스를 export하고 있다면 해당 동작을 이해하기 위해 코드를 확인하고, 동적으로 테스트하여 기밀 정보를 추출하거나 인증 우회(bypass) 등과 같은 취약점을 확인해야 합니다.
Learn how to exploit Services with Drozer.
Exploiting Broadcast Receivers
Read this if you want to refresh what is a Broadcast Receiver.
Broadcast Receiver의 동작은 onReceive 메서드에서 시작된다는 점을 기억하세요.
브로드캐스트 리시버는 특정 타입의 메시지를 기다립니다. 리시버가 메시지를 처리하는 방식에 따라 취약할 수 있습니다.
Learn how to exploit Broadcast Receivers with Drozer.
Exploiting Schemes / Deep links
deep links는 수동으로 찾을 수 있으며, MobSF 같은 도구나 this one 같은 스크립트를 사용할 수 있습니다.
선언된 scheme는 adb 또는 browser를 사용해 열 수 있습니다:
adb shell am start -a android.intent.action.VIEW -d "scheme://hostname/path?param=value" [your.package.name]
참고: 패키지 이름을 생략할 수 있으며 모바일이 해당 링크를 열 앱을 자동으로 호출합니다.
<!-- Browser regular link -->
<a href="scheme://hostname/path?param=value">Click me</a>
<!-- fallback in your url you could try the intent url -->
<a href="intent://hostname#Intent;scheme=scheme;package=your.package.name;S.browser_fallback_url=http%3A%2F%2Fwww.example.com;end">with alternative</a>
실행되는 코드
앱에서 실행될 코드를 찾으려면 deeplink에 의해 호출되는 activity로 가서 함수 **onNewIntent**를 검색하세요.
 (1) (1) (1).png)
민감한 정보
deep link를 찾을 때마다 URL 파라미터를 통해 비밀번호 같은 민감한 데이터가 전달되지 않는지 확인하세요. 다른 애플리케이션이 deep link를 사칭해 그 데이터를 훔칠 수 있기 때문입니다!
경로 내 파라미터
URL 경로 안에 파라미터를 사용하는 deep link가 있는지도 반드시 확인해야 합니다, 예: https://api.example.com/v1/users/{username}. 그런 경우 example://app/users?username=../../unwanted-endpoint%3fparam=value 같은 접근으로 path traversal을 유도할 수 있습니다.
애플리케이션 내부에서 올바른 엔드포인트를 찾으면 Open Redirect(경로의 일부가 도메인으로 사용되는 경우), account takeover(CSRF 토큰 없이 사용자 정보를 수정할 수 있고 취약한 엔드포인트가 올바른 메서드를 사용한 경우) 등 다른 취약점이 발생할 수 있습니다. More info about this here.
More examples
An interesting bug bounty report about links (/.well-known/assetlinks.json).
전송 계층 검사 및 검증 실패
- Certificates are not always inspected properly by Android applications. Android 애플리케이션이 경고를 무시하고 self-signed certificate를 허용하거나, 경우에 따라 HTTP 연결로 되돌아가는 일이 흔합니다.
- Negotiations during the SSL/TLS handshake are sometimes weak, 취약한 cipher suite를 사용하는 경우가 있습니다. 이 취약점은 연결을 MITM 공격에 취약하게 만들어 공격자가 데이터를 복호화할 수 있게 합니다.
- Leakage of private information is a risk when applications authenticate using secure channels but then communicate over non-secure channels for other transactions. 이런 방식은 세션 쿠키나 사용자 정보 같은 민감한 데이터를 악의적인 주체가 가로채는 것으로부터 보호하지 못합니다.
Certificate Verification
우리는 certificate verification에 초점을 맞출 것입니다. 서버 인증서의 무결성을 검증하는 것은 보안을 강화하는 데 필수적입니다. insecure TLS 구성과 암호화되지 않은 채널을 통한 민감한 데이터 전송은 심각한 위험을 초래할 수 있습니다. 서버 인증서를 검증하고 취약점을 해결하는 자세한 단계는 this resource에서 확인하세요.
SSL Pinning
SSL Pinning은 애플리케이션이 서버 인증서를 애플리케이션 내부에 저장된 알려진 복사본과 대조해 검증하는 보안 조치입니다. 이는 MITM 공격을 방지하는 데 중요합니다. 민감한 정보를 다루는 애플리케이션에는 SSL Pinning 구현을 강력히 권장합니다.
Traffic Inspection
HTTP 트래픽을 검사하려면 proxy 도구의 인증서(예: Burp)를 설치해야 합니다. 이 인증서를 설치하지 않으면 암호화된 트래픽이 프록시를 통해 보이지 않을 수 있습니다. 커스텀 CA 인증서 설치 가이드는 click here를 참조하세요.
API Level 24 이상을 대상하는 애플리케이션은 프록시의 CA 인증서를 수락하도록 Network Security Config를 수정해야 합니다. 암호화된 트래픽을 검사하려면 이 단계가 중요합니다. Network Security Config 수정 방법은 refer to this tutorial를 확인하세요.
만약 Flutter를 사용 중이라면 this page의 지침을 따라야 합니다. 단순히 인증서를 스토어에 추가하는 것만으로는 작동하지 않으며, Flutter는 자체적인 유효 CA 목록을 가지고 있기 때문입니다.
Static detection of SSL/TLS pinning
런타임 우회 시도를 하기 전에 APK에서 pinning이 어디에 적용되어 있는지 빠르게 매핑하세요. Static discovery는 훅/패치 계획을 세우고 올바른 코드 경로에 집중하는 데 도움이 됩니다.
Tool: SSLPinDetect
- Open-source static-analysis utility that decompiles the APK to Smali (via apktool) and scans for curated regex patterns of SSL/TLS pinning implementations.
- Reports exact file path, line number, and a code snippet for each match.
- Covers common frameworks and custom code paths: OkHttp CertificatePinner, custom javax.net.ssl.X509TrustManager.checkServerTrusted, SSLContext.init with custom TrustManagers/KeyManagers, and Network Security Config XML pins.
Install
- Prereqs: Python >= 3.8, Java on PATH, apktool
git clone https://github.com/aancw/SSLPinDetect
cd SSLPinDetect
pip install -r requirements.txt
사용법
# Basic
python sslpindetect.py -f app.apk -a apktool.jar
# Verbose (timings + per-match path:line + snippet)
python sslpindetect.py -a apktool_2.11.0.jar -f sample/app-release.apk -v
예제 패턴 규칙 (JSON) proprietary/custom pinning 스타일을 감지하기 위해 signatures를 사용하거나 확장하세요. 자체 JSON을 로드하고 대규모로 scan할 수 있습니다.
{
"OkHttp Certificate Pinning": [
"Lcom/squareup/okhttp/CertificatePinner;",
"Lokhttp3/CertificatePinner;",
"setCertificatePinner"
],
"TrustManager Override": [
"Ljavax/net/ssl/X509TrustManager;",
"checkServerTrusted"
]
}
노트 및 팁
- 대형 앱에서 멀티스레딩과 memory-mapped I/O를 사용해 빠르게 스캔; 사전 컴파일된 regex는 오버헤드/오탐을 줄여준다.
- Pattern collection: https://github.com/aancw/smali-sslpin-patterns
- 다음에 우선 검토할 일반적인 탐지 대상:
- OkHttp: CertificatePinner 사용, setCertificatePinner, okhttp3/okhttp 패키지 참조
- Custom TrustManagers: javax.net.ssl.X509TrustManager, checkServerTrusted 오버라이드
- Custom SSL contexts: SSLContext.getInstance + SSLContext.init(커스텀 매니저 포함)
- res/xml의 network security config에 선언된 declarative pins 및 manifest 참조
- 일치한 위치들을 사용해 Frida hooks, static patches 또는 config 검토를 계획한 후 동적 테스트를 수행하라.
Bypassing SSL Pinning
앱에 SSL Pinning이 구현된 경우 HTTPS 트래픽을 검사하기 위해 이를 우회하는 것이 필요하다. 이를 위한 다양한 방법이 있다:
- 자동으로 modify the apk to bypass SSLPinning with apk-mitm. 이 방법의 가장 큰 장점은 SSL Pinning을 우회하는 데 root가 필요하지 않다는 점이지만, 애플리케이션을 삭제하고 새로 설치해야 하며 항상 동작하지는 않는다.
- Frida(아래에서 설명)를 사용해 이 보호를 우회할 수 있다. Burp+Frida+Genymotion을 사용하는 가이드는 다음을 참조하라: https://spenkk.github.io/bugbounty/Configuring-Frida-with-Burp-and-GenyMotion-to-bypass-SSL-Pinning/
- objection를 사용해 automatically bypass SSL Pinning을 시도할 수 있다::
objection --gadget com.package.app explore --startup-command "android sslpinning disable" - MobSF dynamic analysis(아래 설명)로 automatically bypass SSL Pinning을 시도할 수도 있다.
- 여전히 캡처하지 못하는 트래픽이 있다고 생각되면 forward the traffic to burp using iptables를 시도해보라. 블로그 참조: https://infosecwriteups.com/bypass-ssl-pinning-with-ip-forwarding-iptables-568171b52b62
Looking for Common Web Vulnerabilities
애플리케이션 내부에서 일반적인 웹 취약점을 찾는 것도 중요하다. 이러한 취약점을 식별하고 완화하는 자세한 내용은 이 요약의 범위를 벗어나지만 다른 곳에 광범위하게 설명되어 있다.
Frida
Frida is a dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers.
You can access running application and hook methods on run time to change the behaviour, change values, extract values, run different code…
If you want to pentest Android applications you need to know how to use Frida.
- Learn how to use Frida: Frida tutorial
- Some “GUI” for actions with Frida: https://github.com/m0bilesecurity/RMS-Runtime-Mobile-Security
- Ojection is great to automate the use of Frida: https://github.com/sensepost/objection , https://github.com/dpnishant/appmon
- You can find some Awesome Frida scripts here: https://codeshare.frida.re/
- Try to bypass anti-debugging / anti-frida mechanisms loading Frida as in indicated in https://erfur.github.io/blog/dev/code-injection-without-ptrace (tool linjector)
Anti-instrumentation & SSL pinning bypass workflow
Android Anti Instrumentation And Ssl Pinning Bypass
Dump Memory - Fridump
애플리케이션이 비밀번호나 니모닉 등 저장해서는 안 되는 민감한 정보를 메모리에 저장하고 있는지 확인하라.
Using Fridump3 you can dump the memory of the app with:
# With PID
python3 fridump3.py -u <PID>
# With name
frida-ps -Uai
python3 fridump3.py -u "<Name>"
이 명령은 ./dump 폴더에 메모리를 dump하며, 그 안에서 다음과 같이 grep할 수 있습니다:
strings * | grep -E "^[a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+ [a-z]+$"
Keystore의 민감한 데이터
Android에서 Keystore는 민감한 데이터를 저장하기에 가장 좋은 장소이지만, 충분한 권한이 있으면 여전히 액세스하는 것이 가능하다. 애플리케이션은 여기서 sensitive data in clear text를 저장하는 경향이 있기 때문에 pentests는 root user로서 이를 확인해야 하며, 물리적 접근 권한이 있는 누군가가 이 데이터를 탈취할 수 있다.
앱이 keystore에 데이터를 저장하더라도, 해당 데이터는 암호화되어야 한다.
keystore 내부의 데이터를 액세스하려면 이 Frida script를 사용할 수 있다: https://github.com/WithSecureLabs/android-keystore-audit/blob/master/frida-scripts/tracer-cipher.js
frida -U -f com.example.app -l frida-scripts/tracer-cipher.js
Fingerprint/Biometrics Bypass
다음 Frida 스크립트를 사용하면 Android 애플리케이션이 특정 민감 영역을 보호하기 위해 수행하는 bypass fingerprint authentication을 우회할 수 있습니다:
frida --codeshare krapgras/android-biometric-bypass-update-android-11 -U -f <app.package>
백그라운드 이미지
애플리케이션을 백그라운드로 전환하면, Android는 애플리케이션의 스냅샷을 저장합니다. 앱이 포그라운드로 복원될 때 앱 자체보다 먼저 이미지를 불러와 앱이 더 빨리 로드된 것처럼 보이게 합니다.
하지만 이 스냅샷에 민감한 정보가 포함되어 있다면, 스냅샷에 접근할 수 있는 사람이 그 정보를 탈취할 수 있습니다 (접근하려면 root가 필요하다는 점에 유의하세요).
스냅샷은 일반적으로 다음 경로에 저장됩니다: /data/system_ce/0/snapshots
Android는 FLAG_SECURE를 설정하여 스크린샷 캡처를 방지하는 레이아웃 파라미터 방법을 제공합니다. 이 플래그를 사용하면 창 내용이 보안 처리되어 스크린샷에 나타나거나 비보안 디스플레이에서 표시되는 것을 방지합니다.
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
Android Application Analyzer
이 도구는 dynamic analysis 동안 다양한 도구를 관리하는 데 도움이 될 수 있습니다: https://github.com/NotSoSecure/android_application_analyzer
Intent Injection
개발자들은 종종 이러한 Intents를 처리하고 startActivity(...)나 sendBroadcast(...) 같은 메서드로 전달하는 proxy components(예: activities, services, broadcast receivers)를 만듭니다. 이는 위험할 수 있습니다.
위험은 공격자가 이러한 Intents를 잘못 유도하여 non-exported app components를 트리거하거나 민감한 content providers에 접근할 수 있게 되는 데 있습니다. 대표적인 예로 WebView가 URL을 Intent 객체로 변환하기 위해 Intent.parseUri(...)를 사용하고 이를 실행함으로써 악의적인 Intent injection이 발생할 수 있습니다.
Essential Takeaways
- Intent Injection은 웹의 Open Redirect 문제와 유사합니다.
- 익스플로잇은
Intent객체를 extras로 전달하여 안전하지 않은 동작을 실행하도록 리디렉션하는 것을 포함합니다. - 이는 non-exported components와 content providers를 공격자에게 노출시킬 수 있습니다.
WebView의 URL →Intent변환은 의도하지 않은 동작을 촉진할 수 있습니다.
Android Client Side Injections and others
아마 웹에서 이러한 유형의 취약점을 알고 계실 것입니다. Android 애플리케이션에서는 특히 다음 취약점들에 주의해야 합니다:
- SQL Injection: dynamic queries나 Content-Providers를 처리할 때는 parameterized queries를 사용하고 있는지 확인하세요.
- JavaScript Injection (XSS): 모든 WebViews에 대해 JavaScript 및 Plugin 지원이 비활성화되어 있는지 확인하세요(기본적으로 비활성화). More info here.
- Local File Inclusion: WebViews는 파일 시스템 접근을 비활성화해야 합니다(기본적으로 활성화) -
(webview.getSettings().setAllowFileAccess(false);). More info here. - Eternal cookies: 일부 경우 Android 애플리케이션이 세션을 종료할 때 쿠키가 폐기되지 않거나 디스크에 저장될 수 있습니다.
- Secure Flag in cookies
Automatic Analysis
MobSF
Static analysis
.png)
Vulnerability assessment of the application을 웹 기반 프론트엔드로 깔끔하게 수행합니다. dynamic analysis도 수행할 수 있지만(환경을 준비해야 합니다) 준비가 필요합니다.
docker pull opensecurity/mobile-security-framework-mobsf
docker run -it -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest
Notice that MobSF can analyse Android(apk), IOS(ipa) and Windows(apx) applications (Windows applications must be analyzed from a MobSF installed in a Windows host).
Also, if you create a ZIP file with the source code if an Android or an IOS app (go to the root folder of the application, select everything and create a ZIPfile), it will be able to analyse it also.
MobSF also allows you to diff/Compare analysis and to integrate VirusTotal (you will need to set your API key in MobSF/settings.py and enable it: VT_ENABLED = TRUE VT_API_KEY = <Your API key> VT_UPLOAD = TRUE). You can also set VT_UPLOAD to False, then the hash will be upload instead of the file.
MobSF를 이용한 Assisted Dynamic analysis
MobSF는 Android에서의 dynamic analysis에도 매우 유용하지만, 이 경우 호스트에 MobSF와 genymotion을 설치해야 합니다 (a VM or Docker won’t work). Note: You need to start first a VM in genymotion and then MobSF.
The MobSF dynamic analyser can:
- Dump application data (URLs, logs, clipboard, screenshots made by you, screenshots made by “Exported Activity Tester”, emails, SQLite databases, XML files, and other created files). 이 모든 것은 스크린샷을 제외하고 자동으로 수행됩니다. 스크린샷은 필요할 때 직접 찍어야 하며, 모든 exported activities의 스크린샷을 얻으려면 “Exported Activity Tester“를 눌러야 합니다.
- Capture HTTPS traffic
- Use Frida to obtain runtime information
From android versions > 5, it will automatically start Frida and will set global proxy settings to capture traffic. It will only capture traffic from the tested application.
Frida
By default, it will also use some Frida Scripts to bypass SSL pinning, root detection and debugger detection and to monitor interesting APIs.
MobSF can also invoke exported activities, grab screenshots of them and save them for the report.
To start the dynamic testing press the green bottom: “Start Instrumentation”. Press the “Frida Live Logs” to see the logs generated by the Frida scripts and “Live API Monitor” to see all the invocation to hooked methods, arguments passed and returned values (this will appear after pressing “Start Instrumentation”).
MobSF also allows you to load your own Frida scripts (to send the results of your Friday scripts to MobSF use the function send()). It also has several pre-written scripts you can load (you can add more in MobSF/DynamicAnalyzer/tools/frida_scripts/others/), just select them, press “Load” and press “Start Instrumentation” (you will be able to see the logs of that scripts inside “Frida Live Logs”).
.png)
Moreover, you have some Auxiliary Frida functionalities:
- Enumerate Loaded Classes: 로드된 모든 클래스를 출력합니다
- Capture Strings: 애플리케이션 사용 중에 캡처된 모든 문자열을 출력합니다 (매우 많은 출력이 발생할 수 있습니다)
- Capture String Comparisons: 매우 유용할 수 있습니다. 비교되는 두 문자열을 보여주고 결과가 True인지 False인지 표시합니다.
- Enumerate Class Methods: 클래스 이름(예: “java.io.File”)을 입력하면 해당 클래스의 모든 메서드를 출력합니다.
- Search Class Pattern: 패턴으로 클래스를 검색합니다
- Trace Class Methods: 전체 클래스를 Trace합니다 (해당 클래스의 모든 메서드의 입력과 출력 확인). 기본적으로 MobSF는 여러 흥미로운 Android API 메서드를 트레이스한다는 점을 기억하세요.
선택한 보조 모듈을 사용하려면 “Start Intrumentation“을 누르고 모든 출력은 “Frida Live Logs“에서 확인할 수 있습니다.
Shell
Mobsf는 dynamic analysis 페이지 하단에 몇 가지 adb 명령, MobSF commands, 그리고 일반적인 shell commands를 사용할 수 있는 셸도 제공합니다. 몇 가지 흥미로운 명령:
help
shell ls
activities
exported_activities
services
receivers
HTTP 도구
http 트래픽을 캡처하면 “HTTP(S) Traffic” 버튼에서 캡처된 트래픽의 거친 뷰를 보거나 “Start HTTPTools” 녹색 버튼에서 더 보기 좋은 뷰를 볼 수 있습니다. 두 번째 옵션에서는 캡처된 요청을 Burp나 Owasp ZAP 같은 프록시로 보낼 수 있습니다.
그렇게 하려면, Burp를 켠 후 –> Intercept를 끄고 –> MobSF HTTPTools에서 요청을 선택 –> “Send to Fuzzer“를 누른 다음 –> 프록시 주소를 선택 (http://127.0.0.1:8080\).
MobSF로 동적 분석을 마치면 “Start Web API Fuzzer“를 눌러 HTTP 요청을 fuzz하여 취약점을 찾을 수 있습니다.
Tip
MobSF로 동적 분석을 수행한 후 프록시 설정이 잘못 구성되어 GUI에서 수정할 수 없게 될 수 있습니다. 다음 명령으로 프록시 설정을 수정할 수 있습니다:
adb shell settings put global http_proxy :0
Inspeckage를 이용한 보조 동적 분석
도구는 Inspeckage에서 얻을 수 있습니다.
이 도구는 동적 분석을 수행하는 동안 애플리케이션에서 무슨 일이 일어나는지 알려주기 위해 일부 Hooks를 사용합니다.
Yaazhini
GUI로 정적 분석을 수행하기에 훌륭한 도구입니다.
.png)
Qark
이 도구는 소스 코드나 패키지된 APK에서 여러 보안 관련 Android 애플리케이션 취약점을 찾도록 설계되었습니다. 또한 발견된 일부 취약점(Exposed activities, intents, tapjacking…)을 악용하기 위한 “Proof-of-Concept” 배포 가능한 APK와 ADB commands를 생성할 수 있습니다. Drozer와 마찬가지로 테스트 디바이스를 루팅할 필요는 없습니다.
pip3 install --user qark # --user is only needed if not using a virtualenv
qark --apk path/to/my.apk
qark --java path/to/parent/java/folder
qark --java path/to/specific/java/file.java
ReverseAPK
- 모든 추출된 파일을 표시하여 쉽게 참조할 수 있음
- APK 파일을 자동으로 Java 및 Smali 형식으로 디컴파일
- AndroidManifest.xml을 분석하여 일반적인 취약점 및 동작 확인
- 정적 소스 코드 분석을 통해 일반적인 취약점 및 동작 확인
- 장치 정보
- 등
reverse-apk relative/path/to/APP.apk
SUPER Android Analyzer
SUPER는 Windows, MacOS X 및 Linux에서 사용할 수 있는 커맨드라인 애플리케이션으로, 취약점을 찾기 위해 .apk 파일을 분석합니다. 이 도구는 APK를 압축 해제하고 일련의 규칙을 적용하여 해당 취약점을 탐지합니다.
모든 규칙은 rules.json 파일에 집중되어 있으며, 각 회사나 테스터는 필요한 분석을 위해 자체 규칙을 생성할 수 있습니다.
최신 바이너리는 download page에서 다운로드하세요.
super-analyzer {apk_file}
StaCoAn
.png)
StaCoAn은 모바일 애플리케이션에 대한 static code analysis를 수행하는 개발자, bugbounty hunters 및 ethical hackers를 돕는 crossplatform 도구입니다.
개념은 모바일 애플리케이션 파일(.apk 또는 .ipa 파일)을 StaCoAn 애플리케이션으로 드래그 앤 드롭하면 시각적이고 휴대 가능한 리포트를 생성해 준다는 것입니다. 설정과 워드리스트를 조정하여 맞춤형 경험을 얻을 수 있습니다.
다운로드 latest release:
./stacoan
AndroBugs
AndroBugs Framework는 개발자 또는 hackers가 Android 애플리케이션에서 잠재적인 보안 취약점을 찾아내도록 도와주는 취약점 분석 시스템입니다.
Windows releases
python androbugs.py -f [APK file]
androbugs.exe -f [APK file]
Androwarn
Androwarn은 Android 애플리케이션이 발생시킬 수 있는 잠재적인 악성 동작을 탐지하고 사용자에게 경고하는 도구입니다.
탐지는 애플리케이션의 Dalvik bytecode(표현은 Smali)에 대한 static analysis를 androguard 라이브러리를 사용해 수행합니다.
이 도구는 Telephony identifiers exfiltration, Audio/video flow interception, PIM data modification, Arbitrary code execution… 등과 같은 “bad” applications의 일반적인 동작을 찾아냅니다.
python androwarn.py -i my_application_to_be_analyzed.apk -r html -v 3
MARA Framework
.png)
MARA is a Mobile Application Reverse engineering and Analysis Framework. 일반적으로 사용되는 모바일 애플리케이션 역공학 및 분석 도구들을 모아 OWASP mobile security threats에 대한 모바일 애플리케이션 테스트를 지원하는 도구입니다. 목적은 이 작업을 모바일 애플리케이션 개발자와 보안 전문가에게 더 쉽고 친근하게 만드는 것입니다.
It is able to:
- 다양한 도구를 사용하여 Java와 Smali 코드를 추출합니다
- APKs를 분석하는 데 사용: smalisca, ClassyShark, androbugs, androwarn, APKiD
- 정규표현식(regexps)을 사용하여 APK에서 개인 정보를 추출합니다.
- Manifest를 분석합니다.
- 발견된 도메인을 다음 도구로 분석합니다: pyssltest, testssl and whatweb
- apk-deguard.com을 통해 APK 난독화를 해제합니다
Koodous
Useful to detect malware: https://koodous.com/
코드 난독화/난독화 해제
코드를 난독화하는 데 사용하는 서비스 및 구성에 따라, Secrets는 난독화될 수도 있고 그렇지 않을 수도 있습니다.
ProGuard
From Wikipedia: ProGuard는 Java 코드를 축소(shrink), 최적화(optimize)하고 난독화(obfuscate)하는 오픈 소스 커맨드라인 도구입니다. 바이트코드를 최적화하고 사용되지 않는 명령을 감지하여 제거할 수 있습니다. ProGuard는 자유 소프트웨어이며 GNU General Public License 버전 2로 배포됩니다.
ProGuard는 Android SDK의 일부로 배포되며 애플리케이션을 release 모드로 빌드할 때 실행됩니다.
DexGuard
APK 난독화 해제에 대한 단계별 가이드는 https://blog.lexfo.fr/dexguard.html을 참조하세요.
(해당 가이드에서) 마지막으로 확인했을 때, Dexguard의 동작 방식은 다음과 같았습니다:
- 리소스를 InputStream으로 로드한다;
- 결과를 FilterInputStream을 상속한 클래스에 전달하여 복호화한다;
- 리버서의 시간을 몇 분 낭비시키기 위해 불필요한 난독화를 수행한다;
- 복호화된 결과를 ZipInputStream에 전달해 DEX 파일을 얻는다;
- 마지막으로
loadDex메서드를 사용해 생성된 DEX를 Resource로 로드한다.
DeGuard
DeGuard는 Android 난독화 도구들이 수행한 난독화 과정을 역전시킵니다. 이를 통해 코드 검사 및 라이브러리 예측(predicting libraries)을 포함한 다양한 보안 분석이 가능합니다.
난독화된 APK를 그들의 플랫폼에 업로드할 수 있습니다.
[Deobfuscate android App]https://github.com/In3tinct/deobfuscate-android-app
This is a LLM tool to find any potential security vulnerabilities in android apps and deobfuscate android app code. Uses Google’s Gemini public API.
Simplify
It is a generic android deobfuscator. Simplify는 앱을 virtually executes an app 방식으로 실행하여 동작을 이해한 다음, 동일하게 동작하지만 사람이 이해하기 쉬운 코드를 만들기 위해 코드를 최적화하려고 시도합니다. 각 최적화 유형은 단순하고 일반적이어서 어떤 특정 난독화 유형이 사용되었는지는 중요하지 않습니다.
APKiD
APKiD는 APK가 어떻게 만들어졌는지에 대한 정보를 제공합니다. 다양한 compilers, packers, obfuscators 및 기타 이상 항목들을 식별합니다. Android용 PEiD와 같습니다.
Manual
Read this tutorial to learn some tricks on how to reverse custom obfuscation
실습
Androl4b
AndroL4b는 ubuntu-mate 기반의 Android 보안 가상 머신으로, 리버스 엔지니어링과 malware analysis를 위한 다양한 최신 프레임워크, 튜토리얼 및 실습을 보안 연구자들과 보안 애호가들로부터 모아 제공합니다.
References
- Play Integrity API: How It Works & How to Bypass It
- https://owasp.org/www-project-mobile-app-security/
- https://appsecwiki.com/#/ It is a great list of resources
- https://maddiestone.github.io/AndroidAppRE/ Android quick course
- https://manifestsecurity.com/android-application-security/
- https://github.com/Ralireza/Android-Security-Teryaagh
- https://www.youtube.com/watch?v=PMKnPaGWxtg&feature=youtu.be&ab_channel=B3nacSec
- SSLPinDetect: Advanced SSL Pinning Detection for Android Security Analysis
- SSLPinDetect GitHub
- smali-sslpin-patterns
- Build a Repeatable Android Bug Bounty Lab: Emulator vs Magisk, Burp, Frida, and Medusa
- CoRPhone — Android in-memory JNI execution and packaging pipeline
- justapk — multi-source APK downloader with Cloudflare bypass
- Jezail rooted Android pentesting toolkit (REST API + Flutter UI)
- BeatBanker: A dual‑mode Android Trojan
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을 제출하여 해킹 트릭을 공유하세요.


