I have a program based on WPF in C#, and I want to remove the user's privileges for debugging the application (SeDebugPrivilege) (in Release mode at least). What's the best way to go about this ? I've found a couple of ways of doing it in code that requires unsafe calls to unmanaged code. I'd prefer to do this either purely in C# or, even better, via an application manifest or some other means that prevents the user from having the SeDebugPrivilege at all during the execution of my application. Is there anyway of declaring a Windows group and revoking the privilege for the whole group ? The motivation for this is part of a push to better secure my application by following the principles of least privilege. There are other privileges I'm sure I'd like to remove at some point later, but I'd like to worry about one thing at a time.
Disabling the SeDebugPrivilege in C#
1.9k Views Asked by Alex Marshall At
1
There are 1 best solutions below
Related Questions in C#
- Concatenate excel cell string within cell reference string
- Use hidden information for filtering data
- Using Vlookup in Excel sheet to match substring
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- Why is my xml file having these after convert from excel?
- TextToColumns function uses wrong delimiter
Related Questions in SECURITY
- Concatenate excel cell string within cell reference string
- Use hidden information for filtering data
- Using Vlookup in Excel sheet to match substring
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- Why is my xml file having these after convert from excel?
- TextToColumns function uses wrong delimiter
Related Questions in PRIVILEGES
- Concatenate excel cell string within cell reference string
- Use hidden information for filtering data
- Using Vlookup in Excel sheet to match substring
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- Why is my xml file having these after convert from excel?
- TextToColumns function uses wrong delimiter
Related Questions in LEAST-PRIVILEGE
- Concatenate excel cell string within cell reference string
- Use hidden information for filtering data
- Using Vlookup in Excel sheet to match substring
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- Why is my xml file having these after convert from excel?
- TextToColumns function uses wrong delimiter
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I think you may be misunderstanding the effects of privileges such as
SeDebugPrivilege
. Whilst you can certainly remove the privilege from process token usingAdjustTokenPrivileges
, this does not prevent the application from being debugged, it instead prevents the application itself from performing certain debugging actions. This could however be used to reduce the impact of possible vulnerabilities in your application by preventing it from affecting other processes via means that require the privilege.Note that by default, a user can debug an application they have started themselves even without
SeDebugPrivilege
, so even if run as a non-administrative user (which by default will not have the privilege at all) this will not prevent the application from being debugged.There are of course many examples of applications that attempt to detect whether a debugger is attached and they do so with varying levels of success. At best you will be able to make it harder to debug the application but you won't be able to prevent it entirely if you are running on the user's machine.
You could perhaps periodically check
System.Diagnostics.Debugger.IsAttached
, and take some action if the value istrue
, but it would be relatively straightforward to overcome for someone determined to debug the application.