Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2023-38571 PoC — Apple macOS Big Sur 安全漏洞

Source
Associated Vulnerability
Title:Apple macOS Big Sur 安全漏洞 (CVE-2023-38571)
Description:Apple macOS Big Sur是美国苹果(Apple)公司的苹果公司用于MAC操作系统macOS的第17个主要版本。 Apple macOS Big Sur 11.7.9 版本存在安全漏洞,该漏洞源于应用程序可能能够绕过隐私首选项。
Description
Exploit for CVE-2023-38571
Readme
### Executive summary

macOS Music and TV do an insecure rename resulting in FDA by gaining full
control over the user's TCC.db

I reported this bug in separate tickets for each app, feel free to merge if
applicable.

The underlying problem is that these apps have FDA but fail to sanitize their
file operations.


### Exploit description

Music and TV are almost the same in this regard, only the paths are different.
I'm using Music as an example from here on out. For TV please check the
exploit code it is very straightforward.

Music has functionality to copy files into the user's library using
a special folder to which a user can "drop" files.

A user can simply create a file in
`~/Music/Music/Media.localized/Automatically Add to Music.localized/`

Music will take this file and do an insecure rename into
"~/Music/Music/Media.localized/Automatically Add to Music.localized/Not Added.localized".

If we use a valid TCC.db (that the exploit generates) it will get copied into
the "Not Added.localized" folder since it's not a media file. This is very
helpful, since we can redirect this rename into the real location of TCC.db
using a simple symlink race.

The exploit is technically a race condition, however it's so reliable that
I did not even implement it to retry as it always succeeds on the first try.


### Exploit details

Usage for music:
> DEBUG=1 ./librarian.py 1

Usage for tv:
> DEBUG=1 ./librarian.py 2

To reset tcc db between tests:
> launchctl stop com.apple.tccd
> launchctl start com.apple.tccd
> sleep 1
> tccutil reset All

File Snapshot

[4.0K] /data/pocs/d7e337547458db596564376beb8ef315080f34d1 ├── [ 11K] librarian.py ├── [1.5K] README.md └── [ 160] resettcc.sh 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.