2024-02-08 22:20:49 +00:00
|
|
|
|
# macOS安全性与权限提升
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
<summary><strong>从零开始学习AWS黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS红队专家)</strong></a><strong>!</strong></summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
支持HackTricks的其他方式:
|
2024-01-04 11:46:15 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
|
|
|
|
|
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
|
|
|
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
|
|
|
|
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2022-10-27 23:22:18 +00:00
|
|
|
|
</details>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2023-07-31 15:59:11 +00:00
|
|
|
|
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
加入[**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy)服务器,与经验丰富的黑客和赏金猎人交流!
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
**黑客见解**\
|
|
|
|
|
深入探讨黑客的刺激和挑战的内容
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-20 02:34:32 +00:00
|
|
|
|
**实时黑客新闻**\
|
2024-02-08 22:20:49 +00:00
|
|
|
|
通过实时新闻和见解及时了解快节奏的黑客世界
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-20 02:34:32 +00:00
|
|
|
|
**最新公告**\
|
2024-02-08 22:20:49 +00:00
|
|
|
|
随时了解最新的赏金任务发布和重要平台更新
|
2023-07-14 14:20:34 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
**加入我们的** [**Discord**](https://discord.com/invite/N3FrSbmwdy),立即与顶尖黑客合作!
|
2023-07-14 14:20:34 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
## 基本的MacOS
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
如果您对macOS不熟悉,应该开始学习macOS的基础知识:
|
2023-05-29 20:18:06 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 特殊的macOS**文件和权限:**
|
2023-05-29 20:18:06 +00:00
|
|
|
|
|
2023-06-01 11:07:04 +00:00
|
|
|
|
{% content-ref url="macos-files-folders-and-binaries/" %}
|
|
|
|
|
[macos-files-folders-and-binaries](macos-files-folders-and-binaries/)
|
2023-05-04 23:22:39 +00:00
|
|
|
|
{% endcontent-ref %}
|
2023-05-04 19:22:41 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 常见的macOS**用户**
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2023-06-01 11:07:04 +00:00
|
|
|
|
{% content-ref url="macos-users.md" %}
|
|
|
|
|
[macos-users.md](macos-users.md)
|
|
|
|
|
{% endcontent-ref %}
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2023-06-01 11:07:04 +00:00
|
|
|
|
* **AppleFS**
|
2021-08-18 16:50:47 +00:00
|
|
|
|
|
2023-06-01 11:07:04 +00:00
|
|
|
|
{% content-ref url="macos-applefs.md" %}
|
|
|
|
|
[macos-applefs.md](macos-applefs.md)
|
|
|
|
|
{% endcontent-ref %}
|
2021-08-18 16:50:47 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* **内核**的**架构**
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2023-05-04 23:22:39 +00:00
|
|
|
|
{% content-ref url="mac-os-architecture/" %}
|
|
|
|
|
[mac-os-architecture](mac-os-architecture/)
|
2021-10-18 11:21:18 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 常见的macOS**网络服务和协议**
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2023-06-01 11:07:04 +00:00
|
|
|
|
{% content-ref url="macos-protocols.md" %}
|
|
|
|
|
[macos-protocols.md](macos-protocols.md)
|
2021-10-18 11:21:18 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* **开源**的macOS: [https://opensource.apple.com/](https://opensource.apple.com/)
|
|
|
|
|
* 要下载一个`tar.gz`,请将URL更改为[https://opensource.apple.com/**source**/dyld/](https://opensource.apple.com/source/dyld/),变为[https://opensource.apple.com/**tarballs**/dyld/**dyld-852.2.tar.gz**](https://opensource.apple.com/tarballs/dyld/dyld-852.2.tar.gz)
|
2023-09-11 00:05:20 +00:00
|
|
|
|
|
2022-05-01 13:25:53 +00:00
|
|
|
|
### MacOS MDM
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
在公司中,**macOS**系统很可能会被**MDM管理**。因此,从攻击者的角度来看,了解**它是如何工作的**是很有趣的:
|
2023-06-01 11:07:04 +00:00
|
|
|
|
|
2023-06-13 00:15:20 +00:00
|
|
|
|
{% content-ref url="../macos-red-teaming/macos-mdm/" %}
|
|
|
|
|
[macos-mdm](../macos-red-teaming/macos-mdm/)
|
2021-10-18 11:21:18 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
### MacOS - 检查、调试和模糊
|
2021-08-15 22:40:36 +00:00
|
|
|
|
|
2023-05-12 16:36:21 +00:00
|
|
|
|
{% content-ref url="macos-apps-inspecting-debugging-and-fuzzing/" %}
|
|
|
|
|
[macos-apps-inspecting-debugging-and-fuzzing](macos-apps-inspecting-debugging-and-fuzzing/)
|
2021-10-18 11:21:18 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-08-14 18:01:10 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
## MacOS安全保护
|
2021-07-17 00:28:18 +00:00
|
|
|
|
|
2023-06-01 21:44:32 +00:00
|
|
|
|
{% content-ref url="macos-security-protections/" %}
|
|
|
|
|
[macos-security-protections](macos-security-protections/)
|
2023-06-01 20:34:49 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-07-27 10:55:02 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 攻击面
|
2021-07-26 11:22:19 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
### 文件权限
|
2021-07-22 14:43:04 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
如果以**root身份运行的进程写入**一个用户可以控制的文件,用户可以利用这一点来**提升权限**。\
|
|
|
|
|
这可能发生在以下情况下:
|
2021-07-22 14:43:04 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 使用的文件已经被用户创建(由用户拥有)
|
|
|
|
|
* 使用的文件可被用户写入,因为属于一个组
|
|
|
|
|
* 使用的文件位于用户拥有的目录中(用户可以创建文件)
|
|
|
|
|
* 使用的文件位于由root拥有但用户有写访问权限的目录中(用户可以创建文件)
|
2021-08-10 14:04:23 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
能够**创建一个将被root使用的文件**,允许用户**利用其内容**,甚至创建**符号链接/硬链接**将其指向另一个位置。
|
2021-08-10 14:04:23 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
对于这种类型的漏洞,不要忘记**检查易受攻击的`.pkg`安装程序**:
|
2023-06-08 00:25:42 +00:00
|
|
|
|
|
2023-06-08 10:01:03 +00:00
|
|
|
|
{% content-ref url="macos-files-folders-and-binaries/macos-installers-abuse.md" %}
|
|
|
|
|
[macos-installers-abuse.md](macos-files-folders-and-binaries/macos-installers-abuse.md)
|
2023-06-08 00:25:42 +00:00
|
|
|
|
{% endcontent-ref %}
|
2023-05-26 00:05:25 +00:00
|
|
|
|
|
2024-01-04 11:46:15 +00:00
|
|
|
|
|
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
### 文件扩展名和URL协议处理程序
|
2024-01-04 11:46:15 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
通过文件扩展名注册的奇怪应用程序可能会被滥用,不同的应用程序可以注册以打开特定协议
|
2021-08-10 14:04:23 +00:00
|
|
|
|
|
2023-06-01 21:44:32 +00:00
|
|
|
|
{% content-ref url="macos-file-extension-apps.md" %}
|
|
|
|
|
[macos-file-extension-apps.md](macos-file-extension-apps.md)
|
2023-05-26 15:11:27 +00:00
|
|
|
|
{% endcontent-ref %}
|
2021-08-10 14:04:23 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
## macOS TCC / SIP权限提升
|
2023-09-11 00:05:20 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
在macOS中,**应用程序和二进制文件可以具有访问文件夹或设置的权限**,使它们比其他应用程序更具特权。
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
因此,想要成功地攻击macOS机器的攻击者将需要**提升其TCC权限**(甚至**绕过SIP**,取决于他的需求)。
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
这些权限通常以应用程序签名的**授权**形式给出,或者应用程序可能请求一些访问权限,**用户批准后**可以在**TCC数据库**中找到。进程可以获得这些权限的另一种方式是作为具有这些**权限的进程的子进程**,因为它们通常会被**继承**。
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
点击以下链接查找不同的方式来[**提升TCC权限**](macos-security-protections/macos-tcc/#tcc-privesc-and-bypasses),[**绕过TCC**](macos-security-protections/macos-tcc/macos-tcc-bypasses/),以及过去如何[**绕过SIP**](macos-security-protections/macos-sip.md#sip-bypasses)。
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
## macOS传统权限提升
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
当然,从红队的角度来看,您也应该对提升为root感兴趣。查看以下文章获取一些提示:
|
2021-07-19 23:13:08 +00:00
|
|
|
|
|
2023-12-20 02:34:32 +00:00
|
|
|
|
{% content-ref url="macos-privilege-escalation.md" %}
|
|
|
|
|
[macos-privilege-escalation.md](macos-privilege-escalation.md)
|
2023-05-15 08:11:15 +00:00
|
|
|
|
{% endcontent-ref %}
|
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
## 参考资料
|
2021-07-29 00:18:11 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* [**OS X事件响应:脚本和分析**](https://www.amazon.com/OS-Incident-Response-Scripting-Analysis-ebook/dp/B01FHOHHVS)
|
2022-04-05 22:24:52 +00:00
|
|
|
|
* [**https://taomm.org/vol1/analysis.html**](https://taomm.org/vol1/analysis.html)
|
|
|
|
|
* [**https://github.com/NicolasGrimonpont/Cheatsheet**](https://github.com/NicolasGrimonpont/Cheatsheet)
|
|
|
|
|
* [**https://assets.sentinelone.com/c/sentinal-one-mac-os-?x=FvGtLJ**](https://assets.sentinelone.com/c/sentinal-one-mac-os-?x=FvGtLJ)
|
2023-05-26 00:05:25 +00:00
|
|
|
|
* [**https://www.youtube.com/watch?v=vMGiplQtjTY**](https://www.youtube.com/watch?v=vMGiplQtjTY)
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2023-07-31 15:59:11 +00:00
|
|
|
|
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
2023-07-14 14:20:34 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
加入[**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy)服务器,与经验丰富的黑客和赏金猎人交流!
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
**黑客见解**\
|
|
|
|
|
深入探讨黑客的刺激和挑战的内容
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2023-12-20 02:34:32 +00:00
|
|
|
|
**实时黑客新闻**\
|
2024-02-08 22:20:49 +00:00
|
|
|
|
通过实时新闻和见解及时了解快节奏的黑客世界
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2023-12-20 02:34:32 +00:00
|
|
|
|
**最新公告**\
|
2024-02-08 22:20:49 +00:00
|
|
|
|
随时了解最新的赏金任务发布和重要平台更新
|
2023-02-27 09:28:45 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
**加入我们的** [**Discord**](https://discord.com/invite/N3FrSbmwdy),立即与顶尖黑客合作!
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2022-10-27 23:22:18 +00:00
|
|
|
|
<details>
|
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
<summary><strong>从零开始学习AWS黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS红队专家)</strong></a><strong>!</strong></summary>
|
2024-01-04 11:46:15 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
支持HackTricks的其他方式:
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 22:20:49 +00:00
|
|
|
|
* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
|
|
|
|
|
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
|
|
|
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
|
|
|
|
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|