Get a Pentest and security assessment of your IT network.

Cyber Security

DES Password Recovery with Known Salt

TL;DR

Yes, knowing the salt used with DES-based password hashing significantly weakens security and makes recovery much more feasible. While not trivial for a single password, rainbow tables or brute-force attacks become practical, especially with modern computing power. You should migrate to stronger hashing algorithms like bcrypt, Argon2, or scrypt immediately.

Understanding the Problem

DES (Data Encryption Standard) is an outdated encryption algorithm and therefore a weak hashing function for passwords. When used for password storage, it’s crucial to use a salt. A salt is random data added to each password before hashing. This prevents attackers from using pre-computed tables of hashes (rainbow tables). However, if the salt is known, the effectiveness of the salt is lost.

Why Knowing the Salt Matters

Without knowing the salt, an attacker would need to calculate a hash for every possible password and compare it to the stored hash. With a known salt, the attacker only needs to calculate hashes for passwords combined with that specific salt.

Recovery Methods

  1. Rainbow Tables: If the salt is common or short, pre-computed rainbow tables might exist. These tables store pre-calculated hashes for a range of passwords and salts.
  2. Brute-Force Attack: An attacker can try every possible password combination with the known salt until they find a match. This is computationally expensive but feasible with modern hardware, especially for shorter or simpler passwords.
  3. Dictionary Attack: Similar to brute-force, but only tries words from a dictionary. More efficient if users choose common passwords.

Step-by-Step Recovery (Brute-Force Example – Conceptual)

This example shows the concept; actual implementation requires tools and significant computing resources.

  1. Obtain the Salt: This is assumed to be known in this scenario.
  2. Choose a Brute-Force Tool: Tools like Hashcat or John the Ripper can perform brute-force attacks.
  3. Configure the Tool: Specify the hash algorithm (DES), the salt, and the wordlist (or character set for full brute-force).
  4. Run the Attack: The tool will iterate through possible passwords, hashing them with the salt and comparing to the stored hash.

Example Hashcat command (conceptual):

hashcat -m 0 --salt   ?a?a?a?a?a?a?a?a

-m 0 specifies DES algorithm. Replace `` with the actual salt and `` with the file containing the hashed password.

Mitigation: What to Do Now

  1. Immediately Migrate to a Stronger Algorithm: Use bcrypt, Argon2, or scrypt. These algorithms are designed to be slow and computationally expensive, making brute-force attacks much harder.
  2. Use Long, Random Salts: If you absolutely must use DES temporarily (strongly discouraged), ensure salts are at least 16 bytes long and truly random.
  3. Password Complexity Policies: Enforce strong password policies to encourage users to choose complex passwords.
  4. Regular Audits: Regularly audit your systems for weak hashing algorithms and outdated security practices.

Code Example (Python – Demonstrating Hashing with Salt)

This is a simplified example for understanding the process, not secure password storage.

import hashlib

salt = 'mysecretSalt'
pw = 'password123'

# Hash the password with salt
hashed_pw = hashlib.sha256((pw + salt).encode('utf-8')).hexdigest()

print(f'Hashed Password: {hashed_pw}')

Note that this uses SHA256 for demonstration, not DES. DES is significantly weaker.

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