Skip to content
RCE Write-up Intermediate

Bash Privileged-mode Vulnerabilities In Parallels Desktop And CDPATH Handling In MacOS

Parallels Desktop setuid root binaries invoked bash scripts without privileged mode, so an unprivileged local user could set environment variables like BASH_ENV or export shell functions to execute code as root. Additionally, Apple's bash 3.2 processes CDPATH and GLOBIGNORE even in privileged mode, unlike upstream bash, which could allow hijacking of relative cd commands in setuid scripts.

Reno Robert Follow

Published on zerodayinitiative.com

In the last few years, we have seen multiple vulnerabilities in Parallels Desktop leading to virtual machine escapes. Interested readers can check our previous blog posts about vulnerabilities across interfaces such as RDPMC hypercalls, the Parallels ToolGate, and the VGA virtual device.

Reno Robert (@renorobertr), on zerodayinitiative.com

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 setuid binaries invoked bash without the privileged mode flag (-p) and did not sanitise environment variables, so bash trusted attacker-controlled variables such as BASH_ENV and exported shell functions.

What the attacker needed

Local access to the macOS system; ability to run the setuid binary; control over environment variables

The fix

The vulnerabilities were fixed in Parallels Desktop 18.1.0 by adding the -p flag to shebangs and clearing the environment during posix_spawn; for Apple bash, scripts should use privileged mode and be aware of CDPATH/GLOBIGNORE differences.

How it was found

  1. Identify a setuid root binary that invokes a bash script without privileged mode.
  2. Set the BASH_ENV environment variable to point to a malicious script, or export a shell function with the same name as a command used in the script.
  3. Run the setuid binary; the bash script executes the attacker's code 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.

Some programs run with extra permissions (setuid root) so they can do privileged tasks. If such a program starts a shell (bash) without telling it to ignore the user's environment settings, the user can sneak in commands that the shell will run as root. This is called local privilege escalation because a normal user can become the administrator on the same machine.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Reno Robert

View all

1 more disclosed report, 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.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.