Exploit database

Vulnerability

CVE-2024-27822

Vulnerability details

Score
7.4
Severity
high

CVSS 3.1 · CISA-ADP

Vector string

CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Description

A logic issue was addressed with improved restrictions. This issue is fixed in macOS Sonoma 14.5. An app may be able to gain root privileges.

CVE Program

Exploit source choices

1 source
macOS PackageKit ZSH Environment Privilege Escalation
MSF-osx--local--packagekit_zshenv_privescMetasploitOSX,Unix / remotePreferred

This module exploits CVE-2024-27822, a vulnerability in macOS PackageKit.framework where PKG installer scripts using a ZSH shebang (#!/bin/zsh) are executed as root while inheriting the installing user's environment. This causes ZSH to load the user's ~/.zshenv with root privileges before the installer script body runs. The module injects a payload into ~/.zshenv that only fires when EUID is 0, uploads a minimal PKG (from data/exploits/CVE-2024-27822/template.pkg) whose install script uses a #!/bin/zsh shebang, and opens it with Installer.app. When the user approves the installation dialog and authenticates, PackageKit runs the install script as root. ZSH sources ~/.zshenv before the script body executes, so the payload fires with root privileges. The original ~/.zshenv content is restored immediately after the payload runs. Affected: macOS 14.4 and earlier, 13.6.6 and earlier, 12.7.4 and earlier, and all macOS 11 and older releases. Fixed in: macOS 14.5, 13.6.7, 12.7.5.

2024-06-03packagekit_zshenv_privesc.rb