hacktricks/macos-hardening/macos-security-and-privilege-escalation
Carlos Polop 233c08b779 hp
2024-11-19 12:36:42 +01:00
..
mac-os-architecture GITBOOK-4418: No subject 2024-10-01 14:31:29 +00:00
macos-apps-inspecting-debugging-and-fuzzing GITBOOK-4414: No subject 2024-09-25 23:50:45 +00:00
macos-files-folders-and-binaries GITBOOK-4408: No subject 2024-09-21 18:19:42 +00:00
macos-proces-abuse GITBOOK-4392: No subject 2024-09-02 14:06:08 +00:00
macos-security-protections GITBOOK-4430: No subject 2024-11-19 11:31:22 +00:00
macos-applefs.md a 2024-07-19 01:15:55 +02:00
macos-basic-objective-c.md a 2024-07-19 01:15:55 +02:00
macos-bypassing-firewalls.md a 2024-07-18 18:14:56 +02:00
macos-defensive-apps.md a 2024-07-19 01:15:55 +02:00
macos-dyld-hijacking-and-dyld_insert_libraries.md a 2024-07-19 01:15:55 +02:00
macos-file-extension-apps.md a 2024-07-18 18:14:56 +02:00
macos-gcd-grand-central-dispatch.md a 2024-07-18 18:14:56 +02:00
macos-privilege-escalation.md a 2024-07-19 01:15:55 +02:00
macos-protocols.md a 2024-07-19 01:15:55 +02:00
macos-users.md GITBOOK-4408: No subject 2024-09-21 18:19:42 +00:00
README.md hp 2024-11-19 12:36:42 +01:00

macOS Security & Privilege Escalation

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}

Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!

Hacking Insights
Engage with content that delves into the thrill and challenges of hacking

Real-Time Hack News
Keep up-to-date with fast-paced hacking world through real-time news and insights

Latest Announcements
Stay informed with the newest bug bounties launching and crucial platform updates

Join us on Discord and start collaborating with top hackers today!

Basic MacOS

If you are not familiar with macOS, you should start learning the basics of macOS:

  • Special macOS files & permissions:

{% content-ref url="macos-files-folders-and-binaries/" %} macos-files-folders-and-binaries {% endcontent-ref %}

  • Common macOS users

{% content-ref url="macos-users.md" %} macos-users.md {% endcontent-ref %}

  • AppleFS

{% content-ref url="macos-applefs.md" %} macos-applefs.md {% endcontent-ref %}

  • The architecture of the kernel

{% content-ref url="mac-os-architecture/" %} mac-os-architecture {% endcontent-ref %}

  • Common macOS network services & protocols

{% content-ref url="macos-protocols.md" %} macos-protocols.md {% endcontent-ref %}

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-red-teaming/macos-mdm/" %} macos-mdm {% endcontent-ref %}

MacOS - Inspecting, Debugging and Fuzzing

{% content-ref url="macos-apps-inspecting-debugging-and-fuzzing/" %} macos-apps-inspecting-debugging-and-fuzzing {% endcontent-ref %}

MacOS Security Protections

{% content-ref url="macos-security-protections/" %} macos-security-protections {% endcontent-ref %}

Attack Surface

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.

For this kind of vulnerabilities don't forget to check vulnerable .pkg installers:

{% content-ref url="macos-files-folders-and-binaries/macos-installers-abuse.md" %} macos-installers-abuse.md {% endcontent-ref %}

File Extension & URL scheme app handlers

Weird apps registered by file extensions could be abused and different applications can be register to open specific protocols

{% content-ref url="macos-file-extension-apps.md" %} macos-file-extension-apps.md {% endcontent-ref %}

macOS TCC / SIP Privilege Escalation

In macOS applications and binaries can have permissions to access folders or settings that make them more privileged than others.

Therefore, an attacker that wants to successfully compromise a macOS machine will need to escalate its TCC privileges (or even bypass SIP, depending on his needs).

These privileges are usually given in the form of entitlements the application is signed with, or the application might requested some accesses and after the user approving them they can be found in the TCC databases. Another way a process can obtain these privileges is by being a child of a process with those privileges as they are usually inherited.

Follow these links to find different was to escalate privileges in TCC, to bypass TCC and how in the past SIP has been bypassed.

macOS Traditional Privilege Escalation

Of course from a red teams perspective you should be also interested in escalating to root. Check the following post for some hints:

{% content-ref url="macos-privilege-escalation.md" %} macos-privilege-escalation.md {% endcontent-ref %}

macOS Compliance

References

Join HackenProof Discord server to communicate with experienced hackers and bug bounty hunters!

Hacking Insights
Engage with content that delves into the thrill and challenges of hacking

Real-Time Hack News
Keep up-to-date with fast-paced hacking world through real-time news and insights

Latest Announcements
Stay informed with the newest bug bounties launching and crucial platform updates

Join us on Discord and start collaborating with top hackers today!

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}