August 3, 2018

Hack Administrative Access Windows 7 (sethc.exe vulnerability)


1. Overview
 
The PC was designed for the user to only have standard user account privilege (near guest account) where the user only have the right to read and execute certain data and application. Unlike administrator account doesn’t have the privilege to modify the PC’s setting for example uninstalling admin’s program, editing the registry, modify the services, set the startup, etc. 

Here a method is explained for a standard user or non-user at all to gain administrative access. The method uses physical means through a bootable media such as CD or USB thumb drive to gain access to administrative command line (cmd.exe here) in order to create an administrator user using the vulnerability of sticky key (sethc.exe here). The simulation here uses Virtual Machine (VM) of Windows 7 since I don't want to mess with my real Operating System (OS) (using VM is a great alternative for home experiment).

The concept is to use the vulnerability in Sethc.exe, more details can be referred to below video.
  1.  Try hitting "Shift" button more than 5x, a sticky key should pop.
  2.  Go to C:\Windows\System32.
  3.  Replace "Sethc.exe" with "cmd.exe" by copying "cmd.exe" and renaming to "Sethc.exe".
  4. Try hitting "Shift" button more than 5x again, a command prompt should pop.  

 
2. Gaining Administrator Access


The goal is how to unleash command prompt at startup. Sometimes the safe mode to start command prompt is disabled so another method is needed. The method here is to use the vulnerability in sticky key, replace “sethc.exe” with “cmd.exe”. To do this anything that could have the permission to read and write data on system’s directory will do. On the field I need to execute this quickly to avoid suspicion, so I boot “FreeDOS” from USB with “NTFSParagon” in it to write “cmd.exe” on the host’s directory. I even brought my own cmd.exe because the limit of “NTFSParagon”.

An easier way is to live boot an Operating System (OS) such as Windows, Linux, and MAC. The issue is the OS commonly used by people nowadays is heavy and large for this kind of job. If there’s a lighter way, why not (booting DOS was the lightest from my experience). I found a good light boot application for diagnosing a PC called Ultimate Boot CD (UBCD). Figure 1 shows Partition Magic was included in UBCD (a light Linux based for partition). Through here I can access on “C:\Windows\System32” using the “filemanager”, copy “cmd.exe” to (replace) “sethc.exe” shown on Figure 2. Restart and boot to Windows, then click shift 5x or more. A command prompt will show up as shown in Figure 3. (You can use Rufus, Universial USB, Yumi, Unetboot, or other softwares to make a bootable USB, just choose UBCD iso). (click image to enlarge)
Figure 1. Live Boot UBCD
Figure 2. Overwrite cmd.exe >>> sethc.exe
Figure 3. Command Prompt Access before Log-on

Through here a command line with administrator privilege was summoned. It’s available to create a user and promote any user up to administrator. The syntax to do so as followed:
a) “Net user [username] [password] /add”, example “net user fajar purnama /add”. Username is fajar and password is purnama.
b) “Net localgroup administrators [user] /add”, example “net localgroup fajar add”.
c) “Net view” to look add PC name (here is Client-PC), to login sometimes you have to include the PC name, (PC name usually available on sticker on the front PC). I login using “Username: Client-PC\fajar” and “Password: purnama”
d) Finally an administrator account is created as on Figure 4.

Figure 4. Administrator Account
 

No comments:

Post a Comment