Blog | G5 Cyber Security

Offline SAM Password Cracking

TL;DR

This guide shows how to crack passwords from a Windows System Access Manager (SAM) file offline using tools like Hashcat and John the Ripper. It’s for legitimate purposes only, such as password recovery when other options have failed.

Prerequisites

Step 1: Obtaining the SAM File

The SAM file is located at C:WindowsSystem32configSAM on a Windows system. You’ll need administrative privileges to copy it.

Step 2: Installing Hashcat

If you’re using Kali Linux, Hashcat is likely already installed. If not, install it using:

sudo apt update && sudo apt install hashcat

Step 3: Cracking with Hashcat (NTLM Hashes)

  1. Convert SAM to NTLM: Use samdump2.py from the Responder tool suite to extract the NTLM hashes. You may need to install Responder first.
    python samdump2.py -i /path/to/SAM -o /path/to/output_hashes.txt
  2. Run Hashcat: Use the following command as a starting point (replace placeholders with your actual values):
    hashcat -m 1000 /path/to/output_hashes.txt ?a?a?a?a?a?a passwordlist.txt
    • -m 1000: Specifies the hash type (NTLM).
    • /path/to/output_hashes.txt: The path to your NTLM hash file.
    • ?a?a?a?a?a?a: A mask for brute-force attacks. This example tries passwords up to 6 characters long consisting of lowercase letters. Adjust the length and character set as needed.
    • passwordlist.txt: A wordlist containing potential passwords.

Step 4: Installing John the Ripper

Install John the Ripper using:

sudo apt install john

Step 5: Cracking with John the Ripper

  1. Convert SAM to John Format: Use samdump2.py (as in Step 3) and then convert the output using a script or manually format it for John.
    python samdump2.py -i /path/to/SAM -o /path/to/output_hashes.txt
  2. Run John: Use the following command as a starting point (replace placeholders):
    john --wordlist=/path/to/passwordlist.txt /path/to/output_hashes.txt
    • –wordlist=/path/to/passwordlist.txt: Specifies the wordlist to use.
    • /path/to/output_hashes.txt: The path to your hash file in John format.

Step 6: Analyzing Results

Both Hashcat and John the Ripper will output cracked passwords if successful. Review the output files for discovered credentials.

Important Considerations

Exit mobile version