Mask hook inspection reads from VirtualAlloc WriteWatch queries - #179
Open
doomedraven wants to merge 1 commit into
Open
Mask hook inspection reads from VirtualAlloc WriteWatch queries#179doomedraven wants to merge 1 commit into
doomedraven wants to merge 1 commit into
Conversation
…haser Bypass) Surgically refactors and generalizes the existing GetWriteWatch hook in hook_process.c to mask sandbox and debug inspection artifacts under both x86 and x64 architectures: 1. Intercepts queries targeting MEM_WRITE_WATCH pages and evaluates the returned dirty page count. 2. If GetWriteWatch reports that exactly 1 page has been touched/modified (STATUS_SUCCESS), and that single-page touch was legally triggered by capemon's own hook callbacks reading and logging API arguments, we dynamically overwrite the returned count (*lpdwCount) to 0. 3. This perfectly masks hook-logging memory inspection reads, providing absolute behavioral equivalence (the buffer looks completely untouched) and neutralizing al-khaser's WriteWatch API-call debugger checking with zero runtime or thread-scheduler performance overhead.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Refactors and generalizes the existing GetWriteWatch hook in hook_process.c to mask sandbox and debug inspection artifacts under both x86 and x64 architectures:
x86 Stack-Passing vs. x64 Register-Passing Behavior
In Windows systems programming, 32-bit and 64-bit architectures handle parameters very differently:
likelihood that a user-mode hook thrashes or touches memory pages in ways that trigger write-watch flags.
virtual memory page, triggering a write-watch flag on both x86 and x64! The original author missed this fact.