mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-25 14:10:41 +00:00
GITBOOK-3960: change request with no subject merged in GitBook
This commit is contained in:
parent
b94077922e
commit
0afe4e4475
13 changed files with 411 additions and 329 deletions
15
SUMMARY.md
15
SUMMARY.md
|
@ -139,22 +139,25 @@
|
||||||
## 🍏 MacOS Hardening
|
## 🍏 MacOS Hardening
|
||||||
|
|
||||||
* [macOS Security & Privilege Escalation](macos-hardening/macos-security-and-privilege-escalation/README.md)
|
* [macOS Security & Privilege Escalation](macos-hardening/macos-security-and-privilege-escalation/README.md)
|
||||||
|
* [macOS Users](macos-hardening/macos-security-and-privilege-escalation/macos-users.md)
|
||||||
|
* [macOS Files, Folders & Binaries](macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/README.md)
|
||||||
|
* [macOS Bundles](macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-bundles.md)
|
||||||
|
* [Universal binaries & Mach-O Format](macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md)
|
||||||
|
* [macOS AppleFS](macos-hardening/macos-security-and-privilege-escalation/macos-applefs.md)
|
||||||
* [macOS Dyld Hijacking & DYLD\_INSERT\_LIBRARIES](macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld\_insert\_libraries.md)
|
* [macOS Dyld Hijacking & DYLD\_INSERT\_LIBRARIES](macos-hardening/macos-security-and-privilege-escalation/macos-dyld-hijacking-and-dyld\_insert\_libraries.md)
|
||||||
* [macOS Architecture](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md)
|
* [macOS Kernel](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md)
|
||||||
* [macOS Bundles](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-bundles.md)
|
|
||||||
* [macOS IPC - Inter Process Communication](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md)
|
* [macOS IPC - Inter Process Communication](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/README.md)
|
||||||
* [macOS XPC Connecting Process Check](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md)
|
* [macOS XPC Connecting Process Check](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-connecting-process-check.md)
|
||||||
* [macOS PID Reuse](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md)
|
* [macOS PID Reuse](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-pid-reuse.md)
|
||||||
* [macOS XPC Authorization](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md)
|
* [macOS XPC Authorization](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-ipc-inter-process-communication/macos-xpc-authorization.md)
|
||||||
* [macOS Function Hooking](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md)
|
* [macOS Function Hooking](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-function-hooking.md)
|
||||||
* [Universal binaries & Mach-O Format](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/universal-binaries-and-mach-o-format.md)
|
* [macOS Kernel Extensions](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-kernel-extensions.md)
|
||||||
* [macOS MDM](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md)
|
* [macOS MDM](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md)
|
||||||
* [Enrolling Devices in Other Organisations](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md)
|
* [Enrolling Devices in Other Organisations](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md)
|
||||||
|
* [macOS Serial Number](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/macos-serial-number.md)
|
||||||
* [macOS Basic Objective-C](macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md)
|
* [macOS Basic Objective-C](macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md)
|
||||||
* [macOS Network Protocols](macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md)
|
* [macOS Network Services & Protocols](macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md)
|
||||||
* [macOS Kernel Extensions](macos-hardening/macos-security-and-privilege-escalation/macos-kernel-extensions.md)
|
|
||||||
* [macOS Red Teaming](macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md)
|
* [macOS Red Teaming](macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md)
|
||||||
* [macOS Serial Number](macos-hardening/macos-security-and-privilege-escalation/macos-serial-number.md)
|
|
||||||
* [macOS TCC](macos-hardening/macos-security-and-privilege-escalation/macos-tcc.md)
|
* [macOS TCC](macos-hardening/macos-security-and-privilege-escalation/macos-tcc.md)
|
||||||
* [macOS Sandbox](macos-hardening/macos-security-and-privilege-escalation/macos-sandbox/README.md)
|
* [macOS Sandbox](macos-hardening/macos-security-and-privilege-escalation/macos-sandbox/README.md)
|
||||||
* [macOS Sandbox Debug & Bypass](macos-hardening/macos-security-and-privilege-escalation/macos-sandbox/macos-sandbox-debug-and-bypass.md)
|
* [macOS Sandbox Debug & Bypass](macos-hardening/macos-security-and-privilege-escalation/macos-sandbox/macos-sandbox-debug-and-bypass.md)
|
||||||
|
|
|
@ -32,252 +32,46 @@ First of all, please note that **most of the tricks about privilege escalation a
|
||||||
|
|
||||||
## Basic MacOS
|
## Basic MacOS
|
||||||
|
|
||||||
### Special File Permissions
|
If you are not familiar with macOS, you should start learning the basics of macOS: 
|
||||||
|
|
||||||
#### Folder permissions
|
* Special macOS **files & permissions:**
|
||||||
|
|
||||||
In a **folder**, **read** allows to **list it**, **write** allows to **delete** and **write** files on it, and **execute** allows to **traverse** the directory. So, for example, a user with **read permission over a file** inside a directory where he **doesn't have execute** permission **won't be able to read** the file.
|
{% content-ref url="macos-files-folders-and-binaries/" %}
|
||||||
|
[macos-files-folders-and-binaries](macos-files-folders-and-binaries/)
|
||||||
#### Flag modifiers
|
|
||||||
|
|
||||||
There are some flags that could be set in the files that will make file behave differently. You can **check the flags** of the files inside a directory with `ls -lO /path/directory`
|
|
||||||
|
|
||||||
* **`uchg`**: Known as **uchange** flag will **prevent any action** changing or deleting the **file**. To set it do: `chflags uchg file.txt`
|
|
||||||
* The root user could **remove the flag** and modify the file
|
|
||||||
* **`restricted`**: This flag makes the file be **protected by SIP** (you cannot add this flag to a file).
|
|
||||||
* **`Sticky bit`**: If a directory with sticky bit, **only** the **directories owner or root can remane or delete** files. Typically this is set on the /tmp directory to prevent ordinary users from deleting or moving other users’ files.
|
|
||||||
|
|
||||||
#### ACLs
|
|
||||||
|
|
||||||
File **ACLs** contain **ACE** (Access Control Entries) where more **granular permissions** can be assigned to different users.
|
|
||||||
|
|
||||||
It's possible to grant a **directory** these permissions: `list`, `search`, `add_file`, `add_subdirectory`, `delete_child`, `delete_child`.\
|
|
||||||
Ans to a **file**: `read`, `write`, `append`, `execute`.
|
|
||||||
|
|
||||||
You can see the ACLs of file with `ls -le`: **`ls -le ~/Library`**
|
|
||||||
|
|
||||||
#### Privilege Escalation via File permissions
|
|
||||||
|
|
||||||
If a **process running as root writes** a file that can be controlled by a user, the user could abuse this to **escalate privileges**.\
|
|
||||||
This could occur in the following situations:
|
|
||||||
|
|
||||||
* File used was already created by a user (owned by the user)
|
|
||||||
* File used is writable by the user because of a group
|
|
||||||
* File used is inside a directory owned by the user (the user could create the file)
|
|
||||||
* File used is inside a directory owned by root but user has write access over it because of a group (the user could create the file)
|
|
||||||
|
|
||||||
Being able to **create a file** that is going to be **used by root**, allows a user to **take advantage of its content** or even create **symlinks/hardlinks** to point it to another place.
|
|
||||||
|
|
||||||
### OS X Specific Extensions
|
|
||||||
|
|
||||||
* **`.dmg`**: Apple Disk Image files are very frequent for installers.
|
|
||||||
* **`.kext`**: It must follow a specific structure and it's the OS X version of a driver.
|
|
||||||
* **`.plist`**: Also known as property list stores information in XML or binary format.
|
|
||||||
* Can be XML or binary. Binary ones can be read with:
|
|
||||||
* `defaults read config.plist`
|
|
||||||
* `/usr/libexec/PlistBuddy -c print config.plsit`
|
|
||||||
* `plutil -p ~/Library/Preferences/com.apple.screensaver.plist`
|
|
||||||
* `plutil -convert xml1 ~/Library/Preferences/com.apple.screensaver.plist -o -`
|
|
||||||
* `plutil -convert json ~/Library/Preferences/com.apple.screensaver.plist -o -`
|
|
||||||
* **`.app`**: Apple applications that follows directory structure.
|
|
||||||
* **`.dylib`**: Dynamic libraries (like Windows DLL files)
|
|
||||||
* **`.pkg`**: Are the same as xar (eXtensible Archive format). The installer command can be use to install the contents of these files.
|
|
||||||
|
|
||||||
### File hierarchy layout
|
|
||||||
|
|
||||||
* **/Applications**: The installed apps should be here. All the users will be able to access them.
|
|
||||||
* **/bin**: Command line binaries
|
|
||||||
* **/cores**: If exists, it's used to store core dumps
|
|
||||||
* **/dev**: Everything is treated as a file so you may see hardware devices stored here.
|
|
||||||
* **/etc**: Configuration files
|
|
||||||
* **/Library**: A lot of subdirectories and files related to preferences, caches and logs can be found here. A Library folder exists in root and on each user's directory.
|
|
||||||
* **/private**: Undocumented but a lot of the mentioned folders are symbolic links to the private directory.
|
|
||||||
* **/sbin**: Essential system binaries (related to administration)
|
|
||||||
* **/System**: File fo making OS X run. You should find mostly only Apple specific files here (not third party).
|
|
||||||
* **/tmp**: Files are deleted after 3 days (it's a soft link to /private/tmp)
|
|
||||||
* **/Users**: Home directory for users.
|
|
||||||
* **/usr**: Config and system binaries
|
|
||||||
* **/var**: Log files
|
|
||||||
* **/Volumes**: The mounted drives will apear here.
|
|
||||||
* **/.vol**: Running `stat a.txt` you obtain something like `16777223 7545753 -rw-r--r-- 1 username wheel ...` where the first number is the id number of the volume where the file exists and the second one is the inode number. You can access the content of this file through /.vol/ with that information running `cat /.vol/16777223/7545753`
|
|
||||||
|
|
||||||
### Applications Folders
|
|
||||||
|
|
||||||
* **System applications** are located under `/System/Applications`
|
|
||||||
* **Installed** applications are usually installed in `/Applications` or in `~/Applications`
|
|
||||||
* **Application data** can be found in `/Library/Application Support` for the applications running as root and `~/Library/Application Support` for applications running as the user.
|
|
||||||
* Third-party applications **daemons** that **need to run as root** as usually located in `/Library/PrivilegedHelperTools/`
|
|
||||||
* **Sandboxed** apps are mapped into the `~/Library/Containers` folder. Each app has a folder named according to the application’s bundle ID (`com.apple.Safari`).
|
|
||||||
* The **kernel** is located in `/System/Library/Kernels/kernel`
|
|
||||||
* **Apple's kernel extensions** are located in `/System/Library/Extensions`
|
|
||||||
* **Third-party kernel extensions** are stored in `/Library/Extensions`
|
|
||||||
|
|
||||||
### Firmlinks
|
|
||||||
|
|
||||||
The `Data` volume is mounted in **`/System/Volumes/Data`** (you can check this with `diskutil apfs list`).
|
|
||||||
|
|
||||||
The list of firmlinks can be found in the **`/usr/share/firmlinks`** file.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat /usr/share/firmlinks
|
|
||||||
/AppleInternal AppleInternal
|
|
||||||
/Applications Applications
|
|
||||||
/Library Library
|
|
||||||
[...]
|
|
||||||
```
|
|
||||||
|
|
||||||
On the **left**, there is the directory path on the **System volume**, and on the **right**, the directory path where it maps on the **Data volume**. So, `/library` --> `/system/Volumes/data/library`
|
|
||||||
|
|
||||||
### Special MacOS files and folders
|
|
||||||
|
|
||||||
* **`.DS_Store`**: This file is on each directory, it saves the attributes and customisations of the directory.
|
|
||||||
* **`.Spotlight-V100`**: This folder appears on the root directory of every volume on the system.
|
|
||||||
* **`.metadata_never_index`**: If this file is at the root of a volume Spotlight won't index that volume.
|
|
||||||
* **`<name>.noindex`**: Files and folder with this extension won't be indexed by Spotlight.
|
|
||||||
* **`$HOME/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2`**: Contains information about downloaded files, like the URL from where they were downloaded.
|
|
||||||
* **`/var/log/system.log`**: Main log of OSX systems. com.apple.syslogd.plist is responsible for the execution of syslogging (you can check if it's disabled looking for "com.apple.syslogd" in `launchctl list`.
|
|
||||||
* **`/private/var/log/asl/*.asl`**: These are the Apple System Logs which may contain interesting information.
|
|
||||||
* **`$HOME/Library/Preferences/com.apple.recentitems.plist`**: Stores recently accessed files and applications through "Finder".
|
|
||||||
* **`$HOME/Library/Preferences/com.apple.loginitems.plsit`**: Stores items to launch upon system startup
|
|
||||||
* **`$HOME/Library/Logs/DiskUtility.log`**: Log file for thee DiskUtility App (info about drives, including USBs)
|
|
||||||
* **`/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist`**: Data about wireless access points.
|
|
||||||
* **`/private/var/db/launchd.db/com.apple.launchd/overrides.plist`**: List of daemons deactivated.
|
|
||||||
* **`/private/etc/kcpassword`**: If autologin is enabled this file will contain the users login password XORed with a key.
|
|
||||||
|
|
||||||
### macOS Bundles
|
|
||||||
|
|
||||||
{% content-ref url="mac-os-architecture/macos-bundles.md" %}
|
|
||||||
[macos-bundles.md](mac-os-architecture/macos-bundles.md)
|
|
||||||
{% endcontent-ref %}
|
{% endcontent-ref %}
|
||||||
|
|
||||||
### Common users
|
* Common macOS **users**
|
||||||
|
|
||||||
* **Daemon**: User reserved for system daemons. The default daemon account names usually start with a "\_":
|
{% content-ref url="macos-users.md" %}
|
||||||
|
[macos-users.md](macos-users.md)
|
||||||
|
{% endcontent-ref %}
|
||||||
|
|
||||||
```bash
|
* **AppleFS**
|
||||||
_amavisd, _analyticsd, _appinstalld, _appleevents, _applepay, _appowner, _appserver, _appstore, _ard, _assetcache, _astris, _atsserver, _avbdeviced, _calendar, _captiveagent, _ces, _clamav, _cmiodalassistants, _coreaudiod, _coremediaiod, _coreml, _ctkd, _cvmsroot, _cvs, _cyrus, _datadetectors, _demod, _devdocs, _devicemgr, _diskimagesiod, _displaypolicyd, _distnote, _dovecot, _dovenull, _dpaudio, _driverkit, _eppc, _findmydevice, _fpsd, _ftp, _fud, _gamecontrollerd, _geod, _hidd, _iconservices, _installassistant, _installcoordinationd, _installer, _jabber, _kadmin_admin, _kadmin_changepw, _knowledgegraphd, _krb_anonymous, _krb_changepw, _krb_kadmin, _krb_kerberos, _krb_krbtgt, _krbfast, _krbtgt, _launchservicesd, _lda, _locationd, _logd, _lp, _mailman, _mbsetupuser, _mcxalr, _mdnsresponder, _mobileasset, _mysql, _nearbyd, _netbios, _netstatistics, _networkd, _nsurlsessiond, _nsurlstoraged, _oahd, _ondemand, _postfix, _postgres, _qtss, _reportmemoryexception, _rmd, _sandbox, _screensaver, _scsd, _securityagent, _softwareupdate, _spotlight, _sshd, _svn, _taskgated, _teamsserver, _timed, _timezone, _tokend, _trustd, _trustevaluationagent, _unknown, _update_sharing, _usbmuxd, _uucp, _warmd, _webauthserver, _windowserver, _www, _wwwproxy, _xserverdocs
|
|
||||||
```
|
|
||||||
* **Guest**: Account for guests with very strict permissions
|
|
||||||
|
|
||||||
{% code overflow="wrap" %}
|
{% content-ref url="macos-applefs.md" %}
|
||||||
```bash
|
[macos-applefs.md](macos-applefs.md)
|
||||||
state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess")
|
{% endcontent-ref %}
|
||||||
for i in "${state[@]}"; do sysadminctl -"${i}" status; done;
|
|
||||||
```
|
|
||||||
{% endcode %}
|
|
||||||
|
|
||||||
* **Nobody**: Processes are executed with this user when minimal permissions are required
|
* The **architecture** of the k**ernel**
|
||||||
* **Root**
|
|
||||||
|
|
||||||
### User Privileges
|
|
||||||
|
|
||||||
* **Standard User:** The most basic of users. This user needs permissions granted from an admin user when attempting to install software or perform other advanced tasks. They are not able to do it on their own.
|
|
||||||
* **Admin User**: A user who operates most of the time as a standard user but is also allowed to perform root actions such as install software and other administrative tasks. All users belonging to the admin group are **given access to root via the sudoers file**.
|
|
||||||
* **Root**: Root is a user allowed to perform almost any action (there are limitations imposed by protections like System Integrity Protection).
|
|
||||||
* For example root won't be able to place a file inside `/System`
|
|
||||||
|
|
||||||
### **File ACLs**
|
|
||||||
|
|
||||||
When the file contains ACLs you will **find a "+" when listing the permissions like in**:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ls -ld Movies
|
|
||||||
drwx------+ 7 username staff 224 15 Apr 19:42 Movies
|
|
||||||
```
|
|
||||||
|
|
||||||
You can **read the ACLs** of the file with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ls -lde Movies
|
|
||||||
drwx------+ 7 username staff 224 15 Apr 19:42 Movies
|
|
||||||
0: group:everyone deny delete
|
|
||||||
```
|
|
||||||
|
|
||||||
You can find **all the files with ACLs** with (this is veeery slow):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ls -RAle / 2>/dev/null | grep -E -B1 "\d: "
|
|
||||||
```
|
|
||||||
|
|
||||||
### Resource Forks or MacOS ADS
|
|
||||||
|
|
||||||
This is a way to obtain **Alternate Data Streams in MacOS** machines. You can save content inside an extended attribute called **com.apple.ResourceFork** inside a file by saving it in **file/..namedfork/rsrc**.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo "Hello" > a.txt
|
|
||||||
echo "Hello Mac ADS" > a.txt/..namedfork/rsrc
|
|
||||||
|
|
||||||
xattr -l a.txt #Read extended attributes
|
|
||||||
com.apple.ResourceFork: Hello Mac ADS
|
|
||||||
|
|
||||||
ls -l a.txt #The file length is still q
|
|
||||||
-rw-r--r--@ 1 username wheel 6 17 Jul 01:15 a.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
You can **find all the files containing this extended attribute** with:
|
|
||||||
|
|
||||||
{% code overflow="wrap" %}
|
|
||||||
```bash
|
|
||||||
find / -type f -exec ls -ld {} \; 2>/dev/null | grep -E "[x\-]@ " | awk '{printf $9; printf "\n"}' | xargs -I {} xattr -lv {} | grep "com.apple.ResourceFork"
|
|
||||||
```
|
|
||||||
{% endcode %}
|
|
||||||
|
|
||||||
### Risk Files Mac OS
|
|
||||||
|
|
||||||
The files `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/System` contains the risk associated to files depending on the file extension.
|
|
||||||
|
|
||||||
The possible categories include the following:
|
|
||||||
|
|
||||||
* **LSRiskCategorySafe**: **Totally** **safe**; Safari will auto-open after download
|
|
||||||
* **LSRiskCategoryNeutral**: No warning, but **not auto-opened**
|
|
||||||
* **LSRiskCategoryUnsafeExecutable**: **Triggers** a **warning** “This file is an application...”
|
|
||||||
* **LSRiskCategoryMayContainUnsafeExecutable**: This is for things like archives that contain an executable. It **triggers a warning unless Safari can determine all the contents are safe or neutral**.
|
|
||||||
|
|
||||||
### Remote Access Services
|
|
||||||
|
|
||||||
You can enable/disable these services in "System Preferences" --> Sharing
|
|
||||||
|
|
||||||
* **VNC**, known as “Screen Sharing”
|
|
||||||
* **SSH**, called “Remote Login”
|
|
||||||
* **Apple Remote Desktop** (ARD), or “Remote Management”
|
|
||||||
* **AppleEvent**, known as “Remote Apple Event”
|
|
||||||
|
|
||||||
Check if any is enabled running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rmMgmt=$(netstat -na | grep LISTEN | grep tcp46 | grep "*.3283" | wc -l);
|
|
||||||
scrShrng=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.5900" | wc -l);
|
|
||||||
flShrng=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | egrep "\*.88|\*.445|\*.548" | wc -l);
|
|
||||||
rLgn=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.22" | wc -l);
|
|
||||||
rAE=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.3031" | wc -l);
|
|
||||||
bmM=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.4488" | wc -l);
|
|
||||||
printf "\nThe following services are OFF if '0', or ON otherwise:\nScreen Sharing: %s\nFile Sharing: %s\nRemote Login: %s\nRemote Mgmt: %s\nRemote Apple Events: %s\nBack to My Mac: %s\n\n" "$scrShrng" "$flShrng" "$rLgn" "$rmMgmt" "$rAE" "$bmM";
|
|
||||||
```
|
|
||||||
|
|
||||||
### MacOS Architecture
|
|
||||||
|
|
||||||
{% content-ref url="mac-os-architecture/" %}
|
{% content-ref url="mac-os-architecture/" %}
|
||||||
[mac-os-architecture](mac-os-architecture/)
|
[mac-os-architecture](mac-os-architecture/)
|
||||||
{% endcontent-ref %}
|
{% endcontent-ref %}
|
||||||
|
|
||||||
### MacOS Serial Number
|
* Common macOS n**etwork services & protocols**
|
||||||
|
|
||||||
{% content-ref url="macos-serial-number.md" %}
|
{% content-ref url="macos-protocols.md" %}
|
||||||
[macos-serial-number.md](macos-serial-number.md)
|
[macos-protocols.md](macos-protocols.md)
|
||||||
{% endcontent-ref %}
|
{% endcontent-ref %}
|
||||||
|
|
||||||
### MacOS MDM
|
### MacOS MDM
|
||||||
|
|
||||||
|
In companies **macOS** systems are highly probably going to be **managed with a MDM**. Therefore, from the perspective of an attacker is interesting to know **how that works**:
|
||||||
|
|
||||||
{% content-ref url="macos-mdm/" %}
|
{% content-ref url="macos-mdm/" %}
|
||||||
[macos-mdm](macos-mdm/)
|
[macos-mdm](macos-mdm/)
|
||||||
{% endcontent-ref %}
|
{% endcontent-ref %}
|
||||||
|
|
||||||
### MacOS Protocols
|
|
||||||
|
|
||||||
{% content-ref url="macos-protocols.md" %}
|
|
||||||
[macos-protocols.md](macos-protocols.md)
|
|
||||||
{% endcontent-ref %}
|
|
||||||
|
|
||||||
### MacOS - Inspecting, Debugging and Fuzzing
|
### MacOS - Inspecting, Debugging and Fuzzing
|
||||||
|
|
||||||
{% content-ref url="macos-apps-inspecting-debugging-and-fuzzing/" %}
|
{% content-ref url="macos-apps-inspecting-debugging-and-fuzzing/" %}
|
||||||
|
@ -639,6 +433,15 @@ ls -lR /usr/lib/cron/tabs/ /private/var/at/jobs /etc/periodic/
|
||||||
|
|
||||||
There you can find the regular **cron** **jobs**, the **at** **jobs** (not very used) and the **periodic** **jobs** (mainly used for cleaning temporary files). The daily periodic jobs can be executed for example with: `periodic daily`.
|
There you can find the regular **cron** **jobs**, the **at** **jobs** (not very used) and the **periodic** **jobs** (mainly used for cleaning temporary files). The daily periodic jobs can be executed for example with: `periodic daily`.
|
||||||
|
|
||||||
|
The periodic scripts (**`/etc/periodic`**) are executed because of the **launch daemons** configured in `/System/Library/LaunchDaemons/com.apple.periodic*`. Note that if a script is stored in `/etc/periodic/` as a way to **escalate privilege**s, it will be **executed** as the **owner of the file**.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls -l /System/Library/LaunchDaemons/com.apple.periodic*
|
||||||
|
-rw-r--r-- 1 root wheel 887 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-daily.plist
|
||||||
|
-rw-r--r-- 1 root wheel 895 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist
|
||||||
|
-rw-r--r-- 1 root wheel 891 May 13 00:29 /System/Library/LaunchDaemons/com.apple.periodic-weekly.plist
|
||||||
|
```
|
||||||
|
|
||||||
### kext
|
### kext
|
||||||
|
|
||||||
In order to install a KEXT as a startup item, it needs to be **installed in one of the following locations**:
|
In order to install a KEXT as a startup item, it needs to be **installed in one of the following locations**:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# macOS Architecture
|
# macOS Kernel
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
|
@ -12,32 +12,32 @@
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Kernel
|
## XNU Kernel
|
||||||
|
|
||||||
### XNU
|
The **core of macOS is XNU**, which stands for "X is Not Unix". This kernel is fundamentally composed of the **Mach microkerne**l (to be discussed later), **and** elements from Berkeley Software Distribution (**BSD**). XNU also provides a platform for **kernel drivers via a system called the I/O Kit**. The XNU kernel is part of the Darwin open source project, which means **its source code is freely accessible**.
|
||||||
|
|
||||||
The heart of Mac OS X is the **XNU kernel**. XNU is basically composed of a **Mach core** (covered in the next section) with supplementary features provided by Berkeley Software Distribution (**BSD**). Additionally, **XNU** is responsible for providing an **environment for kernel drivers called the I/O Kit**. **XNU is a Darwin package**, so all of the source **code** is **freely available**.
|
From a perspective of a security researcher or a Unix developer, **macOS** can feel quite **similar** to a **FreeBSD** system with an elegant GUI and a host of custom applications. Most applications developed for BSD will compile and run on macOS without needing modifications, as the command-line tools familiar to Unix users are all present in macOS. However, because the XNU kernel incorporates Mach, there are some significant differences between a traditional Unix-like system and macOS, and these differences might cause potential issues or provide unique advantages.
|
||||||
|
|
||||||
From a security researcher’s perspective, **Mac OS X feels just like a FreeBSD box with a pretty windowing system** and a large number of custom applications. For the most part, applications written for BSD will compile and run without modification on Mac OS X. All the tools you are accustomed to using in BSD are available in Mac OS X. Nevertheless, the fact that the **XNU kernel contains all the Mach code** means that some day, when you have to dig deeper, you’ll find many differences that may cause you problems and some you may be able to leverage for your own purposes.
|
|
||||||
|
|
||||||
### Mach
|
### Mach
|
||||||
|
|
||||||
Mach was originated as a UNIX-compatible **operating system** back in 1984. One of its primary design **goals** was to be a **microkernel**; that is, to **minimize** the amount of code running in the **kernel** and allow many typical kernel functions, such as file system, networking, and I/O, to **run as user-level** Mach tasks.
|
Mach is a **microkernel** designed to be **UNIX-compatible**. One of its key design principles was to **minimize** the amount of **code** running in the **kernel** space and instead allow many typical kernel functions, such as file system, networking, and I/O, to **run as user-level tasks**.
|
||||||
|
|
||||||
**In XNU, Mach is responsible for many of the low-level operations** you expect from a kernel, such as processor scheduling and multitasking and virtual- memory management.
|
In XNU, Mach is **responsible for many of the critical low-level operations** a kernel typically handles, such as processor scheduling, multitasking, and virtual memory management.
|
||||||
|
|
||||||
### BSD
|
### BSD
|
||||||
|
|
||||||
The **kernel** also involves a large chunk of **code derived from the FreeBSD** code base. This code runs as part of the kernel along with Mach and uses the same address space. The F**reeBSD code within XNU may differ significantly from the original FreeBSD code**, as changes had to be made for it to coexist with Mach. FreeBSD provides many of the remaining operations the kernel needs, including:
|
The XNU **kernel** also **incorporates** a significant amount of code derived from the **FreeBSD** project. This code **runs as part of the kernel along with Mach**, in the same address space. However, the FreeBSD code within XNU may differ substantially from the original FreeBSD code because modifications were required to ensure its compatibility with Mach. FreeBSD contributes to many kernel operations including:
|
||||||
|
|
||||||
* Processes
|
* Process management
|
||||||
* Signals
|
* Signal handling
|
||||||
* Basic security, such as users and groups
|
* Basic security mechanisms, including user and group management
|
||||||
* System call infrastructure
|
* System call infrastructure
|
||||||
* TCP/IP stack and sockets
|
* TCP/IP stack and sockets
|
||||||
* Firewall and packet filtering
|
* Firewall and packet filtering
|
||||||
|
|
||||||
To get an idea of just how complicated the interaction between these two sets of code can be, consider the idea of the fundamental executing unit. **In BSD the fundamental unit is the process. In Mach it is a Mach thread**. The disparity is settled by each BSD-style process being associated with a Mach task consisting of exactly one Mach thread. When the BSD fork() system call is made, the BSD code in the kernel uses Mach calls to create a task and thread structure. Also, it is important to note that both the Mach and BSD layers have different security models. The **Mach security** model is **based** **on** **port** **rights**, and the **BSD** model is based on **process** **ownership**. Disparities between these two models have resulted in a **number of local privilege-escalation vulnerabilities**. Additionally, besides typical system cells, there are Mach traps that allow user-space programs to communicate with the kernel.
|
Understanding the interaction between BSD and Mach can be complex, due to their different conceptual frameworks. For instance, BSD uses processes as its fundamental executing unit, while Mach operates based on threads. This discrepancy is reconciled in XNU by **associating each BSD process with a Mach task** that contains exactly one Mach thread. When BSD's fork() system call is used, the BSD code within the kernel uses Mach functions to create a task and a thread structure.
|
||||||
|
|
||||||
|
Moreover, **Mach and BSD each maintain different security models**: **Mach's** security model is based on **port rights**, whereas BSD's security model operates based on **process ownership**. Disparities between these two models have occasionally resulted in local privilege-escalation vulnerabilities. Apart from typical system calls, there are also **Mach traps that allow user-space programs to interact with the kernel**. These different elements together form the multifaceted, hybrid architecture of the macOS kernel.
|
||||||
|
|
||||||
### I/O Kit - Drivers
|
### I/O Kit - Drivers
|
||||||
|
|
||||||
|
@ -88,70 +88,6 @@ kextunload com.apple.iokit.IOReportFamily
|
||||||
[macos-ipc-inter-process-communication](macos-ipc-inter-process-communication/)
|
[macos-ipc-inter-process-communication](macos-ipc-inter-process-communication/)
|
||||||
{% endcontent-ref %}
|
{% endcontent-ref %}
|
||||||
|
|
||||||
## Apple Propietary File System (APFS)
|
|
||||||
|
|
||||||
APFS, or Apple File System, is a modern file system developed by Apple Inc. that was designed to replace the older Hierarchical File System Plus (HFS+) with an emphasis on **improved performance, security, and efficiency**.
|
|
||||||
|
|
||||||
Some notable features of APFS include:
|
|
||||||
|
|
||||||
1. **Space Sharing**: APFS allows multiple volumes to **share the same underlying free storage** on a single physical device. This enables more efficient space utilization as the volumes can dynamically grow and shrink without the need for manual resizing or repartitioning.
|
|
||||||
1. This means, compared with traditional partitions in file disks, t**hat in APFS different partitions (volumes) shares all the disk space**, while a regular partition usually had a fixed size.
|
|
||||||
2. **Snapshots**: APFS supports **creating snapshots**, which are **read-only**, point-in-time instances of the file system. Snapshots enable efficient backups and easy system rollbacks, as they consume minimal additional storage and can be quickly created or reverted.
|
|
||||||
3. **Clones**: APFS can **create file or directory clones that share the same storage** as the original until either the clone or the original file is modified. This feature provides an efficient way to create copies of files or directories without duplicating the storage space.
|
|
||||||
4. **Encryption**: APFS **natively supports full-disk encryption** as well as per-file and per-directory encryption, enhancing data security across different use cases.
|
|
||||||
5. **Crash Protection**: APFS uses a **copy-on-write metadata scheme that ensures file system consistency** even in cases of sudden power loss or system crashes, reducing the risk of data corruption.
|
|
||||||
|
|
||||||
Overall, APFS offers a more modern, flexible, and efficient file system for Apple devices, with a focus on improved performance, reliability, and security.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
diskutil list # Get overview of the APFS volumes
|
|
||||||
```
|
|
||||||
|
|
||||||
## Applications
|
|
||||||
|
|
||||||
A kernel without applications isn’t very useful. **Darwin** is the non-Aqua, **open-source core of Mac OS X**. Basically it is all the parts of Mac OS X for which the **source code is available**. The code is made available in the form of a **package that is easy to install**. There are hundreds of **available Darwin packages**, such as X11, GCC, and other GNU tools. Darwin provides many of the applications you may already use in BSD or Linux for Mac OS X. Apple has spent significant time **integrating these packages into their operating system** so that everything behaves nicely and has a consistent look and feel when possible.
|
|
||||||
|
|
||||||
On the **other** hand, many familiar pieces of Mac OS X are **not open source**. The main missing piece to someone running just the Darwin code will be **Aqua**, the **Mac OS X windowing and graphical-interface environment**. Additionally, most of the common **high-level applications**, such as Safari, Mail, QuickTime, iChat, etc., are not open source (although some of their components are open source). Interestingly, these closed-source applications often **rely on open- source software**, for example, Safari relies on the WebKit project for HTML and JavaScript rendering. **For perhaps this reason, you also typically have many more symbols in these applications when debugging than you would in a Windows environment.**
|
|
||||||
|
|
||||||
### **Universal binaries &** Mach-o Format
|
|
||||||
|
|
||||||
{% content-ref url="universal-binaries-and-mach-o-format.md" %}
|
|
||||||
[universal-binaries-and-mach-o-format.md](universal-binaries-and-mach-o-format.md)
|
|
||||||
{% endcontent-ref %}
|
|
||||||
|
|
||||||
### Bundles
|
|
||||||
|
|
||||||
{% content-ref url="macos-bundles.md" %}
|
|
||||||
[macos-bundles.md](macos-bundles.md)
|
|
||||||
{% endcontent-ref %}
|
|
||||||
|
|
||||||
### Objective-C
|
|
||||||
|
|
||||||
Programs written in Objective-C **retain** their class declarations **when** **compiled** into (Mach-O) binaries. Such class declarations **include** the name and type of:
|
|
||||||
|
|
||||||
* The class
|
|
||||||
* The class methods
|
|
||||||
* The class instance variables
|
|
||||||
|
|
||||||
You can get this information using [**class-dump**](https://github.com/nygard/class-dump):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
class-dump Kindle.app
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that this names can be obfuscated to make the reversing of the binary more difficult.
|
|
||||||
|
|
||||||
### Native Packages
|
|
||||||
|
|
||||||
There are some projects that allow to generate a binary executable by MacOS containing script code which will be executed. Some examples are:
|
|
||||||
|
|
||||||
* **Platypus**: Generate MacOS binary executing shell scripts, Python, Perl, Ruby, PHP, Swift, Expect, Tcl, AWK, JavaScript, AppleScript or any other user-specified interpreter.
|
|
||||||
* **It saves the script in `Contents/Resources/script`. So finding this script is a good indicator that Platypus was used.**
|
|
||||||
* **PyInstaller:** Python
|
|
||||||
* Ways to detect this is the use of the embedded string **“Py\_SetPythonHome”** or a a **call** into a function named **`pyi_main`.**
|
|
||||||
* **Electron:** JavaScript, HTML, and CSS.
|
|
||||||
* These binaries will use **Electron Framework.framework**. Moreover, the non-binary components (e.g. JavaScript files) maybe found in the application’s **`Contents/Resources/`** directory, achieved in `.asar` files. These binaries will use Electron Framework.framework. Moreover, the non-binary components (e.g. JavaScript files) maybe found in the application’s **`Contents/Resources/`** directory, achieved in **`.asar` files**. It's possible **unpack** such archives via the **asar** node module, or the **npx** **utility:** `npx asar extract StrongBox.app/Contents/Resources/app.asar appUnpacked`\\
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
* [**The Mac Hacker's Handbook**](https://www.amazon.com/-/es/Charlie-Miller-ebook-dp-B004U7MUMU/dp/B004U7MUMU/ref=mt\_other?\_encoding=UTF8\&me=\&qid=)
|
* [**The Mac Hacker's Handbook**](https://www.amazon.com/-/es/Charlie-Miller-ebook-dp-B004U7MUMU/dp/B004U7MUMU/ref=mt\_other?\_encoding=UTF8\&me=\&qid=)
|
||||||
|
|
|
@ -22,7 +22,7 @@ Obviously, this is so powerful, it's complicated to load a kernel extension. The
|
||||||
|
|
||||||
* Going into **recovery mode** Kexts need to be **allowed to be loaded**:
|
* Going into **recovery mode** Kexts need to be **allowed to be loaded**:
|
||||||
|
|
||||||
<figure><img src="../../.gitbook/assets/image (2).png" alt=""><figcaption></figcaption></figure>
|
<figure><img src="../../../.gitbook/assets/image (2).png" alt=""><figcaption></figcaption></figure>
|
||||||
|
|
||||||
* The Kext must be **signed with a kernel code signing certificate**, which can only be granted by **Apple**. Who will be **reviewing** in detail the **company** and the **reasons** why this is needed.
|
* The Kext must be **signed with a kernel code signing certificate**, which can only be granted by **Apple**. Who will be **reviewing** in detail the **company** and the **reasons** why this is needed.
|
||||||
* The Kext also needs to be **notarized**, Apple will be able to check it for malware.
|
* The Kext also needs to be **notarized**, Apple will be able to check it for malware.
|
|
@ -0,0 +1,60 @@
|
||||||
|
# macOS AppleFS
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Apple Propietary File System (APFS)
|
||||||
|
|
||||||
|
APFS, or Apple File System, is a modern file system developed by Apple Inc. that was designed to replace the older Hierarchical File System Plus (HFS+) with an emphasis on **improved performance, security, and efficiency**.
|
||||||
|
|
||||||
|
Some notable features of APFS include:
|
||||||
|
|
||||||
|
1. **Space Sharing**: APFS allows multiple volumes to **share the same underlying free storage** on a single physical device. This enables more efficient space utilization as the volumes can dynamically grow and shrink without the need for manual resizing or repartitioning.
|
||||||
|
1. This means, compared with traditional partitions in file disks, t**hat in APFS different partitions (volumes) shares all the disk space**, while a regular partition usually had a fixed size.
|
||||||
|
2. **Snapshots**: APFS supports **creating snapshots**, which are **read-only**, point-in-time instances of the file system. Snapshots enable efficient backups and easy system rollbacks, as they consume minimal additional storage and can be quickly created or reverted.
|
||||||
|
3. **Clones**: APFS can **create file or directory clones that share the same storage** as the original until either the clone or the original file is modified. This feature provides an efficient way to create copies of files or directories without duplicating the storage space.
|
||||||
|
4. **Encryption**: APFS **natively supports full-disk encryption** as well as per-file and per-directory encryption, enhancing data security across different use cases.
|
||||||
|
5. **Crash Protection**: APFS uses a **copy-on-write metadata scheme that ensures file system consistency** even in cases of sudden power loss or system crashes, reducing the risk of data corruption.
|
||||||
|
|
||||||
|
Overall, APFS offers a more modern, flexible, and efficient file system for Apple devices, with a focus on improved performance, reliability, and security.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
diskutil list # Get overview of the APFS volumes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Firmlinks
|
||||||
|
|
||||||
|
The `Data` volume is mounted in **`/System/Volumes/Data`** (you can check this with `diskutil apfs list`).
|
||||||
|
|
||||||
|
The list of firmlinks can be found in the **`/usr/share/firmlinks`** file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat /usr/share/firmlinks
|
||||||
|
/AppleInternal AppleInternal
|
||||||
|
/Applications Applications
|
||||||
|
/Library Library
|
||||||
|
[...]
|
||||||
|
```
|
||||||
|
|
||||||
|
On the **left**, there is the directory path on the **System volume**, and on the **right**, the directory path where it maps on the **Data volume**. So, `/library` --> `/system/Volumes/data/library`
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
|
@ -12,6 +12,24 @@
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## Objective-C
|
||||||
|
|
||||||
|
{% hint style="danger" %}
|
||||||
|
Note that programs written in Objective-C **retain** their class declarations **when** **compiled** into [Mach-O binaries](macos-files-folders-and-binaries/universal-binaries-and-mach-o-format.md). Such class declarations **include** the name and type of:
|
||||||
|
{% endhint %}
|
||||||
|
|
||||||
|
* The class
|
||||||
|
* The class methods
|
||||||
|
* The class instance variables
|
||||||
|
|
||||||
|
You can get this information using [**class-dump**](https://github.com/nygard/class-dump):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
class-dump Kindle.app
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this names could be obfuscated to make the reversing of the binary more difficult.
|
||||||
|
|
||||||
## Classes, Methods & Objects
|
## Classes, Methods & Objects
|
||||||
|
|
||||||
### Interface, Properties & Methods
|
### Interface, Properties & Methods
|
||||||
|
|
|
@ -0,0 +1,189 @@
|
||||||
|
# macOS Files, Folders & Binaries
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## File hierarchy layout
|
||||||
|
|
||||||
|
* **/Applications**: The installed apps should be here. All the users will be able to access them.
|
||||||
|
* **/bin**: Command line binaries
|
||||||
|
* **/cores**: If exists, it's used to store core dumps
|
||||||
|
* **/dev**: Everything is treated as a file so you may see hardware devices stored here.
|
||||||
|
* **/etc**: Configuration files
|
||||||
|
* **/Library**: A lot of subdirectories and files related to preferences, caches and logs can be found here. A Library folder exists in root and on each user's directory.
|
||||||
|
* **/private**: Undocumented but a lot of the mentioned folders are symbolic links to the private directory.
|
||||||
|
* **/sbin**: Essential system binaries (related to administration)
|
||||||
|
* **/System**: File fo making OS X run. You should find mostly only Apple specific files here (not third party).
|
||||||
|
* **/tmp**: Files are deleted after 3 days (it's a soft link to /private/tmp)
|
||||||
|
* **/Users**: Home directory for users.
|
||||||
|
* **/usr**: Config and system binaries
|
||||||
|
* **/var**: Log files
|
||||||
|
* **/Volumes**: The mounted drives will apear here.
|
||||||
|
* **/.vol**: Running `stat a.txt` you obtain something like `16777223 7545753 -rw-r--r-- 1 username wheel ...` where the first number is the id number of the volume where the file exists and the second one is the inode number. You can access the content of this file through /.vol/ with that information running `cat /.vol/16777223/7545753`
|
||||||
|
|
||||||
|
### Applications Folders
|
||||||
|
|
||||||
|
* **System applications** are located under `/System/Applications`
|
||||||
|
* **Installed** applications are usually installed in `/Applications` or in `~/Applications`
|
||||||
|
* **Application data** can be found in `/Library/Application Support` for the applications running as root and `~/Library/Application Support` for applications running as the user.
|
||||||
|
* Third-party applications **daemons** that **need to run as root** as usually located in `/Library/PrivilegedHelperTools/`
|
||||||
|
* **Sandboxed** apps are mapped into the `~/Library/Containers` folder. Each app has a folder named according to the application’s bundle ID (`com.apple.Safari`).
|
||||||
|
* The **kernel** is located in `/System/Library/Kernels/kernel`
|
||||||
|
* **Apple's kernel extensions** are located in `/System/Library/Extensions`
|
||||||
|
* **Third-party kernel extensions** are stored in `/Library/Extensions`
|
||||||
|
|
||||||
|
## OS X Specific Extensions
|
||||||
|
|
||||||
|
* **`.dmg`**: Apple Disk Image files are very frequent for installers.
|
||||||
|
* **`.kext`**: It must follow a specific structure and it's the OS X version of a driver. (it's a bundle)
|
||||||
|
* **`.plist`**: Also known as property list stores information in XML or binary format.
|
||||||
|
* Can be XML or binary. Binary ones can be read with:
|
||||||
|
* `defaults read config.plist`
|
||||||
|
* `/usr/libexec/PlistBuddy -c print config.plsit`
|
||||||
|
* `plutil -p ~/Library/Preferences/com.apple.screensaver.plist`
|
||||||
|
* `plutil -convert xml1 ~/Library/Preferences/com.apple.screensaver.plist -o -`
|
||||||
|
* `plutil -convert json ~/Library/Preferences/com.apple.screensaver.plist -o -`
|
||||||
|
* **`.app`**: Apple applications that follows directory structure (It's a bundle).
|
||||||
|
* **`.dylib`**: Dynamic libraries (like Windows DLL files)
|
||||||
|
* **`.pkg`**: Are the same as xar (eXtensible Archive format). The installer command can be use to install the contents of these files.
|
||||||
|
* **`.DS_Store`**: This file is on each directory, it saves the attributes and customisations of the directory.
|
||||||
|
* **`.Spotlight-V100`**: This folder appears on the root directory of every volume on the system.
|
||||||
|
* **`.metadata_never_index`**: If this file is at the root of a volume Spotlight won't index that volume.
|
||||||
|
* **`.noindex`**: Files and folder with this extension won't be indexed by Spotlight.
|
||||||
|
|
||||||
|
### macOS Bundles
|
||||||
|
|
||||||
|
Basically, a bundle is a **directory structure** within the file system. Interestingly, by default this directory **looks like a single object in Finder** (like `.app`). 
|
||||||
|
|
||||||
|
{% content-ref url="macos-bundles.md" %}
|
||||||
|
[macos-bundles.md](macos-bundles.md)
|
||||||
|
{% endcontent-ref %}
|
||||||
|
|
||||||
|
## Special File Permissions
|
||||||
|
|
||||||
|
### Folder permissions
|
||||||
|
|
||||||
|
In a **folder**, **read** allows to **list it**, **write** allows to **delete** and **write** files on it, and **execute** allows to **traverse** the directory. So, for example, a user with **read permission over a file** inside a directory where he **doesn't have execute** permission **won't be able to read** the file.
|
||||||
|
|
||||||
|
### Flag modifiers
|
||||||
|
|
||||||
|
There are some flags that could be set in the files that will make file behave differently. You can **check the flags** of the files inside a directory with `ls -lO /path/directory`
|
||||||
|
|
||||||
|
* **`uchg`**: Known as **uchange** flag will **prevent any action** changing or deleting the **file**. To set it do: `chflags uchg file.txt`
|
||||||
|
* The root user could **remove the flag** and modify the file
|
||||||
|
* **`restricted`**: This flag makes the file be **protected by SIP** (you cannot add this flag to a file).
|
||||||
|
* **`Sticky bit`**: If a directory with sticky bit, **only** the **directories owner or root can remane or delete** files. Typically this is set on the /tmp directory to prevent ordinary users from deleting or moving other users’ files.
|
||||||
|
|
||||||
|
### **File ACLs**
|
||||||
|
|
||||||
|
File **ACLs** contain **ACE** (Access Control Entries) where more **granular permissions** can be assigned to different users.
|
||||||
|
|
||||||
|
It's possible to grant a **directory** these permissions: `list`, `search`, `add_file`, `add_subdirectory`, `delete_child`, `delete_child`.\
|
||||||
|
Ans to a **file**: `read`, `write`, `append`, `execute`.
|
||||||
|
|
||||||
|
When the file contains ACLs you will **find a "+" when listing the permissions like in**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls -ld Movies
|
||||||
|
drwx------+ 7 username staff 224 15 Apr 19:42 Movies
|
||||||
|
```
|
||||||
|
|
||||||
|
You can **read the ACLs** of the file with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls -lde Movies
|
||||||
|
drwx------+ 7 username staff 224 15 Apr 19:42 Movies
|
||||||
|
0: group:everyone deny delete
|
||||||
|
```
|
||||||
|
|
||||||
|
You can find **all the files with ACLs** with (this is veeery slow):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls -RAle / 2>/dev/null | grep -E -B1 "\d: "
|
||||||
|
```
|
||||||
|
|
||||||
|
### Resource Forks | macOS ADS
|
||||||
|
|
||||||
|
This is a way to obtain **Alternate Data Streams in MacOS** machines. You can save content inside an extended attribute called **com.apple.ResourceFork** inside a file by saving it in **file/..namedfork/rsrc**.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "Hello" > a.txt
|
||||||
|
echo "Hello Mac ADS" > a.txt/..namedfork/rsrc
|
||||||
|
|
||||||
|
xattr -l a.txt #Read extended attributes
|
||||||
|
com.apple.ResourceFork: Hello Mac ADS
|
||||||
|
|
||||||
|
ls -l a.txt #The file length is still q
|
||||||
|
-rw-r--r--@ 1 username wheel 6 17 Jul 01:15 a.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
You can **find all the files containing this extended attribute** with:
|
||||||
|
|
||||||
|
{% code overflow="wrap" %}
|
||||||
|
```bash
|
||||||
|
find / -type f -exec ls -ld {} \; 2>/dev/null | grep -E "[x\-]@ " | awk '{printf $9; printf "\n"}' | xargs -I {} xattr -lv {} | grep "com.apple.ResourceFork"
|
||||||
|
```
|
||||||
|
{% endcode %}
|
||||||
|
|
||||||
|
### Privilege Escalation via File permissions
|
||||||
|
|
||||||
|
If a **process running as root writes** a file that can be controlled by a user, the user could abuse this to **escalate privileges**.\
|
||||||
|
This could occur in the following situations:
|
||||||
|
|
||||||
|
* File used was already created by a user (owned by the user)
|
||||||
|
* File used is writable by the user because of a group
|
||||||
|
* File used is inside a directory owned by the user (the user could create the file)
|
||||||
|
* File used is inside a directory owned by root but user has write access over it because of a group (the user could create the file)
|
||||||
|
|
||||||
|
Being able to **create a file** that is going to be **used by root**, allows a user to **take advantage of its content** or even create **symlinks/hardlinks** to point it to another place.
|
||||||
|
|
||||||
|
## **Universal binaries &** Mach-o Format
|
||||||
|
|
||||||
|
Mac OS binaries usually are compiled as **universal binaries**. A **universal binary** can **support multiple architectures in the same file**.
|
||||||
|
|
||||||
|
{% content-ref url="universal-binaries-and-mach-o-format.md" %}
|
||||||
|
[universal-binaries-and-mach-o-format.md](universal-binaries-and-mach-o-format.md)
|
||||||
|
{% endcontent-ref %}
|
||||||
|
|
||||||
|
## Risk Files Mac OS
|
||||||
|
|
||||||
|
The files `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/System` contains the risk associated to files depending on the file extension.
|
||||||
|
|
||||||
|
The possible categories include the following:
|
||||||
|
|
||||||
|
* **LSRiskCategorySafe**: **Totally** **safe**; Safari will auto-open after download
|
||||||
|
* **LSRiskCategoryNeutral**: No warning, but **not auto-opened**
|
||||||
|
* **LSRiskCategoryUnsafeExecutable**: **Triggers** a **warning** “This file is an application...”
|
||||||
|
* **LSRiskCategoryMayContainUnsafeExecutable**: This is for things like archives that contain an executable. It **triggers a warning unless Safari can determine all the contents are safe or neutral**.
|
||||||
|
|
||||||
|
## Log files
|
||||||
|
|
||||||
|
* **`$HOME/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2`**: Contains information about downloaded files, like the URL from where they were downloaded.
|
||||||
|
* **`/var/log/system.log`**: Main log of OSX systems. com.apple.syslogd.plist is responsible for the execution of syslogging (you can check if it's disabled looking for "com.apple.syslogd" in `launchctl list`.
|
||||||
|
* **`/private/var/log/asl/*.asl`**: These are the Apple System Logs which may contain interesting information.
|
||||||
|
* **`$HOME/Library/Preferences/com.apple.recentitems.plist`**: Stores recently accessed files and applications through "Finder".
|
||||||
|
* **`$HOME/Library/Preferences/com.apple.loginitems.plsit`**: Stores items to launch upon system startup
|
||||||
|
* **`$HOME/Library/Logs/DiskUtility.log`**: Log file for thee DiskUtility App (info about drives, including USBs)
|
||||||
|
* **`/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist`**: Data about wireless access points.
|
||||||
|
* **`/private/var/db/launchd.db/com.apple.launchd/overrides.plist`**: List of daemons deactivated.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
Basically, a bundle is a **directory structure** within the file system. Interestingly, by default this directory **looks like a single object in Finder**. 
|
Basically, a bundle is a **directory structure** within the file system. Interestingly, by default this directory **looks like a single object in Finder**. 
|
||||||
|
|
||||||
The **common** frequent bundle we will encounter is the **`.app` bundle**, but many other executables are also packaged as bundles, such as **`.framework`** and **`.systemextension`**.
|
The **common** frequent bundle we will encounter is the **`.app` bundle**, but many other executables are also packaged as bundles, such as **`.framework`** and **`.systemextension`** or **`.kext`**.
|
||||||
|
|
||||||
The types of resources contained within a bundle may consist of applications, libraries, images, documentation, header files, etc. All these files are inside `<application>.app/Contents/`
|
The types of resources contained within a bundle may consist of applications, libraries, images, documentation, header files, etc. All these files are inside `<application>.app/Contents/`
|
||||||
|
|
|
@ -77,6 +77,14 @@ Unfortunately, if an organization has not taken additional steps to **protect th
|
||||||
* Additional trusted certificates for server URL (optional pinning)
|
* Additional trusted certificates for server URL (optional pinning)
|
||||||
* Extra settings (e.g. which screens to skip in Setup Assistant)
|
* Extra settings (e.g. which screens to skip in Setup Assistant)
|
||||||
|
|
||||||
|
## Serial Number
|
||||||
|
|
||||||
|
Apple devices manufactured after 2010 generally have **12-character alphanumeric** serial numbers, with the **first three digits representing the manufacturing location**, the following **two** indicating the **year** and **week** of manufacture, the next **three** digits providing a **unique** **identifier**, and the **last** **four** digits representing the **model number**.
|
||||||
|
|
||||||
|
{% content-ref url="macos-serial-number.md" %}
|
||||||
|
[macos-serial-number.md](macos-serial-number.md)
|
||||||
|
{% endcontent-ref %}
|
||||||
|
|
||||||
## Steps for enrolment and management
|
## Steps for enrolment and management
|
||||||
|
|
||||||
1. Device record creation (Reseller, Apple): The record for the new device is created
|
1. Device record creation (Reseller, Apple): The record for the new device is created
|
||||||
|
|
|
@ -1,22 +1,40 @@
|
||||||
# MacOS Protocols
|
# macOS Network Services & Protocols
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
- 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)!
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
* **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).
|
||||||
|
|
||||||
- **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
||||||
|
|
||||||
- **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)**.
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Bonjour
|
## Remote Access Services
|
||||||
|
|
||||||
|
These are the common macOS services to access them remotely.\
|
||||||
|
You can enable/disable these services in `System Settings` --> `Sharing`
|
||||||
|
|
||||||
|
* **VNC**, known as “Screen Sharing”
|
||||||
|
* **SSH**, called “Remote Login”
|
||||||
|
* **Apple Remote Desktop** (ARD), or “Remote Management”
|
||||||
|
* **AppleEvent**, known as “Remote Apple Event”
|
||||||
|
|
||||||
|
Check if any is enabled running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rmMgmt=$(netstat -na | grep LISTEN | grep tcp46 | grep "*.3283" | wc -l);
|
||||||
|
scrShrng=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.5900" | wc -l);
|
||||||
|
flShrng=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | egrep "\*.88|\*.445|\*.548" | wc -l);
|
||||||
|
rLgn=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.22" | wc -l);
|
||||||
|
rAE=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.3031" | wc -l);
|
||||||
|
bmM=$(netstat -na | grep LISTEN | egrep 'tcp4|tcp6' | grep "*.4488" | wc -l);
|
||||||
|
printf "\nThe following services are OFF if '0', or ON otherwise:\nScreen Sharing: %s\nFile Sharing: %s\nRemote Login: %s\nRemote Mgmt: %s\nRemote Apple Events: %s\nBack to My Mac: %s\n\n" "$scrShrng" "$flShrng" "$rLgn" "$rmMgmt" "$rAE" "$bmM";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bonjour Protocol
|
||||||
|
|
||||||
**Bonjour** is an Apple-designed technology that enables computers and **devices located on the same network to learn about services offered** by other computers and devices. It is designed such that any Bonjour-aware device can be plugged into a TCP/IP network and it will **pick an IP address** and make other computers on that network **aware of the services it offers**. Bonjour is sometimes referred to as Rendezvous, **Zero Configuration**, or Zeroconf.\
|
**Bonjour** is an Apple-designed technology that enables computers and **devices located on the same network to learn about services offered** by other computers and devices. It is designed such that any Bonjour-aware device can be plugged into a TCP/IP network and it will **pick an IP address** and make other computers on that network **aware of the services it offers**. Bonjour is sometimes referred to as Rendezvous, **Zero Configuration**, or Zeroconf.\
|
||||||
Zero Configuration Networking, such as Bonjour provides:
|
Zero Configuration Networking, such as Bonjour provides:
|
||||||
|
@ -100,14 +118,10 @@ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.p
|
||||||
|
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
- 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)!
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
* **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).
|
||||||
|
|
||||||
- **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
||||||
|
|
||||||
- **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)**.
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
# macOS Users
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Common Users
|
||||||
|
|
||||||
|
* **Daemon**: User reserved for system daemons. The default daemon account names usually start with a "\_":
|
||||||
|
|
||||||
|
```bash
|
||||||
|
_amavisd, _analyticsd, _appinstalld, _appleevents, _applepay, _appowner, _appserver, _appstore, _ard, _assetcache, _astris, _atsserver, _avbdeviced, _calendar, _captiveagent, _ces, _clamav, _cmiodalassistants, _coreaudiod, _coremediaiod, _coreml, _ctkd, _cvmsroot, _cvs, _cyrus, _datadetectors, _demod, _devdocs, _devicemgr, _diskimagesiod, _displaypolicyd, _distnote, _dovecot, _dovenull, _dpaudio, _driverkit, _eppc, _findmydevice, _fpsd, _ftp, _fud, _gamecontrollerd, _geod, _hidd, _iconservices, _installassistant, _installcoordinationd, _installer, _jabber, _kadmin_admin, _kadmin_changepw, _knowledgegraphd, _krb_anonymous, _krb_changepw, _krb_kadmin, _krb_kerberos, _krb_krbtgt, _krbfast, _krbtgt, _launchservicesd, _lda, _locationd, _logd, _lp, _mailman, _mbsetupuser, _mcxalr, _mdnsresponder, _mobileasset, _mysql, _nearbyd, _netbios, _netstatistics, _networkd, _nsurlsessiond, _nsurlstoraged, _oahd, _ondemand, _postfix, _postgres, _qtss, _reportmemoryexception, _rmd, _sandbox, _screensaver, _scsd, _securityagent, _softwareupdate, _spotlight, _sshd, _svn, _taskgated, _teamsserver, _timed, _timezone, _tokend, _trustd, _trustevaluationagent, _unknown, _update_sharing, _usbmuxd, _uucp, _warmd, _webauthserver, _windowserver, _www, _wwwproxy, _xserverdocs
|
||||||
|
```
|
||||||
|
* **Guest**: Account for guests with very strict permissions
|
||||||
|
|
||||||
|
{% code overflow="wrap" %}
|
||||||
|
```bash
|
||||||
|
state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess")
|
||||||
|
for i in "${state[@]}"; do sysadminctl -"${i}" status; done;
|
||||||
|
```
|
||||||
|
{% endcode %}
|
||||||
|
|
||||||
|
* **Nobody**: Processes are executed with this user when minimal permissions are required
|
||||||
|
* **Root**
|
||||||
|
|
||||||
|
### User Privileges
|
||||||
|
|
||||||
|
* **Standard User:** The most basic of users. This user needs permissions granted from an admin user when attempting to install software or perform other advanced tasks. They are not able to do it on their own.
|
||||||
|
* **Admin User**: A user who operates most of the time as a standard user but is also allowed to perform root actions such as install software and other administrative tasks. All users belonging to the admin group are **given access to root via the sudoers file**.
|
||||||
|
* **Root**: Root is a user allowed to perform almost any action (there are limitations imposed by protections like System Integrity Protection).
|
||||||
|
* For example root won't be able to place a file inside `/System`
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
* 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)!
|
||||||
|
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||||
|
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||||
|
* **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** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||||
|
* **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).
|
||||||
|
|
||||||
|
</details>
|
Loading…
Reference in a new issue