Shlayer
- Type
- Downloader
- Capabilities
- Initial accessDefense evasionReconnaissancePersistence
- Delivery
- MalvertisingFake updateLanding pageLureCracked software
- Platforms
- macOS
Shlayer is a macOS trojan downloader first identified in February 2018. It primarily provides first-stage infection by downloading, unpacking, and executing additional payloads, especially adware families including Bundlore, Cimpli, Pirrit, and AdLoad. Shlayer has also delivered Tarmac. Its campaigns are predominantly associated with advertising fraud; downstream adware injects advertisements, manipulates browser searches, and redirects traffic.
Distribution relies heavily on malvertising, malicious websites, hijacked or expired domains, and fraudulent software-update pages, historically impersonating Adobe Flash Player. Affiliate networks distribute malicious links through websites, video descriptions, and references on legitimate services. Entertainment-themed lures and cracked-software sites also facilitate distribution. VeryMal and Yosec are established malvertising operators associated with Shlayer delivery. Infections affect macOS users broadly, including U.S. K–12 educational institutions.
Variants use Bash, Zsh, Python, or Mach-O executables, commonly packaged in disk images. Shlayer collects system identifiers and the operating-system version, retrieves secondary payloads, makes them executable, and launches them using native macOS utilities. Observed implementations obscure scripts and configuration through encryption and layered obfuscation; the Shlayer.F variant conceals AES-encrypted configuration within a modified disk-image structure. Some variants remove downloaded archives and staging artifacts after execution. Shlayer has used Launch Item persistence and techniques that bypass macOS execution protections, including exploitation of the Gatekeeper bypass CVE-2021-30657. Malicious Shlayer code also obtained Apple notarization in 2020, enabling execution under default Gatekeeper settings.
Associated vulnerabilities
1 CVE Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Associated threat actors
3 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
Feb 2020 Campaign: 모래종이(Sandpaper) ... Observed commodity malware: Shlayer and Mirai bot.
The bad actor is known for running large scale fake Flash update campaigns that are hosted on .icu domains by way of display ad auto-redirects: VeryMal Fake Flash Update — Shlayer Trojan
Yosec — ... They are a major source of distribution for the notorious Shlayer trojan: OSX/Shlayer ...
Techniques & procedures
34 distinct techniques documented for this family, organized by ATT&CK tactic.
Resource Development
2 techniques
Resource Development
In March 2022, Malvertisement accounted for the greatest number of alerts. Malvertisement remains the top initial infection vector due to Shlayer activity.
By leveraging on commodity malware, they are attempting to operate under the cloak of anonymity to avoid being identified as state-sponsored hacker groups.
Initial Access
2 techniques
Initial Access
It is primarily distributed through malicious websites, hijacked domains, and malicious advertising posing as a fake Adobe Flash updater.
Instructs the recipient to visit a website that is compromised by the cyber actor
Execution
6 techniques
Execution
Note the decrypted string that corresponds to commands, OSX/Shlayer.F executes them via popen() function.
The malicious shell scripts used by Shlayer and Bundlore are usually malvertising-focused adware bundlers using shell scripts in the kill chain to download and install an adware payload.
The most recent Shlayer variant is Trojan-Downloader.OSX.Shlayer.e... written in Python rather than Bash... the seemingly standard installer turns out to be a Python script.
After unpacking the archive, the main Python script uses the chmod tool to assign the file 84cd5bba3870 permission to run in the system. After that, the trojan runs the downloaded and unpacked application package using the built-in open tool.
Shlayer is a downloader and dropper for MacOS malware. It is primarily distributed through malicious websites, hijacked domains, and malvertizing posing as a fake Adobe Flash updater.
В терминологии MITRE ATT&CK задействованы User Execution: Malicious File (T1204.002, Execution ...).
Privilege Escalation
1 technique
Privilege Escalation
CVE-2021-30657 April 26 macOS Gatekeeper bypass abused by Shlayer malware
Stealth
9 techniques
Stealth
The bash script in these variants decrypt the next stage encrypted blobs containing the next stage bash scripts using openssl with base64, Advanced Encryption Standard (AES), CBC (Cipher Block Chaining) to thwart security scanners.
That’s exactly what we saw with VeryMal’s offensive steganography and what we’re continuing to see with this use of harmless looking Firestore code.
Shlayer is a trojan downloader, which spreads via fake applications that hide its malicious code... Cimpli masquerades as a useful Mac utility (i.e., “Any Search”).
“Performs a killall Terminal to kill the running script’s terminal window”
After that, the Trojan runs the downloaded and unpacked application package using the built-in open tool, and deletes the downloaded archive and its unpacked contents.
Most variants of them are known to commonly leverage at least 3 of the 5 built-in macOS commands and utilities: openssl, curl, sqlite3, killall and funzip.
Use mdls to validate payload download sources and timestamps to guard against sandbox executions. mdls -name "kMDItemWhereFroms" -name "kMDItemDownloadedDate"
I could also see this used as an anti-sandbox check, since sandbox analysis systems won’t have such entry in the LSQuarantineEvent table when submitting a sample for analysis.
“a .command script is executed from a hidden directory in the mounted volume… (e.g. /Volumes/Player/.hidden)”
Defense Impairment
4 techniques
Defense Impairment
After unpacking the archive, the main python script uses the chmod tool to assign the file 84cd5bba3870 permission to run in the system.
“Makes the binary within the unzipped .app executable using chmod +x”
В терминологии MITRE ATT&CK задействованы ... Gatekeeper Bypass (T1553.001, Defense Evasion ...).
“Many of the initial DMGs are signed with a legitimate Apple developer ID… payloads… signed with a valid developer ID… Gatekeeper will allow this software to run without prompt.”
Credential Access
1 technique
Credential Access
“MITRE ATT&CK TIDs… T1142 Credential Access Keychain access”
Discovery
6 techniques
Discovery
encrypted string ref in function 0x100020a50 decoded to : defaults read /System/Library/CoreServices/SystemVersion.plist ProductVersion
Next, the main script generates a unique user and system ID, and also collects information about the version of macOS in use.
Use mdls to print file paths and sizes when enumerating host resources. xargs -0 mdls -n kMDItemPath -n kMDItemFSSize
Use mdls to validate payload download sources and timestamps to guard against sandbox executions. mdls -name "kMDItemWhereFroms" -name "kMDItemDownloadedDate"
I could also see this used as an anti-sandbox check, since sandbox analysis systems won’t have such entry in the LSQuarantineEvent table when submitting a sample for analysis.
As mentioned above, this variant OSX/Shlayer.F queries QuarantineEventsV2 as follows: sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* ‘select LSQuarantineDataURLString from LSQuarantineEvent where LSQuarantineDataURLString like “%s3.amazonaws.com%” order by LSQuarantineTimeStamp desc limit 5’
Collection
1 technique
Collection
The ZIP archive downloaded to the /tmp/%(sessionID) directory is unpacked to the /tmp/tmp directory using the unzip function.
Command and Control
3 techniques
Command and Control
I wanted to revisit the OSX/Shlayer.F variant of the Shlayer malware to report on a technique that has not previously been seen in other macOS malware for hiding Command and Control (C2) information. This variant encrypts its configuration using AES within the DMG file header structure, resulting in a modified DMG file.
A majority of binaries in our intelligence systems downloaded the Bundlore payload to the tmp directory using curl request to the C2.
Shlayer is a Trojan downloader and dropper for MacOS malware.
Impact
1 technique
Impact
This variant encrypts its configuration using AES within the DMG file header structure, resulting in a modified DMG file.
Observables
33 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
25 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.