# Privileged path re-resolution race

Privileged code that checks a path or peer, then reopens it by name instead of by handle

_Area: Memory corruption and native code. Seen in 2 disclosed reports; latest 2026-11-15. Updated 2026-11-24._

## How it works
A privileged component (daemon, agent, updater) must decide whether a path or peer is safe, then act on it. If the check and the use each resolve the name independently, the attacker changes what the name points to in between. The assumption that breaks: that a path or PID identifies the same object at check time and use time. On POSIX, `execve` updates a process's path while its PID stays frozen [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md); a symlink can be repointed between `stat` and `open` [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf.md); a redirectable file path can be swapped while a privileged reader is suspended [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md).

## Where it shows up
- Peer validation using `LOCAL_PEERPID` then `proc_pidpath`, or any pid-then-path identity check [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md)
- Privileged file writes into user-controlled directories (home dirs, `~/.ssh`) without `O_NOFOLLOW` [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf.md)
- Signature/update importers, VSS snapshot readers, cloud-placeholder restores that follow a path [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md)
- Opcodes or branches that skip an authorization call, or treat a missing auth argument as authorized [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md)
- Hardlink acceptance where symlinks are rejected by a regular-file filter [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md)

## How to review
Find every privileged operation that takes a name (path, PID, socket peer) and ask: is the object resolved once and held, or resolved again at use? The invariant: the identity checked must be the identity used — open by handle/descriptor, `O_NOFOLLOW`, verify target ownership, or re-validate after acquiring a lock the attacker cannot break. For IPC, confirm the peer check cannot be raced by `execve` or PID reuse. For file writes, confirm the final component and every parent are not attacker-writable, and that the auth gate cannot be bypassed by an opcode or an absent argument.

## How finders spotted it
- Cross-platform variant analysis: after Windows Defender race CVEs, the finder compared the macOS peer check and noticed a frozen PID paired with a live path, plus that macOS `link(2)` needs no target access unlike Windows hardlinks [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md)
- Correlated endpoint telemetry (Defender quarantine names, EICAR alerts) with public PoC filenames, then pulled VPN logs showing one account from Russia, Singapore and Switzerland, and analyzed the tunnel binary [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md)

## Variants seen
- PID-reuse/execve race against IPC peer validation, reaching ungated opcodes [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md)
- Symlink following in a root-privileged file-write helper [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf.md)
- TOCTOU on a signature-update path, with an oplock suspending the privileged reader while a frozen snapshot holds the target [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md)

## Impact and severity
Root file read/write escalating to credential theft and root via a dormant cron path [E1](https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md); low-privileged account to root via SSH key injection [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf.md); unprivileged user to SYSTEM via SAM hash extraction and token theft, chained with VPN initial access and a reverse tunnel [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md). Severity rises with what the privileged write reaches (credentials, auth files) and whether the race can be held open indefinitely [E3](https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Microsoft Defender for macOS** (wdavdaemon AF_UNIX IPC sockets) (version not stated): Race Against the (Mac)hine: Local Privilege Escalation in Microsoft Defender for macOS (CVE-2026-50657, CVE-2026-50658). Report: https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md
- **Microsoft Windows Defender** (signature update import pipeline) (version not stated): Nightmare-Eclipse Tooling Seen in Real-World Intrusion (CVE-2026-33825). Report: https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Aspaceraccoon-dev-race-against-the-machine-defender-macos-lpe.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf.md
- E3: https://bugbountylibrary.com/r/blog%3Ahuntress-com-blog-nightmare-eclipse-intrusion.md
