# iOS App Extensions {% 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 %} μ•± ν™•μž₯은 λ‹€λ₯Έ μ•±μ΄λ‚˜ μ‹œμŠ€ν…œκ³Ό μƒν˜Έμž‘μš©ν•˜μ—¬ μ‚¬μš©μž μ •μ˜ κΈ°λŠ₯μ΄λ‚˜ μ½˜ν…μΈ λ₯Ό μ œκ³΅ν•¨μœΌλ‘œμ¨ μ•±μ˜ κΈ°λŠ₯을 ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€. μ΄λŸ¬ν•œ ν™•μž₯μ—λŠ” λ‹€μŒμ΄ ν¬ν•¨λ©λ‹ˆλ‹€: - **μ»€μŠ€ν…€ ν‚€λ³΄λ“œ**: κΈ°λ³Έ iOS ν‚€λ³΄λ“œλ₯Ό λŒ€μ²΄ν•˜μ—¬ λͺ¨λ“  μ•±μ—μ„œ κ³ μœ ν•œ ν‚€λ³΄λ“œλ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€. - **곡유**: μ†Œμ…œ λ„€νŠΈμ›Œν¬ λ˜λŠ” λ‹€λ₯Έ μ‚¬μš©μžμ™€ 직접 κ³΅μœ ν•  수 있게 ν•©λ‹ˆλ‹€. - **였늘(μœ„μ ―)**: μ•Œλ¦Ό μ„Όν„°μ˜ 였늘 λ³΄κΈ°μ—μ„œ μ½˜ν…μΈ λ₯Ό μ œκ³΅ν•˜κ±°λ‚˜ μž‘μ—…μ„ μ‹ μ†ν•˜κ²Œ μˆ˜ν–‰ν•©λ‹ˆλ‹€. μ‚¬μš©μžκ°€ 호슀트 μ•±μ—μ„œ ν…μŠ€νŠΈλ₯Ό κ³΅μœ ν•˜λŠ” λ“±μ˜ λ°©μ‹μœΌλ‘œ μ΄λŸ¬ν•œ ν™•μž₯κ³Ό μƒν˜Έμž‘μš©ν•  λ•Œ, ν™•μž₯은 ν•΄λ‹Ή μž…λ ₯을 μžμ‹ μ˜ μ»¨ν…μŠ€νŠΈ λ‚΄μ—μ„œ μ²˜λ¦¬ν•˜λ©°, 곡유된 정보λ₯Ό ν™œμš©ν•˜μ—¬ μž‘μ—…μ„ μˆ˜ν–‰ν•©λ‹ˆλ‹€. μ΄λŠ” Apple의 λ¬Έμ„œμ— μžμ„Ένžˆ μ„€λͺ…λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. ### **λ³΄μ•ˆ 고렀사항** μ£Όμš” λ³΄μ•ˆ 츑면은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€: - ν™•μž₯κ³Ό κ·Έλ₯Ό ν¬ν•¨ν•˜λŠ” 앱은 μ§μ ‘μ μœΌλ‘œκ°€ μ•„λ‹ˆλΌ ν”„λ‘œμ„ΈμŠ€ κ°„ 톡신을 톡해 ν†΅μ‹ ν•©λ‹ˆλ‹€. - **였늘 μœ„μ ―**은 νŠΉμ • 방법을 톡해 μžμ‹ μ˜ 앱을 열도둝 μš”μ²­ν•  수 μžˆλ‹€λŠ” μ μ—μ„œ λ…νŠΉν•©λ‹ˆλ‹€. - 곡유 데이터 접근은 개인 μ»¨ν…Œμ΄λ„ˆ λ‚΄μ—μ„œ ν—ˆμš©λ˜μ§€λ§Œ, 직접 접근은 μ œν•œλ©λ‹ˆλ‹€. - HealthKit을 ν¬ν•¨ν•œ νŠΉμ • APIλŠ” μ•± ν™•μž₯μ—μ„œ μ‚¬μš©ν•  수 μ—†μœΌλ©°, iMessage ν™•μž₯을 μ œμ™Έν•˜κ³ λŠ” μž₯κΈ° μ‹€ν–‰ μž‘μ—…μ„ μ‹œμž‘ν•˜κ±°λ‚˜ 카메라 λ˜λŠ” λ§ˆμ΄ν¬μ— μ ‘κ·Όν•  수 μ—†μŠ΅λ‹ˆλ‹€. ### 정적 뢄석 #### **μ•± ν™•μž₯ μ‹λ³„ν•˜κΈ°** μ†ŒμŠ€ μ½”λ“œμ—μ„œ μ•± ν™•μž₯을 찾으렀면 Xcodeμ—μ„œ `NSExtensionPointIdentifier`λ₯Ό κ²€μƒ‰ν•˜κ±°λ‚˜ ν™•μž₯을 λ‚˜νƒ€λ‚΄λŠ” `.appex` 파일이 μžˆλŠ” μ•± λ²ˆλ“€μ„ κ²€μ‚¬ν•©λ‹ˆλ‹€. μ†ŒμŠ€ μ½”λ“œκ°€ μ—†λŠ” 경우 grep λ˜λŠ” SSHλ₯Ό μ‚¬μš©ν•˜μ—¬ μ•± λ²ˆλ“€ λ‚΄μ—μ„œ μ΄λŸ¬ν•œ μ‹λ³„μžλ₯Ό μ°ΎμŠ΅λ‹ˆλ‹€. #### **μ§€μ›λ˜λŠ” 데이터 μœ ν˜•** ν™•μž₯의 `Info.plist` νŒŒμΌμ—μ„œ `NSExtensionActivationRule`을 ν™•μΈν•˜μ—¬ μ§€μ›λ˜λŠ” 데이터 μœ ν˜•μ„ μ‹λ³„ν•©λ‹ˆλ‹€. 이 섀정은 호슀트 μ•±μ—μ„œ ν˜Έν™˜λ˜λŠ” 데이터 μœ ν˜•λ§Œ ν™•μž₯을 νŠΈλ¦¬κ±°ν•˜λ„λ‘ 보μž₯ν•©λ‹ˆλ‹€. #### **데이터 곡유** μ•±κ³Ό κ·Έ ν™•μž₯ κ°„μ˜ 데이터 κ³΅μœ λŠ” "μ•± κ·Έλ£Ή"을 톡해 μ„€μ •λœ 곡유 μ»¨ν…Œμ΄λ„ˆκ°€ ν•„μš”ν•˜λ©°, `NSUserDefaults`λ₯Ό 톡해 μ ‘κ·Όν•©λ‹ˆλ‹€. 이 곡유 곡간은 ν™•μž₯μ—μ„œ μ‹œμž‘λœ λ°±κ·ΈλΌμš΄λ“œ 전솑에 ν•„μš”ν•©λ‹ˆλ‹€. #### **ν™•μž₯ μ œν•œν•˜κΈ°** 앱은 νŠΉμ • ν™•μž₯ μœ ν˜•, 특히 μ»€μŠ€ν…€ ν‚€λ³΄λ“œλ₯Ό μ œν•œν•  수 있으며, μ΄λŠ” λ―Όκ°ν•œ 데이터 μ²˜λ¦¬κ°€ λ³΄μ•ˆ ν”„λ‘œν† μ½œμ— λ§žλ„λ‘ 보μž₯ν•©λ‹ˆλ‹€. ### 동적 뢄석 동적 λΆ„μ„μ—λŠ” λ‹€μŒμ΄ ν¬ν•¨λ©λ‹ˆλ‹€: - **곡유 ν•­λͺ© 검사**: `NSExtensionContext - inputItems`에 ν›„ν‚Ήν•˜μ—¬ 곡유 데이터 μœ ν˜•κ³Ό 좜처λ₯Ό ν™•μΈν•©λ‹ˆλ‹€. - **ν™•μž₯ μ‹λ³„ν•˜κΈ°**: `NSXPCConnection`κ³Ό 같은 λ‚΄λΆ€ λ©”μ»€λ‹ˆμ¦˜μ„ κ΄€μ°°ν•˜μ—¬ μ–΄λ–€ ν™•μž₯이 κ·€ν•˜μ˜ 데이터λ₯Ό μ²˜λ¦¬ν•˜λŠ”μ§€ λ°œκ²¬ν•©λ‹ˆλ‹€. `frida-trace`와 같은 λ„κ΅¬λŠ” ν”„λ‘œμ„ΈμŠ€ κ°„ ν†΅μ‹ μ˜ 기술적 μ„ΈλΆ€ 사항에 관심이 μžˆλŠ” μ‚¬λžŒλ“€μ—κ²Œ κΈ°λ³Έ ν”„λ‘œμ„ΈμŠ€λ₯Ό μ΄ν•΄ν•˜λŠ” 데 도움을 쀄 수 μžˆμŠ΅λ‹ˆλ‹€. ## References * [https://mas.owasp.org/MASTG/iOS/0x06h-Testing-Platform-Interaction/](https://mas.owasp.org/MASTG/iOS/0x06h-Testing-Platform-Interaction/) * [https://mas.owasp.org/MASTG/tests/ios/MASVS-PLATFORM/MASTG-TEST-0072/](https://mas.owasp.org/MASTG/tests/ios/MASVS-PLATFORM/MASTG-TEST-0072/) {% 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 %}