20 September 2016

Non admin network user can start command line as administrator

Issue: non admin network user can start command line as administrator without UAC window. (Command line have name as "Administrator: C:\Windows\System32\cmd.exe") In result real administrator can't start admin tools as every time from cmd. For temporally use we can start any tools with "runas /user:Admin cmd" or use non secure vbs script for start it.
------------------ Option explicit
Dim oShell
Dim oFS : Set oFS = CreateObject("Scripting.FileSystemObject")
'WScript.Echo "WScript.ScriptFullName", WScript.ScriptFullName
'WScript.Echo "oFS.GetParentFolderName(WScript.ScriptFullName)", oFS.GetParentFolderName(WScript.ScriptFullName)
set oShell= Wscript.CreateObject("WScript.Shell")
'Replace the path with the program you wish to run c:\program files...
oShell.Run "RunAs /noprofile /user:Administrator ""C:\Windows\System32\cmd.exe"""
WScript.Sleep 200
'Replace the string --> yourpassword~ with the
'password used on your system. Include the tilde "~"
oShell.Sendkeys "Pa$$vv0rd~"
WScript.Sleep 200
oShell.Sendkeys "cd /d "
oShell.Sendkeys oFS.GetParentFolderName(WScript.ScriptFullName)
oShell.Sendkeys "~"
oShell.Sendkeys "cmd~"
'oShell.Sendkeys "F:\Deployment\Access\runas.bat~"
Wscript.Quit
------------------
Issue admin rights was resolved by checked registry UAC part for domain users (or Group Policy on server or local users)
List UAC settings below


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
FilterAdministratorToken User Account Control: Admin Approval Mode for the built-in Administrator account 0 (Default) = Disabled
1 = Enabled
EnableUIADesktopToggle User Account Control: Allow UIAccess applications to prompt for elevation without using the secure desktop 0 (Default) = Disabled
1 = Enabled
ConsentPromptBehaviorAdmin User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode 0 = Elevate without prompting
1 = Prompt for credentials on the secure desktop
2 = Prompt for consent on the secure desktop
3 = Prompt for credentials
4 = Prompt for consent
5 (Default) = Prompt for consent for non-Windows binaries
ConsentPromptBehaviorUser User Account Control: Behavior of the elevation prompt for standard users 0 = Automatically deny elevation requests
1 = Prompt for credentials on the secure desktop
3 (Default) = Prompt for credentials
EnableInstallerDetection User Account Control: Detect application installations and prompt for elevation 1 = Enabled (default for home)
0 = Disabled (default for enterprise)
ValidateAdminCodeSignatures User Account Control: Only elevate executables that are signed and validated 0 (Default) = Disabled
1 = Enabled
EnableSecureUIAPaths User Account Control: Only elevate UIAccess applications that are installed in secure locations 0 = Disabled
1 (Default) = Enabled
EnableLUA User Account Control: Run all administrators in Admin Approval Mode 0 = Disabled
1 (Default) = Enabled
PromptOnSecureDesktop User Account Control: Switch to the secure desktop when prompting for elevation 0 = Disabled
1 (Default) = Enabled
EnableVirtualization User Account Control: Virtualize file and registry write failures to per-user locations 0 = Disabled
1 (Default) = Enabled

No comments:

Post a Comment