Skip to content

Commit 4e74715

Browse files
carlospolopgitbook-bot
authored andcommitted
GITBOOK-4115: change request with no subject merged in GitBook
1 parent 06502cc commit 4e74715

File tree

8 files changed

+134
-10
lines changed

8 files changed

+134
-10
lines changed

SUMMARY.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,13 @@
313313
* [Webview Attacks](mobile-pentesting/android-app-pentesting/webview-attacks.md)
314314
* [iOS Pentesting Checklist](mobile-pentesting/ios-pentesting-checklist.md)
315315
* [iOS Pentesting](mobile-pentesting/ios-pentesting/README.md)
316-
* [Basic iOS Testing Operations](mobile-pentesting/ios-pentesting/basic-ios-testing-operations.md)
317-
* [Burp Suite Configuration for iOS](mobile-pentesting/ios-pentesting/burp-configuration-for-ios.md)
318-
* [Extracting Entitlements From Compiled Application](mobile-pentesting/ios-pentesting/extracting-entitlements-from-compiled-application.md)
319-
* [Frida Configuration in iOS](mobile-pentesting/ios-pentesting/frida-configuration-in-ios.md)
320316
* [iOS App Extensions](mobile-pentesting/ios-pentesting/ios-app-extensions.md)
321317
* [iOS Basics](mobile-pentesting/ios-pentesting/ios-basics.md)
318+
* [iOS Basic Testing Operations](mobile-pentesting/ios-pentesting/basic-ios-testing-operations.md)
319+
* [iOS Burp Suite Configuration](mobile-pentesting/ios-pentesting/burp-configuration-for-ios.md)
322320
* [iOS Custom URI Handlers / Deeplinks / Custom Schemes](mobile-pentesting/ios-pentesting/ios-custom-uri-handlers-deeplinks-custom-schemes.md)
321+
* [iOS Extracting Entitlements From Compiled Application](mobile-pentesting/ios-pentesting/extracting-entitlements-from-compiled-application.md)
322+
* [iOS Frida Configuration](mobile-pentesting/ios-pentesting/frida-configuration-in-ios.md)
323323
* [iOS Hooking With Objection](mobile-pentesting/ios-pentesting/ios-hooking-with-objection.md)
324324
* [iOS Protocol Handlers](mobile-pentesting/ios-pentesting/ios-protocol-handlers.md)
325325
* [iOS Serialisation and Encoding](mobile-pentesting/ios-pentesting/ios-serialisation-and-encoding.md)

macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ LC 01: LC_SEGMENT_64 Mem: 0x100000000-0x100028000 __TEXT
165165

166166
You can find further information about the [**information stored in these section in this blog post**](https://knight.sc/reverse%20engineering/2019/07/17/swift-metadata.html).
167167

168+
Moreover, **Swift binaries might have symbols** (for example libraries need to store symbols so its functions can be called). The **symbols usually have the info about the function name** and attr in a ugly way, so they are very useful and there are "**demanglers"** that can get the original name:
169+
170+
```bash
171+
# Ghidra plugin
172+
https://github.com/ghidraninja/ghidra_scripts/blob/master/swift_demangler.py
173+
174+
# Swift cli
175+
swift demangle
176+
```
177+
168178
### Packed binaries
169179

170180
* Check for high entropy

macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/arm64-basic-assembly.md

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ The ARM64 calling convention specifies that the **first eight parameters** to a
3939

4040
When reading a function in assembly, look for the **function prologue and epilogue**. The **prologue** usually involves **saving the frame pointer (`x29`)**, **setting** up a **new frame pointer**, and a**llocating stack space**. The **epilogue** usually involves **restoring the saved frame pointer** and **returning** from the function.
4141

42+
### Calling Convention in Swift
43+
44+
Swift have its own **calling convention** that can be found in [**https://github.com/apple/swift/blob/main/docs/ABI/CallConvSummary.rst#arm64**](https://github.com/apple/swift/blob/main/docs/ABI/CallConvSummary.rst#arm64)
45+
4246
### **Common Instructions**
4347

4448
ARM64 instructions generally have the **format `opcode dst, src1, src2`**, where **`opcode`** is the **operation** to be performed (such as `add`, `sub`, `mov`, etc.), **`dst`** is the **destination** register where the result will be stored, and **`src1`** and **`src2`** are the **source** registers. Immediate values can also be used in place of source registers.

macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/introduction-to-x64.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ The x64 calling convention varies between operating systems. For instance:
3838

3939
If the function has more than six inputs, the **rest will be passed on the stack**. **RSP**, the stack pointer, has to be **16 bytes aligned**, which means that the address it points to must be divisible by 16 before any call happens. This means that normally we would need to ensure that RSP is properly aligned in our shellcode before we make a function call. However, in practice, system calls work many times even if this requirement is not met.
4040

41+
### Calling Convention in Swift
42+
43+
Swift have its own **calling convention** that can be found in [**https://github.com/apple/swift/blob/main/docs/ABI/CallConvSummary.rst#x86-64**](https://github.com/apple/swift/blob/main/docs/ABI/CallConvSummary.rst#x86-64)
44+
4145
### **Common Instructions**
4246

4347
x64 instructions have a rich set, maintaining compatibility with earlier x86 instructions and introducing new ones.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
</details>
1414

15-
<img src="../../../.gitbook/assets/i3.png" alt="" data-size="original">
15+
<figure><img src="../../../.gitbook/assets/i3.png" alt=""><figcaption></figcaption></figure>
1616

1717
**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!
1818

@@ -208,7 +208,7 @@ Java.choose("com.example.a11x256.frida_test.my_activity" , {
208208
});
209209
```
210210
211-
<img src="../../../.gitbook/assets/i3.png" alt="" data-size="original">
211+
<figure><img src="../../../.gitbook/assets/i3.png" alt=""><figcaption></figcaption></figure>
212212
213213
**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!
214214

mobile-pentesting/ios-pentesting/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,19 @@ DocumentDirectory /var/mobile/Containers/Data/Application/8C8E7EB0-BC9B-435B-8E
230230
LibraryDirectory /var/mobile/Containers/Data/Application/8C8E7EB0-BC9B-435B-8EF8-8F5560EB0693/Library
231231
```
232232

233+
You could also search for the app name inside **`/private/var/containers`**:
234+
235+
```bash
236+
find /private/var/containers -name "Progname*"
237+
```
238+
239+
Or using **`ps`** and **`lsof`**:
240+
241+
```bash
242+
ps -ef | grep -i <app-name>
243+
lsof -p <pid> | grep -i "/containers" | head -n 1
244+
```
245+
233246
As you can see, apps have two main locations:
234247

235248
* The **Bundle** **directory** (`/var/containers/Bundle/Application/3ADAF47D-A734-49FA-B274-FBCA66589E67/`).

mobile-pentesting/ios-pentesting/basic-ios-testing-operations.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Basic iOS Testing Operations
1+
# iOS Basic Testing Operations
22

33
<details>
44

@@ -347,6 +347,14 @@ flexdump list #List apps
347347
flexdump dump Twitter.app #Create .ipa file from app
348348
```
349349

350+
#### bagbak
351+
352+
Yet another frida based App decryptor. Requires jailbroken iOS device and [frida.re](https://www.frida.re/)
353+
354+
```bash
355+
bagbak --raw Chrome
356+
```
357+
350358
#### r2flutch
351359

352360
[**r2flutch**](https://github.com/as0ler/r2flutch) is a tool that uses **radare** and **frida** to **decrypt** and **dump ios apps>**

mobile-pentesting/ios-pentesting/frida-configuration-in-ios.md

+88-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Frida Configuration in iOS
1+
# iOS Frida Configuration
22

33
<details>
44

@@ -14,16 +14,101 @@
1414

1515
## Installing Frida
1616

17-
Go to **Cydia** app and add Frida’s repository by going to **Manage -> Sources -> Edit -> Add** and enter [**https://build.frida.re** ](https://build.frida.re). It will add a new source in the source list. Go to the **frida** **source**, now you should **install** the **Frida** package.
17+
Go to **Cydia/Sileo** app in your Jailbroken device and add Frida’s repository by going to **Manage -> Sources -> Edit -> Add** and enter [**https://build.frida.re** ](https://build.frida.re). It will add a new source in the source list. Go to the F**rida** **source**, now you should **install** the **Frida** package.
1818

1919
![](https://miro.medium.com/max/614/0\*qSD26kBtgt\_UIZk1.png)
2020

21-
After installed, you can use in your PC the command `frida-ls-devices` and check that the device appears (your PC needs to be able to access it). Execute also `frida-ps -Uia` to check the running processes of the phone.
21+
If you are using **Corellium** you will need to download the Frida release from [https://github.com/frida/frida/releases](https://github.com/frida/frida/releases) (`frida-gadget-[yourversion]-ios-universal.dylib.gz`) and unpack and copy to the dylib location Frida asks for, e.g.: `/Users/[youruser]/.cache/frida/gadget-ios.dylib`
22+
23+
After installed, you can use in your PC the command **`frida-ls-devices`** and check that the device appears (your PC needs to be able to access it).\
24+
Execute also **`frida-ps -Uia`** to check the running processes of the phone.
2225

2326
## Frida without Jailbroken device & without patching the app
2427

2528
Check this blog post about how to use Frida in non-jailbroken devices without patching the app: [https://mrbypass.medium.com/unlocking-potential-exploring-frida-objection-on-non-jailbroken-devices-without-application-ed0367a84f07](https://mrbypass.medium.com/unlocking-potential-exploring-frida-objection-on-non-jailbroken-devices-without-application-ed0367a84f07)
2629

30+
## Frida Client Installation
31+
32+
Install **frida tools**:
33+
34+
```bash
35+
pip install frida-tools
36+
pip install frida
37+
```
38+
39+
With the Frida server installed and the device running and connected, **check** if the client is **working**:
40+
41+
```bash
42+
frida-ls-devices # List devices
43+
frida-ps -Uia # Get running processes
44+
```
45+
46+
## Frida Trace
47+
48+
```bash
49+
# Trace all methods of all classes
50+
frida-trace -U <program> -m "*[* *]"
51+
52+
# Trace all methods with the word "authentication" from classes that start with "NE"
53+
frida-trace -U <program> -m "*[NE* *authentication*]"
54+
```
55+
56+
### Get all classes and methods
57+
58+
* Get **all** available **classes** (filter by string)
59+
60+
{% code title="/tmp/script.js" %}
61+
```javascript
62+
// frida -U <program> -l /tmp/script.js
63+
64+
var filterClass = "filterstring";
65+
66+
if (ObjC.available) {
67+
for (var className in ObjC.classes) {
68+
if (ObjC.classes.hasOwnProperty(className)) {
69+
if (!filterClass || className.includes(filterClass)) {
70+
console.log(className);
71+
}
72+
}
73+
}
74+
} else {
75+
console.log("Objective-C runtime is not available.");
76+
}
77+
```
78+
{% endcode %}
79+
80+
* Get **all** **methods** of a **class** (filter by string)
81+
82+
{% code title="/tmp/script.js" %}
83+
```javascript
84+
// frida -U <program> -l /tmp/script.js
85+
86+
var specificClass = "YourClassName";
87+
var filterMethod = "filtermethod";
88+
89+
if (ObjC.available) {
90+
if (ObjC.classes.hasOwnProperty(specificClass)) {
91+
var methods = ObjC.classes[specificClass].$ownMethods;
92+
for (var i = 0; i < methods.length; i++) {
93+
if (!filterMethod || methods[i].includes(filterClass)) {
94+
console.log(specificClass + ': ' + methods[i]);
95+
}
96+
}
97+
} else {
98+
console.log("Class not found.");
99+
}
100+
} else {
101+
console.log("Objective-C runtime is not available.");
102+
}
103+
```
104+
{% endcode %}
105+
106+
## Frida Android Tutorials
107+
108+
{% content-ref url="../android-app-pentesting/frida-tutorial/" %}
109+
[frida-tutorial](../android-app-pentesting/frida-tutorial/)
110+
{% endcontent-ref %}
111+
27112
<details>
28113

29114
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>

0 commit comments

Comments
 (0)