Click here to Skip to main content
13,597,195 members
Rate this:
Please Sign up or sign in to vote.
See more:

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).

Posted 2-Mar-13 2:36am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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).

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.180621.3 | Last Updated 3 Mar 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100