Skip to content

Commit 10a3b64

Browse files
committed
a
1 parent 79b8004 commit 10a3b64

File tree

117 files changed

+1209
-2479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1209
-2479
lines changed

mobile-pentesting/android-app-pentesting/README.md

Lines changed: 77 additions & 102 deletions
Large diffs are not rendered by default.

mobile-pentesting/android-app-pentesting/drozer-tutorial/README.md

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Other ways to support HackTricks:
2525
* [Sieve](https://github.com/mwrlabs/drozer/releases/download/2.3.4/sieve.apk) (from mrwlabs)
2626
* [DIVA](https://payatu.com/wp-content/uploads/2016/01/diva-beta.tar.gz)
2727

28+
29+
**Parts of this tutorial were extracted from the [Drozer documentation pdf](https://labs.withsecure.com/content/dam/labs/docs/mwri-drozer-user-guide-2015-03-23.pdf).**
30+
2831
## Installation
2932

3033
Install Drozer Client inside your host. Download it from the [latest releases](https://github.com/mwrlabs/drozer/releases).
@@ -37,15 +40,15 @@ pip install service_identity
3740

3841
Download and install drozer APK from the [latest releases](https://github.com/mwrlabs/drozer/releases). At this moment it is [this](https://github.com/mwrlabs/drozer/releases/download/2.3.4/drozer-agent-2.3.4.apk).
3942

40-
```
43+
```bash
4144
adb install drozer.apk
4245
```
4346

4447
### Starting the Server
4548

4649
Agent is running on port 31415, we need to [port forward](https://en.wikipedia.org/wiki/Port\_forwarding) to establish the communication between the Drozer Client and Agent, here is the command to do so:
4750

48-
```
51+
```bash
4952
adb forward tcp:31415 tcp:31415
5053
```
5154

@@ -55,7 +58,7 @@ Finally, **launch** the **application** and press the bottom "**ON**"
5558

5659
And connect to it:
5760

58-
```
61+
```bash
5962
drozer console connect
6063
```
6164

@@ -80,14 +83,14 @@ drozer console connect
8083

8184
Find the **name** of the package filtering by part of the name:
8285

83-
```
86+
```bash
8487
dz> run app.package.list -f sieve
8588
com.mwr.example.sieve
8689
```
8790

8891
**Basic Information** of the package:
8992

90-
```
93+
```bash
9194
dz> run app.package.info -a com.mwr.example.sieve
9295
Package: com.mwr.example.sieve
9396
Process Name: com.mwr.example.sieve
@@ -109,13 +112,13 @@ Defines Permissions:
109112

110113
Read **Manifest**:
111114

112-
```
115+
```bash
113116
run app.package.manifest jakhar.aseem.diva
114117
```
115118

116119
**Attack surface** of the package:
117120

118-
```
121+
```bash
119122
dz> run app.package.attacksurface com.mwr.example.sieve
120123
Attack Surface:
121124
3 activities exported
@@ -199,7 +202,7 @@ Package: com.mwr.example.sieve
199202

200203
#### **Interact** with a service
201204

202-
```
205+
```bash
203206
app.service.send Send a Message to a service, and display the reply
204207
app.service.start Start Service
205208
app.service.stop Stop Service
@@ -221,30 +224,15 @@ In the following example:
221224
* `arg2 == 1`
222225
* `replyTo == object(string com.mwr.example.sieve.PIN 1337)`
223226

224-
```
227+
```bash
225228
run app.service.send com.mwr.example.sieve com.mwr.example.sieve.AuthService --msg 2354 9234 1 --extra string com.mwr.example.sieve.PIN 1337 --bundle-as-obj
226229
```
227230

228231
![](<../../../.gitbook/assets/image (195).png>)
229232

230233
### Broadcast Receivers
231234

232-
Android apps can send or receive broadcast messages from the Android system and other Android apps, similar to the [publish-subscribe](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe\_pattern) design pattern. These broadcasts are sent when an event of interest occurs. For example, the Android system sends broadcasts when various system events occur, such as when the system boots up or the device starts charging. Apps can also send custom broadcasts, for example, to notify other apps of something that they might be interested in (for example, some new data has been downloaded).
233-
234-
Apps can register to receive specific broadcasts. When a broadcast is sent, the system automatically routes broadcasts to apps that have subscribed to receive that particular type of broadcast.
235-
236-
This could appear inside the Manifest.xml file:
237-
238-
```markup
239-
<receiver android:name=".MyBroadcastReceiver" android:exported="true">
240-
<intent-filter>
241-
<action android:name="android.intent.action.BOOT_COMPLETED"/>
242-
<action android:name="android.intent.action.INPUT_METHOD_CHANGED" />
243-
</intent-filter>
244-
</receiver>
245-
```
246-
247-
From: [https://developer.android.com/guide/components/broadcasts](https://developer.android.com/guide/components/broadcasts)
235+
**In the Android basic info section you can see what is a Broadcast Receiver**.
248236

249237
After discovering this Broadcast Receivers you should **check the code** of them. Pay special attention to the **`onReceive`** function as it will be handling the messages received.
250238

@@ -279,7 +267,7 @@ Package: com.google.android.youtube
279267

280268
#### Broadcast **Interactions**
281269

282-
```
270+
```bash
283271
app.broadcast.info Get information about broadcast receivers
284272
app.broadcast.send Send broadcast using an intent
285273
app.broadcast.sniff Register a broadcast receiver that can sniff particular intents
@@ -295,7 +283,7 @@ In this example abusing the [FourGoats apk](https://github.com/linkedin/qark/blo
295283

296284
If you read the code, the parameters "_phoneNumber_" and "_message_" must be sent to the Content Provider.
297285

298-
```
286+
```bash
299287
run app.broadcast.send --action org.owasp.goatdroid.fourgoats.SOCIAL_SMS --component org.owasp.goatdroid.fourgoats.broadcastreceivers SendSMSNowReceiver --extra string phoneNumber 123456789 --extra string message "Hello mate!"
300288
```
301289

@@ -306,7 +294,7 @@ This mean that you can **attach java debugger** to the running application, insp
306294

307295
When an application is debuggable, it will appear in the Manifest:
308296

309-
```html
297+
```xml
310298
<application theme="@2131296387" debuggable="true"
311299
```
312300

mobile-pentesting/android-app-pentesting/drozer-tutorial/exploiting-content-providers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ Other ways to support HackTricks:
1818

1919
## Intro
2020

21-
A content provider component **supplies data from one application to others** on request. Such requests are handled by the methods of the ContentResolver class. A content provider can use different ways to store its data and the data can be **stored** in a **database**, in **files**, or even over a **network**.
21+
Data is **supplied from one application to others** on request by a component known as a **content provider**. These requests are managed through the **ContentResolver class** methods. Content providers can store their data in various locations, such as a **database**, **files**, or over a **network**.
2222

23-
It has to be declared inside the _Manifest.xml_ file. Example:
23+
In the _Manifest.xml_ file, the declaration of the content provider is required. For instance:
2424

25-
```markup
25+
```xml
2626
<provider android:name=".DBContentProvider" android:exported="true" android:multiprocess="true" android:authorities="com.mwr.example.sieve.DBContentProvider">
2727
<path-permission android:readPermission="com.mwr.example.sieve.READ_KEYS" android:writePermission="com.mwr.example.sieve.WRITE_KEYS" android:path="/Keys"/>
2828
</provider>
2929
```
3030

31-
In this case, it's necessary the permission `READ_KEYS` to access `content://com.mwr.example.sieve.DBContentProvider/Keys`\
32-
(_Also, notice that in the next section we are going to access `/Keys/` which isn't protected, that's because the developer got confused and protected `/Keys` but declared `/Keys/`_)
31+
To access `content://com.mwr.example.sieve.DBContentProvider/Keys`, the `READ_KEYS` permission is necessary. It's interesting to note that the path `/Keys/` is accessible in the following section, which is not protected due to a mistake by the developer, who secured `/Keys` but declared `/Keys/`.
3332

3433
**Maybe you can access private data or exploit some vulnerability (SQL Injection or Path Traversal).**
3534

@@ -57,7 +56,7 @@ dz> run app.provider.info -a com.mwr.example.sieve
5756
Grant Uri Permissions: False
5857
```
5958

60-
We can **reconstruct** part of the content **URIs** to access the **DBContentProvider**, because we know that they must begin with “_content://_ and the information obtained by Drozer inside Path: _/Keys_.
59+
It's possible to piece together how to reach the **DBContentProvider** by starting URIs with “_content://_. This approach is based on insights gained from using Drozer, where key information was located in the _/Keys_ directory.
6160

6261
Drozer can **guess and try several URIs**:
6362

@@ -210,6 +209,7 @@ Vulnerable Providers:
210209

211210
* [https://www.tutorialspoint.com/android/android\_content\_providers.htm](https://www.tutorialspoint.com/android/android\_content\_providers.htm)
212211
* [https://manifestsecurity.com/android-application-security-part-15/](https://manifestsecurity.com/android-application-security-part-15/)
212+
* [https://labs.withsecure.com/content/dam/labs/docs/mwri-drozer-user-guide-2015-03-23.pdf](https://labs.withsecure.com/content/dam/labs/docs/mwri-drozer-user-guide-2015-03-23.pdf)
213213

214214
<details>
215215

mobile-pentesting/android-app-pentesting/frida-tutorial/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,25 @@ frida-ps -U | grep -i <part_of_the_package_name> #Get all the package name
5353
**APK**: [https://github.com/t0thkr1s/frida-demo/releases](https://github.com/t0thkr1s/frida-demo/releases)\
5454
**Source Code**: [https://github.com/t0thkr1s/frida-demo](https://github.com/t0thkr1s/frida-demo)
5555

56-
Follow the [link to read it](frida-tutorial-1.md).
56+
**Follow the [link to read it](frida-tutorial-1.md).**
5757

5858
### [Tutorial 2](frida-tutorial-2.md)
5959

6060
**From**: [https://11x256.github.io/Frida-hooking-android-part-2/](https://11x256.github.io/Frida-hooking-android-part-2/) (Parts 2, 3 & 4)\
6161
**APKs and Source code**: [https://github.com/11x256/frida-android-examples](https://github.com/11x256/frida-android-examples)
6262

63-
Follow the[ link to read it.](frida-tutorial-2.md)
63+
**Follow the[ link to read it.](frida-tutorial-2.md)**
6464

6565
### [Tutorial 3](owaspuncrackable-1.md)
6666

6767
**From**: [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)\
6868
**APK**: [https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk](https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk)
6969

70-
Follow the [link to read it](owaspuncrackable-1.md).\
71-
**You can find some Awesome Frida scripts here:** [**https://codeshare.frida.re/**](https://codeshare.frida.re)
70+
**Follow the [link to read it](owaspuncrackable-1.md).**
7271

73-
## Fast Examples
72+
**You can find more Awesome Frida scripts here:** [**https://codeshare.frida.re/**](https://codeshare.frida.re)
7473

75-
Here you can find the more basic and interesting functionalities of Frida to make a quick script:
74+
## Quick Examples
7675

7776
### Calling Frida from command line
7877

mobile-pentesting/android-app-pentesting/frida-tutorial/frida-tutorial-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you are interested in **hacking career** and hack the unhackable - **we are h
2020

2121
{% embed url="https://www.stmcyber.com/careers" %}
2222

23-
**From**: [https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1](https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1)\
23+
**This is a summary of the post**: [https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1](https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1)\
2424
**APK**: [https://github.com/t0thkr1s/frida-demo/releases](https://github.com/t0thkr1s/frida-demo/releases)\
2525
**Source Code**: [https://github.com/t0thkr1s/frida-demo](https://github.com/t0thkr1s/frida-demo)
2626

mobile-pentesting/android-app-pentesting/frida-tutorial/frida-tutorial-2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
88
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
99
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
10-
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** **🐦**[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
10+
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
1111
* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
1212

1313
</details>
@@ -20,7 +20,7 @@
2020

2121

2222

23-
**From**: [https://11x256.github.io/Frida-hooking-android-part-2/](https://11x256.github.io/Frida-hooking-android-part-2/) (Parts 2, 3 & 4)\
23+
**This is a summary of the post**: [https://11x256.github.io/Frida-hooking-android-part-2/](https://11x256.github.io/Frida-hooking-android-part-2/) (Parts 2, 3 & 4)\
2424
**APKs and Source code**: [https://github.com/11x256/frida-android-examples](https://github.com/11x256/frida-android-examples)
2525

2626
The part 1 is so easy.
@@ -249,7 +249,7 @@ If you are interested in **hacking career** and hack the unhackable - **we are h
249249
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
250250
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
251251
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
252-
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** **🐦**[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
252+
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
253253
* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
254254

255255
</details>

mobile-pentesting/android-app-pentesting/frida-tutorial/objection-tutorial.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ Other ways to support HackTricks:
2222

2323
## **Introduction**
2424

25-
[![objection](https://github.com/sensepost/objection/raw/master/images/objection.png)](https://github.com/sensepost/objection)
26-
2725
**objection - Runtime Mobile Exploration**
2826

29-
`objection` is a runtime mobile exploration toolkit, powered by [Frida](https://www.frida.re). It was built with the aim of helping assess mobile applications and their security posture without the need for a jailbroken or rooted mobile device.
27+
**[Objection](https://github.com/sensepost/objection)** is a runtime mobile exploration toolkit, powered by [Frida](https://www.frida.re). It was built with the aim of helping assess mobile applications and their security posture without the need for a jailbroken or rooted mobile device.
3028

3129
**Note:** This is not some form of jailbreak / root bypass. By using `objection`, you are still limited by all of the restrictions imposed by the applicable sandbox you are facing.
3230

@@ -128,13 +126,13 @@ This is also usefull if somehow you are **unable to get some readable source cod
128126

129127
#### List activities, receivers and services
130128

131-
```
129+
```bash
132130
android hooking list activities
133131
```
134132

135133
![](<../../../.gitbook/assets/image (78).png>)
136134

137-
```
135+
```bash
138136
android hooking list services
139137
android hooking list receivers
140138
```
@@ -143,7 +141,7 @@ Frida will launch an error if none is found
143141

144142
#### Getting current activity
145143

146-
```
144+
```bash
147145
android hooking get current_activity
148146
```
149147

@@ -153,7 +151,7 @@ android hooking get current_activity
153151

154152
Lets start looking for classes inside our application
155153

156-
```
154+
```bash
157155
android hooking search classes asvid.github.io.fridaapp
158156
```
159157

@@ -163,7 +161,7 @@ android hooking search classes asvid.github.io.fridaapp
163161

164162
Now lets extract the methods inside the class _MainActivity:_
165163

166-
```
164+
```bash
167165
android hooking search methods asvid.github.io.fridaapp MainActivity
168166
```
169167

@@ -173,7 +171,7 @@ android hooking search methods asvid.github.io.fridaapp MainActivity
173171

174172
Lets figure out wich parameters does the methods of the class need:
175173

176-
```
174+
```bash
177175
android hooking list class_methods asvid.github.io.fridaapp.MainActivity
178176
```
179177

@@ -183,7 +181,7 @@ android hooking list class_methods asvid.github.io.fridaapp.MainActivity
183181

184182
You could also list all the classes that were loaded inside the current applicatoin:
185183

186-
```
184+
```bash
187185
android hooking list classes #List all loaded classes, As the target application gets usedmore, this command will return more classes.
188186
```
189187

@@ -195,7 +193,7 @@ This is very useful if you want to **hook the method of a class and you only kno
195193

196194
From the [source code](https://github.com/asvid/FridaApp/blob/master/app/src/main/java/asvid/github/io/fridaapp/MainActivity.kt) 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):
197195

198-
```
196+
```bash
199197
android hooking watch class_method asvid.github.io.fridaapp.MainActivity.sum --dump-args --dump-backtrace --dump-return
200198
```
201199

@@ -205,7 +203,7 @@ android hooking watch class_method asvid.github.io.fridaapp.MainActivity.sum --d
205203

206204
Actually I find all the methods of the class MainActivity really interesting, lets **hook them all**. Be careful, this could **crash** an application.
207205

208-
```
206+
```bash
209207
android hooking watch class asvid.github.io.fridaapp.MainActivity --dump-args --dump-return
210208
```
211209

@@ -237,7 +235,7 @@ android heap print_instances <class>
237235

238236
You can play with the keystore and intents using:
239237

240-
```
238+
```bash
241239
android keystore list
242240
android intents launch_activity
243241
android intent launch_service
@@ -254,7 +252,7 @@ memory dump from_base <base_address> <size_to_dump> <local_destination> #Dump a
254252

255253
#### List
256254

257-
```
255+
```bash
258256
memory list modules
259257
```
260258

@@ -272,7 +270,7 @@ Lets checks what is frida exporting:
272270

273271
You can alse search and write inside memory with objection:
274272

275-
```
273+
```bash
276274
memory search "<pattern eg: 41 41 41 ?? 41>" (--string) (--offsets-only)
277275
memory write "<address>" "<pattern eg: 41 41 41 41>" (--string)
278276
```
@@ -283,7 +281,7 @@ You cals can use the command `sqlite` to interact with sqlite databases.
283281

284282
### Exit
285283

286-
```
284+
```bash
287285
exit
288286
```
289287

mobile-pentesting/android-app-pentesting/frida-tutorial/owaspuncrackable-1.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ Other ways to support HackTricks:
2020

2121
{% embed url="https://www.stmcyber.com/careers" %}
2222

23-
\\
24-
2523
***
2624

27-
**From**: [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)\
25+
**This is a summary of the post**: [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)\
2826
**APK**: [https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk](https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk)
2927

3028
## Solution 1

0 commit comments

Comments
 (0)