Skip to content

Commit 969d71b

Browse files
committed
updated mobile security framework series
1 parent 6e3f700 commit 969d71b

17 files changed

+164
-161
lines changed

_posts/2021-08-03-BB-oauth2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2021-08-03 10:00:00
55
categories: [Bounty]
66
toc: true
77
author: paoloserra
8-
img_path: /images/BB-oauth2
8+
media_subpath: /images/BB-oauth2
99
image:
1010
path: wallpaper.jpeg
1111
---

_posts/2021-08-05-oauth2-attacks-client.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 9999-08-03 10:00:00
55
categories: [Topic, OAuth2]
66
toc: true
77
author: paoloserra
8-
img_path: /images/
8+
media_subpath: /images/
99
image:
1010
src: wallpapers/jujutsukaisen.jpeg
1111
---
@@ -33,27 +33,27 @@ The typical scenario for this attack requires that the target website allows use
3333
*1° Scenario*
3434
: Register a new account with the victim's email on the target website. From this time, you own the credentials but still not the account takeover, because an email verification will be probably required. When the victim registers himself by using OAuth (with Facebook or Google, for example), this authorization will bypass the verification required and you will have another way to log in with the victim's account.
3535

36-
| Functional Requirements |
37-
|:------------------------------------|
38-
| Multiple Authentication Methods |
36+
| Functional Requirements |
37+
| :------------------------------ |
38+
| Multiple Authentication Methods |
3939

4040

4141
*2° Scenario*
4242
: First of all, this scenario depends on how the website manages the linking process. It might use IDs parameters, xxx or yyy. What I can suggest, it's seeing the workflow and trying to find out if the process is flawed. For example, if IDs are used to tie the third-party profile to the account, try changing them with the victim's id, thus the victim will have his account tied to the attacker's account.
4343

44-
| Functional Requirements |
45-
|:------------------------------------|
46-
| Link a third-party Account in the profile page |
44+
| Functional Requirements |
45+
| :--------------------------------------------- |
46+
| Link a third-party Account in the profile page |
4747

4848

4949

5050
*3° Scenario*
5151
: Register a new account on the OAuth Provider with the victim’s email (even if email verification is required), then log in to the target website via OAuth with the account just created (with the victim’s email) and see what the target website does. Obviously, the victim must have already a registered account on the website and signed up via email. If you’re lucky, it logs you in the victim's account.
5252

53-
| Functional Requirements |
54-
|:------------------------------------|
55-
| The victim signed up by email |
56-
| The victim doesn't have an account on the Authorization Server |
53+
| Functional Requirements |
54+
| :------------------------------------------------------------- |
55+
| The victim signed up by email |
56+
| The victim doesn't have an account on the Authorization Server |
5757

5858
### Defence
5959

@@ -179,11 +179,11 @@ Check that the access token matches the other data in the request and tie it to
179179

180180
## Token Hijacking
181181

182-
| Limitation |
183-
|:------------------------------------|
184-
| Only tested for Facebook |
185-
| Need to have access to the token |
186-
| Need to have an external app that uses the same OAuth Provider |
182+
| Limitation |
183+
| :------------------------------------------------------------- |
184+
| Only tested for Facebook |
185+
| Need to have access to the token |
186+
| Need to have an external app that uses the same OAuth Provider |
187187

188188
From Facebook Documentation:
189189
> To understand how this happens, imagine a native iOS app that wants to make API calls, but instead of doing it directly, communicates with a server owned by the same app and passes that server a token generated using the iOS SDK. The server would then use the token to make API calls. The endpoint that the server uses to receive the token could be compromised and others could pass access tokens for completely different apps to it. This would be obviously insecure

_posts/2022-06-02-black-box-mindset.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 9999-06-02 10:00:00
55
categories: [Topic, Mindset]
66
toc: true
77
author: paoloserra
8-
img_path: /images/black-box-mindset
8+
media_subpath: /images/black-box-mindset
99
image:
1010
path: wallpaper.jpg
1111
---
@@ -23,4 +23,4 @@ Prova ad immaginarti all'interno di una grande bolla dove ci sei solo tu e l'app
2323

2424
Durante un test black box, non si è a conoscenza di nulla, quindi i primi step da seguire sono basati tutti su un unica filosofia: intuire come l'applicazione si sposta (funziona). Se l'obiettivo finale è quello di scovare più vulnerabilità possibili, non si può pensare di andare a cercarle, perchè ti perderesti facilmente, ciò è dovuto a causa di tanti fattori. Una vero predatore conoscere la sua preda, e se abbastanza furbo, sa che non è lui che deve andare a cercarla, ma deve fare in modo che è la preda stessa che si avvicina a lui. Ormai è una cosa dimostrata, ma per raggiungere delle risposte bisogna porsi delle domande, per questo il mindset dovrebbe essere un "fisso rispondere" a what-how: cosa è questo e come funziona. Una volta che sei pienamente coscente di cosa qualcosa è e come essa funziona, allora le intuzioni vengono da loro, così come le vulnerabilità. Un consiglio è prendere note, per assicurarsi di capire a pieno cosa si ha davanti e farcelo entrare in testa.
2525

26-
Spendere parecchio tempo a conoscere l'applicazione è davvero l'unico modo per
26+
Spendere parecchio tempo a conoscere l'applicazione è davvero l'unico modo per

_posts/2022-08-01-mariana_trench.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2022-09-07 10:00:00
55
categories: [Mobile Security, Mariana Trench]
66
toc: true
77
author: paoloserra
8-
img_path: /images/mariana-trench/part_1
8+
media_subpath: /images/mariana-trench/part_1
99
image:
1010
path: wallpaper.jpeg
1111
---
@@ -224,15 +224,15 @@ At this point, we can decide which flow we are more interested in:
224224

225225
Let's start with the first one. At the moment, Facebook already offers some default sources and sinks with the corresponding ***kind*** (listed in the table below), but none of them concerns a model that deals with input from deep links. For this reason, we are going to create one that fits with the source and sink we are looking for.
226226
227-
| Kind (Sources) | Kind (Sinks) |
228-
|:--- |:----|
229-
|ActivityUserInput | LaunchingComponent|
230-
|FragmentUserInput |CodeExecution|
231-
|ReceiverUserInput |FileResolver|
232-
|IntentCreation |InputStream|
233-
|SensitiveCookieData |SQLQuery|
234-
|ProviderUserInput |SQLMutation|
235-
|ServiceUserInput |WebView|
227+
| Kind (Sources) | Kind (Sinks) |
228+
| :------------------ | :----------------- |
229+
| ActivityUserInput | LaunchingComponent |
230+
| FragmentUserInput | CodeExecution |
231+
| ReceiverUserInput | FileResolver |
232+
| IntentCreation | InputStream |
233+
| SensitiveCookieData | SQLQuery |
234+
| ProviderUserInput | SQLMutation |
235+
| ServiceUserInput | WebView |
236236
237237
238238
We have to create our source and sink. The following is a basic structure of the JSON file for writing a model:
@@ -367,4 +367,4 @@ I showed you a pretty simple example that should have taught you the fundamental
367367
##### References
368368
- [https://engineering.fb.com/2021/09/29/security/mariana-trench/](https://engineering.fb.com/2021/09/29/security/mariana-trench/)
369369
- [https://github.com/facebook/mariana-trench](https://github.com/facebook/mariana-trench)
370-
- [https://github.com/oversecured/ovaa](https://github.com/oversecured/ovaa)
370+
- [https://github.com/oversecured/ovaa](https://github.com/oversecured/ovaa)

_posts/2022-09-30-mariana_trench_part_2.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2023-02-12 10:00:00
55
categories: [Mobile Security, Mariana Trench]
66
toc: true
77
author: paoloserra
8-
img_path: /images/mariana-trench/part_2/
8+
media_subpath: /images/mariana-trench/part_2/
99
image:
1010
path: wallpaper.jpeg
1111
width: 100%
@@ -76,12 +76,12 @@ Once all the models are generated, Mariana does its job and produces a result th
7676
#### Minimize the false positives
7777
Basically, we designed two models based on the ***name*** constraint, which treats the method as a source only if the item contains the specified value. It doesn't care about the class, the arguments' types, or the return value. Each method starting with the ```getQueryParameter``` or the ```putString``` string is treated as a source.
7878

79-
| Source/Sink | Item |
80-
|:--------------------------------------------------------------------------|:-----------------------------------------|
81-
|![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
82-
|![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putStringIntoRequest**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
83-
|![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Lcom/example/classB;|
84-
|![Window shadow](check_icon.png){: w="22" h="22" } | Landroid/content/SharedPreferences$Editor;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
79+
| Source/Sink | Item |
80+
| :------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- |
81+
| ![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
82+
| ![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putStringIntoRequest**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
83+
| ![Window shadow](check_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Lcom/example/classB; |
84+
| ![Window shadow](check_icon.png){: w="22" h="22" } | Landroid/content/SharedPreferences$Editor;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
8585

8686
Let's try to be more efficient. When you define a constraint, you have more options:
8787
- *signature* : specify a regex to fully match the full signature of the target method.
@@ -185,12 +185,12 @@ The JSON definition of our model has been increased a bit. Let me give you some
185185

186186
After tuning, we can say we achieved our goal of minimizing false positives. We are now sure that we have defined a model that handles the methods held by the proper classes.
187187

188-
| Source/Sink | Item |
189-
|:--------------------------------------------------------------------------|:-----------------------------------------|
190-
|![Window shadow](uncheck_icon.png){: w="22" h="22" }| Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
191-
|![Window shadow](uncheck_icon.png){: w="22" h="22" }| Lcom/example/classA;.**putStringIntoRequest**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
192-
|![Window shadow](uncheck_icon.png){: w="22" h="22" }| Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Lcom/example/classB;|
193-
|![Window shadow](check_icon.png){: w="22" h="22" }| Landroid/content/SharedPreferences$Editor;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;|
188+
| Source/Sink | Item |
189+
| :--------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- |
190+
| ![Window shadow](uncheck_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
191+
| ![Window shadow](uncheck_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putStringIntoRequest**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
192+
| ![Window shadow](uncheck_icon.png){: w="22" h="22" } | Lcom/example/classA;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Lcom/example/classB; |
193+
| ![Window shadow](check_icon.png){: w="22" h="22" } | Landroid/content/SharedPreferences$Editor;.**putString**:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor; |
194194

195195
##### Spoiler
196196
In the next episode, we will focus on the SAPP UI to better understand what we can achieve along with it that cannot be with Mariana itself. Additionally, we will backtrack on [Step 2](/posts/mariana_trench/#step-2) and [Step 3](/posts/mariana_trench/#step-3) to generate the necessary rules to complete the first challenge of the Ovaa application with minimal effort and without having to go deeper into the source code to spot the issue.

_posts/2023-06-02-mariana_trench_part_3.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 9999-01-01 10:00:00
55
categories: [Mobile Security, Mariana Trench]
66
toc: true
77
author: paoloserra
8-
img_path: /images/mariana-trench/part_3
8+
media_subpath: /images/mariana-trench/part_3
99
image:
1010
path: wallpaper.jpeg
1111
---
@@ -23,4 +23,4 @@ It's time to level up and explore some other features beyond sources and sinks.
2323

2424
- analizzeremo la UI
2525
- minimizzare i falsi positivi usando i filter sulla UI (si può fare concatenando le regole? Forse l'unico modo è con le feature) features in action
26-
- scriveremo la regola per trovare "a flow where data stored in the shared preferences are processed in an HTTP request" e cercheremo di creare una regola unica per identificare l'insieme dei due flow analizzati: input che proviene dal deeplink salvato nelle shared preferences, poi recuperato e mandato in una richiesta http.
26+
- scriveremo la regola per trovare "a flow where data stored in the shared preferences are processed in an HTTP request" e cercheremo di creare una regola unica per identificare l'insieme dei due flow analizzati: input che proviene dal deeplink salvato nelle shared preferences, poi recuperato e mandato in una richiesta http.

_posts/2023-06-02-mobile-security-cordova.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 9999-01-02 10:00:00
55
categories: [Topic, Mobile Security]
66
toc: true
77
author: paoloserra
8-
img_path: /images/mobile-security-fighting-with-frameworks
8+
media_subpath: /images/mobile-security-fighting-with-frameworks
99
image:
1010
path: /cordova/
1111
---
@@ -23,13 +23,13 @@ Episode of [Fighting with Frameworks](/posts/mobile-security-fighting-with-frame
2323

2424
Apache Cordova (aka PhoneGap) is an open-source mobile development framework. It allows you to use standard web technologies - HTML5, CSS3, and JavaScript for cross-platform development. Applications execute within wrappers targeted to each platform and rely on standards-compliant API bindings to access each device's capabilities such as sensors, data, network status, etc. Cordova doesn't offer any UI
2525

26-
| | Cordova |
27-
|:------------------------------|:-----------------------------------------|
28-
|**Code** |HTML, CSS, Javascript |
29-
|**Compilation iOS** |JIT + WKWebView |
30-
|**Compilation Android** |JIT |
31-
|**UI Rendering** |HTML, CSS |
32-
|**UI Engineering** |Code Sharing for the cost of native experience |
26+
| | Cordova |
27+
| :---------------------- | :--------------------------------------------- |
28+
| **Code** | HTML, CSS, Javascript |
29+
| **Compilation iOS** | JIT + WKWebView |
30+
| **Compilation Android** | JIT |
31+
| **UI Rendering** | HTML, CSS |
32+
| **UI Engineering** | Code Sharing for the cost of native experience |
3333

3434
### Detecting app
3535

@@ -49,18 +49,18 @@ Android
4949
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } use ***Bettercap*** to set up an ARP Poisoning attack
5050
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } use ***NoPE Proxy*** (Burp extension) to carry on a DNS Spoofing attack
5151
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } set up an Access Point and connect the iOS device to it
52-
- ![](device_rooted.png){: .shadow width="35" height="35" } use ProxyDroid App
53-
- ![](device_rooted.png){: .shadow width="35" height="35" } in case of client isolation” activated in the Wireless network and the iOS device and your laptop are not able to communicate: use SSH remote port forwarding
52+
- ![](device_rooted.png){: .shadow width="35" height="35" } use **ProxyDroid** app
53+
- ![](device_rooted.png){: .shadow width="35" height="35" } in case of **client isolation** enabled in the network and the iOS device and your laptop are not able to communicate: use SSH remote port forwarding
5454
- ![](device_rooted.png){: .shadow width="35" height="35" } use the `/etc/hosts`{: .filepath} file to make the target domain point to the IP address of your interception proxy.
5555

5656

5757
iOS
5858
: - ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } use the local proxy settings (WiFi settings)
59-
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } set up a VPN Server and implement the IPTables rules to forward all incoming traffic on 80 and 443 ports to the proxy host and port. Lastly, download OpenVPN Client on the device
59+
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } set up a VPN Server and implement the IPTables rules to forward all incoming traffic on 80 and 443 ports to the proxy host and port. Lastly, download OpenVPN Client on the device.
6060
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } use ***Bettercap*** to set up an ARP Poisoning attack
6161
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } use ***NoPE Proxy*** (Burp extension) to carry on a DNS Spoofing attack
6262
- ![](device_rooted.png){: .shadow width="35" height="35" } ![](device.png){: .shadow width="35" height="35" } set up an Access Point and connect the iOS device to it
63-
- ![](device_rooted.png){: .shadow width="35" height="35" } in case of client isolation” activated in the Wireless network and the iOS device and your laptop are not able to communicate: use SSH remote port forwarding
63+
- ![](device_rooted.png){: .shadow width="35" height="35" } in case of **client isolation** enabled in the network and the iOS device and your laptop are not able to communicate: use SSH remote port forwarding
6464
- ![](device_rooted.png){: .shadow width="35" height="35" } use the `/etc/hosts`{: .filepath} file to make the target domain point to the IP address of your interception proxy.
6565

6666

@@ -91,4 +91,4 @@ iOS
9191
---
9292
## References
9393

94-
- [https://ionic.io/resources/articles/what-is-apache-cordova](https://ionic.io/resources/articles/what-is-apache-cordova)
94+
- [https://ionic.io/resources/articles/what-is-apache-cordova](https://ionic.io/resources/articles/what-is-apache-cordova)

0 commit comments

Comments
 (0)