Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am in need of trying to give access denied message to any-users who try to end my processes. I have made a Anti-Virus which uses heuristics to detect any malicious programs running. This worked flawlessly but now I need to make sure my Process cannot be terminated. Most Anti-Viruses today tend to hook into functions such as:

ZwOpenProcess(), NtOpenProcess(), NtTerminateProcess() Or even NtQuerySystemInformation() , ZwQuerySystemInformation().

These is sometimes considered crude way of stopping user from terminating it's process , Not only that but all Zw*() functions are kernel level mode functions and I am very new to programming or subverting into the kernel. This is also same path Malware or Trojans tend to do as well. I personally do not want to use what Malware & Trojans do since if I hook a same functions as a other Anti-Virus It can lead to BSOD (Blue Screen Of Death). I so looked through many pages of Google about other ways I can do the same function , to stop users form terminating my process, I finally found a function called 'SetSecurityInfo()'. I was happy that I found such a function which allows me to do exactly what I wish. But I do not know how to use the Function. Can somebody give me a simple tutorial or code snippet showing how I can use SetSecurityInfo() safely.

I first tried to hook such functions but this result in my software being detected by a AV (Anti-Virus).

Thanks.
Posted

1 solution

Generally speaking, there are several ways prevent a process form being stopped, and other ways to bypass these ways.
You can prevent users from using the Windows process manager to terminate your process, but you can't prevent users from terminating your process programatically, for example, using TerminateProcess, which is the lowest level, so no other user level function can prevent it from terminating your process. There are other ways around:
For example, you can create another process (or even an NT service) which will be a "Watch Dog" and constantly verify that your service is running.
Your suggestion is also a good choice. You didn't mention that you failed to implement it, but only mentioned that your application is now flagged by AV programs. That doesn't indicate a programming issue. There are ways to handle this. Each AV company has a procedure for white-listing applications that are mistakenly flagged (such flag is referred to as "False Positive"). You need to apply. Explain what your AV do and since it is a legitimate application, they will probably lift this block. Another thing that will most definitely help you, would be obtaining a Code Signing Certificate (like AuthentiCode).
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900