You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing/README.md
You can [**download disarm from here**](https://newosxbook.com/tools/disarm.html).
30
30
31
+
> [!TIP]
32
+
> Note that **`disarm`** can work also with compressed IM4P files (like `kernelcache`) and extract only required parts or even analyze the required part without extracting it.
33
+
31
34
```bash
35
+
export JCOLOR=1
32
36
ARCH=arm64e disarm -c -i -I --signature /path/bin # Get bin info and signature
33
37
ARCH=arm64e disarm -c -l /path/bin # Get binary sections
Copy file name to clipboardExpand all lines: src/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-code-signing.md
+41-6Lines changed: 41 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Mach-o binaries contains a load command called **`LC_CODE_SIGNATURE`** that indi
The magic header of the Code Signature is **`0xFADE0CC0`**. Then you have information such as the length and the number of blobs of the superBlob that contains them.\
16
+
The magic header of the Code Signature is **`0xFADE0CC0`** (embedded code signature) or **`0xFADE0CC1`** (detached code signature). Then you have information such as the length and the number of blobs of the superBlob that contains them.\
17
17
It's possible to find this information in the [source code here](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/osfmk/kern/cs_blobs.h#L276):
18
18
19
19
```c
@@ -112,6 +112,8 @@ __attribute__ ((aligned(1)));
112
112
113
113
Note that there are different versions of this struct where old ones might contain less information.
114
114
115
+
Note that the Code directory can use any hashing algorithm. At the moment, the most common one is **SHA256** (indicated by the value 2 in the field `hashType`) but in the future if this hash is broken, Apple could start using a different one.
116
+
115
117
## Signing Code Pages
116
118
117
119
Hashing the full binary would be inefficient and even useless if when it's only loaded in memory partially. Therefore, the code signature is actually a hash of hashes where each binary page is hashed individually.\
#Note that the last pages might not coincide because the binary didn't signed the signatura that it was calculating but the real size of the binary.
154
189
```
155
190
156
191
## Entitlements Blob
@@ -307,7 +342,10 @@ The **kernel** is the one that **checks the code signature** before allowing the
307
342
308
343
## `cs_blobs` & `cs_blob`
309
344
310
-
[**cs_blob**](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/ubc_internal.h#L106) struct contains the information about the entitlement of the running process on it. `csb_platform_binary` also informs if the application is a platform binary (which is checked in different moments by the OS to apply security mechanisms like to protect the SEND rights to the task ports of these processes).
345
+
[**cs_blob**](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/ubc_internal.h#L106) struct contains the information about the entitlement of the running process on it. `csb_platform_binary` also informs if the application is a **platform binary** (which is checked in different moments by the OS to apply security mechanisms like to protect the SEND rights to the task ports of these processes).
346
+
347
+
> [!WARNING]
348
+
> Note that several security measures depend on the binary being a platform binary, so way to escalate privileges is to **make the binary a platform binary** (for example, by re-signing it with a certificate that allows it).
Copy file name to clipboardExpand all lines: src/macos-hardening/macos-security-and-privilege-escalation/macos-security-protections/macos-dangerous-entitlements.md
> Note that entitlements starting with **`com.apple`** are not available to third-parties, only Apple can grant them.
6
+
> Note that entitlements starting with **`com.apple`** are not available to third-parties, only Apple can grant them... Or if you are using an enterprise certificate you could create your own entitlements starting with **`com.apple`** actually and bypass protections based on this.
7
7
8
8
## High
9
9
@@ -123,6 +123,10 @@ It's possible to check who has this access in _System Settings_ > _Privacy & Sec
123
123
124
124
The process will be able to **abuse the macOS accessibility features**, Which means that for example he will be able to press keystrokes. SO he could request access to control an app like Finder and approve the dialog with this permission.
125
125
126
+
## Trustcache/CDhash related entitlements
127
+
128
+
There are some entitlements that could be used to bypass Trustcache/CDhash protections, which prevent the execution of downgraded versions of Apple binaries.
0 commit comments