Skip to content
Access control Write-up Advanced

Turning a boring file move into a privilege escalation on Mac

A script run by a setuid-root binary moved a user-controlled file into a directory chosen by the user via a symlink, allowing a low-privileged user to place a crafted file into /etc/sudoers.d. The attacker could then gain root privileges by injecting a sudoers rule that grants passwordless sudo.

kn32 Follow

Published on pwn.win

While poking around Parallels Desktop I found a script which is invoked by a setuid-root binary, which has the following snippet:

kn32, on pwn.win

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

The script used a user-writable path for a file move without checking that the destination was not a symlink, allowing a low-privileged user to redirect the move into an arbitrary directory.

Impact

A local low-privileged user could escalate to root, as demonstrated by obtaining a root shell.

What the attacker needed

Local low-privileged user; Parallels Desktop installed

The fix

The vulnerability was fixed in version 18.3.2, likely by preventing the script from following symlinks or by using a safe temporary directory.

How it was found

  1. Create a symlink at ~/Library/Parallels~ pointing to /etc/sudoers.d/.
  2. Create a symlink at ~/Library/Parallels pointing to /var/log/install.log.
  3. Inject a sudoers rule into /var/log/install.log using the logger utility with the install.error priority and a carriage return to start a new line.
  4. Invoke the vulnerable script (which runs as root) to move the symlink into /etc/sudoers.d/.
  5. Run sudo su to obtain a root shell.

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 setuid-root program runs with high privileges, and it called a script that moved a file from the user's home directory to a backup location. Because the user could control both the file and the backup location (via a symbolic link, which is like a shortcut), they could trick the script into placing a file they control into a sensitive system folder. That folder is used by sudo to decide who can run commands as root, so the user could give themselves full admin rights.

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.

More by kn32

View all

12 more disclosed reports, best first.

More from Parallels

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.