analyzing-mach-o-binaries-on-macos
Statically analyzes macOS Mach-O malware: parsing the header and load commands,
v1.0.02 installs+2 in 7 days24 StarsApache-2.0synced 10 hours ago
Install
No NotHoly CLI yet? Install it first.
$ curl -fsSL https://notholy.com/install.sh | sh$ notholy skills install meltedinhex/analyzing-mach-o-binaries-on-macosWrites to ~/.notholy/skills after checking the signature and the SHA-256.
SignatureSigned, ed25519
Package76b85f5e…f66efd8f
76b85f5e1621…a963f66efd8f4 files · 3.2 KBScanMedium2 findings
- Executable script shipped with the skillscripts/analyst.py
- Links to outside domains
Sourcegithub.com/meltedinhex/analyst-ai-pack/tree/main/skills/analyzing-mach-o-binaries-on-macos@da7600a
On this page
When to Use
- You have a macOS sample (Mach-O) and need a static capability and trust read.
- You must handle a fat/universal binary containing multiple architecture slices.
- You need to inspect linked dylibs, entitlements, and code-signing status.
Do not use Windows PE tooling on Mach-O — the formats differ entirely; use Mach-O-aware parsers.
Prerequisites
- A Mach-O parser (Python stdlib
struct, ormacholib/LIEF); the sample handled inertly. - For signing/entitlements on macOS,
codesign/otoolare authoritative.
Safety & Handling
- Parse statically; never execute the sample, especially on a real macOS host.
- Keep the sample password-protected at rest and reference it by hash.
Workflow
Step 1: Detect fat vs. thin and architecture
Check the magic: 0xCAFEBABE (fat/universal) vs. 0xFEEDFACE/0xFEEDFACF (Mach-O 32/64). For
fat binaries, enumerate and analyze each slice.
python scripts/analyst.py header sample.machoStep 2: Parse load commands
Read load commands for linked dylibs (LC_LOAD_DYLIB), entry point (LC_MAIN), and signing
(LC_CODE_SIGNATURE). The dylib list hints at capability (networking, crypto).
Step 3: Inspect entitlements and signing
On macOS, use codesign/otool to read entitlements and verify the signature. Ad-hoc or absent
signatures and suspicious entitlements are risk indicators.
Step 4: Infer capability and route
Map linked frameworks/symbols to behaviors and route to disassembly/RE for deeper analysis.
Validation
- Fat binaries are decomposed and each slice is analyzed, not just the first.
- Load commands, dylibs, and signing status are enumerated correctly.
- Capability inferences are corroborated by linked frameworks/symbols.
Pitfalls
- Analyzing only one slice of a universal binary.
- Trusting a present signature without verifying it (ad-hoc signatures verify but aren't trusted).
- Applying PE assumptions (sections/imports) to Mach-O structures.
References
- See
references/api-reference.mdfor the Mach-O header parser. - Apple Mach-O loader.h and code signing docs (linked in frontmatter).
Files in this version
references/11.3 KB
- api-reference.md1.3 KB
scripts/12.8 KB
- analyst.py2.8 KB
- LICENSE340 B
- SKILL.md3.1 KB
Permissions
| Permission | Declared | Found by the scan |
|---|---|---|
| Reads files | No | No |
| Writes files | No | No |
| Runs shell commands | Yes | Yes |
| Uses the network | Yes | Yes |
| Uses connectors | No | No |
| Drives a browser | No | No |
Scan findings
Reviewed on Nov 13, 2026
- MediumFile · Executable script shipped with the skillscripts/analyst.py
- InfoLink · Links to outside domains
A clean scan lowers the risk but does not prove a package is safe. Read what you install.
| Version | Published | Commit | SHA-256 | Signature | Permission change |
|---|---|---|---|---|---|
| v1.0.0 | Nov 13, 2026 | da7600a | 76b85f5e | Signed | – |
More from meltedinhex
All from this publisher- writing-yara-rules-from-reversed-codemeltedinhex/writing-yara-rules-from-reversed-code4
- validating-detections-with-atomic-testsmeltedinhex/validating-detections-with-atomic-tests4
- writing-suricata-and-snort-rulesmeltedinhex/writing-suricata-and-snort-rules3
- writing-sigma-detection-rulesmeltedinhex/writing-sigma-detection-rules3
More in Reverse engineering and fuzzing
See the categoryAsk anything your scope allows.
Create an account, add credits and ask the first question in the chat or the terminal.
- 1/3
Create the account
Individual or company. You can switch to a company later without losing balance or keys.
IndividualCompany - 2/3
Add credits
By card. Pay per token, no subscription.
$5.00minimum deposit - 3/3
Ask
In the chat, or install the CLI and run notholy login in your terminal.
$ notholy login