2013
08.28

Under Windows the administrator has not super power such as root under linux.

To rename or modify a file, the good right is needed even if you are administrator. To modify the right, you must be owner or has already writing rights.

All follow commands are launch in cmd ran as administrator. If your explorer is down you can see the previous post. In another case you can find cmd.exe (c:\windows\system32\cmd.exe), right click on icon and click run as administrator.

Try to rename the calculator :

C:\Windows\system32>ren calc.exe calc2.exe
Access denied.

See the program calc in details.

C:\Windows\system32>dir /Q calc*
Le volume dans le lecteur C n'a pas de nom.
Le numéro de série du volume est 8C90-057B
Répertoire de C:\Windows\system32
20/11/2010 23:29 776 192 NT SERVICE\TrustedInstacalc.exe
1 fichier(s) 776 192 octets
0 Rép(s) 3 083 681 792 octets libres
C:\Windows\system32>icacls calc*
calc.exe BUILTIN\Administrateurs:(RX)
AUTORITE NT\Système:(RX)
BUILTIN\Utilisateurs:(RX)
NT SERVICE\TrustedInstaller:(F)
1 fichiers correctement traités ; échec du traitement de 0 fichiers

The administrators have the read and execution right and the owner is TrustedInstaller. Yes, Microsoft has more right than you !

We try to become the file owner :

C:\Windows\system32>takeown /F calc.exe

We can change the right :

C:\Windows\system32>icacls calc.exe /grant:r Administrateurs:(F)

We can rename the file.

C:\Windows\system32>ren calc.exe calc2.exe

We obtain the follow results :

C:\Windows\system32>dir /Q calc*
 Le volume dans le lecteur C n'a pas de nom.
Le numéro de série du volume est 8C90-057B
Répertoire de C:\Windows\system32
20/11/2010 23:29 776 192 toto-PC\toto calc2.exe
1 fichier(s) 776 192 octets
0 Rép(s) 3 083 681 792 octets libres
C:\Windows\system32>icacls calc*
calc2.exe BUILTIN\Administrateurs:(F)
AUTORITE NT\Système:(RX)
BUILTIN\Utilisateurs:(RX)
NT SERVICE\TrustedInstaller:(F)
1 fichiers correctement traités ; échec du traitement de 0 fichiers

We are owner and we have full control of file.

Now we revert our modifications :

C:\Windows\system32>ren calc2.exe calc.exe
C:\Windows\system32>icacls calc.exe /setowner "NT Service\TrustedInstaller"
C:\Windows\system32>icacls calc.exe /grant:r Administrateurs:(RX)

We see the same the beginning state.

C:\Windows\system32>dir /Q calc*
Le volume dans le lecteur C n'a pas de nom.
Le numéro de série du volume est 8C90-057B
Répertoire de C:\Windows\system32
20/11/2010 23:29 776 192 NT SERVICE\TrustedInstacalc.exe
1 fichier(s) 776 192 octets
0 Rép(s) 3 083 681 792 octets libres
C:\Windows\system32>icacls calc*
calc.exe BUILTIN\Administrateurs:(RX)
AUTORITE NT\Système:(RX)
BUILTIN\Utilisateurs:(RX)
NT SERVICE\TrustedInstaller:(F)
1 fichiers correctement traités ; échec du traitement de 0 fichiers

right2

2013
08.28

We will see how to obtain shell with administrator right when explorer is down.

For do that, you need powershell. If you are using classical cmd  you can write powershell if it installed.

The magic command line is : 

start-process powershell -verb runas

 or 

start-process cmd -verb runas 

  The UAC confirmation will appear and you get administration right.

That’s all.

shell