Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows Help
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 2-Mar-13 3:36am

1 solution

Rate this: bad
good
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).
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 300
1 Sergey Alexandrovich Kryukov 204
2 PIEBALDconsult 180
3 Suvendu Shekhar Giri 115
4 Peter Leow 100
0 Sergey Alexandrovich Kryukov 6,434
1 OriginalGriff 6,033
2 Peter Leow 2,534
3 Maciej Los 2,268
4 Abhinav S 2,264


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

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