Detections · What MacVigil reads to decide
Runtime code loading on Mac: libraries, in-memory programs and code built on the fly
Not all of a program’s code is visible in its file. Many programs load libraries by name, look up functions at run time or build code in memory. Browsers and plug-in hosts do this every second, but malware uses the same doors to run code that never exists as a file you could inspect.
Updated November 25, 2026 · 45 detections in this category
In short
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.
MacVigil has 45 detections in this category. It reads the file to find them and never runs it.
What runtime code loading is
A program can extend itself while it runs: it opens a library with dlopen, finds a function by name with dlsym, asks for memory it can make executable, or hands text to an interpreter that turns it into code. This is how plug-ins, scripting engines and just-in-time compilers work.
For malware, the same mechanisms mean the code that matters can arrive later, from the network or from an encrypted blob, and run straight from memory. Nothing on disk shows what it does, which is why this is sometimes called fileless malware. On its own, though, runtime loading is not a sign of harm.
How Mac programs do it
- Opening a library by name with
dlopenand calling functions found withdlsym, so they never appear in the import list. - Mapping anonymous memory, filling it, making it executable with
mprotectand calling into it. - Turning a buffer into a loaded program with
NSCreateObjectFileImageFromMemoryandNSLinkModule, without any file on disk. - Writing a library to disk, then loading that same path with
dlopen, sometimes deleting it right after. - Running an AppleScript held in memory, whose source the code decodes or computes, through
NSAppleScriptor the Open Scripting Architecture, as recent AMOS builds do. - In scripts, passing text to
evalorexec, sometimes written in byte escapes or decrypted from a blob whose key sits in the same file. - Hiding a program in a long run of invisible Unicode characters that the file reads back as text.
- In Java, defining classes from bytes at run time or loading a native library; in browser extensions, allowing
unsafe-evalor scripts from another server.
What MacVigil looks for
MacVigil reads the file and never runs it. It lists the libraries and functions a program asks to load at run time, and it says plainly when the target of a dlopen or dlsym call cannot be determined by static reading, which does not prove the program hides it.
Its higher findings follow the steps in one place: one function that requests anonymous memory, fills it, makes it executable and calls into it; native code that writes a file, closes it and loads that same path as a library; or a script source decoded by the code and handed to the same object that executes it. When a script carries an encrypted blob with its key, or a string in byte escapes passed to exec, MacVigil decodes it and reads the result as a program, without running it.
A lone import of dlopen, dlsym or mprotect, or the word eval(, is low or moderate at most. Loading code is a capability, and these findings describe how a program can run code, not that the code is harmful.
When it is normal
Web browsers, JavaScript engines and emulators generate executable code all the time. Audio and video apps load plug-ins, Electron apps evaluate JavaScript, Python tools import modules from source, and Java apps load classes on demand. Runtime loading becomes a concern when the loaded code is hidden, decrypted from the file itself, or fetched from the network by a program with no identifiable publisher.
How to check a program
- Run
codesign -dv --verbose=4on the app to see who signed it, andcodesign --verify --deep --strictto check that nothing changed since. - Look for “Runtime” in the flags line of
codesign -dv: apps built with the hardened runtime limit what code can be loaded into them. - Review System Settings > General > Login Items & Extensions for helpers that start on their own.
- Remove browser extensions you do not use, especially ones that ask to read and change data on all websites.
Related categories
- Hidden payload: A second program carried out of sight: encoded, encrypted, appended after the file's end or tucked into resources.
- Code injection: Placing code inside another program: loading a library into it, writing its memory, hooking its functions.
- 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.
On the blog
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