Microsoft OneDrive for macOS Local Privilege Escalation
The OneDrive XPC daemon verified clients by PID instead of audit token, and its update method retained file permissions when moving a new app, allowing a low-privileged user to replace the root helper with a malicious binary. An attacker could thus execute arbitrary code as root.
Published on offensive-security.com
Research & Tutorials
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
Root cause
Likely the combination of PID-based client verification and retaining file permissions during app installation allowed a low-privileged user to overwrite a root-executed helper.
Impact
A local low-privileged user could execute arbitrary code as root, as demonstrated by a root Terminal popup.
What the attacker needed
Local user access; OneDrive installed
How it was found
- Copy the existing OneDrive.app to /tmp.
- Change permissions of the copied app to 777.
- Call TrashOldApplication to delete the original app.
- Call InstallNewApplicationAtPath to copy the modified app to /Applications.
- Replace the OneDriveUpdaterDaemon binary with a custom binary.
- Wait for the daemon to exit and invoke the Mach service to execute the binary as root.
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.
A background service running as root checked the identity of connecting programs using a process ID, which can be reused by another program. Also, when updating the app, it kept the file permissions from the new copy, so a normal user could make the app writable by everyone. By replacing a file that the root service later runs, the user could run their own code as root.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.