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.
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in SECURITY
- HTTPS configuration in Spring Boot, server returning timeout
- HSM ZKA control mask values
- OWASP Amass Subcommands
- Is there a need for BPF Linux namespace?
- Error when trying to execute a binary compiled in a Kali Linux machine on an Ubuntu system
- When sanitize/encode while implementing tags system like on SO
- spring security version in spring-boot-starter-security
- I am currently trying to implement a rudimentary firewall from a video I watched but the nimda worm detection is not working and i do not know why?
- Is it possible for `sudo` to fail temporarily with the correct password? Hacking suspected
- Is it viable proxying all my mobile apps requests, to some kind knowing that a request is coming from a secure source
- What abilities should I concentrate on while bug hunting, and how can I improve the quality of my bug bounty reports?
- System.ArgumentOutOfRangeException: I passed this error in every single program
- How to prevent users from creating custom client apps?
- Does server-side content security policy exist for youtube video player API, app, mod apks and website?
- Can we pass a hostname/IP address as a query string in a GET request in REST API
Related Questions in PRIVILEGES
- With which user does Oracle APEX create apps?
- What are the Risks of using app with dangerous delegated permissions in azure?
- Rundeck/Ansible privilege escalation doesn't work
- Do Shell Script From Apple Script Requires Terminal To Have Full Disk Access - But It Already Has Full Disk Access
- Error 1217 vs 1452: Still less verbose despite `GRANT_ALL`
- How exception occurred in debug mode do end execution of program buffer in RISCV architecture?
- I was installing the python for the first time, but I can't access the check box for admin privileges, it doesn't allow to check or uncheck it
- Pivileges of a new user in PostgreSQL
- List of role's privileges in Postgres
- MySQL Workbench Creating Users and Privileges
- confine snowflake warehouse usage on user level
- Is it possible to give my Android app root permissions without rooting the device? Perhaps with an MDM or a UEM?
- Creating a Limited Privilege PostgreSQL Role for Backend Server
- Is it possible in node to attain super user / root privileges for a set of actions without running the entire application as root?
- Wow64 subsystem and its implementation on x86_64
Related Questions in LEAST-PRIVILEGE
- How do I make all of my @RequestMapping as @PreAuthorize("isAuthenticated()") by default?
- Why is application permission granted so much privilege on Azure?
- How to follow PoLP with a cloud run application and multiple services without tight coupling
- How can I create an IAM policy on AWS Secrets Manager to grant a group least privilege access. I only grant access to secrets created or owned. Thnx(:
- Best-Practice way to run a python program that needs root privliges for subset of tasks
- Advice on giving developers capability to run explain plans in ORACLE
- I have problem with least privilege principle. incrementing a member when an object is created
- Minimum IAM permissions required to attach SG to EC2 Instance?
- CloudFormation refusing to create AWS::KMS::Key with least privilege
- I want to achieve the following using permission boundary
- Can I AutoCreate an IAM role for a Cloudformation stack from the template?
- Principle of least privilege vs User Interface Privilege Isolation
- Spinnaker User Authorization and Instance Permission Restrictions
- Principle of Least Privilege with Entity Framework
- Identity Server by leastprivilege doesn't work properly on Azure
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?
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)
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.