batsignal (no CVE) - a macOS LPE
A local privilege escalation in macOS Spotlight allowed any user, including Guest, to overwrite protected files such as /etc/sudoers by exploiting insecure file writes and SIP bypasses via user-mounted disk images. An attacker could gain root privileges.
Published on gergelykalman.com
This post is a writeup of batsignal, a macOS local privilege escalation bug from my talk:
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
Impact
An attacker could overwrite /etc/sudoers to gain root privileges, but the exploit required specific conditions and was later mitigated by fixes that restricted Spotlight's access to certain directories and union mounts.
What the attacker needed
Ability to mount a disk image; Spotlight indexing enabled; Local user access (including Guest)
The fix
The issue was fixed by disallowing Spotlight from accessing /Library/Caches/com.apple.Spotlight/ and later by preventing Spotlight from accessing files on union mounts.
How it was found
- Create and mount an HFS+ disk image.
- Turn Spotlight on with mdutil -i on /MY/VOLUME, so /.Spotlight-V100 gets created on the volume.
- Unmount and edit the binary image to break the SIP regex match (e.g., change .Spotlight-V100 to .Spotlight-V900).
- Mount again and do whatever you want under .Spotlight-V900.
- Unmount, reverse the binary edits, and mount again so Spotlight operates on malicious content.
- Optionally trigger a Spotlight index rebuild with mdutil -E /MY/VOLUME.
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.
Spotlight is macOS's search tool, and it runs with the highest permissions (root) to index files. The bug let a normal user trick Spotlight into writing attacker-controlled content to sensitive system files, which could give them full control of the computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.