dELTA
February 9th, 2003, 15:23
I've been wondering for a long time about which techniques that are used when a driver is used to patch or hook other code in the operating system. For example patching operating system modules like kernel32.dll or other third-party drivers (i.e. using in-memory patching, not modifying the actual files on disk).
Is the common technique to simply patch the memory space of the target code, e.g. the code section of kernel32.dll, or is it some more advanced things that have to be done? Are there several different techniques that are usually used for this purpose? Is it elementary to make a global patch of e.g. operating system dll:s from a driver? (With global patch I mean a patch that is seen by all other programs, contrary to the "copy-on-write"-semantic effects that can occur when doing in-memory patching of dll:s from ring3 programs)
If it is only pure patching of the target module memory that is most often used, I guess that you use a driver to do it simply because there is no way to e.g. patch the code section of kernel32.dll from a ring3 program? Or can this be done from ring3 code to, but only local to the process itself, using some virtualprotect trickery?
I have recently bought a good book about driver programming, but I am worried that it won't cover these things (at least not in an apparent manner), so I thought that I'd try to find out some rough details about the used techniques beforehand, so that I can easier spot the parts of the book that are useful for these purposes.
I have understood that several people on this board are quite handy with such driver patching acrobatics, so it would be really great if you could just throw some small pieces of info my way, just to get me started.
Any pointers to good references (e.g. essays) about this subject would be really great too.
Thanks a lot!
Is the common technique to simply patch the memory space of the target code, e.g. the code section of kernel32.dll, or is it some more advanced things that have to be done? Are there several different techniques that are usually used for this purpose? Is it elementary to make a global patch of e.g. operating system dll:s from a driver? (With global patch I mean a patch that is seen by all other programs, contrary to the "copy-on-write"-semantic effects that can occur when doing in-memory patching of dll:s from ring3 programs)
If it is only pure patching of the target module memory that is most often used, I guess that you use a driver to do it simply because there is no way to e.g. patch the code section of kernel32.dll from a ring3 program? Or can this be done from ring3 code to, but only local to the process itself, using some virtualprotect trickery?
I have recently bought a good book about driver programming, but I am worried that it won't cover these things (at least not in an apparent manner), so I thought that I'd try to find out some rough details about the used techniques beforehand, so that I can easier spot the parts of the book that are useful for these purposes.
I have understood that several people on this board are quite handy with such driver patching acrobatics, so it would be really great if you could just throw some small pieces of info my way, just to get me started.
Any pointers to good references (e.g. essays) about this subject would be really great too.
Thanks a lot!