Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't load advapi32.dll into injected processes #28

Merged
merged 12 commits into from
Jun 1, 2017
Merged

Don't load advapi32.dll into injected processes #28

merged 12 commits into from
Jun 1, 2017

Conversation

Mattiwatti
Copy link
Member

Once upon a time, some fool made a PR to improve the NtSetInformationProcess hook. It worked, but this had the side effect of adding an extra import descriptor for to HookLibrary.dll for the HasDebugPrivileges() function, inadvertently causing advapi32.dll to be loaded into every hooked process if it wasn't already. It also added a minor allocation that in hindsight wasn't strictly necessary.

I've come to ask forgiveness and rectify mistakes of the past. This PR modifies HasDebugPrivileges() to use only ntdll.dll, allocate no memory and use at least 3 fewer syscalls.

Mattiwatti and others added 12 commits May 31, 2017 23:46
…revent it from being called every time another DLL is (un)loaded
… advapi32.dll to be loaded into the hooked process
ntdll.h:
- Add NtOpenProcessToken()
- Add NtPrivilegeCheck()
- Add LdrDisableThreadCalloutsForDll()
- Make DbgBreakPoint() stdcall

ntdll_x86.lib/ntdll_x64.lib:
- Replaced with Windows 7 DDK versions containing most/all imports
Don't clear some rarely used heap force flags
Use https symbol path in PDBReader
…4dbg/ScyllaHide/compare/devel/gureedo to ease a future branch merge. The import libs are the same XP ones from the Windows 7 DDK but edited to fix compilation in VS2015/VS2017 with the Windows 10 SDK
Update ntdll.h and ntdll.dll import libs
Don't call DllMain on each DLL (un)load
… advapi32.dll to be loaded into the hooked process
…/ScyllaHide into kill-advapi32-imports

# Conflicts:
#	HookLibrary/HookHelper.cpp
@Mattiwatti
Copy link
Member Author

Fuck I hate git.

@Mattiwatti Mattiwatti merged commit fa6d02f into x64dbg:vs13 Jun 1, 2017
@Mattiwatti Mattiwatti deleted the kill-advapi32-imports branch June 1, 2017 02:08
@mrexodia
Copy link
Member

mrexodia commented Jun 1, 2017 via email

mrexodia pushed a commit that referenced this pull request Nov 5, 2017
Replace HasDebugPrivileges() with a native version that doesn't cause advapi32.dll to be loaded into the hooked process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants