본문으로 건너뛰기
cccskills
무료GitHub에 공개

windbg-user-heap-corruption-investigation

Use when an app, service, or user-mode driver host heap fails or Application Verifier detects corruption; inspect history and bounds. Not for kernel pool corruption or ordinary OOM.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Heap Corruption Investigation

Load windbg-diagnostic-method first if it is not already loaded in this conversation, and apply it throughout for evidence ranking, hypothesis testing, confidence calibration, independent review, and report validation. This skill adds the bug-family-specific commands and evidence requirements.

Detection and limits

Look for STATUS_HEAP_CORRUPTION (0xC0000374), Application Verifier stops, or failures in heap allocate/free/reallocate paths in an application, service, or user-mode driver host such as an UMDF host process. A crash inside the allocator may be the first detection of an earlier bad write, not the faulty operation. Distinguish corruption from allocation failure; for the latter use windbg-user-virtual-memory-exhaustion.

Allocation/free history depends on how the process was instrumented and which pages were captured. A missing history is a limitation, not proof of a leak or use-after-free.

Workflow

1. Decode the stop

.exr -1
.ecxr
!analyze -v
k

Record the stop reason, corrupted block, corruption address, and the operation that detected the damage. If a verifier stop frame has parameter/local symbols, select it with .frame /r <frame> and inspect dv; otherwise use the captured stop output and the documented stop definition. Do not assume one fixed parameter layout or a stop code shared by all verifier versions.

2. Recover available block history

!heap -p -a <address>
!avrf -hp -a <address>

The first command inspects a Page Heap allocation; the second searches available Application Verifier heap-operation history. Use !heap -? and !avrf -? to confirm support in the installed extension. On an uninstrumented dump these commands may not recover the history needed to identify the writer.

Capture allocation and free stacks when present. Check the address is inside the user allocation rather than a header or neighboring block.

3. Test competing explanations

HypothesisEvidence to seek
Use-after-freeConfirmed free before a later access through a retained reference
Double-freeTwo ownership/completion paths freeing the same allocation
Overrun/underrunA write outside the allocated user bounds
Wild writeCorrupted header or payload and a writer with an invalid target
Allocation/free contract mismatchDifferent allocator/deallocator or incorrect owning heap

Inspect bytes with db <address> L<size> and disassembly around the access. Fill patterns and plausible pointers are clues, not causal proof. Correlate with source, history, or a repro and trace the ownership transition.

4. Obtain stronger evidence if necessary

With user approval, enable full Page Heap for a named test executable:

gflags /p /enable target.exe /full

Restart that process and reproduce under the debugger. Application Verifier heap checks can also be configured for that test executable. Explain memory overhead, timing changes, and potential deliberate stops before doing this. Record the previous settings and restore them when finished; if Page Heap was newly enabled for this test, disable it with:

gflags /p /disable target.exe

Do not change an existing application's verification policy without approval. If a user-mode TTD trace is available, use windbg-user-ttd-reverse-debugging-triage to find the relevant mutation or free.

Fix patterns

  • Enforce the actual lifetime contract with ownership types or explicit acquire/release rules. Shared ownership is appropriate only when the design genuinely has multiple owners.
  • Synchronize shared state separately: shared_ptr ownership does not make a concurrently modified cache or pointed-to object thread-safe.
  • Size buffers and check arithmetic, lengths, and terminators; use bounds-aware containers where appropriate.
  • Keep allocation and deallocation compatible across DLL/API boundaries.

Validation

Establish the affected block and supported corruption class, name the path that violated bounds or ownership, and distinguish the detector from the writer. Exercise the fix with the same instrumentation and relevant concurrency/load. Report unresolved writer history rather than presenting a guessed fix as proven.

References

Feedback

Follow FEEDBACK.md and report reviewed, sanitized feedback to WinDbg-Feedback. Include windbg-user-heap-corruption-investigation and the package version from plugin.json; no automatic dump, source, or transcript upload.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use with every WinDbg plugin investigation to apply evidence-first reasoning, confidence calibration, contrarian review, structured reporting, and deterministic validation. Not a bug-family-specific triage skill.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

Use when a kernel dump reports a Windows bugcheck; decode parameters and recover exception or trap context before investigating your driver. Not for user-mode process crashes or blaming a module from its name alone.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

Use when kernel evidence shows stalled I/O, a power IRP, or completion/cancellation misuse; inspect request state and driver ownership. Not for interpreting an empty IRP search in a limited dump as proof of healthy I/O.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

Use when kernel threads block on driver synchronization or Verifier reports a lock-order violation; build an owner/waiter graph. Not for treating every watchdog stop as a deadlock or listing every lock type with !locks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

Use when a kernel dump contains Driver Verifier violations; inspect flags, bugcheck subcodes, and available I/O shadow state. Not for Application Verifier user-mode stops or inferring a violation from enabled flags alone.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

Use when a native C/C++ app, service, or user-mode driver host (including UMDF) crashes with a structured exception in a dump or WinDbg session, including native faults inside managed processes. Not for managed .NET exceptions, WinUI/XAML app errors, or kernel bugchecks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

microsoft/win-dev-skills4742026년 10월 14일 업데이트

microsoft의 스킬 모두 보기

이 스킬의 문제 신고