Skip to content
Access control Write-up Intermediate

librarian (CVE-2023-38571) - a macOS TCC bypass in Music and TV

The Music app on macOS, which has Full Disk Access, moves unrecognised files from an 'Automatically Add to Music' folder to a 'Not Added' subfolder using a rename() call. An attacker can replace the dated subfolder with a symbolic link to the TCC directory, causing the file to be written there and allowing control of the user's TCC database to grant automation rights to Finder, which has Full Disk Access.

Gergely Kalman Follow

Published on gergelykalman.com

This post is a writeup of CVE-2023-38571, a macOS TCC bypass bug I found. It was supposed to be unveiled in my upcoming talk:

Gergely Kalman, on gergelykalman.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 use of rename() without protection against symbolic links, combined with the Music app having unnecessary Full Disk Access.

What the attacker needed

Music app running; ability to write to the 'Automatically Add to Music' folder; ability to create symlinks in that folder

The fix

Apple replaced the rename() call with renameatx_np() using the RENAME_NOFOLLOW_ANY flag, closing the symlink vector.

How it was found

  1. Drop a file into the 'Automatically Add to Music' folder.
  2. Wait for the dated subfolder to be created.
  3. Remove the dated subfolder.
  4. Replace it with a symbolic link to the TCC directory.
  5. Music renames the file into the symlinked directory, writing to the TCC folder.

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.

On macOS, some apps are given special permission to read all files, called Full Disk Access. The Music app has this permission but also automatically moves files you drop into a certain folder. The bug is that an attacker can trick Music into moving a file to a protected location by replacing a folder with a shortcut (symlink), letting them change security settings.

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 Gergely Kalman

View all

7 more disclosed reports, best first.

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.