macOS SIP Analysis Skill
This skill helps analyze macOS System Integrity Protection (SIP) configurations, identify potential security gaps, and understand bypass vectors for security assessments.
When to Use This Skill
Use this skill when:
- Assessing macOS system security posture
- Checking SIP status and configuration
- Identifying potential SIP bypass vectors
- Understanding macOS privilege escalation paths
- Analyzing Sealed System Snapshots
- Performing macOS penetration testing
- Reviewing system hardening requirements
Core Concepts
What is SIP?
System Integrity Protection (SIP) is a macOS security mechanism that prevents even root users from modifying protected system files and directories. Key protected paths include:
/System/bin/sbin/usr
SIP rules are defined in /System/Library/Sandbox/rootless.conf. Paths prefixed with * are exceptions where modifications are allowed.
SIP Status Commands
# Check if SIP is enabled
csrutil status
# Check authenticated root status (for sealed snapshots)
csrutil authenticated-root status
# Check mount status (read-only sealed volumes)
mount | grep -E "(sealed|read-only)"
Identifying SIP Protection
Use ls -lOd to check for protection flags:
# Check directory protection status
ls -lOd /usr/libexec/cups
ls -lOd /usr/libexec
Flag meanings:
restricted: Directory is SIP-protected (no create/modify/delete)sunlnk: Directory cannot be deleted, but files inside can be modifiedcom.apple.rootlessextended attribute: File is SIP-protected
SIP Bypass Vectors
1. Installer Package Bypasses
Apple-signed installer packages can bypass SIP protections. Notable vulnerabilities:
- CVE-2019-8561: Package swap after signature verification
- CVE-2020-9854: Arbitrary binary execution from mounted images
- CVE-2021-30892 (Shrootless):
/etc/zshenvexecution viasystem_installd - CVE-2022-22583: Virtual image mounting in
/tmpfor post-install scripts - CVE-2023-42860: Symlink-based file unrestricting
2. Entitlement-Based Bypasses
Key SIP-bypassing entitlements:
com.apple.rootless.install.heritable: Child processes inherit SIP bypasscom.apple.rootless.install: Direct SIP bypasscom.apple.rootless.xpc.bootstrap: Control launchdcom.apple.rootless.internal.installer-equivalent: Unfettered filesystem access
3. File System Manipulation
- Inexistent files: Files listed in
rootless.confbut not present can be created - Mount over protected folders: Mount filesystems over SIP-protected paths
- fsck_cs vulnerability: Symbolic link corruption of
Info.plist
4. Environment Variable Exploitation
/etc/zshenv: Executed byzshin non-interactive mode~/.zshenv: User-level persistence and privilege escalationBASH_ENV: Bash environment variable exploitationPERL5OPT: Perl script injection
Sealed System Snapshots
Introduced in macOS Big Sur (11.0), Sealed System Snapshots provide additional protection:
Key Features
- Immutable System: System volume cannot be modified
- Safe Updates: New snapshots created for each update
- Data Separation: Data stored on separate volume
Checking Snapshots
# List APFS volumes and snapshots
diskutil apfs list
# Check for sealed status
mount | grep "sealed"
# Verify authenticated root
csrutil authenticated-root status
Important Paths
- System volume:
/(sealed, read-only) - Data volume:
/System/Volumes/Data(user-accessible) - Update mount:
/System/Volumes/Update/mnt1
Security Assessment Checklist
When assessing macOS SIP security:
Check SIP Status
- Run
csrutil status - Verify
csrutil authenticated-root status
- Run
Analyze Protected Paths
- Check
/System/Library/Sandbox/rootless.conffor exceptions - Identify
restrictedandsunlnkflags on key directories
- Check
Identify Bypass Opportunities
- Check for Apple-signed packages that could be exploited
- Look for
/etc/zshenvor~/.zshenvfiles - Verify no symbolic links to protected files
Review Entitlements
- Check for processes with
com.apple.rootless.*entitlements - Identify XPC services with SIP-bypassing capabilities
- Check for processes with
Assess Snapshot Integrity
- Verify snapshots are sealed
- Check mount status for read-only protection
Common Commands Reference
# SIP Status
csrutil status
csrutil authenticated-root status
# Directory Protection
ls -lOd /usr/libexec
ls -lOd /System/Library/Sandbox/rootless.conf
# Snapshot Analysis
diskutil apfs list
mount | grep -E "(sealed|read-only)"
# Check for zshenv files
ls -la /etc/zshenv
ls -la ~/.zshenv
# Check extended attributes
xattr -l /path/to/file | grep rootless
Important Notes
- SIP cannot be disabled without recovery mode: Requires
Command+Rat boot, thencsrutil disable - Sealed snapshots prevent boot if modified: OS won't boot if sealed snapshot is tampered with
- Partial SIP disabling:
csrutil enable --without debugkeeps SIP but removes debugging protections - Sandbox hooks:
hook_vnode_check_setextattrprevents modification ofcom.apple.rootlessattribute
When NOT to Use This Skill
- For general macOS troubleshooting unrelated to security
- For user data recovery tasks
- For application installation guidance
- For non-security-related system configuration
Related Security Concepts
- TCC (Transparency, Consent, and Control): macOS privacy database that can be manipulated via SIP bypass
- Kernel Extensions: SIP prevents loading unsigned kexts
- NVRAM Variables: SIP restricts modification of boot-related variables
- Task Ports: SIP prevents getting task-ports for Apple-signed processes