You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/macos-hardening/macos-security-and-privilege-escalation/macos-files-folders-and-binaries/macos-memory-dumping.md
+94-2Lines changed: 94 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Another important memory-related file in MacOS systems is the **memory pressure
24
24
25
25
In order to dump the memory in a MacOS machine you can use [**osxpmem**](https://github.com/google/rekall/releases/download/v1.5.1/osxpmem-2.1.post4.zip).
26
26
27
-
**Note**: The following instructions will only work for Macs with Intel architecture. This tool is now archived and the last release was in 2017. The binary downloaded using the instructions below targets Intel chips as Apple Silicon wasn't around in 2017. It may be possible to compile the binary for arm64 architecture but you'll have to try for yourself.
27
+
**Note**: This is mostly a **legacy workflow** now. `osxpmem` depends on loading a kernel extension, the [Rekall](https://github.com/google/rekall) project is archived, the latest release is from **2017**, and the published binary targets **Intel Macs**. On current macOS releases, especially on **Apple Silicon**, kext-based full-RAM acquisition is usually blocked by modern kernel-extension restrictions, SIP, and platform-signing requirements. In practice, on modern systems you will more often end up doing a **process-scoped dump** instead of a whole-RAM image.
28
28
29
29
```bash
30
30
#Dump raw format
@@ -52,7 +52,99 @@ sudo su
52
52
cd /tmp; wget https://github.com/google/rekall/releases/download/v1.5.1/osxpmem-2.1.post4.zip; unzip osxpmem-2.1.post4.zip; chown -R root:wheel osxpmem.app/MacPmem.kext; kextload osxpmem.app/MacPmem.kext; osxpmem.app/osxpmem --format raw -o /tmp/dump_mem
For **recent macOS versions**, the most practical approach is usually to dump the memory of a **specific process** instead of trying to image all physical memory.
58
+
59
+
LLDB can save a Mach-O core file from a live target:
60
+
61
+
```bash
62
+
sudo lldb --attach-pid <pid>
63
+
(lldb) process save-core /tmp/target.core
64
+
```
65
+
66
+
By default this usually creates a **skinny core**. To force LLDB to include all mapped process memory:
67
+
68
+
```bash
69
+
sudo lldb --attach-pid <pid>
70
+
(lldb) process save-core /tmp/target-full.core --style full
When a full core is too noisy, dumping only **interesting readable ranges** is often faster. Frida is especially useful because it works well for **targeted extraction** once you can attach to the process.
108
+
109
+
Example approach:
110
+
111
+
1. Enumerate readable/writable ranges
112
+
2. Filter by module, heap, stack, or anonymous memory
113
+
3. Dump only the regions that contain candidate strings, keys, protobufs, plist/XML blobs, or decrypted code/data
114
+
115
+
Minimal Frida example to dump all readable anonymous ranges:
This is useful when you want to avoid giant core files and only collect:
130
+
131
+
- App heap chunks containing secrets
132
+
- Anonymous regions created by custom packers or loaders
133
+
- JIT / unpacked code pages after changing protections
134
+
135
+
Older userland tools such as [`readmem`](https://github.com/gdbinit/readmem) also exist, but they are mainly useful as **source references** for direct `task_for_pid`/`vm_read` style dumping and are not well-maintained for modern Apple Silicon workflows.
136
+
137
+
## Quick triage notes
138
+
139
+
-`sysctl vm.swapusage` is still a quick way to check **swap usage** and whether swap is **encrypted**.
140
+
-`sleepimage` remains relevant mainly for **hibernate/safe sleep** scenarios, but modern systems commonly protect it, so it should be treated as an **artifact source to check**, not as a reliable acquisition path.
141
+
- On recent macOS releases, **process-level dumping** is generally more realistic than **full physical memory imaging** unless you control boot policy, SIP state, and kext loading.
0 commit comments