Anyone maybe knows how to create an unstoppable services like the new viruses? Would be very useful for everyone. Thanks, tte.
Alexander01
Apr 23 2004, 02:49 PM
yeah, im also curious about that
Ash
Apr 23 2004, 03:10 PM
i tryed having alook for some tutorials/reads couldnt find nothing.
stonebreaker
Apr 23 2004, 03:34 PM
apptoserver it can make a exe to system server then this will not stop
cranky
Apr 23 2004, 06:44 PM
any app that runs as a service can be made unstoppable, you only have to modify one byte with a hex editor. can you guess which one?
sylver
Apr 23 2004, 09:11 PM
which byte do u mean? the service name or what?
supermax
Apr 23 2004, 09:58 PM
well I haer from a worm who was runnign (like every worm) but was also creating some small program that where looking at the running worm and if the task was close it was opening ti again so you couldn't stop it unless you knwo what file close first and wich one remove
dEuS
Apr 23 2004, 09:59 PM
i dont think that you only change 1 byte...
but thats the same with some anti virus tools if you use pskill.exe or something like this you cant stop this service or with rserver there is always a screen "permission denided"..
i think thats a special code, but who knows...
but in fact it is a really interesting question.
cya
misa
Apr 24 2004, 09:58 AM
i dont think it is possible to create a COMPLETE unstoppable service
LittleHacker
Apr 24 2004, 10:12 AM
as SUPPERMAX said it is possible to have 2 services that supports each other. I don't think it's possible to kill more than one service at the time so it seems to be it's unstoppable !
I think we had a hot toppic about it in this forum
G-Ryder
Apr 24 2004, 08:38 PM
You could try binding your exe file into a system file which is always running.. example winlogin.exe in xp.. dunno if its on other os.. but u will need something to stop the file protection warning.. I think there is a reg file for it somewhere... but I can't remember where on the board I seen it.
tweakz20
Apr 24 2004, 09:08 PM
i posted about wfp, here's the file again...
yeah, thank me later lol
i didn't try the technique though, not saying it works, but this should help deffinitly if you want to try.
G-Ryder
Apr 24 2004, 10:54 PM
Thanks for the tool m8y will give it a try out
DumpZ
Apr 24 2004, 11:12 PM
Well it should be possible because the Zonealarm service is also unstoppable.
But you can make a critical service depend on yours, so thats also a alternative i guess
bnhc
Apr 25 2004, 02:27 AM
nice tool...thanks
cranky
Apr 25 2004, 07:37 AM
just disassemble the exe, find the second (usually) SetServiceStatus call and look a few instructions above it to where it pushes the value for the controls it accepts. change that to 0x04 and itll be unstopable. look at basic service example code and youll see what i mean.
usch
Apr 25 2004, 08:18 AM
or take a rootkit and hide the service.u can`t kill a service that u don`t see .it is very easy,instructions can be found at the board.
so long
iXNAY
Apr 25 2004, 08:48 AM
thanks for the tool "tweakz20" you can also make a bat file like this one i created: if the service fails or crashes it will automatically restart, all you have to do is replace "service name" with the name of the service you are running that you want to be unstopable! ------------------------------------------------------------------------------------------------ echo REGEDIT4>temp.reg echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"service name"]>>temp.reg echo "FailureActions& quot;=hex:00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,52,00,4f,00,01,00,00,0 0,60,ea,00,00,01,00,00,00,60,ea,00,00,01,00,00,00,60,ea,00,00>>temp.reg regedit -s temp.reg del temp.reg
DumpZ
Apr 25 2004, 08:15 PM
But you can disable Automatic restart in the advanced system properties
if u name the exe like a windows system service u cant stop it from task manager (is the simplest way like he said g-ryder) but is simple to kil with a tool like pskill .. ill wait for more answers
greetz
KeKeTTe
May 30 2004, 10:40 AM
thx for the tool i will test it
hottzo
May 30 2004, 10:48 AM
n Windows 2000 / XP exist several (public known) methods to start a program automatically with windows. One possibility is to use the registry. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run is our example here below.
So, from where does windows know how to use this key? (good thought, he?) I scanned several system files for the aforementioned key with no result. After that i re-examined the system files that are loaded with windows and i stumbled over explorer.exe, that has indeed the key in it. It's just not that easy to find
In version 5.0.3700.6690 of explorer.exe (Windows 2000 / SP4) the key is located from offset: 0000b560h to 0000b5a0h and looks like: "S.o.f.t.w.a.r.e.\.M.i.c.r.o.s.o.f.t.\.W.i.n.d.o.w.s.\.C.u.r.r.e.n.t.V.e.r.s.i.o.n.\.R.u.n." in ascii. The same in hex: "53 00 6F 00 66 00 74 00 77 00 61 00 72 00 65 00 5C 00 4D..." etc.
1. Turn windows file protection off (ask google if you don't know how to). 2. Kill the running explorer.exe 3. Open the file in binary mode and search for the above string. 4. Replace the string by:
"S.y.s.t.e.m.\.H.i.d.d.e.n.A.u.t.o.r.u.n.\.Y.o.u.r.A.p.p.\.P.a.r.a.m.e.t.e.r.s.\.s.r.u.n.s." or something like that. 4.1 The string has to be the same length as the above one. 5. Save the file and restart explorer.exe
The user will just notice a crash of the explorer, as it happens twice a day *scnr* and the ensuing restart of it. From the next reboot on "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" is useless but in exchange you have a new one at "HKEY_LOCAL_MACHINE\System\HiddenAutorun\YourApp\Parameters\sruns". To stay undetected it is essential to load alls apps located in the old registry key. Otherwise a user my notice the change.
THANKS goes to nec, who first made his post available to the public at: http://www.rootkit.com
brainbuster
May 30 2004, 11:23 AM
in vb use this function:
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessId As Long, ByVal dwType As Long) As Long
moby5532
Sep 20 2004, 11:23 AM
thx for your ideas!
moby5532
Sep 21 2004, 12:18 PM
oh, one more question... tried to disassamble servu... found the second SetServiceStatus... but above there are two push values... which one needs to be modified?
chris105
Sep 21 2004, 08:17 PM
Heya brain, I think I need to chat with you about services in vb (and hiding them etc). If your gonna be about on IRC this weekend can we talk?
Jumpi
Sep 23 2004, 05:40 PM
just write an own service and let the stop-procedure empty.
chris105
Sep 24 2004, 09:48 AM
Right ... Ok at least I got something to google for now, cheers.
Honnes
Sep 24 2004, 01:39 PM
This is nice to know, i'll try this one out for sure at my network in order to see if it really works. If it does, i should make some processes unstoppable.
DougieShiney
Sep 24 2004, 07:43 PM
won't this crash the system if you edit winlogin whilst its running??
MxMx
Sep 25 2004, 06:19 AM
QUOTE (iXNAY @ Apr 25 2004, 08:48 AM)
thanks for the tool "tweakz20" you can also make a bat file like this one i created: if the service fails or crashes it will automatically restart, all you have to do is replace "service name" with the name of the service you are running that you want to be unstopable! ------------------------------------------------------------------------------------------------ echo REGEDIT4>temp.reg echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"service name"]>>temp.reg echo "FailureActions& quot;=hex:00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,52,00,4f,00,01,00,00,0 0,60,ea,00,00,01,00,00,00,60,ea,00,00,01,00,00,00,60,ea,00,00>>temp.reg regedit -s temp.reg del temp.reg
even if the process gets killed by pskill or the service gets stopped?
chris105
Sep 25 2004, 10:07 AM
Ok im lining up for the most stupid question ever asked, here it comes !
Do I just use the full path and name of the exe as the service name ? How do I get the service to run my exe or am I looking at this all wrong, Im going off to search so you may find some info below (if i find some).
Property Setting CanStop True to indicate that the service will accept requests to stop running; false to prevent the service from being stopped.
Is this not a way to stop the service being ended ?
MxMx
Sep 25 2004, 10:54 AM
yeah .. but i was talking bout through command line .. Ive known that trick of yours for a long time but now im searching a script/code to do that by cmd
nolimit
Sep 25 2004, 06:21 PM
Service objects just like files can have ACL restrictions imposed on them as well. Deny users access and they can't do anything to the service.
Gelu
Sep 25 2004, 06:35 PM
i looked around my pc a bit for services i couldnt stop. i came up first with deep freeze. a very annoying program which i installed in the hope to figure out how i could kill it (since they also use that at my school and i find that very annoying). i got into regedit and looked what things are all set there. in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DF5Serv\Enum i found a value called "0" with the data: Root\LEGACY_DF5SERV\0000. i tried making my own proces with a data like that. it gave some kind of bind error. i went on looking for services like that. i found the service "netbios". in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBIOS\Enum i found nearly the exact data as in df5serv: "0" with: Root\LEGACY_NETBIOS\0000. could it be that these values in the register has something to do with making services unstoppable ?
segv
Sep 26 2004, 08:02 PM
ResetPeriod = INFINITE
Gelu
Sep 27 2004, 03:49 PM
QUOTE (cranky @ Apr 25 2004, 07:37 AM)
just disassemble the exe, find the second (usually) SetServiceStatus call and look a few instructions above it to where it pushes the value for the controls it accepts. change that to 0x04 and itll be unstopable. look at basic service example code and youll see what i mean.
how ? just hexedit or so ? *edit* ok found it with hexeditting, but what value do to change ? :s
hottzo
Oct 2 2004, 05:43 PM
finally... To make a process invincible on Windows Nt, 2000 and XP, we can intercept the system service- ZwTerminateProcess(), called each time an application or driver requests to terminate a process. Since we are doing this in Kernel Mode- the central part of the operating system, hooking ZwTerminateProcess() in ntoskrnl.exe will catch the call from any single application, dll or driver.
Upon modifying the correct pointer in the system service table for ZwTerminateProcess(), we’ll have changed it to the address of our hook procedure. Inside the new procedure we must do a bit of process checking- If indeed a process is trying to terminate ours we must return STATUS_ACCESS_DENIED; otherwise our hook function should make the call to the original ZwTerminateProcess() system service.
NTSYSAPI NTSTATUS NTAPI ZwTerminateProcess ( IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus );
The problem is that once we’ve hooked ZwTerminateProcess(), we don't actually know the name of the process trying to being terminated- we are only given a HANDLE ProcessHandle to it in the first argument. Unlike in user-mode, we can't rely on the API functions provided by the PSAPI [.dlls aren't linked to drivers operating in Kernel Mode] such as GetModuleBaseName() in PSAPI.DLL to get the name of the process the HANDLE refers to. To overcome this, Kernel Support Routines [Functions provided by the Kernel] are used directly.
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess ( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL );
One Kernel support routine, ZwQueryInformationProcess() accepts a ProcessHandle and fills the fields of the passed in PROCESS_BASIC_INFORMATION structure.
We aren't there yet though; as you can see- there is no variable that holds the ImageFileName- only the ProcessID [UniqueProcessId]. This is no problem however, as we have PsLookupProcessByProcessId().
NTSYSAPI NTSTATUS NTAPI PsLookupProcessByProcessId ( IN ULONG ProcessId, OUT PEPROCESS *Process );
This function takes the UniqueProcessId of a process [we obtained using ZwQueryInformationProcess()] and outputs the fields of a _EPROCESS structure- This structure is large and varies significantly between Major Windows Versions.
And there it is, UCHAR ImageFileName[16]- the start address in memory of the name of the process being terminated.
All we need to do now is perform a simple memory comparison- checking to see that it is indeed our application trying to be terminated. If so we simply return STATUS_ACCESS_DENIED.
if i manually add "FailureActions" in registry to make service unstoppable , the service config is updated after a reboot . how can i add and force windows to read new service config without having to reboot ?
tibbar
Dec 8 2004, 06:24 PM
very good response hottzo. for those of you who are not up to writing kernel mode drivers, this can also be achieved by hooking the ntdll stub to ZwTerminateProcess...i.e. NtTerminateProcess.
This is a less neat solution, since you must inject a hooking dll into each process in usermode, and also hook NtCreateProcess to ensure that new processes are also hooked (much like a usermode rootkit does - you could modify an open source rootkit to achieve this quickly)
In the future Microsoft will put a stop to modifying the system service table, which will either stop kernel hooks, or make us think a bit harder about how it can be achieved.
QUOTE(hottzo @ Oct 2 2004, 05:43 PM)
finally... To make a process invincible on Windows Nt, 2000 and XP, we can intercept the system service- ZwTerminateProcess(), called each time an application or driver requests to terminate a process. Since we are doing this in Kernel Mode- the central part of the operating system, hooking ZwTerminateProcess() in ntoskrnl.exe will catch the call from any single application, dll or driver.
Upon modifying the correct pointer in the system service table for ZwTerminateProcess(), we'll have changed it to the address of our hook procedure. Inside the new procedure we must do a bit of process checking- If indeed a process is trying to terminate ours we must return STATUS_ACCESS_DENIED; otherwise our hook function should make the call to the original ZwTerminateProcess() system service.
NTSYSAPI NTSTATUS NTAPI ZwTerminateProcess ( IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus );
The problem is that once we've hooked ZwTerminateProcess(), we don't actually know the name of the process trying to being terminated- we are only given a HANDLE ProcessHandle to it in the first argument. Unlike in user-mode, we can't rely on the API functions provided by the PSAPI [.dlls aren't linked to drivers operating in Kernel Mode] such as GetModuleBaseName() in PSAPI.DLL to get the name of the process the HANDLE refers to. To overcome this, Kernel Support Routines [Functions provided by the Kernel] are used directly.
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess ( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL );
One Kernel support routine, ZwQueryInformationProcess() accepts a ProcessHandle and fills the fields of the passed in PROCESS_BASIC_INFORMATION structure.
We aren't there yet though; as you can see- there is no variable that holds the ImageFileName- only the ProcessID [UniqueProcessId]. This is no problem however, as we have PsLookupProcessByProcessId().
NTSYSAPI NTSTATUS NTAPI PsLookupProcessByProcessId ( IN ULONG ProcessId, OUT PEPROCESS *Process );
This function takes the UniqueProcessId of a process [we obtained using ZwQueryInformationProcess()] and outputs the fields of a _EPROCESS structure- This structure is large and varies significantly between Major Windows Versions.
And there it is, UCHAR ImageFileName[16]- the start address in memory of the name of the process being terminated.
All we need to do now is perform a simple memory comparison- checking to see that it is indeed our application trying to be terminated. If so we simply return STATUS_ACCESS_DENIED.