Skip to content

Commit 67f9c47

Browse files
carlospolopgitbook-bot
authored andcommitted
GitBook: [master] one page modified
1 parent cf6e142 commit 67f9c47

File tree

1 file changed

+16
-3
lines changed
  • macos/macos-security-and-privilege-escalation

1 file changed

+16
-3
lines changed

macos/macos-security-and-privilege-escalation/README.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ List the cron jobs of the **current user** with:
296296
crontab -l
297297
```
298298

299-
You can also see all the cron jobs of the users in **`/usr/lib/cron/tabs/`** \(needs root\).
299+
You can also see all the cron jobs of the users in **`/usr/lib/cron/tabs/`** and **`/var/at/tabs/`** \(needs root\).
300300

301301
### kext
302302

@@ -333,9 +333,10 @@ osascript -e 'tell application "System Events" to make login item at end with pr
333333

334334
#Remove an item:
335335
osascript -e 'tell application "System Events" to delete login item "itemname"'
336-
337336
```
338337

338+
These items are stored in the file /Users/<username>/Library/Application Support/com.apple.backgroundtaskmanagementagent
339+
339340
### At
340341

341342
“At tasks” are used to **schedule tasks at specific times**.
@@ -649,7 +650,7 @@ However, there are 2 types of dylib hijacking:
649650

650651
The way to **escalate privileges** abusing this functionality would be in the rare case that an **application** being executed **by** **root** is **looking** for some **library in some folder where the attacker has write permissions.**
651652

652-
**A nice scanner to find missing libraries in applications is** [**Dylib Hijack Scanner**](https://objective-see.com/products/dhs.html)**.
653+
**A nice scanner to find missing libraries in applications is** [**Dylib Hijack Scanner**](https://objective-see.com/products/dhs.html) **or a** [**CLI version**](https://github.com/pandazheng/DylibHijack)**.
653654
A nice report with technical details about this technique can be found** [**here**](https://www.virusbulletin.com/virusbulletin/2015/03/dylib-hijacking-os-x)**.**
654655

655656
### **DYLD\_INSERT\_LIBRARIES**
@@ -660,6 +661,14 @@ This is like the [**LD\_PRELOAD on Linux**](../../linux-unix/privilege-escalatio
660661

661662
This technique may be also **used as an ASEP technique** as every application installed has a plist called "Info.plist" that allows for the **assigning of environmental variables** using a key called `LSEnvironmental`.
662663

664+
{% hint style="info" %}
665+
Since 2012 when [OSX.FlashBack.B](https://www.f-secure.com/v-descs/trojan-downloader_osx_flashback_b.shtml) \[22\] abused this technique, **Apple has drastically reduced the “power”** of the DYLD\_INSERT\_LIBRARIES.
666+
667+
For example the dynamic loader \(dyld\) ignores the DYLD\_INSERT\_LIBRARIES environment variable in a wide range of cases, such as setuid and platform binaries. And, starting with macOS Catalina, only 3rd-party applications that are not compiled with the hardened runtime \(which “protects the runtime integrity of software” \[22\]\), or have an exception such as the com.apple.security.cs.allow-dyld-environment-variables entitlement\) are susceptible to dylib insertions.
668+
669+
For more details on the security features afforded by the hardened runtime, see Apple’s documentation: “[Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime)
670+
{% endhint %}
671+
663672
## Crons
664673

665674
In MacOS several folders executing scripts with **certain frequency** can be found in:
@@ -747,3 +756,7 @@ networksetup -getwebproxy Wi-Fi #Wifi Web proxy
747756
networksetup -getftpproxy Wi-Fi #Wifi ftp proxy
748757
```
749758

759+
## References
760+
761+
* [https://taomm.org/vol1/analysis.html](https://taomm.org/vol1/analysis.html)
762+

0 commit comments

Comments
 (0)