Sibling Processes: the Differential Inside One Image

MemDiver can compare several instances of the same program in one memory image. Examples include sessions from a forking server and separate daemons from one executable. The comparison reports bytes that differ between the instances as candidates.

A physical frame shared by several processes has the same bytes in each. A shared frame can still contain a group secret, such as one loaded before fork(). MemDiver labels shared frames so you can include their evidence when you interpret the results.

The measurements below use the test captures v2b with four-level paging and v2c with five-level paging. See Validation for how each measurement is checked against ground truth.

The claim

What the sibling differential needs:

  • at least two live instances of the same program in the image;

  • a per-instance secret, such as a session key. A secret that all instances share is invariant and does not stand out as “different” (it can still be found in the long-term pass, see Ranking);

  • the secret’s pages resident in the image.

On v2b, all 38 ground-truth secret pages of the three sibling groups are present, exclusive to one process, and have a kernel page count of 1. No secret page is shared, not even in the forked dropbear group.

Frame classes

memdiver.page_sharing walks each process’s page tables once and labels every resident 4 KiB page with a share class. The walker is vol3plugins/memdiver/frames.py (standard library and Volatility 3 only).

Class

Meaning

private_dirty, private_clean, private_file_cow

no other compared process maps the frame. This is where a per-instance secret can live

shared_lineage

shared through fork copy-on-write, or by KSM

shared_file

a page-cache page of a file, mapped by several processes

shmem

shared memory

zero

the zero page or the huge zero page

swapped, not_resident

no frame to compare

Two tiers of evidence.

  • T0, one process. A writable PTE (W=1) in a private VMA proves the page exclusive (PageAnonExclusive, kernel 5.19 and later).

  • T1, the sibling intersection. A frame mapped by two or more members is shared. A frame that no other member maps is private relative to the group.

Limits of the frame evidence.

  • W=0 proves nothing. A sibling may have exited, or uffd-wp or clear_refs may have cleared the write bit. A read-only PTE only sets possibly_shared.

  • Smear. Acquisition is not atomic. A frame that two members map while one of them has W=1 was reused between the two walks. It is flagged smear_conflict, and neither label is trusted.

  • Zero page. The zero page and the huge zero page are their own class, zero, and never count as “shared by all”.

  • THP. A 2 MiB or 1 GiB leaf is classified per 4 KiB subpage, each with its own frame number.

  • [vvar]. smaps skips this VM_PFNMAP page, so the plugin’s RssKB is the kernel’s Rss plus 4 kB. PssKB excludes it, as the kernel does.

  • Kernel versions. The SavedDirty bit counts as dirty on 6.6 and later only; the soft-dirty bit never counts as dirty.

  • One member per address space. Two threads of one process passed as two members make every page look shared, so tasks are de-duplicated by mm.

Measured. On v2b and on v2c, for all 38 ground-truth secret pages, the walked frame number equals the kernel’s own pagemap and the class is private_dirty (T0). Each member’s Private_Dirty equals the guest’s smaps_rollup exactly, for 17 of 17 members. Smear: 0. This holds in MemDiver and in the plugin under stock Volatility 2.27.0 and 2.28.2.

Private pages are a small part of each process:

Group (v2b)

Private / Rss

Walk time per process

dropbear

4.26 % (sessions 4.83 %)

8 to 60 ms

OpenSSH

7.49 % (sessions about 9 %)

8 to 60 ms

gocryptfs

55.65 % (Go heap, no fork lineage)

0.26 to 0.29 s

Sibling groups

A sibling group is a set of processes of one program, with a shape: how they are related.

Identity. The ELF build-id, read through the process layer or from the executable’s page cache (a forked child may never have touched its ELF header). Otherwise the executable path, otherwise comm.

Interpreters. For a known interpreter (python, perl, ruby, node, java, the shells, php) the identity is the executable plus the script from argv; -m and -c are handled. On v2b this splits the python3 processes into three groups (unattended-upgrades, the guest’s server script, and eight client scripts) instead of one pool; bash -c is not pooled.

The shape rule. ppid and memory layout point the wrong way too often: a reparented child has ppid 1, and with ASLR off every exec draws the same layout. So the pair relation comes from kernel evidence of fork lineage:

  • mm->exe_file: fork copies the pointer, every execve() opens the file anew;

  • the root of vma->anon_vma: fork shares it, an exec does not;

  • the 16 AT_RANDOM bytes confirm. All zero (the Go runtime leaves them so) is no evidence.

same_exec if exe_file is equal or an anon_vma root is shared; different_exec if neither; conflict if they disagree. ppid and layout are diagnostics only. A shared struct file survives an exec (an inherited log descriptor), so it only links the family tree.

The shapes are forked (every pair same_exec), independent (none), mixed (both), conflict, and single (fewer than two analysed members).

Measured.

  • On v2b, over 163 member pairs (45 of them negative controls), exe_file and the anon_vma root each classify 163 of 163 correctly. AT_RANDOM does so only when all-zero counts as no evidence.

  • The three planted groups get the guest’s shapes: dropbear forked (listener plus 4 sessions), OpenSSH mixed (re-exec’d monitors, each with a forked session), gocryptfs independent (3 daemons). Earlier instances of dropbear and sshd in the image form their own groups.

  • On v2c, the four lineage edge cases (ASLR-off unrelated, ASLR-off forked, reparented forked, reparented unrelated) give 36 of 36 pairs as the guest recorded them.

The rules live in one module, vol3plugins/memdiver/sibling_shape.py with sibling_evidence.py. The plugin and MemDiver’s image.siblings both run it.

Alignment

Siblings do not hold a secret at the same address. To compare them, MemDiver must decide which bytes of member A correspond to which bytes of member B.

module_relative. Bytes inside a mapped module are keyed by (module, offset). An anonymous VMA that starts at the same address in every member is keyed anon:va:<start>; this covers the Go arena at 0xc000000000. Other anonymous memory has no common coordinate.

Why that is not enough. Heap objects sit at different addresses in each member, because each one has its own allocation history. Measured on the v2b ground truth:

  • the 4 OpenSSH sessions form 2 heap-layout families, and across families the key objects sit at different heap offsets;

  • the gocryptfs daemons hold the key at different Go heap addresses (for example 0xc000096220 and 0xc0000ba220).

With module_relative alone, only one of the four OpenSSH key kinds lined up (enc_c2s), and the gocryptfs key was not compared at all.

Pointer propagation. A pointer stored in aligned memory leads to the same object in every member. MemDiver follows such pointers from aligned slots, up to depth 4, and pairs the targets. The allocator gives each target’s extent, so whole objects are paired. A target is paired only if it has the same object size and the same in-object offset in every member. A member address claimed by two different pairings is a conflict, and both are dropped.

On v2b, all OpenSSH session keys are reachable by the same depth-4 path in all 4 sessions, across both layout families: sshd+0xe1f90 -> +0x0 -> +0x158|+0x160 -> +0x20|+0x40 -> key (newkeys to sshenc/sshmac).

Heap extents.

  • ptmalloc2 (glibc) is walked without symbols. On v2b OpenSSH session 11794 it gives 5,759 chunks, and all 6 ground-truth key copies lie in in-use chunks.

  • Go heap. The captured gocryptfs binary is stripped and uses Go 1.22.2. See Go runtime heap for capture requirements and coverage diagnostics. MemDiver parses the Go runtime’s mspan records without symbols. The struct layouts are generated from the Go toolchain’s own DWARF, for Go 1.18 to 1.26 on amd64 and arm64, with a drift test. On v2b and v2c, all 12 ground-truth master-key addresses resolve to a freed slot of a 128-byte object, at object offset 32; span coverage is 100 %.

No pointer path reaches the gocryptfs key, so Go objects are paired differently:

  • Span signatures. A span is paired when its signature (size class, page count, and per slot the shape of each word: zero, a module pointer, or other) occurs exactly once in every member. Each object becomes a row, freed slots included, because that is where the keys are.

  • Object rows beat positional rows. Where a paired object overlaps an anon:va: row, the object row wins.

  • Span shift pairing. On v2c the key spans differ by a shift of 2 slots. Shifted spans are paired by mutual best match, with a margin of at least 4 and a pointer-evidence guard.

Effect on the gocryptfs master key’s ranks (before, the ranks depended on which daemon came first; after, they are the same for every member order):

Capture

Before these two rules

After

v2b

11/12 and 4/9

5/6

v2c

169/170 and 14/19

11/12

Regime. analysis.sibling_diff uses module_relative plus pointer propagation for every shape. The shape is reported, and align_by overrides the regime. For dropbear on v2b, plain virtual-address alignment ranked the MAC keys 6 and 12; module_relative ranked them 4 and 5.

Ranking

The differential classifies every aligned byte and ranks the regions that are not invariant. Two defects were found on real data and fixed:

  • The entropy gate read member 0 only, so a rank depended on the member order. It now takes all members into account. Reversing the member order gives identical ranks.

  • The default query kept a variance floor that found no key. sibling_diff queries the non-invariant classes (structural, pointer, key candidate).

Each candidate gets a taxonomy label: session_secret_candidate, group_tier (shared) or unclassified. A second pass ranks invariant, high-entropy regions that are private in every member (per_process_long_term): material each process holds but that does not differ between siblings.

Measured ranks. Defaults, ground truth read only to score the finished ranking. Each cell is the best rank of a candidate that overlaps the key, for the worst member of the group.

Capture

dropbear (4 sessions)

OpenSSH (4 sessions)

gocryptfs (3 daemons)

v2b, 4-level

mac_s2c 4, mac_c2s 5

enc_s2c 2, enc_c2s 6, mac_s2c 7, mac_c2s 8

master key 5

v2c, 5-level

mac_c2s 6, mac_s2c 9

mac_s2c 2, enc_c2s 3, mac_c2s 5, enc_s2c 7

master key 11

This is not a universal top 10. The v2c gocryptfs key ranks 11, because freed residue slots of the key’s span outrank it. On v2c the gocryptfs master key ranks 11 when the differential compares the three gocryptfs daemons the capture records (the table above), and 8 when the memdiver.sibling_diff plugin selects the group by name with --comm gocryptfs, which adds a fourth gocryptfs process. dropbear’s encryption keys are not ranked: they are not stored raw in process memory (only the word-swapped AES schedule is), and the sidecar records page frames only for the MAC keys.

The private filter saves cost, not precision. Comparing only private frames cut the compared bytes by 95.2 % (dropbear), 75.8 % (OpenSSH) and 92.1 % (gocryptfs). The number of key-candidate regions stayed the same: 3/3, 183/183, 0/0. No rank changed. A frame shared at the same aligned position is invariant by construction, so removing it cannot change the result. What the filter buys is cost, an explanation per page, and a use with a single process (N=1): the private pages of one process are already a small candidate set.

Learning plugins from siblings

Ranking proposes candidates; it proves nothing. The step to proof is synthesis: learn a plugin from some siblings, and prove the key in a sibling it has never seen. See Plugin synthesis for the recipe format.

The pointer_path locator. Byte anchors did not carry across OpenSSH’s two heap-layout families. The pointer_path locator learns pointer chains instead: from a module global through allocator-checked hops to the key. Only paths that are identical in every learned sibling are kept. The plugin follows the path in the target process, and the path’s label (for example enc_c2s) gives the key’s role.

Multi-key synthesis. One plugin can locate and prove several keys, each with its own label and its own ordered list of oracles (keys=[...]; keys_kind="ssh" gives the four SSH labels).

Held-out mode. prove_pids learns from N-1 process views and proves the remaining member with --pid in the full image. The verdict carries held_out: true only when the proven process is not one of the learned ones. Capture identity is (image SHA-256, view, pid), so a .msl extracted from the image and a process view of the same pid count as the same capture.

The gocryptfs vault comes from the same image. Each sibling daemon’s encrypted vault has a ciphertext file and gocryptfs.conf resident in the page cache. MemDiver finds the daemon’s cipher directory (from argv or the FUSE mount source), dumps the file with linux.pagecache, and gives it to the gocryptfs-gcm oracle. Each vault proves only its own daemon’s key.

Measured. Each row names its proof class:

Target

Learn, prove

Proof class

Result

gocryptfs, v2b

3 rotations, each learned on 2 daemons, proven on the third

artefact (gocryptfs-gcm, vault from the page cache)

3/3 proven, held_out true

gocryptfs, v2b to v2c

learned on v2b daemons, proven on a v2c daemon

artefact

proven, held_out true

gocryptfs, v2b, memory only

3 rotations, each learned on 2 daemons (keys only, no vault), proven on the third

memory only: derived-state, chain hkdf-sha256

3/3 proven, held_out true

gocryptfs, v2b to v2c, memory only

the v2b-learned plugin, proven on a v2c daemon

memory only: derived-state, chain hkdf-sha256

proven, held_out true

OpenSSH, v2b

one multi-key plugin learned on 3 sessions, proven on the 4th

memory only: derived-state for all 4 labels

4/4 labels

dropbear, v2b

one multi-key plugin learned on 3 sessions, proven on the 4th

memory only: derived-state (encryption keys), packet-residue (MAC keys)

4/4 labels

OpenSSH and dropbear, v2b to v2c

the v2b plugins, on all 4 v2c sessions each (5-level paging, other ASLR)

memory only

4 labels x 4 sessions each, every key equal to the v2c sidecar

Over the held-out and cross-image runs, the two SSH plugins proved 40 of 40 key slots from memory alone. Every row passed on stock Volatility 2.27.0 and 2.28.2.

Synthesis reads no source code and no symbols of the target program; the gocryptfs binary is stripped. Learning and proving one SSH plugin took 92 to 174 s; the gocryptfs held-out run took 286 to 305 s, plus 188 s to recover the three vaults. See Time to plugin.

Memory-only proof

Two oracle formats prove a key from the same process’s memory, with no artefact and no network traffic. Both are proof class D (key self-consistency) in the oracle taxonomy. Absence of evidence gives unverified, never rejected: an implementation may keep no derived state.

derived-state. A live key leaves deterministic state next to it: its AES round-key schedule (natural or word-swapped word order), its HMAC-SHA256 or HMAC-SHA512 inner and outer midstates, or an HKDF chain. The oracle derives that state from the candidate and searches the process for it.

  • What it proves: a live key of that algorithm is in use in this process.

  • What it does not prove: the key’s role. sshd holds 6 live AES keys, and the AES chain proves any of them. The role (direction, encryption or MAC) comes from the structure the key was found in: the sshenc record, or the label of a learned pointer path.

packet-residue. A received packet often stays in the process buffer with its MAC.

  • Mode A: a plaintext packet followed by HMAC(mac key, seq || packet). It needs the MAC key only.

  • Mode C: ciphertext followed by its MAC. It is decrypted with the paired encryption key and the counter block found next to that key’s schedule, then the MAC is checked. It proves the encryption key, the counter and the MAC key together.

  • What it proves: the key authenticated real traffic that this process received. This also binds the key to its direction.

  • What it does not prove: keys of a direction with no resident packet. On v2b and v2c, the client-to-server encryption keys and the OpenSSH mac_c2s keys have no residue; they are proven by derived-state instead.

What was found in the owning process (v2b, same on v2c):

Implementation

Encryption keys

MAC keys

OpenSSH

AES schedule, 8/8

HMAC midstates, 8/8

dropbear

word-swapped AES schedule, 8/8

no midstates (HMAC is recomputed per packet); packet residue 8/8

gocryptfs

the whole HKDF chain from the master key, 3/3

The OpenSSH monitor processes hold none of their connection’s secrets.

In the hand-written memdiver.ssh. OpenSSH (tier B) and dropbear (tier C) keys on the x86 captures were unverified, because K and H are wiped. With these proofs, 24 rows per capture on v2b and v2c are now oracle:derived-state (8 dropbear AES, 8 OpenSSH AES, 8 OpenSSH HMAC-SHA256), all 24 equal to the ground truth, with no new false proof and no row lost. ChaCha20-Poly1305 keys are proven by the key-stream block their ChaCha20 contexts cache (both halves; 10 of 10 per capture), or by a leftover packet when no block is cached; IVs stay unverified. memdiver.ssh does not locate dropbear’s MAC keys; synthesized plugins prove them by packet residue.

Tools

memdiver.page_sharing.PageSharing (stock Volatility, no MemDiver). Per-process page accounting by share class, sibling groups with --group, pair evidence with --pairs, private pages with --dump. PssKB is computed from each page’s struct page mapcount, as the kernel’s smaps_rollup does. --patched-code diffs every private copy of a file-backed executable page against the page-cache copy of the same file page: on capture v2d it finds the inline hook (5 bytes) and the int3 (1 byte) exactly as the guest recorded them, and nothing in any other process. See Usage.

memdiver.sibling_diff.SiblingDiff (needs MemDiver, imported only when the plugin runs). The Volatility front end of the differential: one row per (candidate, member), with the member’s address, the regime, the propagation path and the taxonomy. Without MemDiver it prints one refused row and does not fail. vol -h stays at about 0.41 s. See Usage.

memdiver image sibling-diff and analysis.sibling_diff. The same differential from MemDiver’s command line, library, REST (POST /api/image/sibling-diff, a job) and MCP (image_sibling_diff). memdiver image siblings (image.siblings) lists the groups.

memdiver image siblings capture.lime --isf kernel.isf.json --comm sshd
memdiver image sibling-diff capture.lime --isf kernel.isf.json --comm dropbear
memdiver image sibling-diff capture.lime --isf kernel.isf.json --pids 11970,12011,12056 --frames all

The .msl share-class block. A process extracted from an image to .msl can carry its share classes in an extension segment (block type 0x1F5C, a producer-defined structural type, tag memdiver.shareclass/1). This uses the extension mechanism of the Memory Slice specification v1.1.0; the specification is unchanged. The block round-trips the classification page for page, stock readers skip it, and a flipped byte in it is detected while the capture chain stays valid (checked on v2b for OpenSSH and dropbear sibling groups).

The referee (memdiver vol3 referee). It runs any plugin over every capture that has a ground-truth sidecar and prints recall, false rows, runtime and exit status per capture and Volatility tree. It scores linux.dmcrypt at recall 1.0 with 0 false rows, and a copy of the gocryptfs plugin with its key offset shifted by 8 bytes at recall 0.0, without a crash. See Usage.

Honest limits

  • A shared frame can hold a group secret. The private filter cannot see a key loaded before fork() as “different”. Such a key sits in shared_lineage frames and is labelled group_tier.

  • W=0 proves nothing, and a smeared frame is trusted in neither direction.

  • The private filter saves cost, not precision. Measured: identical candidate regions and ranks with all frames and with private frames only.

  • Ranks are not a universal top 10. On v2c the gocryptfs master key ranks 11 when the differential compares the three gocryptfs daemons the capture records, and 8 when the group is selected by name with --comm gocryptfs, which adds a fourth gocryptfs process. Ranks are measured on two captures with three groups each; other programs will differ.

  • A derived-state proof shows “a live key of that algorithm in this process”. The role comes from structure: the struct the key was found in, or the label of a learned pointer path.

  • Not every key has memory-only proof. IVs keep no derived state (ChaCha20-Poly1305 keys are proven only when a cached key-stream block or a leftover packet is resident), and memdiver.ssh does not locate dropbear MAC keys. Kernel WireGuard transport keys are proven only when a leftover data message in memory reproduces their tag (O_pkt).

  • Siblings are not independent captures. Forked siblings share ASLR and the parent’s pre-fork heap, so pointer bytes look static among them. The cross-image synthesis runs (learned on v2b, proven on v2c with other ASLR and 5-level paging) check that the learned plugins do not depend on this.

  • Ground truth from two captures. Groups, ranks and proofs were measured on v2b and v2c, three groups each (dropbear, OpenSSH, gocryptfs). The robustness matrix (the six public captures, and 21 more images in Compatibility) checks only that the plugins run cleanly and prove nothing false; it measures no recall.

  • sibling_diff needs MemDiver. The plugin refuses without it; memdiver.page_sharing does not.

  • Oracle budget. --oracle-budget applies per scan target. The multi-key Dropbear plugin over v2c with --comm dropbear (both listeners and an OpenSSH-client session included) proves all 16 keys with the default budget in 24.6 s (2.27.0) / 26.5 s (2.28.2); it took 494 s. The cause was re-checking, in every scan target, the candidates earlier targets left unproven; now each target judges only candidates its own locators found, and large derived-state passes use one memory sweep. Limit: a key is only proven from its own process’s memory.

  • Repeated --comm. Volatility keeps only the last value of a repeated option. Give several names after one --comm.