![]() |
#1
|
|||
|
|||
SST Hook -> Bluescreen!?
Hi there,
For educational purpose (?) i want to code a File/Regmon Clone, with the same method of SystemServiceTable Hooking described in "Undocumented Windows NT" but when i try to Patch i get a Bluescreen "DRIVER_IRQL_NOT_LESS_OR_EQUAL" !? Code:
extern PSERVICE_DESCRIPTOR_TABLE KeServiceDescriptorTable; #define SYSTEMSERVICE(_function) KeServiceDescriptorTable->ntoskrnl.ServiceTable[*(PULONG)((PUCHAR)_function+1)] _asm cli; (NTCREATEFILE)(SYSTEMSERVICE(ZwCreateFile)) = NewZwCreateFile; // <---#HERE# _asm sti; Is the Table in WinXP write protected or whats going on? The whole source is attached. Happy new Year @all -Cobi |
#2
|
|||
|
|||
![]()
Yes, the "System Desciptor Table" in xp is write protected...
you need to disable the WP bit in the processors CR0 register. Hooking by modifying the "Kernel service table" is used by several publicly available rootkit packages. HE4Hook and KApiHooks are two of them... I can't download your attachment (Not enough thankyou points or something) but trysomething like this... Code:
_asm { CLI //dissable interrupt MOV EAX, CR0 //move CR0 register into EAX AND EAX, NOT 10000H //disable WP bit MOV CR0, EAX //write register back } (NTCREATEFILE)(SYSTEMSERVICE(ZwCreateFile)) = NewZwCreateFile; // <---#HERE# _asm { MOV EAX, CR0 //move CR0 register into EAX OR EAX, 10000H //enable WP bit MOV CR0, EAX //write register back STI //enable interrupt } ![]() Last edited by goggles99; 01-02-2005 at 05:16. |
#3
|
|||
|
|||
Hi,
And if you want some examples of SDT hooking coded entirely in assembly language, you can look at my codes in my vault "Opc0de" in the rootkit site: hxxp://www.rootkit.com/download.php Maybe you need to register before you be able to download it Regards, Opc0de |
#4
|
|||
|
|||
After each blue screen, a Crash Dump file is created in "Minidump" folder at your Windows directory.
You can load this dump file into "WinDbg" (A Microsoft debugger that comes with SDKs) or other debuggers that can load this type of files, and then you analyze the reason of the crash and get usefull ideas |
#5
|
|||
|
|||
-> It seems to work
![]() Big Thx @ all! @hajir I know, but i had already lokated the error exacxtly a the point where i try to write a table entry, but thx the for tip ![]() |
#6
|
|||
|
|||
Another bad news. Microsoft disable modify service table in 64-bit windows. It disable to modify service table and even function entry code. So such program cann't use in 64-bit windows in future.
|
#7
|
|||
|
|||
Hmm, yes, ( link ) but ->
Quote:
![]() ![]() Last edited by Cobi; 01-07-2005 at 20:33. |
#8
|
|||
|
|||
Curious if anyone has run into issues with WinXP SP2? I can hook ZwCreateFile (As I am trying to debug a rather nasty problem...) just fine, but if I want to open a file from my driver within the hook for ZwCreateFile, using the proper/original ZwCreateFile I manage to get a STATUS_ACCESS_VIOLATION.
Anyone run into this problem and have a quick solution? I have walked through the disassembly in Windbg and IDA Pro and see that everything goes bad when NtCreateFile->IoCreateFile->IopCreateFile runs into MmUserProbeAddress() on the FileHandle I supply to the original ZwCreateFile. Any subtle insights would be greatly appreciated. |
#9
|
|||
|
|||
You're passing UserMode on a buffer that comes from Kernel-Mode.
|
#10
|
|||
|
|||
How am I passing anything from UserMode? I am creating my own handle in kernel-mode to pass on to the original ZwCreateFile. Absolutely touching nothing coming from user-mode. The address of my kernel-mode allocated handle that I am passing is _valid_ for kernel-mode and not a user-mode buffer.
|
#11
|
|||
|
|||
If i understand you right you want to pass a File-Handle created by your Kernel-Mode Process to a User-Mode Process, so you could edit the File-Object and change its owner.
(ObObjectRefferenceByHandle or smth.) |
#12
|
|||
|
|||
Actually no. I am hooking ZwCreateFile, within the hooked function for ZwCreateFile that I created I am trying to call the original ZwCreateFile with all attributes allocated IN kernel-space and utilized IN kernel space. Absolutely NOTHING to do with user-mode other than interceding in the middle of a user-mode application attempting to open a file. Not in anyway shape or form attempting to pass anything back to user-mode.
|
#13
|
|||
|
|||
Quote:
|
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Windows Hook | user1 | Source Code | 0 | 04-24-2021 05:23 |
How can I hook DllMain ? | ioannis | General Discussion | 12 | 07-29-2015 01:09 |
DriverStudio 3.1 Viaagp.sys Bluescreen | bgrimm | General Discussion | 1 | 02-19-2004 02:37 |