Multiple new macOS sandbox escape vulnerabilities
Multiple XPC services in macOS accept connections from sandboxed applications without checking the client's entitlements, and some of these services can extract archives or run tasks without applying the quarantine attribute. An attacker who already has code execution inside a sandboxed app could abuse these services to drop and launch a non-sandboxed application, escaping the sandbox.
jhftss.github.io
Published on jhftss.github.io
This is a blog post for my presentation at the conference POC2024. The slides are uploaded here.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the XPC services registered in the app's PID domain did not verify the entitlement or identity of the connecting client, and some also failed to propagate the quarantine extended attribute to files they created.
Impact
A sandboxed application could escape the App Sandbox and, in some cases, bypass SIP protection, gaining broader file access and execution capabilities.
What the attacker needed
Code execution inside a sandboxed app; macOS version affected by the specific CVE
The fix
Apple fixed the issues by removing the vulnerable services or by checking a specific entitlement in the incoming XPC client's code signature.
How it was found
- Load the private framework that contains the target XPC service so it registers in the app's PID domain.
- Open an NSXPCConnection to the service by its bundle identifier.
- Call the vulnerable method (for example, one that extracts an archive or runs a task) with attacker-controlled paths.
- Use the resulting unquarantined files to launch a non-sandboxed application.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
macOS apps often run inside a 'sandbox', a set of rules that limits what files and services they can touch. Some helper services (XPC services) are supposed to be reachable only by trusted programs, but here they accepted requests from any sandboxed app. Because those helpers could write files without the usual 'quarantine' mark, a malicious app could use them to place and start a program outside the sandbox.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.