Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2005, 16:06
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
Lightbulb Suspending Kernel Mode Threads...

Hi.

I know windows driver model (programming).
I know how to suspend user-mode threads.
Can anyone help me about suspending kernel-mode threads.

Thanks
Reply With Quote
  #2  
Old 01-06-2005, 23:23
Neitsa
 
Posts: n/a
Hello,

Try ZwSuspendThread / ZwResumeThread (Kernel mode Counterpart of SuspendThread & ResumeThread).

I don't know if it will works on Kernel mode thread created with PsCreateSystemThread for example...

If this is one of your drivers, you should use Kernel events (as user-mode events) :

KeSetEvent and KeWaitxxx or KeWaitForSingleObject (or KeWaitForMultipleObjects).

There's also some timer routines like KeInitializeTimer(Ex) and KeSetTimer.

As usual, you should be carefull about differents IRQL required by those routines.

Hope it could help.

Regards, Neitsa.
Reply With Quote
  #3  
Old 01-07-2005, 19:44
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
Let me describe exactly what I want.

I'm about to suspend some protection threads in XTreme protector kernel-driver, to make another Ring-0 dumper be able to dump the process memory.

Regards
OMID
Reply With Quote
  #4  
Old 01-08-2005, 10:34
doug
 
Posts: n/a
are these threads spawned by the driver (PsCreateSystemThread) or by the EXE application (which, afaik, as elevated privileges and has access to some ring-0 memory pages such as the IDT & the Xprotector driver).

Perhaps you could look into patching the driver directly or hooking PsCreateSystemThread.
Reply With Quote
  #5  
Old 01-09-2005, 12:59
willcodeforfood
 
Posts: n/a
Smile

This snippet will lower the IRQL (not nec unless in DISPATCH_MODE or greater, but safe if you're not sure). Create an event and then wait for it (infinitely). As the event never gets triggered, the thread will never run again *sniff ;(, poor thread*. If you do want it to run at a later time, simply trigger the event.

LARGE_INTEGER TotalTime = {0,0};
KeLowerIrql(0);
KeInitializeEvent(&NonEvent, NotificationEvent, FALSE);
status = KeWaitForSingleObject(
&NonEvent,
Executive, //Suspended,
KernelMode,
TRUE,
&TotalTime
);

Hope this helps, WCFF
Reply With Quote
  #6  
Old 01-12-2005, 03:38
pp2 pp2 is offline
Friend
 
Join Date: Jan 2002
Posts: 60
Rept. Given: 1
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 16 Times in 12 Posts
pp2 Reputation: 2
You can try to use "rootkit" technics and remove thread from scheduler list (see recent articles at rootkit.com how to do it). If you control scheduler you decide whether system thread is runnable or not now. Anyway suspending some system threads maybe extremely dangerous and cause immediate exception (and BSOD also), so you should check thread's IRQL.
Reply With Quote
  #7  
Old 01-12-2005, 10:42
hksonngan
 
Posts: n/a
look here http://www.security.org.sg/code/sdtrestore.html
Reply With Quote
  #8  
Old 01-12-2005, 20:07
Opc0de
 
Posts: n/a
Quote:
Originally Posted by hksonngan
look here http://www.security.org.sg/code/sdtrestore.html
Look here too:
http://www.rootkit.com/newsread.php?newsid=200

Regards,
Opcode
Reply With Quote
  #9  
Old 01-17-2005, 13:13
just4urim
 
Posts: n/a
Post Kernel Mode Threads

Quote:
Originally Posted by omidgl
Hi.
I know windows driver model (programming).
I know how to suspend user-mode threads.
Can anyone help me about suspending kernel-mode threads.
Thanks
In kernel mode you can create a thread by calling "PsCreateSystemThread" API and then you can suspend it by calling "KeWaitForSingleObject" API .Find more in Microsoft Development Kit (DDK) .
Goodluck
Reply With Quote
  #10  
Old 01-17-2005, 14:10
omidgl omidgl is offline
Friend
 
Join Date: Jul 2004
Posts: 86
Rept. Given: 10
Rept. Rcvd 4 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 5 Times in 5 Posts
omidgl Reputation: 4
I don't want to suspend current thread, It's all about to suspend other driver threads so KeWaitForSingleObject can't do anything about it.
Reply With Quote
  #11  
Old 01-17-2005, 17:56
Opc0de
 
Posts: n/a
If you know the KTHREAD address of those system threads, just
remove it from the internal kernel thread lists like
KiDispatcherReadyListHead and KiWaitListHead.
If you make this, the kernel thread will not get any CPU time

Take a look in the klister source code at www.rootkit.com
and this paper:
http://opensores.thebunker.net/pub/mirrors/blackhat/presentations/bh-usa-03/bh-us-03-rutkowski/bh-us-03-rutkowski.pdf

Regards,
Opc0de
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hades:Windows kernel driver lets reverse engineers monitor user and kernel mode code sh3dow Source Code 0 05-12-2016 03:15
Use IDA in kernel mode ?? Veyskarami General Discussion 14 02-23-2013 12:38
How to pass the large data in kernel mode to user mode? benina General Discussion 3 03-06-2010 04:50
Kernel-Mode GUI!? (like SoftIce) Cobi General Discussion 1 01-21-2005 02:24
Kernel Mode Driver for NT SPeY General Discussion 12 04-22-2004 15:34


All times are GMT +8. The time now is 13:32.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )