XCSSET Reloaded: Smarter, Stealthier, Stronger

February 20, 2025

Introduction

Malware often lurks in suspicious downloads, phishing emails, or shady software, but what if the danger was hiding in the very tools used to build trusted applications? XCSSET, a sophisticated macOS malware first identified in 2020, does exactly that. By embedding itself within the Xcode projects, which are structured workspaces used to develop macOS and iOS applications, XCSSET spreads unknowingly through developer environments, exploiting zero-day vulnerabilities to infiltrate macOS systems.

Over time, XCSSET has continuously adapted, incorporating advanced techniques to improve its ability to remain undetected and maintain persistence within macOS systems.  

XCSSET in 2020: The Emergence

A concerning and unusual form of infection was discovered in 2020, linked to Xcode developer projects. An investigation revealed that a developer's Xcode project had unknowingly hosted the source code for malware, leading to a series of malicious payloads. The most alarming discovery involved two zero-day exploits: one targeting a flaw in Data Vaults to steal Safari cookies, and another exploiting the developer version of Safari itself.  

This was a particularly unique threat. The malicious code was injected directly into local Xcode projects, meaning that once these projects were built, the harmful code was executed. This presented a serious risk to developers, especially when infected projects were uploaded to GitHub, triggering a supply-chain attack. Users who relied on these repositories as dependencies could have inadvertently incorporated the malware into their own projects. Evidence of this malware had also been found on VirusTotal, showing its broader presence in the wild.  The malware was identified as TrojanSpy.MacOS.XCSSET.A, with its command and control (C&C) related files identified as Backdoor.MacOS.XCSSET.A.  XCSSET spread primarily through maliciously modified Xcode projects and applications generated from those projects. The exact initial entry point remained unclear, but the systems involved were predominantly used by developers. These Xcode projects were altered so that when built, they executed the malicious code, ultimately deploying the XCSSET malware onto the infected system. Users affected by XCSSET were at significant risk of having their credentials, sensitive accounts, and vital data compromised.

Once XCSSET took control of a system, it performed a range of malicious activities:

The UXSS (Universal Cross-Site Scripting) attack had the potential to alter nearly every aspect of a user's browsing experience by injecting arbitrary JavaScript code. Some of the key modifications it could make included:  

XCSSET in 2021: Refined tactics and expanded reach

The first version of XCSSET was observed to collect data from various applications and transmit it to a command-and-control (C&C) server. Initially, the purpose of this data collection was unclear, but further analysis revealed that the stolen data contained sensitive and valuable information, which could be exploited in various ways.  

One example of the malware's operation is demonstrated by the malicious AppleScript file "telegram.applescript," targeting the Telegram app. This script’s primary function is to compress the folder “~/Library/Group Containers/6N38VWS5BX.ru.keepcoder.Telegram” into a .ZIP file and then upload it to the C&C server. XCSSET malware has been found to steal critical privacy data from numerous applications, much of which is stored in their sandbox directories. A similar method was observed with the Chrome browser.

In Chrome, XCSSET targets sensitive data such as stored passwords. To extract this data, the malware requires the “safe_storage_key,” which can be obtained using the command “security find-generic-password -wa ‘Chrome.’” However, this command necessitates root privileges. To bypass this requirement, the malware groups all operations that demand root privileges into a single function, prompting the user with a fake dialog box to grant access. Once the “safe_storage_key” is obtained, the malware decrypts the stored passwords and uploads the data to the C&C server. Similar methods have been used to target applications such as Contacts, Evernote, Notes, Opera, Skype, WeChat, and others.  

The discovery of new command-and-control (C&C) domains for XCSSET in April 2021 marked a significant development in the malware's infrastructure. These domains: atecasec.com, linebrand.xyz, mantrucksxyz, monotal.xyz, nodeline.xyz, and sidelink.xyz, were linked to the IP address 94[.]130[.]27[.]189, which had been previously associated with the malware. The fact that these domains were secured with HTTPS certificates from "Let's Encrypt" valid until July 2021 indicated that the attackers had actively taken measures to maintain the security and integrity of their communication channels. This encryption takes measures to maintain the security and integrity of their communication channels. This encryption suggested the attackers were making efforts to prevent detection and ensure their C&C infrastructure remained functional and protected from potential takedowns. The movement of domains, such as icloudserv.com, from a non-malicious IP address to the same 94[.]130[.]27[.]189 address, further underscored the dynamic nature of the malware's operational tactics. By April 2021, all C&C domains were resolved to the IP address 194[.]87[.]186[.], reflecting a shift in the malware's command server structure.  

The introduction of a new domain (irc-nbg.v001.com) to the original C&C IP address indicated that XCSSET might have expanded its functionality, potentially setting up an IRC server for communication. While it was not directly linked to the malware at the time, this move showed how adaptable and evolving the attackers' infrastructure could be.  

In the months following, in June 2021, a significant change occurred when the original C&C domains used by XCSSET were removed, and a fresh batch of domains appeared. These included atecasec.info, datasomatic.ru, icloudserv.ru, lucidapps.info, relativedata.ru, revokecert.ru, and safariperks.ru. This shift in C&C infrastructure demonstrated the malware's ability to rapidly adapt and switch to new servers when the existing ones were compromised or detected. However, by the end of June 2021, these new servers were also taken offline, and since then, the location of XCSSET's current servers remained unclear.    

The XCSSET malware has been found exploiting a newly discovered third zero-day vulnerability to bypass Apple's Transparency, Consent, and Control (TCC) framework. One of the known vulnerabilities, CVE-2021-30713, is an improper authentication flaw affecting multiple macOS versions, enabling unauthorized access to restricted system resources. This vulnerability has also been added to CISA's Known Exploited Vulnerabilities (KEV) catalog.  

XCSSET in 2022: Evolving strategies to evade detection

In 2022, XCSSET malware had continued to leverage SHC-compiled shell scripts and run-only AppleScripts to obfuscate both droppers and payloads, making static detection challenging. SHC Binaries contained minimal readable strings, preventing signature-based identification. The malware had also shifted its disguise, embedding its primary executable in a fake  Notes.app, replacing earlier iterations where it masqueraded as fake Xcode.app in 2020 and Mail.app in 2021. These fake apps were dropped in randomly generated directories within the user's Library folder.  

To further evade detection, the malware had introduced randomized variables within its  replicator.applescript, modifying --max-time values (ranging from 5 to 9 seconds) and altering the phaseName variable to hinder static analysis and detection rules. Additionally, XCSSET had changed its cache storage directory from ~/Library/Caches/GeoServices/ to ~/Library/Caches/GitServices/, reinforcing its ability to blend in with legitimate system files.  

The malware had continued targeting widely used applications, particularly chat apps like Telegram, WeChat, and Tencent 360, along with an expanded list of browsers such as Opera, Brave, and Edge. Multiple malicious run-only AppleScripts had been used to steal and exfiltrate sensitive user data. The contacts.applescript had specifically targeted chat applications, while payloader.applescript had gathered hardware profiling data, checking for display type and system updates to better tailor attacks. The listing.applescript had assessed Apple’s XProtect and MRT status, allowing attackers to deploy more effective payloads. For exfiltrating large stolen data files, XCSSET had utilized the public service transfer.sh to offload data beyond attacker-controlled servers.  

XCSSET in 2025: The latest adaptations

Microsoft Threat Intelligence has identified a new variant of XCSSET, a modular macOS malware that infects Xcode projects. Although currently observed in limited attacks, this latest variant introduces advanced obfuscation techniques, updated persistence mechanisms, and new infection strategies, further enhancing its capabilities. Previously known for targeting digital wallets, collecting data from the Notes app, and exfiltrating system information, XCSSET now poses an even greater threat to macOS users.

Obfuscation:

The malware’s obfuscation methods have been significantly improved, incorporating a more randomized approach for payload generation. Unlike earlier versions that relied solely on xxd (hexdump) for encoding, this variant also utilizes Base64, with both the encoding technique and number of iterations being randomized. Additionally, module names within the code are now obfuscated, making it more difficult to determine their functions.

Persistence:

For persistence, XCSSET employs two distinct techniques: the “zshrc” method and the “dock” method.  

The zshrc method involves creating a file named ~/.zshrc_aliases containing the payload and modifying the ~/.zshrc file to execute it whenever a new shell session is started. Meanwhile, the dock method downloads a signed dockutil tool from a command-and-control server, allowing the malware to manipulate dock items. It then replaces the legitimate Launchpad application path with a fake one, ensuring that whenever Launchpad is launched from the dock, both the real application and the malicious payload are executed.

Infection Techniques:

The new variant also introduces additional infection techniques, modifying where the payload is placed within an Xcode project. It selects from three different placement methods: TARGET, RULE, or FORCED_STRATEGY; while another method embeds the payload inside the TARGET_DEVICE_FAMILY key under build settings, executing it at a later stage.

XCCSET Techniques mapped to MITRE ATT&CK

Strengthening Defenses Against XCSSET

While the latest XCSSET variant introduces refinements in its tactics, its core behavior remains unchanged.  To protect against the XCSSET malware variant, users should follow these security best practices:  

Final Thoughts

The resurgence of the XCSSET malware variant highlights the ever-changing landscape of macOS cybersecurity threats. With its evolving command infrastructure, the malware continues to adapt, making detection and mitigation increasingly challenging. Its focus on crypto theft and data exfiltration from applications like Telegram and WeChat reflects cybercriminals' shifting tactics in response to the growing digital economy. As XCSSET exploits sophisticated infection strategies, it is crucial for users and developers to implement proactive security measures. Regular system updates, cautious downloading practices, and robust endpoint protection remain essential in defending against such advanced threats. By staying vigilant and informed, macOS users can strengthen their defenses and minimize the risks posed by evolving cyber threats.

Sources Cited:

  1. https://documents.trendmicro.com/assets/pdf/XCSSET_Technical_Brief.pdf
  2. https://www.trendmicro.com/en_us/research/20/h/xcsset-mac-malware--infects-xcode-projects--uses-0-days.html  
  3. https://www.trendmicro.com/en_us/research/21/d/xcsset-quickly-adapts-to-macos-11-and-m1-based-macs.html  
  4. https://www.trendmicro.com/en_us/research/21/g/updated-xcsset-malware-targets-telegram--other-apps.html  
  5. https://securelist.com/malware-for-the-new-apple-silicon-platform/101137/  
  6. https://www.sentinelone.com/blog/xcsset-malware-update-macos-threat-actors-prepare-for-life-without-python/  
  7. https://x.com/MsftSecIntel/status/1891410993265123662  
  8. https://hivepro.com/threat-advisory/xcsset-malware-exploits-zero-day-tcc-vulnerability-in-macos/
  9. https://documents.trendmicro.com/assets/pdf/XCSSET_Technical_Brief_Followup.pdf

About Loginsoft

For over 20 years, leading companies in Telecom, Cybersecurity, Healthcare, Banking, New Media, and more have come to rely on Loginsoft as a trusted resource for technology talent. From startups, to product and enterprises rely on our services. Whether Onsite, Offsite, or Offshore, we deliver. With a track record of successful partnerships with leading technology companies globally, and specifically in the past 6 years with Cybersecurity product companies, Loginsoft offers a comprehensive range of security offerings, including Software Supply Chain, Vulnerability Management, Threat Intelligence, Cloud Security, Cybersecurity Platform Integrations, creating content packs for Cloud SIEM, Logs onboarding and more. Our commitment to innovation and expertise has positioned us as a trusted player in the cybersecurity space. Loginsoft continues to provide traditional IT services which include Software development & Support, QA automation, Data Science & AI, etc.

Expertise in Integrations with Threat Intelligence and Security Products: Built more than 250+ integrations with leading TIP, SIEM, SOAR, and Ticketing Platforms such as Cortex XSOAR, Anomali, ThreatQ, Splunk, IBM QRadar & Resilient, Microsoft Azure Sentinel, ServiceNow, Swimlane, Siemplify, MISP, Maltego, Cryptocurrency Digital Exchange Platforms, CISCO, Datadog, Symantec, Carbonblack, F5, Fortinet, and so on. Loginsoft is a partner with industry leading technology vendors Palo Alto, Splunk, Elastic, IBM Security, etc.

In addition, Loginsoft offers Research as a service: We're more than just experts in cybersecurity; we're your accredited in-house research team focused on unraveling the complexities of cybersecurity and future technologies. From Application Security to Threat Research, our seasoned professionals have cultivated expertise in every facet of the field. We've earned the trust of over 20 security platform companies, who count on our research and analysis to strengthen their cybersecurity solutions.

Interested to learn more? Let’s start a conversation.

Get notified

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

BLOGS AND RESOURCES

Latest Articles