winappdbg.crash
Crash dump support.
Crash reporting:
- Crash
- CrashDictionary
Warnings:
- CrashWarning
- class winappdbg.crash.Crash(event)
Represents a crash, bug, or another interesting event in the debugee.
Basic information
Optional information
debugStringmodFileNamelpBaseOfDllexceptionCodeexceptionNameexceptionDescriptionexceptionAddressexceptionLabelfirstChancefaultTypefaultAddressfaultLabelisOurBreakpointisSystemBreakpointstackTracestackTracePCstackTraceLabelsstackTracePretty
Extra information
commandLineenvironmentenvironmentDataregistersPeekstackRangestackFramestackPeekfaultCodefaultMemfaultPeekfaultDisasmmemoryMap
Report
Notes
Miscellaneous
- Variables:
timeStamp (float) – Timestamp as returned by
time.time().signature (str) –
SHA256 hash-based signature for the Crash object.
This signature can be used as an heuristic to determine if two crashes were caused by the same software error. It is a stable hash based on key crash attributes that can be used for deduplication.
notes (list[str]) – List of strings, each string is a note.
eventCode (int) – Event code as defined by the Win32 API.
eventName (str) – Event code user-friendly name.
pid (int) – Process global ID.
tid (int) – Thread global ID.
arch (str) – Processor architecture.
os (str) –
Operating system version.
May indicate a 64 bit version even if
archandbitsindicate 32 bits. This means the crash occurred inside a WOW64 process.bits (int) –
32or64bits.commandLine (str or None) – Command line for the target process.
Noneif unapplicable or unable to retrieve.environmentData (list[str] or None) – Environment data for the target process.
Noneif unapplicable or unable to retrieve.environment (dict[str, str] or None) – Environment variables for the target process.
Noneif unapplicable or unable to retrieve.registers (dict[str, int]) – Dictionary mapping register names to their values.
registersPeek (dict[str, str] or None) – Dictionary mapping register names to the data they point to.
Noneif unapplicable or unable to retrieve.labelPC (str or None) – Label pointing to the program counter.
Noneor invalid if unapplicable or unable to retrieve.debugString (str or None) – Debug string sent by the debugee.
Noneif unapplicable or unable to retrieve.exceptionCode (int or None) – Exception code as defined by the Win32 API.
Noneif unapplicable or unable to retrieve.exceptionName (str or None) – Exception code user-friendly name.
Noneif unapplicable or unable to retrieve.exceptionDescription (str or None) – Exception description.
Noneif unapplicable or unable to retrieve.exceptionAddress (int or None) – Memory address where the exception occured.
Noneif unapplicable or unable to retrieve.exceptionLabel (str or None) – Label pointing to the exception address.
Noneor invalid if unapplicable or unable to retrieve.faultType (int or None) –
Access violation type. Only applicable to memory faults. Should be one of the following constants:
win32.ACCESS_VIOLATION_TYPE_READwin32.ACCESS_VIOLATION_TYPE_WRITEwin32.ACCESS_VIOLATION_TYPE_DEP
Noneif unapplicable or unable to retrieve.faultAddress (int or None) – Access violation memory address. Only applicable to memory faults.
Noneif unapplicable or unable to retrieve.faultLabel (str or None) – Label pointing to the access violation memory address. Only applicable to memory faults.
Noneif unapplicable or unable to retrieve.firstChance (bool or None) –
Truefor first chance exceptions,Falsefor second chance.Noneif unapplicable or unable to retrieve.isOurBreakpoint (bool) –
Truefor breakpoints defined by theDebugclass,Falseotherwise.Noneif unapplicable.isSystemBreakpoint (bool) –
Truefor known system-defined breakpoints,Falseotherwise.Noneif unapplicable.modFileName (str or None) – File name of module where the program counter points to.
Noneor invalid if unapplicable or unable to retrieve.lpBaseOfDll (int or None) – Base of module where the program counter points to.
Noneif unapplicable or unable to retrieve.stackTrace (tuple[tuple[int, int, str]] or None) – Stack trace of the current thread as a tuple of (frame pointer, return address, module filename).
Noneor empty if unapplicable or unable to retrieve.stackTracePretty (tuple[tuple[int, str]] or None) – Stack trace of the current thread as a tuple of (frame pointer, return location).
Noneor empty if unapplicable or unable to retrieve.stackTracePC (tuple[int, ...] or None) – Tuple of return addresses in the stack trace.
Noneor empty if unapplicable or unable to retrieve.stackTraceLabels (tuple[str, ...] or None) – Tuple of labels pointing to the return addresses in the stack trace.
Noneor empty if unapplicable or unable to retrieve.stackRange (tuple[int, int]) – Stack beginning and end pointers, in memory addresses order.
Noneif unapplicable or unable to retrieve.stackFrame (str or None) – Data pointed to by the stack pointer.
Noneor empty if unapplicable or unable to retrieve.stackPeek (dict[int, str] or None) – Dictionary mapping stack offsets to the data they point to.
Noneor empty if unapplicable or unable to retrieve.faultCode (str or None) – Data pointed to by the program counter.
Noneor empty if unapplicable or unable to retrieve.faultMem (str or None) – Data pointed to by the exception address.
Noneor empty if unapplicable or unable to retrieve.faultPeek (dict[int, str] or None) – Dictionary mapping guessed pointers at
faultMemto the data they point to.Noneor empty if unapplicable or unable to retrieve.faultDisasm (tuple[tuple[int, int, str, str]] or None) – Dissassembly around the program counter.
Noneor empty if unapplicable or unable to retrieve.memoryMap (list[
MemoryBasicInformation] or None) – Memory snapshot of the program. May contain the actual data from the entire process memory if requested. Seefetch_extra_data()for more details.Noneor empty if unapplicable or unable to retrieve._rowid (int) – Row ID in the database. Internally used by the DAO layer. Only present in crash dumps retrieved from the database. Do not rely on this property to be present in future versions of WinAppDbg.
- addNote(msg)
Add a note to the crash event.
- Parameters:
msg (str) – Note text.
- briefReport()
- Return type:
str
- Returns:
Short description of the event.
- clearNotes()
Clear the notes of this crash event.
- environmentReport()
- Return type:
str
- Returns:
The process environment variables, merged and formatted for a report.
- fetch_extra_data(event, takeMemorySnapshot=0)
Fetch extra data from the
Eventobject.Note
Since this method may take a little longer to run, it’s best to call it only after you’ve determined the crash is interesting and you want to save it.
- Parameters:
event (Event) – Event object for crash.
takeMemorySnapshot (int) –
Memory snapshot behavior:
0to take no memory information (default).1to take only the memory map. Seeget_memory_map().2to take a full memory snapshot. Seetake_memory_snapshot().3to take a live memory snapshot. Seegenerate_memory_snapshot().
- property fp
Value of the frame pointer register.
- Return type:
int
- fullReport(bShowNotes=True)
- Parameters:
bShowNotes (bool) –
Trueto show the user notes,Falseotherwise.- Return type:
str
- Returns:
Long description of the event.
- getNotes()
Get the list of notes of this crash event.
- Return type:
list[str]
- Returns:
List of notes.
- hasNotes()
- Return type:
bool
- Returns:
Trueif there are notes for this crash event.
- isExploitable()
Guess how likely is it that the bug causing the crash can be leveraged into an exploitable vulnerability.
Note
Don’t take this as an equivalent of a real exploitability analysis, that can only be done by a human being! This is only a guideline, useful for example to sort crashes - placing the most interesting ones at the top.
The heuristics are similar to those of the
!exploitableextension for WinDBG: https://web.archive.org/web/20210413145507/https://archive.codeplex.com/?p=msecdbg- Return type:
tuple[str, str, str]
- Returns:
The first element of the tuple is the result of the analysis, being one of the following:
Not an exception
Not exploitable
Not likely exploitable
Unknown
Probably exploitable
Exploitable
The second element of the tuple is a code to identify the matched heuristic rule.
The third element of the tuple is a description string of the reason behind the result.
- iterNotes()
Iterate the notes of this crash event.
- Return type:
iterator
- Returns:
Iterator of the list of notes.
- notesReport()
- Return type:
str
- Returns:
All notes, merged and formatted for a report.
- property pc
Value of the program counter register.
- Return type:
int
- property signature
Create a stable hash-based signature for crash deduplication.
Returns a SHA256 hash based on key crash attributes that determine if two crashes are likely caused by the same bug.
- Return type:
str
- Returns:
SHA256 hash as hexadecimal string
- property sp
Value of the stack pointer register.
- Return type:
int
- class winappdbg.crash.CrashDictionary(url, creator=None, allowRepeatedKeys=True)
Dictionary-like persistence interface for
Crashobjects.Currently the only implementation is through
db.CrashDAO.- add(crash)
Adds a new crash to the container.
Note
When the
allowRepeatedKeysparameter of the constructor is set toFalse, duplicated crashes are ignored.See also
- Parameters:
crash (Crash) – Crash object to add.
- get(key)
Retrieves a crash from the container.
- Parameters:
key (
Crashsignature) – Heuristic signature of the crash to get.- Return type:
- Returns:
Crash matching the given signature. If more than one is found, retrieve the newest one.
See also
Warning
A copy of each object is returned, so any changes made to them will be lost.
- To preserve changes do the following:
Keep a reference to the object.
Delete the object from the set.
Modify the object and add it again.
- has_key(key)
- exception winappdbg.crash.CrashWarning
An error occurred while gathering crash data. Some data may be incomplete or missing.