I've been looking at hash security, and how tools like hashcat and John The Ripper work. I seem to have misunderstood some basic stuff, and would appreciate some clarification on:

  1. If you're pen testing, and you've got a hash that you're trying to get a plain password from, how exactly are you meant to have found that hash? Is it is assumed that you're already on the target system and can simply read /etc/shadow/whatever? Or is it assumed to have been snooped from plain HTTP, in which case when would ever find a hash, rather than a plain password, on HTTP?
  2. Various sources on the web make the point that you can't do dictionary or rainbow attacks without the salt. But when would you ever have a hash string which doesn't actually include the salt in plaintext anyway? Surely, in practical cases, if you have a hash string, you also have the salt?
  3. If you've got the salt, what's to stop you from just constructing your own rainbow tables?

1 Answer 1



Password hashes are typically stored in a database, so the prerequisite for a brute-force attack against a hash is that the attacker has already gained sufficient access to the database, e.g., through an SQL injection.


How and where the salt is stored is entirely implementation-specific. Modern algorithms like bcrypt or Argon2 often have some kind of output format which does include the salt, but it doesn't have to be this way. The salt may very well be stored separately. This is particularly true for self-made algorithms. In practice, however, an attacker who has managed to get the hash should also be able to obtain the corresponding salt. The salt isn't considered secret, so it doesn't make sense for applications to protect it better than the hash.


Nothing, except that it's entirely pointless. The purpose of rainbow tables is that they're precomputed and can be used for quick lookups in later attacks. If you construct a rainbow table ad-hoc for every hash, you don't gain anything. In fact, you're wasting computing power and space on a data structure which you already know cannot be reused.

Note that the relevance of rainbow tables is far smaller than people usually think. In practice, modern hardware like GPUs and ASICs is so powerful that a brute-force attack doesn't require any precomputation. So salts are less about defeating rainbow tables and more about making sure that an attacker cannot attack all hashes at once.

Not the answer you're looking for? Browse other questions tagged .