ELEG 467/667

Pentesting & CTF's

View on GitHub

Hashing

What’s a Hash?

Play around for a bit with this program to determine the properties of a hash function.

So you can probably tell now that a hash function is a deterministic “scrambler” of some input. You pass in an arbitrary length input, and you get fixed-length output (the hash) that you cannot determine the input from. Everytime you run the same hash function n the same input, you get the same output.

Here are a few more proprties of a good hash function:

What Are Hashes Used For?

Common Hash Functions

Vulnerabilities

Collisions

Collisions happen when two different pieces of data hash to the same value.

Why is this bad?

Length Extension Attacks

Before we get into this attack, you should understand the concept of a Message Authenication Code, or a MAC. MACs are sort of like hashes with keys. There is a secret key that both the sender and recevier know. For some message, the sender generates a MAC using a hash function and the key. The receiver can then verify that the message is unaltered and came from the sender by generating a MAC for the received message using the same hash function and key. If the two MACs are the same, the message is verified.

Now let’s look at a MAC scheme that is vulnerable to a legnth extension attack:

We can easily forge signatures with this scheme using programs like HashPump or hlextend.

Tabletop