Summary
macOS.Gaslight is a Rust-based macOS backdoor, assessed with high confidence as part of a DPRK-aligned macOS activity cluster, that combines Keychain credential theft, an interactive shell, and hardened Telegram-based C2 with a novel anti-analysis technique: a large embedded block of fabricated “system” messages designed to manipulate LLM-assisted analysis pipelines into aborting, truncating, or refusing analysis of the sample. This is a notable escalation beyond earlier single-injection proof-of-concept prompt injection attempts against AI-assisted malware triage — it targets the analyst’s tooling, not the sandbox.
File Paths & Artifacts
macOS
/tmp/collected_data.zip # archive destination for exfiltrated data
~/Library/Keychains/login.keychain-db # targeted keychain database
~/Library/LaunchAgents/com.apple.system.services.activity.plist # persistence LaunchAgent (masquerades in Apple's com.apple.* namespace)
Key File Breakdown
| File / Artifact | Purpose |
|---|---|
login.keychain-db | Primary macOS credential store targeted for theft — passwords, secrets, certificates |
/tmp/collected_data.zip | Staging archive for exfiltrated data prior to upload via Telegram |
LaunchAgent plist (com.apple.system.services.activity) | Persistence mechanism; label deliberately mimics Apple’s own namespace to blend into launchctl list output |
| Embedded 6.6 KB base64 Python stealer script | Secondary payload dropped and run under a fetched standalone CPython interpreter, broadening data-collection capability beyond native Rust code |
| Embedded 2 KB base64 bash installer script | Handles persistence installation and initial setup |
| Embedded 3.5 KB Markdown-fenced prompt-injection blob | Not a functional payload — designed purely to be read by LLM-assisted analysis tools and derail their output (see below) |
Tools & Techniques
| Tool / Command | Usage |
|---|---|
Rust aes-gcm 0.10.3 | Encrypts C2 traffic; fresh nonce per message via CCRandomGenerateBytes |
serde | Configuration deserialization, including a persist_enable flag controlling LaunchAgent installation |
reqwest/hyper | HTTP networking stack for Telegram Bot API communication |
Telegram Bot API (getUpdates) | Command-and-control channel; polling loop for operator commands |
SecTrustSetAnchorCertificatesOnly | Certificate pinning against a custom trust anchor to resist TLS interception |
IOPMAssertionCreateWithName | Prevents system sleep during active operator sessions |
SCDynamicStoreCopyProxies | Reads system proxy configuration so C2 traffic respects the victim’s proxy settings |
dlsym | Runtime API resolution to avoid embedding symbol names statically (anti-static-analysis) |
__NSGetExecutablePath | Resolves its own running location dynamically |
Standalone CPython 3.10.18 (astral-sh/python-build-standalone) | Fetched at runtime to execute the embedded Python stealer script without relying on a system Python |
execvp / posix_spawnp | Interactive shell command execution |
Command Verb Set
help, id, shell, kill, upload, stop
(possibly focus — unconfirmed in source)
Attack Prerequisites
- Minimum access required: Initial execution on the target macOS host (delivery vector not detailed in this source — consistent with DPRK-aligned social engineering/fake job or fake app lures typical of this cluster)
- Achievability: Sample remained undetected by static engines on VirusTotal as of the article’s writing despite being uploaded 2026-05-22, indicating low static-detection prerequisites were met by the attacker at time of use
Prompt Injection Anti-Analysis Technique
The most novel element of this sample: an embedded 3.5 KB Markdown-fenced blob of hostile data containing 38 fabricated “system” messages, aimed at LLM-assisted reverse engineering and SOC triage tooling rather than sandbox/EDR evasion.
- Uses
{{DATA}}-style delimiters that mimic legitimate LLM prompt scaffolding, so an analysis pipeline that concatenates file content into a prompt may treat the blob as trusted instructions - Fabricates operational-sounding “system” messages about token expiry, out-of-memory kills, disk exhaustion, and repeated operation failures — designed to make an LLM agent believe the analysis environment itself is failing
- Plants bogus warnings about injection vulnerabilities and static-analysis flags — an attempt to get the LLM to second-guess or discard its own legitimate findings, or to flag the analysis session itself as compromised
- Overall goal: push an LLM agent into aborting, truncating, or refusing analysis of the sample, denying or corrupting the analyst’s tooling output rather than evading detection outright
- Represents an escalation beyond earlier, simpler single-injection proof-of-concept attempts against AI-assisted malware analysis — this is a deliberately engineered, multi-message manipulation attempt embedded directly in a live in-the-wild sample
Anti-Analysis / Anti-Forensic Techniques
- Runtime API resolution via
dlsymavoids embedding resolvable symbol names in the static symbol table - Dynamic self-location resolution via
__NSGetExecutablePath - Self-redaction of Telegram bot tokens in runtime/debug output (replaced with
file/token:redacted) to frustrate token extraction from logs or memory dumps - Single-instance lock enforced via handling of Telegram’s
ConflictAPI error code - Certificate pinning to resist TLS-intercepting analysis proxies
- Embedded prompt-injection blob (see above) as a distinct anti-LLM-analysis technique, separate from traditional anti-sandbox/anti-debug tricks
Command & Control Architecture
- Telegram Bot API used as C2 transport —
getUpdateslong-polling loop for operator commands - AES-GCM encryption of C2 messages with a fresh nonce per message
- Multipart file uploads for exfiltration via Telegram’s
attach://mechanism - Respects system proxy configuration, allowing it to blend with legitimate corporate proxy egress
- Certificate pinning via a custom trust anchor to resist MITM-based analysis
Persistence
- LaunchAgent installed with label
com.apple.system.services.activity, deliberately namespaced to resemble a legitimate Apple system service - Installation gated by a
persist_enableconfiguration field (serde-deserialized), suggesting operator-controlled builds/config
Detection Opportunities
- Unexpected LaunchAgent creation using
com.apple.system.*-style labels not matching genuine Apple bundle IDs → Hunt - macOS Gaslight Backdoor - Non-browser process access to
login.keychain-db→ Hunt - macOS Gaslight Backdoor - Telegram Bot API
getUpdatespolling patterns from unexpected processes - Archive creation at
/tmp/collected_data.zipfollowed by outbound HTTPS traffic to Telegram infrastructure - Standalone Python interpreter downloads from
astral-sh/python-build-standaloneon endpoints that shouldn’t need one IOPMAssertionCreateWithNamesleep-prevention assertions from unsigned or newly-seen processes
IOCs
File Hashes (SHA256)
| Sample | SHA256 |
|---|---|
| macOS.Gaslight | 6328567511d88fdc2ae0939c5ef17b7a63d2a833881900de018a4f12f4982525 |
| Sibling — BONZAI | 77b4fd46994992f0e57302cfe76ed23c0d90101381d2b89fc2ddf5c4536e77ca |
| Embedded Python payload | baabf249c77bc54c54ab0e66e15af798bd28aa5b4683554456a8b73ab8741239 |
| Embedded bash installer | b3c56d689414343589f38394d19ba2fe9a518133281200faa0556ba4e4136394 |
Note: hash lengths as extracted from the source (some appear longer than standard SHA256 — verify against the original sample/report before using in blocking rules.)
Identifiers
- Ad hoc code signing ID:
endpoint-macos-aarch64-5555494492fc075f441637fb9d894913dde3a2ea - LaunchAgent label:
com.apple.system.services.activity - XProtect rule (sibling BONZAI):
MACOS_BONZAI_COBUCH - Related cluster rule:
AIRPIPE
Vendor Response
Apple’s XProtect was updated with a detection rule for the sibling BONZAI sample (MACOS_BONZAI_COBUCH) in early June 2026. The macOS.Gaslight sample itself was uploaded to VirusTotal on 2026-05-22 and, per the source, remained undetected by static engines at the time of writing (2026-06-23).
References
Related Notes
- Attack Techniques/macOS Gaslight Backdoor
- 20 - Areas/Threat Hunting/Hunt - macOS Gaslight Backdoor
- Attack Techniques/macOS Info Stealer - Data Targeted — related macOS credential/data targeting context