Disclosure
This analysis details two vulnerabilities (CVE-2026-50657 and CVE-2026-50658) in Microsoft Defender for macOS, explaining the technical details of the TOCTOU exploit leading to file read and root escalation. A patch was released on July 14, 2026, for versions prior to 101.26042.0020.
Microsoft Defender for macOS: Arbitrary File Read and Local Privilege Escalation to root
Read on dbugs: https://dbu.gs/news/microsoft-defender-for-macos-arbitrary-file-read-and-local-privilege-escalation-to-root-20261119
Security researcher Eugene Lim (Spaceraccoon) analyzed two vulnerabilities in Microsoft Defender for Endpoint on macOS — CVE-2026-50657 (https://dbu.gs/vulnerability/CVE-2026-50657) and CVE-2026-50658 (https://dbu.gs/vulnerability/CVE-2026-50658). They allow a local unprivileged user to read protected files and execute code with root privileges.
The privileged daemon "wdavdaemon" exposes two Unix domain sockets: "/var/run/wdavdaemon.sock" and "/var/run/priv_wdavdaemon.sock". Both have "0666" permissions, making them accessible to any local process. To verify a connecting client, the daemon obtains its PID via "LOCAL_PEERPID", retrieves its executable path using "proc_pidpath()", and checks the binary's location and code signature.
The bypass exploits a time-of-check-to-time-of-use (TOCTOU) race condition. "LOCAL_PEERPID" captures the PID when the connection is established, while "proc_pidpath()" returns the process's current executable path. The attacker connects to the socket, sends a request, and invokes "execve()" to launch a signed Defender component under the same PID. If the daemon checks the process path after "execve()", it treats the connection as trusted, even though the request originated from attacker-controlled code.
This provides access to two operations:
• CVE-2026-50657 (https://dbu.gs/vulnerability/CVE-2026-50657) — arbitrary file read. The "get_diagnostic_files" command creates a diagnostic ZIP archive as "root" without additional authorization. By placing a hardlink to a protected file in Defender's log directory, the attacker can cause its contents to be included in the archive. Unlike a symlink, a hardlink passes the regular-file check. This makes it possible to read "/etc/kcpassword", local account password hashes, and other secrets.
• CVE-2026-50658 (https://dbu.gs/vulnerability/CVE-2026-50658) — privilege escalation. The "handle_threat::restore" handler restores files from quarantine to a specified directory. If the optional "AuthorizationExternalForm" field is absent, the authorization check is skipped. After bypassing client validation, the attacker can make the root-privileged daemon create a new file containing attacker-controlled data. Existing files cannot be overwritten, and the restored file's ownership is subsequently set to that of the original file.
The researcher placed a file in Defender's quarantine, replaced its contents with a "cron" job, and then used the vulnerable restore mechanism to create "/etc/crontab". On a standard macOS installation, this file is usually absent, and its creation causes "launchd" to start "cron". Crucially, "cron" does not require "/etc/crontab" to be owned by root: commands run as the user specified in the corresponding job field. In the PoC, the researcher specified "root" and obtained an interactive root shell.
Both vulnerabilities were fixed on July 14, 2026. Versions of Microsoft Defender for Endpoint for Mac earlier than 101.26042.0020 are affected.
Article: https://spaceraccoon.dev/race-against-the-machine-defender-macos-lpe/
CVE-2026-50657 — PT-2026-58485: https://dbu.gs/vulnerability/PT-2026-58485
CVE-2026-50658 — PT-2026-58486: https://dbu.gs/vulnerability/PT-2026-58486
250 views2 likes0 reposts
Source