Detections · Harmful behavior
Hidden payloads in Mac malware: the second program you cannot see
Many Mac threats arrive as a harmless-looking first stage that carries the real program out of sight. The payload is encoded, encrypted, appended after the end of an image or tucked into a resource, and it only takes shape when the first stage runs.
Updated November 25, 2026 · 76 detections in this category
In short
A second program carried out of sight: encoded, encrypted, appended after the file's end or tucked into resources.
MacVigil has 76 detections in this category. It reads the file to find them and never runs it.
What a hidden payload is
A hidden payload is a second program carried inside the first one in a form you cannot read: Base64 text, encrypted bytes, data after an image’s declared end, or an extended attribute the Finder never shows. The first stage decodes it, writes it somewhere or loads it straight into memory, and runs it.
For the attacker, this keeps the real behavior away from a casual look and from simple scanners that only search plain text. It also lets the same wrapper deliver different payloads over time.
How Mac malware does it
- A script carries its next stage as Base64, hexadecimal or reversed text, decodes it with
base64 -dor similar, writes it to/tmp/and runs it. - A program cuts bytes out of a carrier file, such as an image or a resource named
.dator.png, decrypts them, marks the result executable and launches it. - Data is appended after the file’s declared end and read back with
tail -c +or a seek from the end. - A program decodes a script from its own data and hands it to the AppleScript machinery from memory, under function names it computes.
- Code is stored in an extended attribute or a preference value, then read back, decoded and passed to an interpreter.
- A Java archive decrypts an embedded resource and turns the bytes into loaded code, or drops and launches a program.
- A browser extension hides code after the end of one of its own images and passes the decoded text to
eval. - A password-protected archive with the password in plain text in the command keeps automated tools from opening the payload.
What MacVigil looks for
MacVigil reads the file and never runs it, and it decodes what it can. It reverses Base64, hexadecimal, Base32, byte escapes and reversed text, decrypts embedded resources when the key is in the same file, and even steps through a program’s own string decoder on a private copy of its bytes. The decoded text is then analyzed like the rest.
Its strongest findings tie the steps together: one function that writes an executable image carried in the file to a temporary file, makes it executable and launches it; a buffer decoded from the program’s data handed as script source to the Open Scripting Architecture; or encrypted strings whose decoded form names several sensitive targets. Many of these weigh more when no accountable publisher stands behind the file.
A lone base64 -d or openssl enc is only a moderate mention, and combinations of separate mentions are reported with the caveat that nothing shows they are linked or ran.
When it is normal
Installers and self-extracting archives legitimately carry compressed data, apps encrypt resources to protect licensed content, and an image that hides text after its end can also be a tracking pixel. What raises concern is decoding followed by execution, especially in a file with no identifiable publisher.
How to check a file
- In Terminal,
xattr -lon a file lists its extended attributes; anything beyond the usual quarantine or Finder tags deserves a look. fileon an item tells you what its content really is, whatever its extension says.codesign -dvshows who signed an app; an unsigned or ad hoc signed app from a download deserves extra caution.- Never run a command someone asks you to paste into Terminal, especially one containing
base64or a long encoded string. - Open a downloaded disk image or package only after checking what it contains, and be wary of archives that come with a password in the instructions.
Related categories
- Runtime code loading: Code the program loads or makes while it runs: libraries opened by name, functions looked up with dlsym, memory made executable, program images built from a buffer. Browsers, plug-in hosts and JIT engines all do this.
- Analysis resistance: What makes a program harder to examine: packing, obfuscation, debugger and virtual-machine checks, erased traces.
- Download and execute: Code fetched from the network and run here: what executes is decided by a server, not by the file that was checked.
- Masquerading: A file that presents itself as something else: a misleading name, icon or extension, a label imitating Apple.
On the blog
- AMOS in November 2026: the script is no longer in the file
- Fake ChatGPT, Grok and Brave Talk disk images
- How to check a DMG or PKG for malware before you open it
Know what a file does before you open it
MacVigil reads any app, disk image, installer or script without running it, and shows the evidence behind every finding. Nothing leaves your Mac.
Free for 7 days, then $29.95 a year for 2 Macs, a launch price: the regular price will be $59 a year. Requires macOS 15 Sequoia or later on a Mac with Apple silicon.
More: all detection categories · what MacVigil detects · the blog