Why XProtect Remediator scans now take longer
One of the key features of third-party protection against malicious software is the scanning of executable code and other files. macOS used to have its Malware Removal Tool MRT, but in the summer of 2022 that was replaced in Catalina and later by XProtect Remediator (XPR), a sibling of the on-demand scanning tool XProtect, used by Gatekeeper to check code before it’s launched. That developed rapidly in the latter half of 2022, and is now one of the frontline protections against malicious software in macOS. This article looks at how XPR changed over the last year.
At least once a day, often shortly after startup, XPR scans the Mac for known malicious software. If it identifies any, it reports that as an endpoint security event and attempts to remove or ‘remediate’ it. Scans consist of running a series of executable code modules, named according to the malware they detect and remediate, and each set of scans is run twice, once as root and a second time as user.
Some scanning modules are executed very quickly, but according to the execution time reported for each, none takes longer than a small fraction of a second, and the complete double set used to take just a few minutes. Over the last year, those few minutes have progressively extended, and by the end of 2024, it’s not unusual to see XPR scans taking over half an hour, most of that time apparently looking for Adload. Activity Monitor reports that modules are run one at a time in a single thread in the background, on the E cores, minimising their impact on the user.
Scanning time and Yara rules
Work by Alden confirmed that some XPR modules use Yara detection signatures, similar to those normally supplied for XProtect’s on-demand scans. Scrutiny of log entries for XPR’s components struck gold, in that most scanning modules report that they have initialised a Yara library early during their scanning, with the characteristic log entryInitialized libYARA version 3.11
To estimate the actual scanning time for each module that initialised libYARA, I therefore measured the time elapsed between that log entry and the module’s final report. Those are wildly different from the execution time reported by the module: for example, that reported for one Adload scan was 0.0000510 s, but measured as over 24 minutes. As that matched observations in Activity Monitor, I think I know which represents the true scanning time.
By their own admission, 17 of the current 24 scanning modules use Yara definitions in their scans. These are detailed, together with measured scanning times, in the table below.
Total time for modules using Yara definitions was 30 minutes 9.99 seconds, matching times recorded by XProCheck and those observed in Activity Monitor.
Modules taking substantial time, including Adload, Bundlore, Crapyrator, Dolittle, DubRobber, Pirrit and SheepSwap, have substantial rules in the current Yara definitions used by XProtect (the on-demand version), and during 2024 those rules have grown considerably as XProtect has targeted them more aggressively. If XPR were to use XProtect’s Yara rules, that would explain the noticeable increase in time taken by its scanning modules. This may also account for XPR being updated less frequently than in the past: if its detections are at least partly based on those rules, often updated every fortnight, then replacing its scanning modules shouldn’t be required as often.
Scanning modules in XPR, 2024
Adload (Yara-based) is an old adware and bundleware loader dating back to 2016 with a track record of rapid change, enabling it to evade static detection. It normally achieves persistence through a bogus service installed in ~/Library/LaunchAgents/, and Phil Stokes gives fuller details here.
BadGacha remains unidentified, but has in the past reported false positives for helper apps in non-malicious apps.
BlueTop (Yara-based) is a bogus WindowServer app that was part of a Trojan-Proxy campaign investigated by Kaspersky in late 2023.
Bundlore (Yara-based) is an old adware dropper from 2015 or earlier that has become more malicious in the software that it installs, and has been reviewed by several researchers, including Jay Vrijenhoek and Joshua Long.
CardboardCutout remains unidentified.
ColdSnap (Yara-based) is known better as POOLRAT or SimpleTea, a cross-platform component that was part of the 3CX supply-chain attack.
Crapyrator (Yara-based) has been identified as BkDr.Activator, found in many torrents of cracked apps such as MarsEdit, DaisyDisk, and SpamSieve. It uses sophisticated methods, characteristically installing Activator.app in the main Applications folder, prompts for a password and uses that to disable Gatekeeper checks, then kills Notification Centre to cover its tracks. Further details are given here.
Dolittle (Yara-based) has been identified as Genieo, see below.
DubRobber (Yara-based) is known more generally as XCSSET, a versatile and troubling Trojan dropper that changes frequently to escape detection.
Eicar (Yara-based) isn’t malware at all, but a standard non-malicious test of detection methods.
FloppyFlipper remains unidentified.
Genieo, also known as MaxOfferDeal, is another old hand that changes frequently to escape detection. This is so well-known that it qualifies for its own page in Wikipedia.
GreenAcre (Yara-based), also known as OSX.Gimmick, is cross-platform spyware used in targeted attacks, discovered by Volexity in late 2021.
KeySteal (Yara-based), as its name suggests, exfiltrates the contents of keychains. Although it first appeared at least four years ago, it seems to have reappeared in autumn/fall 2022, and has been described in full detail by Luis Magisa and Qi Sun of Trend Micro. It has been found as a malicious version of the ResignTool app, used to change code signatures. It can come correctly signed, and has been delivered in a signed Installer package.
MRTv3 is a collection of malware detection and remediation items inherited from Apple’s old Malware Removal Tool, MRT.
Pirrit (Yara-based) has also been known in many different variants and forms since it first appeared in 2016. For a long time it posed as a Flash Player installer, although it has moved on since then. It has been overviewed recently by Paloalto Networks.
RankStank (Yara-based) is another malicious app at the centre of the 3CX supply chain attack, where it’s found in the 3CX Desktop App, and has been attributed to the Lazarus Group.
RedPine (retired in 2024) is believed to cover TriangleDB malware, sophisticated spyware that has been targeted primarily at iOS devices using malicious Messages. Its scanning module has recently been dropped from XPR.
RoachFlight remains unidentified.
SheepSwap (Yara-based) is believed to be other variants of Adload, see above.
SnowBeagle (Yara-based) has been identified as TraderTraitor from the Lazarus group, and targets crypto trading. It has a CISA Advisory giving details.
SnowDrift (Yara-based) is CloudMensis spyware, another sophisticated malicious app that may masquerade as WindowServer.
ToyDrop (Yara-based) appears to be a variant of Adload (see above), according to the rules in XProtect’s Yara file.
Trovi is believed to be a cross-platform browser hijacker that can affect Safari and others.
WaterNet (Yara-based) is thought to be a version of Proxit malware written in Go.
I’d like to thank Alden, Phil Stokes and others who have been kindly decoding Apple’s bizarre names.