Skip to content

Commit

Permalink
Fix handle leak in NtQueryInformationProcess(ProcessDebugObjectHandle) (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattiwatti authored and buldi committed Apr 24, 2022
1 parent d844109 commit 05c1397
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions TitanHide/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ static NTSTATUS NTAPI HookNtQueryInformationProcess(
{
BACKUP_RETURNLENGTH();

__try
{
// This was a successful request and a valid handle was returned.
// That means we should close it before we nuke it to prevent handle leaks.
ObCloseHandle(*(PHANDLE)ProcessInformation, KernelMode);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
NOTHING;
}

*(ULONG_PTR*)ProcessInformation = 0;

RESTORE_RETURNLENGTH();
Expand Down

0 comments on commit 05c1397

Please sign in to comment.