# iOS UIActivity Sharing {% 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 %} # UIActivity Sharing Semplificato A partire da iOS 6, le applicazioni di terze parti possono **condividere dati** come testo, URL o immagini utilizzando meccanismi come AirDrop, come descritto nella [guida alla comunicazione tra app](https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html#//apple_ref/doc/uid/TP40007072-CH6-SW3) di Apple. Questa funzionalità si manifesta attraverso un _foglio di attività di condivisione_ a livello di sistema che appare interagendo con il pulsante "Condividi". Un elenco completo di tutte le opzioni di condivisione integrate è disponibile in [UIActivity.ActivityType](https://developer.apple.com/documentation/uikit/uiactivity/activitytype). Gli sviluppatori possono scegliere di escludere specifiche opzioni di condivisione se le ritengono inadeguate per la loro applicazione. ## **Come Condividere Dati** L'attenzione dovrebbe essere rivolta a: - La natura dei dati condivisi. - L'inclusione di attività personalizzate. - L'esclusione di determinati tipi di attività. La condivisione è facilitata attraverso l'istanza di un `UIActivityViewController`, al quale vengono passati gli elementi destinati alla condivisione. Questo si ottiene chiamando: ```bash $ rabin2 -zq Telegram\ X.app/Telegram\ X | grep -i activityItems 0x1000df034 45 44 initWithActivityItems:applicationActivities: ``` Developers should scrutinize the `UIActivityViewController` for the activities and custom activities it's initialized with, as well as any specified `excludedActivityTypes`. ## **Come Ricevere Dati** The following aspects are crucial when receiving data: - The declaration of **tipi di documento personalizzati**. - The specification of **tipi di documento che l'app può aprire**. - The verification of the **integrità dei dati ricevuti**. Without access to the source code, one can still inspect the `Info.plist` for keys like `UTExportedTypeDeclarations`, `UTImportedTypeDeclarations`, and `CFBundleDocumentTypes` to understand the types of documents an app can handle and declare. A succinct guide on these keys is available on [Stackoverflow](https://stackoverflow.com/questions/21937978/what-are-utimportedtypedeclarations-and-utexportedtypedeclarations-used-for-on-i), highlighting the importance of defining and importing UTIs for system-wide recognition and associating document types with your app for integration in the "Open With" dialogue. ## Dynamic Testing Approach To test **invio di attività**, one could: - Hook into the `init(activityItems:applicationActivities:)` method to capture the items and activities being shared. - Identify excluded activities by intercepting the `excludedActivityTypes` property. For **ricezione di elementi**, it involves: - Sharing a file with the app from another source (e.g., AirDrop, email) that prompts the "Open with..." dialogue. - Hooking `application:openURL:options:` among other methods identified during static analysis to observe the app's response. - Employing malformed files or fuzzing techniques to evaluate the app's robustness. ## References * [https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06h-testing-platform-interaction](https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06h-testing-platform-interaction) {% 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 %}