0:00
–:––
React at 0:00
Black Hat USA 2025

XUnprotect: Reverse Engineering macOS XProtect Remediator

Koh Nakagawa, FFRI Security, Inc.Reverse Engineering

When and where

Day
Thu 7 Aug 2025
Time
10:20 to 11:00 PDT
Room
South Pacific F, Level 0 - North Convention Center

Speaker

  • Koh NakagawaFFRI Security, Inc.

    Koh M. Nakagawa is a security researcher at FFRI Security, Inc., mainly working on vulnerability research. His research interests are the security of Apple Products. He gave talks at security conferences such as Black Hat EU, Black Hat Asia, and CODE BLUE.

Abstract

The macOS threat landscape has changed considerably in recent years with the ever-increasing prevalence of macOS malware. In response, Apple has expanded the capabilities of XProtect by introducing new features such as XProtect Remediator (XPR) and XProtect Behavior Service. XPR periodically scans to remove malware and restores infected devices. However, due to a lack of detailed reverse engineering efforts, its detection or remediation capabilities remain unclear. In this presentation, we share our reverse engineering results of XPR. Since XPR binaries are stripped Swift binaries, the detailed analysis was challenging. We developed custom tools for static and dynamic analysis of Swift binaries, which allowed us to perform a thorough investigation. Our analysis uncovered intriguing detection logics that go beyond the previously known simple scanning using YARA rules. These include a creative mechanism that employs OCR to detect malware performing a Gatekeeper bypass. Furthermore, our examination revealed Apple-exclusive threat intelligence, including information related to malware believed to be the TriangleDB macOS implants. Remarkably, we discovered that XPR's detection logic is described with a custom DSL using Swift Result Builders—the same technology that powers SwiftUI's declarative syntax. Our analysis of the DSL demonstrated that it significantly helps in understanding the details of XPR's detection logic. In addition, we revealed a novel mechanism—Provenance Sandbox—that XPR uses to track the origin of remediated files. This provenance information serves as a valuable forensic artifact even for third-party security vendors. This presentation provides valuable insights into XPR internals for blue teams working on macOS security. The tools being introduced will help security researchers analyze future XPR updates to obtain Apple's threat intelligence included in XPR. Additionally, information on XPR vulnerabilities and Provenance Sandbox bypasses will benefit red teams.

What you'll get from it

Apple's XProtect Remediator scans Macs for malware and cleans them up, but little has been known about what it detects or how. Koh Nakagawa built tools to reverse engineer its stripped Swift binaries, and found detection logic beyond YARA rules, including OCR used to catch malware that bypasses Gatekeeper, rules written in a custom DSL built on Swift Result Builders, and Apple-only threat intelligence apparently tied to TriangleDB implants. There's also Provenance Sandbox, which records where remediated files came from and is a useful forensic artefact. Blue teams on macOS gain most, with bypass notes for red teams.

Did you find what you came for?