Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Vista UAC per-application, or elevate privileges without prompt?

I have an app that normal users need to be able to run, but requires administrator privileges to actually function.

I tried to make the shortcut that my users run it with "Run as administrator" but this just causes a UAC prompt whenever they try to run the app.

Is there any way to elevate privileges programatically, without my users needing to go through a UAC prompt and/or knowing an administrator password? From a security standpoint, I understand that most applications shouldn't be allowed to do this, so I'm hoping there is some way to do it if I can provide a valid username/password pair, or something.

The app is written in C#, so a fully managed solution would be preferred, but p/Invoke Black Magic (or even writing an MC++ Wrapper Which We Do Not Speak About) would be more acceptable than disabling UAC entirely.

like image 235
Alex Lyman Avatar asked Jan 24 '23 15:01

Alex Lyman


2 Answers

Generally this problem solved by installing a Windows Service which runs as SYSTEM or an admin account. Then your application can request the privileged action from this service.

Obviously to not pose a security threat ensure that your service can't run arbitrary code or something which might leave the all users vulnerable to privilege escalation attacks.

Winpcap and most of the other sniffing applications use a similar design to give sniffing access to unprivileged users.

like image 68
dr. evil Avatar answered May 11 '23 10:05

dr. evil


Actually, why don't you just create a Task Schedule which runs the app with elevated privileges? As long as you setup the Task under elevation, it will not prompts you for a UAC when it is auto-run during reboot or whatever your trigger is.

Just make sure you set level=requireElevation in your manifest file, and task scheduler will run your app with admin rights without prompting your user for admin rights, as this had already been established when you setup the task with admin privileges.

like image 22
Erx_VB.NExT.Coder Avatar answered May 11 '23 10:05

Erx_VB.NExT.Coder