Skip to content

Handle missing streams in minidumps - #725

Open
zardus wants to merge 1 commit into
masterfrom
feature/fix-cle-minidump-streams
Open

zardus wants to merge 1 commit into
masterfrom
feature/fix-cle-minidump-streams

Conversation

@zardus

@zardus zardus commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

Problem

A minidump directory lists only the streams that its writer emitted. The backend failed when a module stream was absent. Removing ModuleListStream from tests/x86_64/windows/breakpad/tiny-exe-with-cet-xsave.dmp produces this error:

    RAISED AttributeError: str(e)="'NoneType' object has no attribute 'modules'"
    isinstance(cle.CLEError) = False
      | if any(module.name.endswith("wow64.dll") for module in self._mdf.modules.modules):

This failure stops the load. It prevents access to captured memory, recorded thread registers, and module sections. A missing SystemInfoStream also raised MinidumpMissingStreamError with str(e)='' and isinstance(cle.CLEError) = False.

Cause

The minidump package represents an absent stream as None. Minidump.__init__ read self._mdf.modules.modules at two sites and self._mdf.threads.threads at one site without checking for None. It also rejected a dump with no captured memory:

raise MinidumpMissingStreamError("MemoryList", "The memory segments were not defined")

A minidump requires only its header and stream directory. These streams may be absent. MinidumpMissingStreamError inherited from Exception and did not pass its message to the base class. The exception therefore had an empty string and was not a CLEError.

Fix

The backend now reads modules and threads once. It uses [] when either stream is absent. A dump without a module stream has no sections. A dump without a thread stream has no threads. A dump without a memory list has segments = [].

MinidumpMissingStreamError now derives from CLEError and passes its message to the base class.

--- no ModuleListStream:      LOADED Minidump arch=AMD64 segments=65 threads=['0x5bc'] rip=0x7ff9111e39e4
--- no ThreadListStream:      LOADED Minidump arch=X86 segments=173 sections=30 threads=[]
--- no captured memory:       LOADED Minidump arch=AMD64 segments=0 threads=[]
--- no SystemInfoStream:      RAISED MinidumpMissingStreamError:
    str(e)='SystemInfoStream is missing. The architecture was not specified'
    isinstance(cle.CLEError) = True

A missing SystemInfoStream still raises because the backend cannot infer the architecture. The backend still rejects a module when the dump did not capture its image.

#715 changes the same function. The second pull request to land will need a rebase.

@zardus

zardus commented Aug 10, 2026 •

Copy link
Copy Markdown
Member Author

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

This note applies to head 08852723cfedbb25167fa3fdde957d0bb8e60a60 and baseline 46a37333f4f59b0facf8774ee743ebc4cc074e9b.

Eight affected dumps have no memory list. The smallest is a 912-byte x86 dump with SHA-256 e198aef56fbc85f9ddfb91fe360e1aea109e80d18f58558afbf0162ebff47d38. The sample cannot be shared. It contains SystemInfo, ThreadList, ModuleList, and Exception streams.

Most of these eight dumps appear to be authored rather than captured. They use one module timestamp for every module. They also use sequential thread IDs and a header TimeDateStamp of 2.

These eight dumps still fail at the module loop that #715 replaces. None can serve as the regression fixture for this change.

The branch was re-keyed on 2026-08-28. The original head was 9f414421bcfb9c3a7d738514635748857e672371 on baseline b58ea02a446106647cdaae32bdf91b7062404cc1. The current head is 08852723cfedbb25167fa3fdde957d0bb8e60a60 on baseline 46a37333f4f59b0facf8774ee743ebc4cc074e9b.

git range-diff b58ea02a446106647cdaae32bdf91b7062404cc1..9f414421bcfb9c3a7d738514635748857e672371 46a37333f4f59b0facf8774ee743ebc4cc074e9b..08852723cfedbb25167fa3fdde957d0bb8e60a60 reports every commit unchanged. git diff 9f414421bcfb9c3a7d738514635748857e672371 08852723cfedbb25167fa3fdde957d0bb8e60a60 contains only the advance of master. It reports 23 files changed, 1358 insertions, and 92 deletions. Master did not change the files in this pull request between the two baselines.

@angr-bot

Copy link
Copy Markdown
Member

Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_725

A minidump's stream directory lists only the streams its writer chose to emit;
the header and the directory are the only mandatory parts of the file. The
backend read four of them and handled a missing one three different ways: the
memory list was required, the module and thread lists were dereferenced
unguarded and produced an AttributeError from the middle of a loop, and only the
system information stream raised a considered error.

A dump with no memory list now loads with no memory, and one with no module or
thread list loads with no sections or with no threads. The module list is read on
the architecture path as well, where a 64-bit dump without one failed before any
of that.

MinidumpMissingStreamError, which the missing system information stream still
raises when no architecture was passed either, now derives from CLEError and
hands its explanation to the base class. It was invisible to except CLEError, and
str() on it was empty because the explanation only ever reached an attribute.

A module whose image the dump did not capture is still rejected twenty lines
further down; #715 covers that half.
@zardus
zardus force-pushed the feature/fix-cle-minidump-streams branch from c9d2bf5 to 0885272 Compare August 26, 2026 22:46
@zardus

zardus commented Aug 28, 2026 •

Copy link
Copy Markdown
Member Author

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

The old backend fails when a minidump lacks ModuleListStream, ThreadListStream, or captured memory. It reads a None stream object. A missing SystemInfoStream raises MinidumpMissingStreamError without a message. That exception is not a CLEError.

Each case below uses tests/x86_64/windows/breakpad/tiny-exe-with-cet-xsave.dmp or tests/x86/windows/jusched_x86.dmp. The case changes one stream directory entry to UnusedStream in a temporary in-memory copy. This matches a dump whose writer did not collect that stream. No other file data changes.

cle at the merge base, 46a3733
cle: <cle at the merge base>/cle/__init__.py
fixtures: tests/x86_64/windows/breakpad/tiny-exe-with-cet-xsave.dmp, tests/x86/windows/jusched_x86.dmp
--- no ModuleListStream
    input: tiny-exe-with-cet-xsave.dmp with ModuleListStream struck from the directory
    RAISED AttributeError: str(e)="'NoneType' object has no attribute 'modules'"
    isinstance(cle.CLEError) = False
      | if any(module.name.endswith("wow64.dll") for module in self._mdf.modules.modules):
      | ^^^^^^^^^^^^^^^^^^^^^^^^^
      | AttributeError: 'NoneType' object has no attribute 'modules'
--- no ThreadListStream
    input: jusched_x86.dmp with ThreadListStream struck from the directory
    RAISED AttributeError: str(e)="'NoneType' object has no attribute 'threads'"
    isinstance(cle.CLEError) = False
      | for thread in self._mdf.threads.threads:
      | ^^^^^^^^^^^^^^^^^^^^^^^^^
      | AttributeError: 'NoneType' object has no attribute 'threads'
--- no captured memory (MemoryList+ModuleList+ThreadList)
    input: tiny-exe-with-cet-xsave.dmp with MemoryList, ModuleList, ThreadListStream struck from the directory
    RAISED AttributeError: str(e)="'NoneType' object has no attribute 'modules'"
    isinstance(cle.CLEError) = False
      | if any(module.name.endswith("wow64.dll") for module in self._mdf.modules.modules):
      | ^^^^^^^^^^^^^^^^^^^^^^^^^
      | AttributeError: 'NoneType' object has no attribute 'modules'
--- no SystemInfoStream
    input: tiny-exe-with-cet-xsave.dmp with SystemInfoStream struck from the directory
    RAISED MinidumpMissingStreamError: str(e)=''
    isinstance(cle.CLEError) = False
      | File "<cle at the merge base>/cle/backends/minidump/__init__.py", line 38, in __init__
      | raise MinidumpMissingStreamError("SystemInfo", "The architecture was not specified")
      | cle.backends.minidump.MinidumpMissingStreamError

With this change, the backend loads the first three minidumps with the data they contain. A missing SystemInfoStream raises a CLEError with a clear message.

with this change, 0885272
cle: <cle with this change>/cle/__init__.py
fixtures: tests/x86_64/windows/breakpad/tiny-exe-with-cet-xsave.dmp, tests/x86/windows/jusched_x86.dmp
--- no ModuleListStream
    input: tiny-exe-with-cet-xsave.dmp with ModuleListStream struck from the directory
    LOADED  Minidump arch=AMD64 wow64=False
    segments=65 sections=0 sections_map=0 entries []
    threads=['0x5bc'] tls.threads=1
    thread 0x5bc: rip=0x7ff9111e39e4 rsp=0xcbc82ff448
--- no ThreadListStream
    input: jusched_x86.dmp with ThreadListStream struck from the directory
    LOADED  Minidump arch=X86 wow64=False
    segments=173 sections=30 sections_map=30 entries ['CRYPTBASE.dll', 'KERNELBASE.dll', 'advapi32.dll']...
    threads=[] tls.threads=0
--- no captured memory (MemoryList+ModuleList+ThreadList)
    input: tiny-exe-with-cet-xsave.dmp with MemoryList, ModuleList, ThreadListStream struck from the directory
    LOADED  Minidump arch=AMD64 wow64=False
    segments=0 sections=0 sections_map=0 entries []
    threads=[] tls.threads=0
--- no SystemInfoStream
    input: tiny-exe-with-cet-xsave.dmp with SystemInfoStream struck from the directory
    RAISED MinidumpMissingStreamError: str(e)='SystemInfoStream is missing. The architecture was not specified'
    isinstance(cle.CLEError) = True
      | File "<cle with this change>/cle/backends/minidump/__init__.py", line 48, in __init__
      | raise MinidumpMissingStreamError("SystemInfo", "The architecture was not specified")
      | cle.backends.minidump.MinidumpMissingStreamError: SystemInfoStream is missing. The architecture was not specified

@zardus zardus changed the title Load minidumps whose writer left out a stream Handle missing streams in minidumps Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants