168 Commits

Author SHA1 Message Date
Matthijs Lavrijsen 37b35ddcb1 Add Cheat Engine to hidden process/window lists
Reference: #154
2023-05-11 23:23:54 +02:00
Matthijs Lavrijsen 74d928f6a2 Add API monitor and new WinDBG to hidden process/window lists
Closes #154
2023-05-11 22:38:55 +02:00
heck-gd b53c2f7314 Add compatibility for VMProtect 3.6+ 2023-02-03 16:08:09 +01:00
Matthijs Lavrijsen 480dc49de2 Fix XP support in GH releases by using the VS 2019 14.27 toolchain 2023-01-12 15:15:43 +01:00
rise a0e5b8f2b1 Add Process Monitor blacklisted processes (#142) 2022-04-26 11:22:19 +02:00
Matthijs Lavrijsen 7e648fb29e Update default Themida settings profile
Support for the latest Themida is incomplete, see #127
2021-08-23 15:27:50 +02:00
Matthijs Lavrijsen 2276f14771 Add NtUserGetForegroundWindow hook
Fixes #116
2021-01-26 03:47:19 +01:00
Sam Russell 75fde06ac9 Enable OSBuildVersion in plugin menus (#109) 2020-09-09 16:50:28 +02:00
Matthijs Lavrijsen 75fcdc539e Update to VS2019 2020-08-09 21:11:36 +02:00
Bill Bierman 706fec4350 Add 64 bit support for KiUserExceptionDispatcher (#106)
* Added manually generated trampoline for KiUserExceptionDispatcher on x86_64

* Preserve prologue of KiUserExceptionDispatcher for hook removal
2020-06-08 20:04:44 +02:00
Mattiwatti 59309a2057 Adjust OtherOperationCount after NtMapViewOfSection
https://everdox.blogspot.com/2013/11/debugger-detection-with.html
2020-05-17 00:27:27 +02:00
Mattiwatti 10ddb89fba ProcessDebugObjectHandle: handle overlapping buffer and return length
See https://github.com/mrexodia/TitanHide/issues/39
2019-12-12 11:39:23 +01:00
Mattiwatti a596f7f5d2 Add TLS to HookLibrary for InstrumentationCallbackDisabled field
This fixes potential race conditions with multiple threads active while the instrumentation callback is installed
2019-12-12 11:34:58 +01:00
Mattiwatti 684af33c46 Instrumentation callback improvements and fixes
- Fix "initialization error 1" on Windows 7/8/8.1 and supported (= with known syscall tables) versions of Windows 10
- Zero extend the value of RAX on x64 when returning an NTSTATUS
- Fix access violation on instrumentation callback removal on Windows 7/8/8.1
2019-06-03 03:14:45 +02:00
Mattiwatti f3f41ebe09 NtUserQueryWindow hook improvements
- Do not return the real PID or TID of any window with a bad owner process, window class name or title
- Instead of returning a bogus handle, return the debuggee's own client ID
2019-05-22 01:17:44 +02:00
Mattiwatti 7bc1fa7de7 Fix NtUserBuildHwndList hook on Windows 8 and later
NtUserBuildHwndList gained a boolean parameter in Windows 8, which breaks the call because the original syscall is called with one less argument (which results in STATUS_INVALID_HANDLE). Work around this by exporting a separate HookedNtUserBuildHwndList_Eight function that uses the new prototype. Replace the HOOK_NATIVE() invocation in ApplyHooking.cpp with a manual version that determines the hook to use based on the OS version
2019-05-18 04:51:25 +02:00
Mattiwatti 956fea4e6d Improve NtUserBuildHwndList hook
- Query NtUserGetClassName and NtUserInternalGetWindowText addresses using the new syscall lookup magic
- Add IsWindowBad() helper function which determines for a given HWND not only whether it belongs to the debugger process by PID, but also whether is has a forbidden class name or window text
- FilterHwndList: instead of only comparing against the protected PID, use IsWindowBad() both to determine which HWNDs to overwrite and which ones are good replacements. This allows you to have e.g. IDA and x64dbg open and both will be hidden, even if only x64dbg is actively debugging
2019-05-18 03:25:07 +02:00
Mattiwatti 6817d32581 Remove NtApiCollection.ini
- Get rid of NtApiLoader and replace it with a syscall lookup table (Windows XP through early 10) or win32u.dll addresses (later Windows 10 versions)
- Remove NtApiTool/PDBReader project since the NtApiCollection.ini file it generates is no longer used
- Rename BlockInput hook to NtUserBlockInput since they are the same function. The INI setting "BlockInputHook" is now also NtUserBlockInputHook
- Merge ApplyUser32Hook and ApplyWin32uHook into ApplyUserHook
2019-05-17 01:10:42 +02:00
Mattiwatti 1bd5c5c8fe Remove unused ntdll, kernel32/base and user32 handles from DLL data 2019-05-17 00:58:18 +02:00
Mattiwatti 0a03ffd378 Add Windows 10 WOW64 instrumentation callback hook 2019-05-03 23:23:07 +02:00
Mattiwatti d16ca2d1c2 Move RealGetSystemTime and RealGetLocalTime to HookHelper.cpp 2019-05-03 23:22:18 +02:00
Mattiwatti caca9baa11 Update to VS2017 2019-05-03 15:59:09 +02:00
Mattiwatti 66ec9ad514 Add x64 instrumentation callback hook 2019-04-05 13:00:11 +02:00
Mattiwatti d26e4dde45 Update ntdll.h 2019-04-05 00:18:39 +02:00
Mattiwatti b125c69235 Disable Spectre mitigation crap 2019-04-04 20:44:16 +02:00
Mattiwatti dfec5d0e2f NtGetContextThread: if debug registers were requested, zero them 2019-03-25 23:26:47 +01:00
Mattiwatti 5cf2d494ee Add NtDuplicateObject hook
This is actually part of the NtClose hook (in that NtClose is the problem, not NtDuplicateObject), it's just that NtDuplicateObject with DUPLICATE_CLOSE_SOURCE is a very clever way of calling NtClose inside the kernel where our ntdll hook obviously doesn't fly

Reported by _BaZzi (https://forum.tuts4you.com/topic/35191-scyllahide/?page=9&tab=comments#comment-189015)
2019-01-14 16:32:56 +01:00
͏ c763dfd144 Fixed return length adjustment for SystemHandleInformation/Ex in HookedNtQuerySystemInformation (#59) 2018-10-11 11:41:37 +02:00
Mattiwatti a2ac0575d2 Fix VMProtect detection of NtQueryInformationProcess(ProcessDebugObjectHandle). Closes #51
This was caused by an incorrect order of operations (modifying return length after changing the return status).
In the interest of saving time on both sides, pre-emptively fix this for other syscalls/classes as well
2018-09-22 14:38:30 +02:00
Mattiwatti b2618a39cb Fix signed/unsigned comparison 2018-09-22 14:34:43 +02:00
Mattiwatti 77cd88f6d6 Fix a sliightly embarrassing bug where the debug object handle returned by NtQueryInformationProcess(ProcessDebugObjectHandle) was zeroed but not actually closed, causing this handle to remain in the debuggee's process handle table. (This can be repeated up to ~1300 times if needed to build a handy array of spare debug object handles - after that the process becomes unresponsive.)
This bug has been in ScyllaHide since the first commit to the repository.
2018-08-27 08:50:32 +02:00
Mattiwatti dfb6610981 NtUserBuildHwndList: do not assume the i+1th HWND is a safe replacement for the case of the HWND with i == 0 being the debugger process. This fixes EnumWindows() finding e.g. x64dbg despite the hook because it has multiple windows which can be obtained if i = 0, i = 1, i = 2... and so on 2018-01-05 02:14:14 +01:00
Mattiwatti 36a85a9b40 Remove Hook.cpp/.h as they aren't actually used by anything (this functionality is implemented in RemoteHook.cpp using distorm), and remove LDE64 from the libs dir as it was only required by Hook.cpp in the first place 2017-11-25 23:34:14 +01:00
Mattiwatti 1caa98bd67 The required length for SystemCodeIntegrityUnlockInformation was changed in RS3, but the correct output is still 0. Simply zero SystemInformationLength bytes of memory to be compatible with both RS3 and earlier versions 2017-11-22 12:08:37 +01:00
Mattiwatti d2f20e7b9a NtSetDebugFilterState should not return STATUS_ACCESS_DENIED if the process has debug privileges 2017-11-14 21:08:10 +01:00
Mattiwatti c850825cf7 NtQueryObject hook: only set the total object and handle counts to 0 for ObjectTypesInformation, decrement by 1 for ObjectTypeInformation
This prevents the debuggee from doing
NtCreateDebugObject(&h);
NtQueryObject(h, ObjectTypeInformation);
if (TotalNumberOfObjects == 0) { /* something is wrong since we just made a debug object */ }

Found by Al-Khaser (https://github.com/LordNoteworthy/al-khaser)
2017-11-12 03:04:34 +01:00
Mattiwatti 6d6fa93678 NtQuerySystemInformation(SystemHandleInformation/SystemExtendedHandleInformation): more return length bookkeeping 2017-11-12 02:58:35 +01:00
Mattiwatti a88c9695ad The code was dead 2017-11-11 23:28:27 +01:00
Mattiwatti e4baef943c GetExplorerProcessId() really only has to exist in one place 2017-11-11 23:25:08 +01:00
Mattiwatti daefbae3bb Change wcsistr to RtlUnicodeStringContains and make IsWindow[Class]NameBad use this to save pointless string copying 2017-11-11 22:57:25 +01:00
Mattiwatti 51ed290240 GetProcessIdByName():
- Take a PUNICODE_STRING and use RtlEqualUnicodeString instead of _wcsicmp
- Fix off-by-one error in SystemProcessInformation enumeration
2017-11-11 18:31:01 +01:00
Mattiwatti 4c1d62f47f Add IDA 7.0 process names. You're welcome Hex-Rays SA 2017-11-09 21:00:15 +01:00
Mattiwatti 1100da8b60 IsProcessBad(): we already have a length counted string. No need to throw away the length, allocate 800 bytes, zero them, copy the string, then do an equality comparison which requires length counting anyway. Instead just call RtlEqualUnicodeString
IsWindowClassBad and IsWindowNameBad still require 'wcsistr'. Added TODO note to wcsistr to rename it and make it take a PUNICODE_STRING in order to increase sanity levels
ScyllaTest: call FreeConsole before exiting
2017-11-09 20:56:00 +01:00
Mattiwatti 4dd48ed40f HookHelper fixes/cleanup:
- Remove _wcslen, _strlen and _wcscat which are already provided as compiler intrinsics and as ntdll exports
- wcsistr (1): fix off-by-one error by changing < to <=, and remove 'if (l1 == l2)' check because the for loop already does the same thing
- wcsistr (2): fix bug introduced by me causing wcsistr(L"asdf", L"asd") to return false. Now we're back to using _wcsicmp and _wcsnicmp together
- Misc dead code removal/variable naming
2017-11-09 19:45:52 +01:00
Mattiwatti 85daaf73b6 NtQueryInformationProcess/NtQuerySystemInformation/NtQueryObject hooks: if a return length is present and overlaps (is part of) the output buffer, store a backup of the return length prior to hooking, then restore the original return length afterwards. Fixes #47 and makes NtQuery_OverlappingReturnLength test succeed with hooks enabled 2017-11-08 19:50:36 +01:00
Mattiwatti 91441ba2b4 NtQueryInformationProcess and NtQueryObject hooks: check if the ProcessInformationClass or ObjectInformationClass is relevant prior to doing anything, similar to how the NtQuerySystemInformation hook already works
This is in preparation for the next commit which will be quite gruesome
2017-11-08 19:40:06 +01:00
Mattiwatti 927d844d71 Increase MAX_NATIVE_HOOKS to 32 2017-11-08 19:36:39 +01:00
Mattiwatti 315c4af39d Add SystemSessionProcessInformation to NtQuerySystemInformation hook (#42) 2017-10-28 00:45:43 +02:00
Mattiwatti 36617dde6e NtQuerySystemInformation hook: add SystemHandleInformation and SystemExtendedHandleInformation. Handles to objects of types DebugObject, Process and Thread are filtered out.
Currently this is done by PID *for the debugger process only* (i.e., it does not work when using the CLI, and it does not hide a process handle from windbg.exe to the debuggee if ScyllaHide is running as an x64dbg plugin)
2017-10-26 21:48:02 +02:00
Mattiwatti c449425804 Remove hardcoded SDK version now that $(LatestTargetPlatformVersion) finally works properly 2017-10-22 03:36:39 +02:00