# Deeplinks vulns

## Qu'est ce qu'un deeplink ?

Dans Android, un lien profond est un lien qui vous amène directement à une destination spécifique dans une application. Le composant Navigation vous permet de créer deux types différents de liens profonds : explicites et implicites.

Un lien profond explicite est une instance unique d'un lien profond qui utilise un `PendingIntent` pour rediriger les utilisateurs vers un emplacement spécifique de votre application. On peut afficher un lien profond explicite dans une notification ou un widget d'application, par exemple.

Un lien profond implicite est une destination spécifique dans une application. Lorsque le lien profond est appelé (par exemple, lorsqu'un utilisateur clique dessus), Android peut ouvrir votre application à la destination correspondante.

Les liens profonds peuvent être mis en correspondance par URI, actions d'intent et types MIME.

### Reconnaissance

Les deeplink sont retrouvable dans le fichier AndroidManifest.xml de l'application.

Exemple:

```xml
<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_view_http_gizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepte les URIs commencant par "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="/gizmos" />
        <!-- Noter que le "/" est requis ici-->
    </intent-filter>
    <intent-filter android:label="@string/filter_view_example_gizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepet les URIs commancant par "example://s1rn3tz” -->
        <data android:scheme="example"
              android:host="s1rn3tz" />
    </intent-filter>
</activity>
```

On peut ensuite aller rechercher leur usage dans le contexte de l'application directement dans le code source.

{% hint style="info" %}
Note: Les deeplinks présents dans un même bloc `<intent-filter>` sont  en fait fusionnés de manière à rendre valide pluiseurs combinaisons.
{% endhint %}

Exemple:

```xml
<intent-filter>
  ...
  <data android:scheme="https" android:host="target.com" />
  <data android:scheme="app" android:host="target.my.app" />
</intent-filter>
```

Créé les deeplinks valides suivants:

```
https://target.com => valide
app://target.my.app => valide
https://target.my.app => valide
app://target.com => valide
```

#### Lister les deeplinks d'une application

Avec adb:

```
$ adb shell dumpsys package com.example.package
```

Avec Deeplink Analyser:

```
python3 deeplink_analyser.py -op list-all -apk example.apk
```

ressource: <https://github.com/inesmartins/Android-App-Link-Verification-Tester>

## Outils

### NSdeepLink

NSdeepLink est un script python de reconnaissance et d'exploitation de deeplinks.

Ressource: <https://github.com/mathis2001/NSdeepLink>

Exemple d'utilisation:

`$ python3 NSdeepLink.py --adb com.example.xyz --verify`

## Liens utiles

{% embed url="<https://djini.ai/1-click-ato-a-studycase-of-common-android-apps-misconfigurations/>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.s1rn3tz.ovh/pentest-mobile/android/deeplinks-vulns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
