03 Modification Check Values Flashcards
What are the two main categories of modification check values?
- MDC (Modification Detection Code)
- MAC (Message Authentication Code)
What is a Hash function and what are their two main properties?
A hash function is a function “h” with the properties of:
- Compression: h maps an input x of arbitrary finite bit length, to an output h(x) of fixed bit length n.
- Ease of computation: (with h and x it is easy to compute h(x)).
Cryptographic hash functions are used to compute MDC (Modification Detection Codes).
What are other (secondary) properties of cryptographic hash functions?
- Pre-image resistance (for all pre-specified outputs y, it is computationally infeasible to find and x that h(x)=y). –> Non-reversible.
- 2nd pre-image resistance (given x it is computationally infeasible to find any second input x’ with x=/=x’ such that h(x)=h(x’) )–> Different results for every hash.
- Collision resistance: it is computationally infeasible to find any pair (x,x’) with x=/= x’ such that h(x)=h(x’) –> Cannot find two different arbitrary inputs that produce the same output/hash.
What is a MAC and how it works?
MAC (Message Authentication Code) is a family of functions hk parameterized by a secret key k with properties:
- Compression: hk maps an input x of arbitrary finite bit-length to an output hk(x) of fixed bit-lenght, called the MAC.
- Ease of computation: given k, x and a known function family hk the value hk(x) is easy to compute.
- Computation-resistance: for every fixed, allowed, but unknown value of k, given zero or more text-MAC pairs (xi, hi(xi)) it is computationally infeasible to compute a text-MAC pair (x, hk(x)) for any NEW input x=/= xi.
What is computation-resistance on MACs?
Implies a property where k cannot be recovered using pairs (xi, hk(xi)).
However, computation-resistance is not deduced solely from key non-recovery as sometimes the key k is not needed to forge new MACs.
Message integrity is the principal application which lead the original design of MDC and MAC. Elaborate on each of them:
- MDC (Modification Detection Code) -> represents a digital fingerprint, that can be signed with a private key (RSA, ElGamal…) and two messages cannot have the same fingerprint (non-reusable by attackers).
- MAC (Message Authentication Code) -> over a message m, certifies that a sender of the message possesses the secret key K and the message could not have been modified without that key.
What are other (non-original) applications for MDC and MAC that require some caution:
- Confirmation of knowledge
- Key derivation
- Pseudo-random number generation
What is the Birthday Phenomenon and how is it related to MDCs?
- Concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday.
- p.50% = 23 people
- p.99% = 70 people
- If there are n possible different values, the number K of values needed to obtain at least one pair of identical values is of the order: k = 1.18*Sqrt(n)
- This is related to MDCs due to the birthday attack because this one depends on the higher likelihood of collisions (different inputs, same hash output) found between random attack attempts and a fixed degree of permutations.
- Due to this birthday problem, these attacks are much faster than a brute force attack.
What are some challenges faced by the Birthday attack?
- At least 1.18*Sqrt(n) variations of each of the two messages must be produced in order to have at least a probability of 0.5
- A memory problem (storing every message tried with their MDCs to find a match)
- m1’ and m2’ should produce MDC1(m1’) = MDC1(m2’)
- Average effort to produce two m1’ and m2’ are of the order n^(MDCs lenght/2)
- Thus a minimum of 160 bitlength of the hash value is recommended as it is considered as infeasible to attack.
Explain the Merkle-Dåmgard structure in used by many cryptographic hash functions today:
- An arbitrary message (y) has its length appended and it is padded/splitted into block sizes b (Creating y0, y1,.. yL-1. L blocks of size b)
- An IV is assigned to CV0 (Chaining Value) := IV and then MDC(y) := CVL
- f is a compression function wich compresses (n+b) bits to n bits (shifted b comming from the current y) and n comming from the current CV)
Summarized:
CV0 = IV initial n-bit value
CVi = f (CVi-1, yi-1) 1 <= i <= L
H(y) = CVL
Explain the Merkle-Dåmgard structure, a common structure of Cryptographic Hash Functions:
Mention some inherent weaknesses of Merkle-Dåmgard constructions:
- If one collision is found, finding more is cheap.
- Multi-collisions can be found with little more work than collisions.
- Second preimage attacks are much more efficient than brute force
What are some Cryptographic Hash Functions commonly used for creating MDCs?
- MD5 = Message Digest 5
- SHA1 = Secure Hash Algorithm 1
- SHA2 = Secure Hash Algorithm 2 (SHA-256, SHA-512)
- SHA3 = Secure Hash Algorithm 3
Explain and elaborate on MD5:
- MD5 processes a variable-lenght message into a fixed-length output of 128 bits.
- A message “y” is padded by a “1” followed by 0-to-511 “0”s bits such that the length of the resulting message is congruent 448 modulo 512 (divisible by 512).
- Length of the message is up to 64 bits fewer than 512 (=448).
- The message is divided in blocks of b=512 bits.
- MD5 operates on a n=128-bit state (chaining value acts as four 32-bit words A,B,C and D).
- Each block of the message (yi) is processed with the chaining value CVi with the function f (internally realized by 4 rounds of 16 steps each = 64 operations in total). This modifies the chain state.
- The processing of a message block uses a non-linear function F (4 differents), modular addition (with the aid of a table T with 64 constants) and left shift by s-bits.
Graphically explain 1 step of MD5:
Explain some security concerns about MD5:
- In 1996 an attack that allows a collision (same hash for different inputs) for the function f was published.
- In 2004 the first collision was found.
- Currently a collision can be done with the right hardware within seconds.
- MD5 for collision resistance compliance must be avoided (different files, same MD5, faking signatures such SSL certificates)
- MD5 is still OK against preimage attacks (good for tranmissions checking or data consistency).
- It is recommended to use another higher-output hash function like SHA-256.