Get a Pentest and security assessment of your IT network.

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

  • A copy of the SAM file (usually found on a Windows system).
  • A computer running Linux (Kali Linux is recommended) or macOS.
  • Hashcat and/or John the Ripper installed.
  • Sufficient processing power (GPU acceleration significantly speeds up cracking).

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.

  • Important: Copying the SAM file requires elevated permissions and should only be done on systems you own or have explicit permission to access.
  • You can use tools like robocopy from a command prompt with admin rights, or boot into a recovery environment 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

  • Legal Implications: Cracking passwords without authorization is illegal. This guide is for educational purposes only.
  • Resource Intensive: Password cracking can be very resource intensive, especially with brute-force attacks. A powerful GPU significantly improves performance.
  • Wordlist Quality: The effectiveness of wordlist attacks depends heavily on the quality and relevance of the wordlist used.
  • cyber security: Always practice responsible cyber security measures to protect your systems from unauthorized access.
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation