Android Scudo (scudo)

The Scudo method finds key candidates in Android app heaps captured across cold boots. It is the original heap block-consensus method. The Windows heap method later generalised its pairing engine (see Block consensus engine and Windows heap). This page explains, top-down, the parts of the Scudo allocator that MemDiver relies on, and how MemDiver turns N .msl dumps into the reduced heap consensus matrix and then into a candidates.json for brute-force.

Use it when you have at least two native .msl dumps of the same Android app (Android 11 or later, where Scudo is the default allocator), taken on separate cold boots. Each run’s secret (a TLS traffic secret, a session key) should be freshly random. It needs the dumps’ region tables and VAS maps, which native .msl dumps carry, and one of the runs as the reference that brute-force will read.

1. The idea

MemDiver’s default reduction is positional: it compares the byte at the same region-relative offset in every dump and keeps the offsets whose value changes from run to run. That works when the memory layout stays put between runs. On an Android cold boot it does not. Scudo puts allocations into other blocks and slots each run, so the same offset holds unrelated objects in two dumps and the positional variance is high almost everywhere (see Why positional consensus breaks on heaps).

The Scudo method compares chunks, not addresses. Every live chunk in the Scudo primary heap carries an 8-byte header that records its size class, its allocation origin and the size the program asked for. MemDiver reads those headers in every dump and turns each chunk into a signature such as scudo:c3:o0:s40. A signature that occurs exactly once in every dump names the same object in every run, wherever it was placed. Those chunks are paired, and their user bytes are stacked into a matrix with one row per dump. The columns whose bytes vary between runs are where a per-run secret can live.

Left, two dumps whose heap block A sits at offset 0x10 in dump 0 and at 0x50 in dump 1, so a same-offset comparison pits block A against an unrelated block B. Right, block A matched by signature in three dumps and stacked into a matrix whose columns are byte offsets within the block; constant columns are invariant and the columns that vary per run are key candidates.

Same-offset comparison fails on a heap; pairing blocks by signature restores the correspondence.

2. The Scudo allocator, as far as MemDiver needs it

Scudo is the hardened allocator from the LLVM project. Android uses it as the default malloc from Android 11. Three parts matter here: the primary allocator, the chunk header and the secondary allocator.

Primary allocator: one region per size class

Small allocations (here: requests of up to 65,536 bytes) are served by the primary allocator. On 64-bit Android it reserves one memory region per size class. Every block in a region has the same size, so a region is a regular grid of blocks. The class number is the ClassId. Class 0 is Scudo’s internal BatchClass and never holds user data, so user chunks have ClassId 1 to 32.

The kernel shows these regions in /proc/<pid>/maps with names that memslicer copies into the .msl VAS map:

mapping name

what it is

used by the Scudo method

[anon:scudo:primary]

the readable, writable primary regions

scanned

[anon:scudo:primary_reserve]

the PROT_NONE reserve behind them

no

[anon:scudo:secondary]

large (secondary) allocations

no

Scudo randomises where in its regions a chunk lands. Between two cold boots the same malloc call therefore returns a block in a different slot, or in a differently placed region. This is the behaviour the method is built for.

MemDiver uses the block sizes of the Android configuration in AOSP platform/external/scudo at tag android-17.0.0_r1 (AndroidNormalSizeClassConfig, 64-bit). The sizes include the 16-byte header area:

class  1..8   0x20  0x30  0x40  0x50  0x60  0x70  0x90  0xb0
class  9..16  0xc0  0xe0  0x120 0x160 0x1c0 0x250 0x320 0x450
class 17..24  0x670 0x830 0xa10 0xc30 0x1010 0x1210 0x1bd0 0x2210
class 25..32  0x2d90 0x3790 0x4010 0x4810 0x5a10 0x7310 0x8210 0x10010

A request of s bytes needs roundUp(s, 16) + 16 bytes, and Scudo picks the smallest class whose block is at least that large. MemDiver ports Scudo’s own lookup (TableSizeClassMap::getClassIdBySize) for this. Some examples:

requested size

needed

ClassId

block size

0, 1 or 16

16 or 32

1

0x20

17 to 32 (a 32-byte AES-256 key)

48

2

0x30

33 to 48 (a 48-byte TLS 1.3 SHA-384 secret)

64

3

0x40

128

144

7

0x90

4096

4112

21

0x1010

65536 (largest)

65552

32

0x10010

The chunk: a 16-byte header area, then user data

A chunk starts on its class grid. The first 16 bytes are the header area: roundUp(sizeof(u64), 16) on 64-bit. The user pointer that malloc returns is block + 16. The first 8 bytes of the area hold the packed header, a little-endian u64 with these fields (Chunk::UnpackedHeader in Scudo’s chunk.h, bit 0 = least significant):

bits

width

field

meaning

0–7

8

ClassId

size class, 1 to 32 for user chunks (0 is BatchClass)

8–9

2

State

0 = available, 1 = allocated, 2 = quarantined

10–11

2

OriginOrWasZeroed

for an allocated chunk, how it was allocated: 0 = malloc, 1 = new, 2 = new[], 3 = memalign

12–31

20

SizeOrUnusedBytes

for a primary chunk, the requested size in bytes

32–47

16

Offset

distance from the block start to the chunk, in units of the 16-byte minimum alignment; 0 unless the allocation was realigned

48–63

16

Checksum

a checksum over the header, keyed with a per-process random cookie and the chunk address

MemDiver’s two parsers decode exactly this layout, and so does the synthetic fixture packer in the tests.

The user data follows the header area and is as long as the requested size. The rest of the block, up to the next block, is tail padding. Bytes 8 to 15 of the header area are not read by MemDiver.

Panel a shows the eight header bytes 02 01 02 00 00 00 27 7f as stored at a block start, read as the little-endian 64-bit word 0x7f27000000020102. Panel b splits that word into fields with bit 63 on the left: Checksum 0x7f27 in bits 63 to 48 (never verified, needs the per-process cookie), Offset 0 in bits 47 to 32 (must be 0), SizeOrUnusedBytes 32 in bits 31 to 12 (must fit the class), Origin 0 in bits 11 to 10, State 1 in bits 9 to 8 and ClassId 2 in bits 7 to 0. A brace marks ClassId, Origin and size as the pairing signature scudo:c2:o0:s32. Panel c shows a 64-byte class-3 block: 8 bytes packed header, 8 unused bytes, 40 bytes of user data marked as compared across dumps, and 8 bytes of tail padding marked as never compared.

The packed chunk header, decoded from a word observed in front of a malloc(32) chunk in an Android 17 emulator dump, and the bytes of a block that the method compares.

The header word in the figure is the one test ground truth from a real device: a header read 16 bytes before a malloc(32) secret in a lab dump from an API 37 (Android 17) emulator. It decodes to ClassId 2, State 1 (allocated), origin 0, size 32, Offset 0 and checksum 0x7f27.

Chunk states

  • Allocated (1): in use by the program. These are the only chunks the Scudo method compares.

  • Available (0): free and ready for reuse.

  • Quarantined (2): freed, but held back from reuse for a while when the quarantine is enabled.

Freed and quarantined chunks can still hold old secrets. The method does not compare them (see Limits).

Secondary allocator and the checksum

Requests larger than the largest primary class go to the secondary allocator, which maps memory per allocation and uses a different header (LargeBlock::Header). The Scudo method never looks at [anon:scudo:secondary].

The checksum protects the header against corruption. It is keyed with a random cookie that exists only in the running process. A dump reader does not have that cookie, so MemDiver never verifies or recovers the checksum. It checks the header’s structure instead (next section).

3. How MemDiver extracts chunks from one dump

MemDiver reads Scudo headers in two independent places. Keep them apart: only the second one builds the matrix.

Two boxes side by side. Left, the heap-mode parser in heap/allocators/scudo.py, which scans regions named [anon:scudo:primary* or anonymous writable regions, infers the block stride from the bytes, reports every chunk state with a per-slot confidence and lists secondary regions without decoding them; it feeds allocator detection (allocator=auto) and the heap viewer. Right, the consensus extractor in engine/scudo_chunk_consensus.py, which scans writable regions inside [anon:scudo:primary] or else every writable region, uses the fixed Android 17 size-class table, keeps allocated chunks of the dominant on-grid class only, and feeds the reduced heap consensus matrix. A dashed arrow from allocator detection to the matrix is labelled gate only.

The heap-mode parser answers “is this Scudo?” and powers the heap viewer; the consensus extractor alone feeds the matrix.

heap-mode parser heap/allocators/scudo.py

consensus extractor engine/scudo_chunk_consensus.py

used by

allocator detection (--allocator auto), the heap viewer and its chunk inspector

the Scudo method only (build_chunk_consensus)

region scope

regions named [anon:scudo:primary* (a prefix match), else anonymous writable regions, unless glibc or musl is mapped without a Scudo library

writable regions inside a mapping named exactly [anon:scudo:primary], else every writable region

size classes

inferred from the bytes: the most common gap between same-class headers is the block stride

fixed Android 17 table of 32 classes

states

available, allocated and quarantined

allocated only

result

every slot with a confidence from 0.1 to 1.0 (below 0.6 = unknown)

a plausible, on-grid header or nothing

secondary

listed as regions, header not decoded

ignored

The heap-mode parser is described in the heap guide under Supported allocators and Known limitations. The rest of this page is about the consensus extractor, extract_chunks.

Panel a lists mappings of one dump. Only [anon:scudo:primary] is scanned; [anon:scudo:primary_reserve], [anon:scudo:secondary], and dalvik spaces or stacks are skipped while a primary mapping is named. A note says that without such a mapping every writable region is scanned (all_rw_fallback, diagnostic scudo.scope_fallback). Panel b shows the primary as one region per size class, from class 1 (block 0x20) to class 32 (block 0x10010), with class 3 highlighted. Panel c shows eight 0x40-byte blocks of a class-3 region: allocated chunks become scudo:c3:o0:s40, scudo:c3:o0:s48 twice and scudo:c3:o1:s36; an available block, a quarantined block and a never-used block with ClassId 0 are skipped; an allocated class-1 header on that grid is only counted as another class.

What the consensus extractor scans in one dump, and which blocks of a class-3 region become chunks.

Step 1: choose the regions to scan

  • Only regions with protection exactly read/write count. Read/write/execute regions are left out.

  • If the dump’s VAS map names at least one [anon:scudo:primary] mapping, a region is scanned only when its base lies inside such a mapping. The name must match exactly: [anon:scudo:primary] is also a prefix of [anon:scudo:primary_reserve]. The scope is recorded as vas:scudo_primary.

  • Otherwise every read/write region is scanned (all_rw_fallback). A warning is logged, and search-reduce adds the diagnostic scudo.scope_fallback: header-shaped words in stacks or other heaps can then be taken for chunks.

  • The scope is reported per dump (kind, reason, read/write regions seen and scanned, bytes scanned and skipped). Skipped regions are never read.

Step 2: read every 16-byte slot as a header candidate

A real header is the first u64 of a 16-byte-aligned slot. For every captured page of a scanned region, the low 8 bytes of each 16-byte slot are taken as a candidate. Uncaptured pages are simply absent.

Step 3: keep plausible headers

A candidate is plausible when all of these hold:

  • ClassId is between 1 and 32;

  • State is 1 (allocated);

  • Offset is 0. MemDiver assumes no realignment in the primary, so memalign-style chunks with a non-zero Offset are not extracted;

  • the requested size is at most 65,536 bytes;

  • the smallest class that fits the requested size is exactly the header’s ClassId. A header whose size belongs to a smaller or a larger class is rejected.

OriginOrWasZeroed is not checked. The checksum is not checked.

Step 4: keep headers on their class grid

A real chunk starts on its class’s block grid, so its offset from the region start is a multiple of the block size. Plausible words off the grid are only counted (off_grid_plausible).

Step 5: one class per region

A Scudo primary region holds one size class. The on-grid class with the most plausible headers names the region, and only chunks of that class are extracted. On-grid headers of other classes are counted as other_class_votes.

Step 6: take exactly the requested user bytes

For each chunk, MemDiver takes the bytes from block + 16 to block + 16 + requested size. The header area and the tail padding are never taken. The chunk is dropped if any page those bytes touch was not captured, because joining only the captured pages would return bytes from the wrong address. This can happen where the block size does not divide the page size, for example class 7 (block 0x90). A malloc(0) chunk gets empty user data.

Step 7: record the chunk

Each chunk becomes a record with:

  • sig: the signature scudo:c<ClassId>:o<origin>:s<requested size>, for example scudo:c3:o0:s40;

  • user_va: the user pointer, region base + offset + 16;

  • slot: the block number in its region. It is recorded but never used for pairing;

  • data: the user bytes.

The signature is the whole pairing key. Chunks are never matched by address, slot or ordinal across dumps.

4. Building the reduced heap consensus matrix

Everything after “a list of (signature, user VA, user bytes) per dump” is the shared block-consensus engine. The Block consensus engine page describes it for all heap methods. This section walks through it with Scudo chunks.

Panel a shows the allocated chunks of three dumps as tiles in address order. Each dump has one c3:o0:s40 chunk at a different address (..0000d0, ..000290, ..000450), one c3:o0:s36 and one c3:o1:s36 chunk at different addresses, two c3:o0:s48 chunks, and a c1:o0:s8 chunk that is absent from dump 2. Panel b shows the matrix: three rows, one per dump, with three segments laid end to end at strip offsets 0, 36, 76 and 112 for scudo:c3:o0:s36, scudo:c3:o0:s40 and scudo:c3:o1:s36. Below it the variance row is 0 at every byte for the two 36-byte segments and varies with mean 2356.22 for the 40-byte segment. Layout rows record offset, length and three user addresses; the verdicts are drop, keep, drop. Side notes explain that the ambiguous s48 chunks are compared by pointer-masked content and here end as content_shared, and that the missing s8 chunk is not judged.

Three dumps’ chunks paired by signature and laid end to end into the strip; only the segment whose bytes vary between runs is kept.

Step 1: pair by signature

For every signature, MemDiver counts how often it occurs in each dump:

  • unique: exactly once in every dump. Those N chunks are paired directly.

  • ambiguous: in every dump, but more than once in at least one. These go to content pairing.

  • missing: absent from at least one dump. These chunks are never compared.

  • empty: unique, but with no user bytes (malloc(0)). Pairable, but there is nothing to compare.

Step 2: pair duplicates by content

For an ambiguous signature, every chunk’s user bytes are pointer-masked: each aligned 8-byte word whose little-endian value is at least 0x10000 and falls inside one of the dump’s mappings (end inclusive) is set to zero. The mappings come from the VAS map, or from the stored regions when there is no map. The chunks are then grouped by their masked bytes:

  • A group found exactly once in every dump is paired as a content-invariant row, keyed <sig>#content:<16 hex digits>.

  • A group found in every dump but more than once somewhere, or in only some dumps, is counted and not paired.

  • A chunk whose masked bytes occur in no other dump is a per-run dynamic candidate. If every dump has exactly one such chunk for the signature, they are paired as the dynamic residue, keyed <sig>#dynamic.

Masking only decides which chunks correspond. The row still carries the raw bytes, so a pointer word shows up as variance in the matrix.

Step 3: lay the paired chunks into the strip

Each paired row is N byte strings of the same length: the requested size, which is part of the signature. The rows are laid end to end into one synthetic strip (the code calls it a slab). It is not an address range of any dump.

  • The signature-unique rows come first, in sorted order of their signature strings. Content-paired rows follow, grouped by signature.

  • For every strip byte, MemDiver stores the population variance of that byte across the N dumps (numpy.var, ddof = 0), and dump 0’s byte as the reference byte. Dump 0 is the first dump in the input list.

  • Each row also records a layout row (strip offset, length, [user VA in each dump]), and the row’s mean variance.

  • Each byte gets a variance class with the default thresholds: invariant (0), structural (up to 200), pointer (up to 3000), key_candidate (above).

So the “matrix” is ragged: one N × L block per paired chunk, conceptually an N × S matrix where S is the strip length. Only the variance row, the reference bytes and the layout rows are kept. The 16-byte header area and the tail padding never enter it.

In pseudo-code:

for each dump d:
    chunks[d]  = extract_chunks(d)              # Scudo-specific (section 3)
    ranges[d]  = mapped ranges of d             # for the pointer mask

unique, ambiguous, missing = count signatures over all dumps
rows = [ (sig, [chunk_d.data], [chunk_d.user_va]) for sig in sorted(unique)
         if chunk_0.data is not empty ]

for sig in sorted(ambiguous):
    groups[d] = group chunks of sig in dump d by mask_pointer_words(data, ranges[d])
    for each masked key k:
        if k occurs exactly once in every dump:  rows += "<sig>#content:<hash>"
    dynamic[d] = chunks whose masked key occurs only in dump d
    if every dump has exactly one dynamic chunk: rows += "<sig>#dynamic"

offset = 0
for row in rows:                                  # each row: N strings of length L
    variance[offset : offset+L] = var(stack(row.data), axis=0)
    reference[offset : offset+L] = row.data[0]    # dump 0
    layout += (offset, L, row.user_vas)
    offset += L

Step 4: one verdict per chunk of the reference dump

search-reduce then judges every chunk of one reference dump. The first rule that applies wins:

verdict

condition

kept

empty

no user bytes

no

signature_unique

in a signature-unique row with mean variance > 0

yes

signature_unique_invariant

in a signature-unique row with variance 0

no

dynamic_residue

in a <sig>#dynamic row

yes

content_invariant

in a <sig>#content:<hex> row

no

dynamic_candidate

its masked content occurs in no other dump

yes

missing

its signature is absent from some dump

not judged

content_shared

ambiguous, unpaired, and its masked content recurs elsewhere

no

The rule assumes the target value changes between runs. “Variance > 0” uses the exact float, so a chunk in which a single byte differs is kept. A dynamic-residue chunk is listed once, even though it is also a dynamic candidate. A missing chunk is neither kept nor ruled out: one run without the TLS connection removes that signature from every reference’s candidates, and the report says how many bytes that is. The verdicts, their order and their limits are shared with the Windows heap method; see Block consensus engine.

Step 5: translate to the reference dump’s flat vas offsets

brute-force --dump <reference> reads the reference in its flat vas view. Each kept chunk’s user VA is translated to an offset in that view and checked three ways. A chunk that fails is skipped and counted:

  • not_captured: the VA has no offset in the view;

  • not_contiguous: the chunk’s last byte is not at offset + length - 1;

  • bytes_mismatch: the bytes read back at the offset differ from the chunk’s bytes.

A reference whose captured runs hold fewer bytes than their pages (a truncated container) is refused outright with scudo.reference_truncated, because every offset behind the short run would be wrong.

Step 6: write candidates.json

The result has the same contract as every search-reduce output, so brute-force --candidates reads it unchanged. It adds Scudo provenance:

field

content

source, version

search-reduce:scudo, 0.1.0

consensus

method (scudo_chunk_signature), version (0.2.0), aligned_rows, and the counts of ambiguous_signatures, missing_signatures, empty_signatures

N, dumps, reference_dump, reference_index, cohort

the inputs

region_scope

the reference dump’s scan scope

funnel

chunks and bytes per verdict, kept verdicts first, zeros included

not_judged

chunks, bytes and signatures of the missing verdict

skipped

counts of the three translation guards

totals

regions, bytes, key_sizes, stride (1) and windows

diagnostics

scudo.scope_fallback, scudo.candidates_skipped, scudo.not_judged, scudo.candidates_empty

regions

one entry per kept chunk: offset, length, va, signature, selected_as (the verdict), plus row and mean_variance for paired chunks

Regions are sorted by offset. The method does not rank them; brute-force uses mean_variance only to rank its zero-hit top_k. No region_filter is recorded, so brute-force opens the reference unfiltered, which is the view the offsets are in.

totals.windows estimates how many windows brute-force will test at stride 1: for each region and key size k, max(0, length - k + 1). --key-sizes only sizes this estimate; it never filters a region.

What is Scudo-specific and what is shared

  • Scudo-specific: the chunk extractor (header grid, Android 17 class table, allocated only, one class per region, the [anon:scudo:primary] scope and its fallback), the signature format scudo:c:o:s, the per-dump scan scope, the scudo.scope_fallback diagnostic and the allocator check before the build.

  • Shared with the Windows and Go heap methods: signature pairing, the pointer mask, content pairing, the strip and its variance, the eight verdicts, the translation to vas offsets, the window estimate and the candidates.json contract. The refactor that moved these into the shared engine kept Scudo output unchanged.

5. Worked example

The test suite’s synthetic three-run fixture (tests/fixtures/generate_scudo_msl_fixtures.py) makes the steps concrete. The values below were produced by running the code on it.

The dumps. Each run has one class-3 region (block 0x40) at a different base (0x7f0000000000, 0x7f0010000000, 0x7f0020000000) and holds:

  • one 40-byte chunk scudo:c3:o0:s40 whose bytes differ per run, at slot 3, 10 or 17;

  • two 48-byte chunks scudo:c3:o0:s48 with identical constant bytes;

  • in runs 1 and 2 only, an 8-byte chunk scudo:c1:o0:s8 in a second region.

The fixture has no VAS map, so every dump is scanned under all_rw_fallback and the output carries scudo.scope_fallback.

Pairing.

signature

per dump

outcome

scudo:c3:o0:s40

1, 1, 1

unique: one row of 40 bytes at strip offset 0

scudo:c3:o0:s48

2, 2, 2

ambiguous; both copies mask to the same bytes, so the group occurs twice in every dump: counted, not paired

scudo:c1:o0:s8

1, 1, 0

missing

The strip is 40 bytes long. The coverage warning says that 40 bytes were compared per dump and 304 chunk bytes (71.7 % of the input) were not: 288 in the ambiguous signature and 16 in the missing one. The 40-byte row has a mean variance of 2356.22.

Verdicts for reference run 1 (144 bytes in 4 chunks):

verdict

chunks

bytes

signature_unique (kept)

1

40

content_shared

2

96

missing (not judged)

1

8

Output. One region of 40 bytes: offset 4304 in the reference’s flat vas view, VA 0x7f00000000d0, selected_as: signature_unique, mean variance 2356.22. The window estimate is 1 window for --key-sizes 40, 9 for 32 and 33 for 8. With run 3 as the reference, nothing is missing, because run 3 has no s8 chunk to judge.

The matrix figure above takes its paired rows from a second fixture (“neighbour”): three unique signatures scudo:c3:o0:s36, scudo:c3:o0:s40 and scudo:c3:o1:s36 at strip offsets 0, 36 and 76 (112 bytes). That fixture has no s48 or s8 chunks; the figure draws them in, after the first fixture, to show the ambiguous and the missing case. The two 36-byte rows are constant (signature_unique_invariant); the 40-byte row varies (signature_unique). Note that the rows are in string order of their signatures, not numeric order: s36 comes before s40 here, but s100 would sort before s40.

6. Using it

CLI: a collect session

The Scudo method runs as a collect session. consensus-add only records each dump’s path, because the pairing needs all dumps at once:

memdiver consensus-begin --state scudo.json --allocator scudo   # or: --allocator auto (picks the method)
for run in rnd-*.msl; do memdiver consensus-add --state scudo.json "$run"; done
memdiver search-reduce --state scudo.json --reference-dump rnd-1.msl \
  --key-sizes 48 -o cand.json
memdiver brute-force --candidates cand.json --dump rnd-1.msl --pcap rnd-1.pcap \
  --key-sizes 48 --stride 1 -o hits.json
  • --allocator scudo forces this method and skips allocator detection. Detection, which auto relies on to decide Scudo, combines mapping names ([anon:scudo:*], a libscudo* module, Android) with the heap-mode parser’s header probe.

  • consensus-begin --allocator auto without --size begins a heap-auto session: search-reduce picks Windows heap, Go heap or Scudo from the collected dumps (the auto rules of Choosing a method, with --reference-dump as the first dump), prints memdiver: heap method scudo (auto): <reason> on stderr and reduces as this method. When no heap method fits it refuses with consensus.no_heap_method. A state file written before heap-auto sessions existed (allocator: auto without a method field) stays a Scudo session: search-reduce detects the reference’s allocator and refuses with scudo.wrong_allocator unless it finds Scudo, as before. With --size, --allocator keeps its generic meaning (which heap roles a positional session records), and --size together with --allocator scudo is refused (consensus.size_allocator_xor).

  • The reference must be one of the collected dumps. Fewer than two dumps, a dump named twice, a missing file, a non-.msl dump, a locked encrypted dump or a mix of cohorts (without --mixed-ok) are refused before any heap is read.

  • search-reduce prints the verdict funnel to stderr. Positional flags such as --min-variance are reported as ignored.

The quickstart has the same chain in context: Android Scudo heaps across cold boots.

Web UI and REST

In the web pipeline, pick the Android Scudo (cold boots) recipe, or set Reduction method to Android Scudo (cold boots). Allocator offers Detect on dump 1 and require Scudo and Force Scudo (skip detection). Dump 1 is the reference, so the oracle or capture must belong to that run. The Scudo chunk verdicts table replaces the reduction funnel. The region filter chosen when opening a dump does not apply to this method. See the web UI tour.

Over REST, POST /api/pipeline/run selects the method with scudo: {"allocator": "auto" | "scudo"} or method: "scudo" (API reference):

  • the first entry of source_paths is the reference;

  • the run has only the search_reduce and brute_force stages, and a hit carries no neighbourhood variance;

  • escalation, on by default for a positional run, is silently off, and no plugin is generated (a REST run generates one only when emit asks for it). An explicit request is refused: emit: true or an emit object with scudo.plugin_unsupported (emit: false counts as no request); nsweep, escalate: true, a region filter or any reduce field with scudo.unsupported_option;

  • a method that names another method than the params object given is refused with pipeline.method_conflict.

CLI and MCP pipeline run, MCP tool

memdiver pipeline run --method scudo (MCP pipeline_run(method="scudo")) runs the whole chain with the first dump as the reference, Scudo allocator detection on, and the same refusals as the REST run (scudo.plugin_unsupported, scudo.unsupported_option). Under --method auto (the default) the run picks scudo by itself for a Scudo cohort (see What auto means here). The MCP tool search_reduce_scudo(dump_paths, reference_path, output_dir, key_sizes, ..., allocator="auto" | "scudo") is the reduce step on its own: it writes output_dir/candidates.json in the reference’s vas view, which brute_force reads with the same reference.

Library

from memdiver.app.tools_pipeline_android import search_reduce_android

summary = search_reduce_android(
    dump_paths=["rnd-1.msl", "rnd-2.msl", "rnd-3.msl"],
    reference_path="rnd-1.msl",
    output_dir="out",
    key_sizes=(48,),
    allocator="scudo",          # or "auto"
)
print(summary["candidates_path"], summary["funnel"])

For the matrix itself, memdiver.engine.scudo_chunk_consensus.build_chunk_consensus returns the vector, the aligned rows and the per-dump chunks and scopes, and memdiver.engine.scudo_candidates.classify_chunks gives the verdicts for one dump.

What auto means here

There are two different “auto” settings:

  • Allocator auto (the web Detect on dump 1, REST and MCP allocator: "auto", search_reduce_android(allocator="auto")) only checks that the reference is a Scudo heap once the Scudo method is chosen.

  • Method auto (pipeline run --method auto, MCP pipeline_run(method="auto"), REST method: "auto", the web Automatic, and the CLI heap-auto session consensus-begin --allocator auto without --size) chooses between windows_heap, go_heap, scudo and positional; where a pipeline run falls back to positional, the heap-auto session refuses with consensus.no_heap_method instead. It picks scudo when every dump is a readable .msl of the same OS that names a writable [anon:scudo:primary*] mapping and the reference’s heap is detected as Scudo, the same check this method applies itself (see Choosing a method). A Go process whose reference has a validated Go heap is checked for go_heap first and never falls through to scudo; when it also names Scudo mappings, the reason says (also a Scudo heap; --method scudo pairs Scudo chunks). An encrypted reference is probed decrypted when the run is given its key material (--key-file, --passphrase or --kem-key-file, or the same fields on the other surfaces); without it auto resolves to positional (method.encrypted). The heap-auto session’s own detection reads no key material: for an encrypted cohort, or a Scudo heap found only through anonymous mappings, search-reduce falls back to the Scudo session, which detects the allocator on the reference opened with search-reduce’s key flags.

The method is reachable on every surface: pipeline run --method scudo (CLI and MCP pipeline_run), the stand-alone MCP tool search_reduce_scudo, the CLI collect session, the REST and web pipeline and the library (search_reduce_android). --method positional runs an Android cohort through the positional reduction, which is what method auto did before it could pick scudo.

7. Validation status, limits and open issues

Validation status

  • The method is covered by unit and end-to-end tests on synthetic fixtures (the ones in Worked example, plus fixtures for content pairing, the dynamic residue, scope selection and page capture), and by a browser test that runs it through the web pipeline.

  • One header word from a real device (the Android 17 emulator header shown above) is pinned in the tests as decoding ground truth.

  • The repository records no real-data reduction for this method: no chunk counts, reduction ratios, keys found or timings on a real Android cold-boot cohort. Treat the method as validated on synthetic data only.

Limits

  • Android version. The extractor uses the Android 17 size-class table. A release with a different table can make valid headers fail the size-fits-class test, so they are silently not extracted. The heap-mode parser avoids this by inferring strides, but it does not feed the matrix.

  • Allocated primary chunks only. Freed and quarantined chunks, secondary (large) allocations, the ART heap and stacks are never compared, even though freed memory can still hold old secrets.

  • Realigned chunks (non-zero Offset, for example memalign) are not extracted.

  • Checksum unused. The checksum is never verified, so the extractor’s only defence against header-shaped garbage is the structural test and the class grid. Under all_rw_fallback this matters most.

  • ARM64 tagged pointers. On Android ARM64, heap pointers can carry a tag in the top byte (for example 0xb4…). The pointer mask does not strip that byte, so tagged pointers are not masked. Chunks that differ only in such pointers may then fail content grouping and end as dynamic_candidate, which enlarges the kept set. Not measured.

  • Mask errors. 32-bit ART references, unaligned and encoded pointers are not masked. Integers that happen to fall inside a mapping are masked, in particular values in the fixed ART heap window 0x02000000–0x32000000. For uniform random data, a word is wrongly masked with a probability of about 1e-9.

  • Missing signatures. One run without the target allocation (for example no TLS connection) removes that signature from every reference’s candidates; those chunks are reported as not judged.

  • Reference in its own consensus. The reference dump is one of the N dumps. A held-out reference is a different experiment.

  • Row order. Signature-unique rows are ordered by the string sort of their signatures (s100 before s40). This only affects strip offsets, not verdicts.

  • No plugin, N-sweep, escalation or Refine. These need a positional, per-byte variance along the reference’s address space, which this method does not produce.

Open issues

  • Real-data validation on an Android cold-boot cohort.

  • Behaviour on Android releases other than 17 (other size-class tables).

  • Stripping ARM64 pointer tags before the pointer mask.

  • Whether secondary allocations should be compared.

  • The per-class slot and the header checksum are recorded or decoded but unused.

  • The chunk vector carries a layout that the N-dump hex workspace could show, but no surface wires a Scudo chunk vector into it yet.

8. Source map

what

where

Android 17 class table, header decode, chunk extraction, signature, scope

engine/scudo_chunk_consensus.py (CLASSES, class_id_by_size, _plausible, extract_chunks, ScudoScanScope, build_chunk_consensus)

signature pairing, pointer mask, content pairing, strip assembly

engine/heap_block_consensus.py (align_blocks, mask_pointer_words, content_align, align_and_assemble)

strip variance and layout rows

engine/object_consensus.py (build_object_vector)

verdicts and funnel

engine/heap_block_verdicts.py; Scudo wrapper engine/scudo_candidates.py (classify_chunks)

producer, allocator check, candidates.json, refusal codes

app/tools_pipeline_android.py (search_reduce_android, _require_scudo)

input validation, vas translation, window estimate

app/heap_block_reduce.py

options refused for heap-block methods

app/heap_block_options.py

heap-mode parser and detection probe

heap/allocators/scudo.py (ScudoHeader, probe_scudo, parse_scudo); heap/detect.py

CLI session and search-reduce dispatch

cli/consensus.py, cli/pipeline.py, cli/_scudo_report.py

REST parameters and refusals

api/routers/pipeline.py (ScudoParams)

web method panel and verdict table

frontend/src/components/pipeline/stages/ScudoMethodPanel.tsx, frontend/src/components/pipeline/run/ScudoFunnel.tsx

tests and fixtures

tests/test_scudo_chunk_consensus.py, tests/test_search_reduce_scudo.py, tests/test_pipeline_runner_scudo.py, tests/fixtures/generate_scudo_msl_fixtures.py, tests/e2e/specs/pipeline-scudo.spec.ts