Skip to content
RCE Write-up Advanced

Uncovering a macOS App Sandbox escape vulnerability: A deep dive into CVE-2022-26706

A sandbox escape in macOS allowed a sandboxed app such as Microsoft Word to run arbitrary code outside its sandbox by using the open command's --stdin option to feed a quarantined Python file to the Python app. An attacker could use this to gain elevated privileges or execute malicious commands on the affected device.

Microsoft 365 Defender Research Team Follow

Published on microsoft.com

Microsoft uncovered a vulnerability in macOS that could allow specially crafted codes to escape the App Sandbox and run unrestricted on the system. We shared these findings with Apple through Coordinated Vulnerability Disclosure (CVD) via Microsoft Security Vulnerability Research (MSVR) in October 2021.

Microsoft Threat Intelligence, on microsoft.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

The open command's --stdin option allowed a sandboxed app to pass a quarantined file as standard input to Python, which then executed it outside the sandbox because the process was launched by launchd.

Impact

An attacker could escape the App Sandbox and gain elevated privileges or execute malicious commands like installing additional payloads.

What the attacker needed

MacOS with vulnerable version; sandboxed app like Microsoft Word; attacker can run macro or code in app

How it was found

  1. Drop a “~$exploit.py” file with arbitrary Python commands.
  2. Run open –stdin=’~$exploit.py’ -a Python, which runs the Python app with the dropped file as standard input.
  3. Python executes the code, and since it is a child process of launchd, it is not bound by Word's sandbox rules.

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.

The App Sandbox is a security feature in macOS that limits what an app can do, like which files it can read or write. This report shows that a sandboxed app could trick another program, the open command, into running a Python script outside the sandbox, letting the attacker run any code on 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.

More by Microsoft 365 Defender Research Team

View all

3 more disclosed reports, best first.

More from Apple

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.