The idea#
GitHub Desktop for macOS failed to add the quarantine attribute to files cloned from a repository, so Gatekeeper did not check them. An attacker could host a malicious app in a repository, trick a user into cloning it via a custom URL handler, and then have the app's own URL handler auto-registered and invoked, leading to unsigned code execution.
theevilbit.github.io
Published on theevilbit.github.io
The GitHub Desktop app doesn’t add the quarantine extended attribute to files downloaded from the web, and this along with macOS’s URL handler auto-registration feature allows an attacker to execute arbitrary, even unsigned code on a macOS system. If we don’t count the clicks required to open the GitHub App, and…
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 GitHub Desktop did not set the quarantine extended attribute on files it cloned, so macOS Gatekeeper did not evaluate them.
Impact
An attacker could execute arbitrary unsigned code on a macOS system with a few user clicks, bypassing Gatekeeper; the author notes that GitHub considered the required user interaction unlikely.
What the attacker needed
MacOS with GitHub Desktop installed; victim clicks a link to clone a repo; victim approves opening GitHub Desktop; victim clicks Clone
The fix
GitHub Desktop should set the quarantine extended attribute on files it clones so that Gatekeeper can evaluate them.
How it was found
- Create a Git repository containing a malicious app that defines a custom URL handler.
- Create a website with a link that opens GitHub Desktop and clones that repository.
- The user approves opening GitHub Desktop and clicks Clone.
- After cloning, macOS Launch Services parses the app and registers its URL handler.
- The attacker's website invokes the newly registered URL handler to run the app.
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.
When you download a file on a Mac, the system usually marks it as coming from the internet. A security feature called Gatekeeper then checks it before letting it run. Here, the GitHub Desktop app cloned files without that mark, so Gatekeeper never checked them, and a malicious app could run without warning.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.