Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UAC and Java

Is it possible to ask for elevated permissions from within a Java Application? Suggestions I've seen seem to all be centered around running an external executable or setting up a manifest to request privileges on launch. These aren't available to, for instance, applets. Is there any way to request elevation from a running application?

like image 806
joegester Avatar asked Jul 02 '09 21:07

joegester


People also ask

Should UAC be on or off?

While we've explained how to disable UAC in the past, you shouldn't disable it – it helps keep your computer secure. If you reflexively disable UAC when setting up a computer, you should give it another try – UAC and the Windows software ecosystem have come a long way from when UAC was introduced with Windows Vista.

What is the purpose of a UAC?

User Account Control (UAC) helps prevent malware from damaging a PC and helps organizations deploy a better-managed desktop. With UAC, apps and tasks always run in the security context of a non-administrator account, unless an administrator specifically authorizes administrator-level access to the system.

What happens if you disable UAC?

If UAC is disabled, then IE Protected Mode is also disabled. What this means is if a vulnerability is triggered via Internet Explorer, then the resulting code that executes should have the same privileges as the logged-on user.

How do I bypass UAC for a specific program?

On your desktop, right click and select New > Shortcut. Paste 'C:\Windows\System32\schtasks.exe /RUN /TN "Name of folder\Name of task" into the text box. This will create a link to your program that will automatically skip the prompt asking for permission to make changes to your computer.


1 Answers

UAC is not something that a running process can request (doesn't matter what language you are running in). You have to request elevation at launch time.

The way that most windows apps handle this (and make it look like they are requesting elevation) is to spawn an extra copy of themselves, requesting elevation, and passing sufficient command line arguments to the new process so that the appropriate dialog can be displayed.

This is why UAC elevation in a dialog is always initiated by a button click that opens a new dialog.

So, in the Java world, you just have to do exactly what everyone else has to do: launch your app again, requesting elevation. There are several ways to launch elevated, the 'run as' verb probably being the easiest.

like image 76
Kevin Day Avatar answered Sep 28 '22 18:09

Kevin Day