Skip to content
Access control Write-up Advanced

Analyzing CVE-2025-31191: A macOS security-scoped bookmarks-based sandbox escape

A macOS design flaw let a sandboxed app delete the keychain secret used by the ScopedBookmarkAgent to sign security-scoped bookmarks and replace it with a secret of its own choosing. An attacker could then forge bookmark entries and obtain file access tokens without user interaction, escaping the App Sandbox.

microsoft.com

Published on microsoft.com

In April 2024, Microsoft uncovered a vulnerability in macOS that could allow specially crafted codes to escape the App Sandbox and run unrestricted on the system. An attacker could create an exploit to escape the App Sandbox without user interaction required for any sandboxed app using security-scoped bookmarks.

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 keychain access control list only protected reading the signing secret, so a sandboxed process could delete the entry and create a replacement with a known value and a permissive ACL.

Impact

An attacker could escape the App Sandbox and run code unrestricted, then elevate privileges, exfiltrate data and deploy further payloads; the text notes the exploit is complex and, for Office, needs macros enabled, and that Defender for Endpoint detects and blocks the behaviour.

What the attacker needed

A sandboxed app using security-scoped bookmarks; ability to run code inside that app; for Office, macros must be enabled

How it was found

  1. Delete the old signing secret from the keychain and decide on a new known secret that is accessible to all processes.
  2. Calculate the cryptographic key for an app since its bundle ID is known.
  3. Artificially sign new entries in the persistent scoped bookmarks PLIST file that is accessible since it persists in the Containers directory.
  4. Invoke GrantAccessToMultipleFiles, which sends the newly self-signed bookmarks to ScopedBookmarkAgent.
  5. Use the new arbitrary file access capability to escape the macOS sandbox.

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 macOS feature that stops an app from touching files it was not given permission to use. Normally a user must pick a file in a dialog before the app can reach it, and a helper service signs a lasting permission slip so the app can reopen that file later. The researchers found that a sandboxed app could swap out the secret key used to sign those slips, so it could write its own slips and reach any file it liked.

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.

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.