3

In my java program I've created something that creates a batch file and then executes it, but what I'm trying to get it to do requires administrator rights. Is there a way I can run it from my java program and bypass the UAC console and run it with administrator rights?

Hayden Taylor
  • 329
  • 1
  • 4
  • 9
  • This is a duplicate of a question on ServerFault - http://serverfault.com/q/30131/22361 – Jim Garrison Sep 11 '14 at 17:23
  • If you're in unix, you can sudo the execution, but it's not a good idea to hack admin access from non-admin accounts: http://stackoverflow.com/a/18708275/512652 – ajwood Sep 11 '14 at 17:23
  • 1
    it is not possible to "bypass" UAC. Please take your hacking-questions elsewhere ... why are there so much questions about hacking today? Are you kids bored? – specializt Sep 11 '14 at 18:12

1 Answers1

0

No, inorder to run a program as an admin you need to be the admin.

What you can do is give the current user that is running the app a permission to create a file in the current directory.

This is promised by the OS not by Java although Java has its own security manager that can be configured to take or give you certain privileges.

By the way, you should NEVER run as admin, if you have (and you do) a security hole in your program and an hacker finds it, then he now has all the permissions your app has -> he is now the admin -> you are dead.

David Limkys
  • 4,907
  • 5
  • 26
  • 38
  • Then how would I go about disabling task manager in Java? Should I use JNI and just do it with c++? – Hayden Taylor Sep 11 '14 at 17:26
  • 1
    Why would you want to do such a thing ? sound like hacking talk to me. Any way, using JNI wont work here, you will bypass the Java Security Manager, but the C++(or C or ASM) code is still bound to the OS, and unless the current user has the permission to disable it, your code, running on that user wont either. – David Limkys Sep 11 '14 at 17:28
  • It isn't necessarily hacking, I'm working on a rat for a school project. How do rats disable task manager then? – Hayden Taylor Sep 11 '14 at 17:29
  • Like I said, unless you run as root(or a user with sufficient privileges) You just cant. Its the OS security, it wont let you do something you are not allowed to. (unless you find a bug in the OS which, makes it hacking.) If you are authorized to do this, ask your school Sys Admin to give your user a permission for this particular thing. – David Limkys Sep 11 '14 at 17:32
  • it is not possible to "deactivate" the task manager - even if you were to achieve this marvelous OS-hack, a bluescreen would appear once you hit CTRL+ALT+DEL. – specializt Sep 11 '14 at 18:11