Objection ํํ ๋ฆฌ์ผ
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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์๊ฐ
objection - ๋ฐํ์ ๋ชจ๋ฐ์ผ ํ์
Objection๋ Frida์ ์ํด ๊ตฌ๋๋๋ ๋ฐํ์ ๋ชจ๋ฐ์ผ ํ์ ํดํท์ ๋๋ค. jailbroken ๋๋ rooted ๋ชจ๋ฐ์ผ ๊ธฐ๊ธฐ๊ฐ ํ์ํ์ง ์๊ณ ๋ชจ๋ฐ์ผ ์ ํ๋ฆฌ์ผ์ด์ ๊ณผ ๊ทธ ๋ณด์ ์ํ๋ฅผ ํ๊ฐํ๋ ๋ฐ ๋์์ ์ฃผ๊ธฐ ์ํด ๋ง๋ค์ด์ก์ต๋๋ค.
์ฐธ๊ณ : ์ด๊ฒ์ ์ด๋ค ํํ์ jailbreak / root bypass๊ฐ ์๋๋๋ค. objection์ ์ฌ์ฉํ๋๋ผ๋, ๋น์ ์ ์ฌ์ ํ ์ ์ฉ๋๋ sandbox๊ฐ ๋ถ๊ณผํ๋ ๋ชจ๋ ์ ํ์ ์ํฅ์ ๋ฐ์ต๋๋ค.
์์ฝ
objection์ ๋ชฉํ๋ ์ฌ์ฉ์๊ฐ Frida๊ฐ ์ ๊ณตํ๋ ์ฃผ์ ์์ ๋ค์ ํธ์ถํ ์ ์๊ฒ ํ๋ ๊ฒ์ ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด, ์ฌ์ฉ์๋ ํ ์คํธํ๋ ค๋ ๊ฐ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํด ๋จ์ผ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค์ด์ผ ํฉ๋๋ค.
ํํ ๋ฆฌ์ผ
์ด ํํ ๋ฆฌ์ผ์์๋ ์ฌ๊ธฐ์์ ๋ค์ด๋ก๋ํ ์ ์๋ APK๋ฅผ ์ฌ์ฉํ๊ฒ ์ต๋๋ค:
๋๋ ๊ทธ original repository (download app-release.apk)์์ ๋ฐ์ ์ ์์ต๋๋ค.
์ค์น
pip3 install objection
์ฐ๊ฒฐ
์ผ๋ฐ์ ์ธ ADB conection์ ํ๊ณ ์ฅ์น์์ frida ์๋ฒ๋ฅผ ์์ํ์ธ์ (ํด๋ผ์ด์ธํธ์ ์๋ฒ ๋ ๋ค์์ frida๊ฐ ์๋ํ๋์ง ํ์ธํ์ธ์).
๋ง์ฝ rooted device๋ฅผ ์ฌ์ฉ ์ค์ด๋ผ๋ฉด, โgadget ์ต์ ์์์ ํ ์คํธํ๋ ค๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ ํํด์ผ ํฉ๋๋ค. ์ด ๊ฒฝ์ฐ:
frida-ps -Uai
objection --gadget asvid.github.io.fridaapp explore
๊ธฐ๋ณธ ๋์
์ด ํํ ๋ฆฌ์ผ์๋ objections์ ๋ชจ๋ ๊ฐ๋ฅํ ๋ช ๋ น์ ๋์ดํ์ง ์์ต๋๋ค. ์ ๊ฐ ๋ ์ ์ฉํ๋ค๊ณ ์๊ฐํ ๊ฒ๋ค๋ง ํฌํจํฉ๋๋ค.
ํ๊ฒฝ
ํ๊ฒฝ ๋ด๋ถ์์ (์: passwords ๋๋ paths)์ ๊ฐ์ ํฅ๋ฏธ๋ก์ด ์ ๋ณด๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
env
.png)
Frida ์ ๋ณด
frida
.png)
์ ๋ก๋/๋ค์ด๋ก๋
file download <remote path> [<local path>]
file upload <local path> [<remote path>]
frida script ์ํฌํธ
import <local path frida-script>
SSLPinning
android sslpinning disable #Attempts to disable SSL Pinning on Android devices.
๋ฃจํ ํ์ง
android root disable #Attempts to disable root detection on Android devices.
android root simulate #Attempts to simulate a rooted Android environment.
๋ช ๋ น ์คํ
android shell_exec whoami
์คํฌ๋ฆฐ์ท
android ui screenshot /tmp/screenshot
android ui FLAG_SECURE false #This may enable you to take screenshots using the hardware keys
Static analysis๋ฅผ Dynamicํ๊ฒ ์ ์ฉํ๊ธฐ
์ค์ ์ ํ๋ฆฌ์ผ์ด์ ์์๋ objection์ ์ฌ์ฉํ๊ธฐ ์ ์ ์ด ์น์ ์์ ๋ฐ๊ฒฌ๋ ๋ชจ๋ ์ ๋ณด๋ฅผ static analysis ๋๋ถ์ ์๊ณ ์์ด์ผ ํฉ๋๋ค. ์ด์จ๋ , ์ฌ๊ธฐ์๋ classes, methods and exported objects์ ์ ์ฒด ๋ชฉ๋ก๋ง ์ ๊ณต๋๋ฏ๋ก ์ด ๋ฐฉ๋ฒ์ผ๋ก๋ ์๋ก์ด ๊ฒ์ ๋ฐ๊ฒฌํ ์๋ ์์ต๋๋ค.
๋ํ ์ฑ์ ์ฝ์ ์ ์๋ source code๋ฅผ ์ป์ ์ ์๋ ๊ฒฝ์ฐ์๋ ์ ์ฉํฉ๋๋ค.
activities, receivers and services ๋์ด
android hooking list activities
.png)
android hooking list services
android hooking list receivers
Frida๋ ์๋ฌด๊ฒ๋ ์ฐพ์ง ๋ชปํ๋ฉด ์ค๋ฅ๋ฅผ ๋ฐ์์ํต๋๋ค
ํ์ฌ activity ๊ฐ์ ธ์ค๊ธฐ
android hooking get current_activity
.png)
ํด๋์ค ๊ฒ์
์ ํ๋ฆฌ์ผ์ด์ ๋ด๋ถ์์ ํด๋์ค๋ค์ ์ฐพ์๋ณด๊ฒ ์ต๋๋ค.
android hooking search classes asvid.github.io.fridaapp
.png)
ํด๋์ค์ ๋ฉ์๋ ๊ฒ์
์ด์ ํด๋์ค MainActivity: ์์ ์๋ ๋ฉ์๋๋ฅผ ์ถ์ถํด๋ณด์.
android hooking search methods asvid.github.io.fridaapp MainActivity
.png)
ํด๋์ค์ ์ ์ธ๋ ๋ฉ์๋์ ํด๋น ๋งค๊ฐ๋ณ์ ๋ชฉ๋ก
ํด๋์ค์ ๋ฉ์๋๋ค์ด ์ด๋ค ๋งค๊ฐ๋ณ์๋ฅผ ํ์๋ก ํ๋์ง ์์๋ณด์:
android hooking list class_methods asvid.github.io.fridaapp.MainActivity
.png)
ํด๋์ค ๋์ด
ํ์ฌ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ก๋๋ ๋ชจ๋ ํด๋์ค๋ฅผ ๋์ดํ ์๋ ์์ต๋๋ค:
android hooking list classes #List all loaded classes, As the target application gets usedmore, this command will return more classes.
์ด๋ ํด๋์ค์ ์ด๋ฆ๋ง ์๊ณ ์๊ณ hook the method of a class and you only know the name of the class ํ๋ ค๋ ๊ฒฝ์ฐ์ ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ์ด ํจ์๋ฅผ ์ฌ์ฉํด ํด๋์ค๊ฐ ์ด๋ ๋ชจ๋์ ์ํ๋์ง search which module owns the class ๋ฅผ ์ฐพ์๋ธ ๋ค์ ํด๋น method๋ฅผ hookํ ์ ์์ต๋๋ค.
Hooking being easy
Hooking (watching) a method
From the source code of the application we know that the function sum() from MainActivity is being run every second. Lets try to dump all possible information each time the function is called (arguments, return value and backtrace):
android hooking watch class_method asvid.github.io.fridaapp.MainActivity.sum --dump-args --dump-backtrace --dump-return
.png)
Hooking (์ ์ฒด ํด๋์ค ๊ฐ์ํ๊ธฐ)
์ฌ์ค MainActivity ํด๋์ค์ ๋ชจ๋ ๋ฉ์๋๊ฐ ๋งค์ฐ ํฅ๋ฏธ๋ก์์, ์ ๋ถ hook them all ํด๋ณด๊ฒ ์ต๋๋ค. ์ฃผ์: ์ด๋ก ์ธํด ์ ํ๋ฆฌ์ผ์ด์ ์ด crash ํ ์ ์์ต๋๋ค.
android hooking watch class asvid.github.io.fridaapp.MainActivity --dump-args --dump-return
If you play with the application while the class is hooked you will see when each function is being called, its arguments and the return value.
.png)
ํจ์์ boolean ๋ฐํ๊ฐ ๋ณ๊ฒฝ
์์ค ์ฝ๋๋ฅผ ๋ณด๋ฉด ํจ์ _checkPin_์ด _String_์ ์ธ์๋ก ๋ฐ๊ณ _boolean_์ ๋ฐํํ๋ค๋ ๊ฒ์ ์ ์ ์์ต๋๋ค. ์ด ํจ์๋ฅผ ํญ์ true๋ฅผ ๋ฐํํ๋๋ก ๋ง๋ค์ด๋ณด์:
.png)
์ด์ PIN ์ฝ๋ ์ ๋ ฅ๋์ ๋ฌด์์ด๋ ์ฐ๋ฉด ๋ชจ๋ ์ ํจํ ๊ฒ์ผ๋ก ๋ณด์ผ ๊ฒ์ ๋๋ค:
.png)
ํด๋์ค ์ธ์คํด์ค
ํน์ ํ Java class์ live instances๋ฅผ ๊ฒ์ํ๊ณ ์ถ๋ ฅํฉ๋๋ค(์์ ํ ํด๋์ค ์ด๋ฆ์ผ๋ก ์ง์ ). Out์ ๋ฐ๊ฒฌ๋ objection์ ๋ํด string ๊ฐ์ ์ป์ผ๋ ค๋ ์๋์ ๊ฒฐ๊ณผ์ด๋ฉฐ, ์ผ๋ฐ์ ์ผ๋ก ๊ฐ์ฒด์ property ๊ฐ๋ค์ ํฌํจํฉ๋๋ค.
android heap print_instances <class>
.png)
ํค์คํ ์ด/์ธํ ํธ
๋ค์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํด keystore์ intents๋ฅผ ์กฐ์ํ ์ ์์ต๋๋ค:
android keystore list
android intents launch_activity
android intent launch_service
๋ฉ๋ชจ๋ฆฌ
๋คํ
memory dump all <local destination> #Dump all memory
memory dump from_base <base_address> <size_to_dump> <local_destination> #Dump a part
๋ชฉ๋ก
memory list modules
.png)
๋ชฉ๋ก ๋งจ ์๋์ frida๊ฐ ๋ณด์ ๋๋ค:
.png)
frida๊ฐ ๋ด๋ณด๋ด๋ ํญ๋ชฉ์ ํ์ธํด๋ด ์๋ค:
.png)
๊ฒ์/์ฐ๊ธฐ
objection์ ์ฌ์ฉํด ๋ฉ๋ชจ๋ฆฌ ๋ด๋ถ๋ฅผ ๊ฒ์ํ๊ณ ์ธ ์๋ ์์ต๋๋ค:
memory search "<pattern eg: 41 41 41 ?? 41>" (--string) (--offsets-only)
memory write "<address>" "<pattern eg: 41 41 41 41>" (--string)
SQLite
sqlite ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ํธ์์ฉํ๋ ค๋ฉด sqlite ๋ช
๋ น์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์ข ๋ฃ
exit
Objection์์ ์์ฌ์ด ์
- hooking methods๋ ๊ฐ๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ํฌ๋์์ํจ๋ค(์ด๋ Frida ๋๋ฌธ์ด๊ธฐ๋ ํจ).
- ํด๋์ค์ ์ธ์คํด์ค๋ฅผ ์ฌ์ฉํด ๊ทธ ์ธ์คํด์ค์ ํจ์๋ฅผ ํธ์ถํ ์ ์๋ค. ๋ํ ํด๋์ค๋ฅผ ์๋ก ์ธ์คํด์คํํ์ฌ ๊ทธ ์ธ์คํด์ค๋ก ํจ์๋ฅผ ํธ์ถํ ์๋ ์๋ค.
- ์ ํ๋ฆฌ์ผ์ด์ ์์ ์ฌ์ฉ๋๋ ์ผ๋ฐ์ ์ธ crypto methods๋ฅผ ๋ชจ๋ ํ ํนํ์ฌ cyphered text, plain text, keys, IVs ๋ฐ algorithms์ ํ์ธํ ์ ์๋ ๋จ์ถ ๊ธฐ๋ฅ(์: sslpinnin์ฉ)์ ์๋ค.
References
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์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


