Defeating Windows Logon Passwords with chntpw and a Linux Boot USB

What You Need

Start the Windows Machine

Boot your Windows machine and log in as usual.

Getting a Linux ISO

You need a Linux LiveCD ISO. I used BackTrack 5 R1.

For the Summer 2012 class, the ISO file you need is on the Samba server in the Hacking3 folder.

If you want to download your own ISO file, go to http://www.backtrack-linux.org/downloads/, click the Downloads button, and download an ISO version, as shown below:

Insert the Flash Drive

Plug in the USB flash drive. Open the Computer window to find its drive letter.

When I did it, the flash drive was drive E:, as shown below:

Getting UNetbootin

Open a Web browser and go to http://unetbootin.sourceforge.net/

Click the "Download (for Windows)" button.

Double-click the downloaded UNetbootin file. In the top line of the UNetbootin window, select the Linux distribution you are using.

In the "Diskimage" line, select ISO and cick the ... button. Navigate to the ISO file you are using.

On the bottom line, verify that the drive letter is correct for your USB drive. Be Careful Not to Erase the Wrong Disk!

Your UNetbootin should resemble the example shown below:

Click the OK button. The program starts extracting files and writing them to the USB.

Its progress is strange--it will quickly get to 39% or so, then just sit there for 5-10 minutes doing nothing. Then it will start moving again and finish quickly.

When it finishes, eject and remove the USB drive and close the UNetbootin window.

Creating a Limited User Account

Click Start, right-click Computer, and click Manage.

In the left pane of "Computer Management", expand the "Local Users and Groups" container.

Right-click the Users folder and click "New User...", as shown below:

In the "New User" window, enter your name in the "User name" field, without any spaces.

Clear the "User must change password at next logon" box.

Check the "Password never expires" box, as shown below:

Click the Create button.

Click the Close button.

In the right pane of "Computer Management", right-click Your Name and click "Set Password... ", as shown below:

In the "Set Password for YOUR NAME" box, click the Proceed button.

In the "Set Password for YOUR NAME" box, enter forgottenpassword in both fields, as shown below:

Click the OK button.

Shut down the Windows machine.

Booting from the USB Drive

Plug in the USB drive and power on the Windows machine. While it is starting up, press the appropriate key to change the Boot Order--for the Summer 2012 class, it's the Esc key.

Boot from the USB drive. In the Summer 2012 class, it's the KINGSTON device.

At the BackTrack boot menu, accept the default boot option.

When BackTrack starts, type this command and then press the Enter key:

startx

Using chntpw to Change Windows Password Settings

When the graphical BackTrack interface loads, click the black square icon to open a Terminal window.

In the Terminal window, type this command and then press the Enter key:

fdisk -l | grep NTFS
Note that the switch is a lowercase L, not the numeral one.

You should see the Linux path to your Windows disk. When I did it, the path was /dev/sda1, as shown below:

In the Terminal window, type this command (using the correct path to your Windows disk, if it is different from /dev/sda1), and then press the Enter key:

mount /dev/sda1 /mnt/

This mounts the Windows drive so Linux can write to it.

In the Terminal window, type these commands, pressing Enter after each one:

cd /mnt/

ls

Note that the second command is a lowercase LS, not 1S.

You should see several files and folders, including a Windows folder, as shown below:

In the Terminal window, type these commands, pressing Enter after each one:

cd Windows/System32/config

ls

You should see many files, including one named SAM, as shown below:

This is the Security Accounts Manager, the file that contains password and account information.

Chntpw will change this file (and some other files) to bypass Windows passwords.

In the Terminal window, type this command and then press the Enter key:

/rofs/pentest/passwords/chntpw/chntpw -l SAM
Note that the switch is a lowercase L, not the numeral one.

You see a list of the user accounts on your Windows machine, as shown below:

Find the account with your name on it--this account is not currently an ADMIN account.

In the Terminal window, type this command and then press the Enter key:

/rofs/pentest/passwords/chntpw/chntpw -u YOUR-NAME SAM
You see a list of information about your account, with several options at the bottom, as shown below:

At the "Select: [q] > " prompt, enter 1 and press Enter, to clear the password.

At the "Write hive files (y/n) [n] : " prompt, enter y and press Enter, to clear the password.

OPTIONAL: Promoting the User to Administrator

This is somewhat dangerous, you can skip it if you don't want to risk damage to your Windows machine.

In the Terminal window, type this command and then press the Enter key:

/rofs/pentest/passwords/chntpw/chntpw -u YOUR-NAME SAM

At the "Select: [q] " prompt, enter 3 and press Enter, to promote your account to Administrator.

Read the scary warning. Continue if you dare!

Logging in to Windows

Power off the computer. Remove the USB drive. Power it on again.

Log in with your account--no password is required!

Source

http://ethicaldiary.wordpress.com/2010/09/24/how-to-hack-windows-from-backtrack-4-r1/


Last modified 6:32 pm 6-12-12