A Technical Analysis of CVE-2022-22583 and CVE-2022-32800
The PackageKit framework created a temporary sandbox directory without restrictions, allowing an attacker to replace it with a symlink and redirect privileged scripts to a controlled location, thereby bypassing System Integrity Protection. A second flaw allowed hijacking the SandboxState file on a DMG volume to control the PKInstallSandbox instance and delete arbitrary SIP-protected paths.
Published on trendmicro.com
This blog entry discusses the technical details of how we exploited CVE-2022-22583 using a different method. We also tackle the technical details of CVE-2022-32800, another SIP-bypass that we discovered more recently, in this report.
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 installer created a temporary directory in /tmp without proper access restrictions, and later trusted files inside it, allowing a symlink or file replacement attack.
Impact
An attacker could execute arbitrary commands in a SIP-bypass context and create files in restricted directories, and for CVE-2022-32800 could remove arbitrary SIP-protected paths.
What the attacker needed
Ability to install a package; local access to the system; timing for symlink race
The fix
Apple patched CVE-2022-22583 by using a restricted sandbox path for Apple-signed packages, and patched CVE-2022-32800 by requiring the SandboxState file to be trusted or restricted for Apple-signed packages.
How it was found
- Monitor the creation of the “/tmp/PKInstallSandbox.XXXXXX” directory and replace it with a symlink to another “/tmp/fakebox” location to redirect the restricted scripts there.
- Once the scripts are located inside the “/tmp/fakebox”, remove the symlink and recreate the same “/tmp/PKInstallSandbox.XXXXXX” directory, then place the payload script in the “/tmp/PKInstallSandbox.XXXXXX/Scripts/pkgid.XXXXXX/” directory.
- Wait for the payload script to execute.
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.
System Integrity Protection (SIP) is a macOS security feature that stops even root from modifying certain critical files. The installer service runs with special privileges that can bypass SIP. The bug let an attacker trick the installer into running their own script with those privileges, so they could change protected files.
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.