osx priv-esc cve-2024-27822#21499
Open
h00die wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #19914
This PR adds an exploit for older MACs (like I have) with cve-2024-27822. Requires user interaction.
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.
Claude assisted in generating this code.
Verification
msfconsoleuse exploit/osx/local/packagekit_zshenv_privescexploit