HOME

TheInfoList



OR:

A birthday attack is a type of
cryptographic attack Cryptanalysis (from the Greek ''kryptós'', "hidden", and ''analýein'', "to analyze") refers to the process of analyzing information systems in order to understand hidden aspects of the systems. Cryptanalysis is used to breach cryptographic sec ...
that exploits the mathematics behind the
birthday problem In probability theory, the birthday problem asks for the probability that, in a set of randomly chosen people, at least two will share a birthday. The birthday paradox is that, counterintuitively, the probability of a shared birthday exceeds 5 ...
in
probability theory Probability theory is the branch of mathematics concerned with probability. Although there are several different probability interpretations, probability theory treats the concept in a rigorous mathematical manner by expressing it through a set ...
. This attack can be used to abuse communication between two or more parties. The attack depends on the higher likelihood of collisions found between random attack attempts and a fixed degree of permutations ( pigeonholes). With a birthday attack, it is possible to find a collision of a hash function in \sqrt = 2^, with 2^n being the classical
preimage resistance In cryptography, a preimage attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its preimage (set of possible inputs). In the context of attack, the ...
security. There is a general (though disputed) result that quantum computers can perform birthday attacks, thus breaking collision resistance, in \sqrt = 2^. Although there are some digital signature vulnerabilities associated with the birthday attack, it cannot be used to break an encryption scheme any faster than a
brute-force attack In cryptography, a brute-force attack consists of an attacker submitting many passwords or passphrases with the hope of eventually guessing correctly. The attacker systematically checks all possible passwords and passphrases until the correc ...
.


Understanding the problem

As an example, consider the scenario in which a teacher with a class of 30 students (n = 30) asks for everybody's birthday (for simplicity, ignore
leap year A leap year (also known as an intercalary year or bissextile year) is a calendar year that contains an additional day (or, in the case of a lunisolar calendar, a month) added to keep the calendar year synchronized with the astronomical year or ...
s) to determine whether any two students have the same birthday (corresponding to a hash collision as described further). Intuitively, this chance may seem small. Counter-intuitively, the probability that at least one student has the same birthday as ''any'' other student on any day is around 70% (for n = 30), from the formula 1-\frac. If the teacher had picked a ''specific'' day (say, 16 September), then the chance that at least one student was born on that specific day is 1 - (364/365)^, about 7.9%. In a birthday attack, the attacker prepares many different variants of benign and malicious contracts, each having a digital signature. A pair of benign and malicious contracts with the same signature is sought. In this fictional example, suppose that the digital signature of a string is the first byte of its
SHA-256 SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compressi ...
hash. The pair found is indicated in green – note that finding a pair of benign contracts (blue) or a pair of malicious contracts (red) is useless. After the victim accepts the benign contract, the attacker substitutes it with the malicious one and claims the victim signed it, as proven by the digital signature.


Mathematics

Given a function f, the goal of the attack is to find two different inputs x_, x_ such that f(x_) = f(x_). Such a pair x_, x_ is called a collision. The method used to find a collision is simply to evaluate the function f for different input values that may be chosen randomly or pseudorandomly until the same result is found more than once. Because of the birthday problem, this method can be rather efficient. Specifically, if a
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
f(x) yields any of H different outputs with equal probability and H is sufficiently large, then we expect to obtain a pair of different arguments x_ and x_ with f(x_) = f(x_) after evaluating the function for about 1.25\sqrt different arguments on average. We consider the following experiment. From a set of ''H'' values we choose ''n'' values uniformly at random thereby allowing repetitions. Let ''p''(''n''; ''H'') be the probability that during this experiment at least one value is chosen more than once. This probability can be approximated as : p(n;H) \approx 1 - e^ \approx 1-e^ Let ''n''(''p''; ''H'') be the smallest number of values we have to choose, such that the probability for finding a collision is at least ''p''. By inverting this expression above, we find the following approximation : n(p;H)\approx \sqrt and assigning a 0.5 probability of collision we arrive at : n(0.5;H) \approx 1.1774 \sqrt H Let ''Q''(''H'') be the expected number of values we have to choose before finding the first collision. This number can be approximated by : Q(H)\approx \sqrt As an example, if a 64-bit hash is used, there are approximately different outputs. If these are all equally probable (the best case), then it would take 'only' approximately 5 billion attempts () to generate a collision using brute force. This value is called birthday bound and for ''n''-bit codes it could be approximated as 2''n''/2. Other examples are as follows: : :''Table shows number of hashes n''(''p'')'' needed to achieve the given probability of success, assuming all hashes are equally likely. For comparison, ' to ' is the uncorrectable bit error rate of a typical hard disk. In theory, MD5 hashes or UUIDs, being roughly 128 bits, should stay within that range until about 820 billion documents, even if its possible outputs are many more.'' It is easy to see that if the outputs of the function are distributed unevenly, then a collision could be found even faster. The notion of 'balance' of a hash function quantifies the resistance of the function to birthday attacks (exploiting uneven key distribution.) However, determining the balance of a hash function will typically require all possible inputs to be calculated and thus is infeasible for popular hash functions such as the MD and SHA families. The subexpression \ln\frac in the equation for n(p;H) is not computed accurately for small p when directly translated into common programming languages as log(1/(1-p)) due to
loss of significance In numerical analysis, catastrophic cancellation is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers. For example, if there are two studs, one L_ ...
. When log1p is available (as it is in
C99 C99 (previously known as C9X) is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard. It extends the previous version ( C90) with new features for the language and the standard library, and helps impl ...
) for example, the equivalent expression -log1p(-p) should be used instead. If this is not done, the first column of the above table is computed as zero, and several items in the second column do not have even one correct significant digit.


Simple approximation

A good rule of thumb which can be used for
mental calculation Mental calculation consists of arithmetical calculations using only the human brain, with no help from any supplies (such as pencil and paper) or devices such as a calculator. People may use mental calculation when computing tools are not availab ...
is the relation :p(n) \approx which can also be written as :H \approx . or :n \approx \sqrt . This works well for probabilities less than or equal to 0.5. This approximation scheme is especially easy to use when working with exponents. For instance, suppose you are building 32-bit hashes (H = 2^) and want the chance of a collision to be at most one in a million ( p \approx 2^ ), how many documents could we have at the most? :n \approx \sqrt = \sqrt = \sqrt = 2^ \approx 90.5 which is close to the correct answer of 93.


Digital signature susceptibility

Digital signatures can be susceptible to a birthday attack. A message m is typically signed by first computing f(m), where f is a
cryptographic hash function A cryptographic hash function (CHF) is a hash algorithm (a map of an arbitrary binary string to a binary string with fixed size of n bits) that has special properties desirable for cryptography: * the probability of a particular n-bit output re ...
, and then using some secret key to sign f(m). Suppose Mallory wants to trick Bob into signing a
fraudulent In law, fraud is intentional deception to secure unfair or unlawful gain, or to deprive a victim of a legal right. Fraud can violate civil law (e.g., a fraud victim may sue the fraud perpetrator to avoid the fraud or recover monetary compens ...
contract. Mallory prepares a fair contract m and a fraudulent one m'. She then finds a number of positions where m can be changed without changing the meaning, such as inserting commas, empty lines, one versus two spaces after a sentence, replacing synonyms, etc. By combining these changes, she can create a huge number of variations on m which are all fair contracts. In a similar manner, Mallory also creates a huge number of variations on the fraudulent contract m'. She then applies the hash function to all these variations until she finds a version of the fair contract and a version of the fraudulent contract which have the same hash value, f(m) = f(m'). She presents the fair version to Bob for signing. After Bob has signed, Mallory takes the signature and attaches it to the fraudulent contract. This signature then "proves" that Bob signed the fraudulent contract. The probabilities differ slightly from the original birthday problem, as Mallory gains nothing by finding two fair or two fraudulent contracts with the same hash. Mallory's strategy is to generate pairs of one fair and one fraudulent contract. The birthday problem equations apply where n is the number of pairs. The number of hashes Mallory actually generates is 2n. To avoid this attack, the output length of the hash function used for a signature scheme can be chosen large enough so that the birthday attack becomes computationally infeasible, i.e. about twice as many bits as are needed to prevent an ordinary
brute-force attack In cryptography, a brute-force attack consists of an attacker submitting many passwords or passphrases with the hope of eventually guessing correctly. The attacker systematically checks all possible passwords and passphrases until the correc ...
. Besides using a larger bit length, the signer (Bob) can protect himself by making some random, inoffensive changes to the document before signing it, and by keeping a copy of the contract he signed in his own possession, so that he can at least demonstrate in court that his signature matches that contract, not just the fraudulent one.
Pollard's rho algorithm for logarithms Pollard's rho algorithm for logarithms is an algorithm introduced by John Pollard in 1978 to solve the discrete logarithm problem, analogous to Pollard's rho algorithm to solve the integer factorization problem. The goal is to compute \gamma suc ...
is an example for an algorithm using a birthday attack for the computation of discrete logarithms.


Reverse Attack

The same fraud is possible if the signer is Mallory, not Bob. Bob could suggest a contract to Mallory for a signature. Mallory could find both an inoffensively-modified version of this fair contract that has the same signature as a fraudulent contract, and Mallory could provide the modified fair contract and signature to Bob. Later, Mallory could produce the fraudulent copy. If Bob doesn't have the inoffensively-modified version contract (perhaps only finding their original proposal), Mallory's fraud is perfect. If Bob does have it, Mallory can at least claim that it is Bob who is the fraudster.


See also

*
Collision attack In cryptography, a collision attack on a cryptographic hash tries to find two inputs producing the same hash value, i.e. a hash collision. This is in contrast to a preimage attack where a specific target hash value is specified. There are roughl ...
* Meet-in-the-middle attack


Notes


References

*
Mihir Bellare Mihir Bellare is a cryptographer and professor at the University of California San Diego. He has published several seminal papers in the field of cryptography (notably in the area of provable security), many of which were co-written with Phillip R ...
, Tadayoshi Kohno: Hash Function Balance and Its Impact on Birthday Attacks. EUROCRYPT 2004: pp401–418 * ''Applied Cryptography, 2nd ed.'' by
Bruce Schneier Bruce Schneier (; born January 15, 1963) is an American cryptographer, computer security professional, privacy specialist, and writer. Schneier is a Lecturer in Public Policy at the Harvard Kennedy School and a Fellow at the Berkman Klein Cente ...


External links


"What is a digital signature and what is authentication?"
from
RSA Security RSA Security LLC, formerly RSA Security, Inc. and doing business as RSA, is an American computer and network security company with a focus on encryption and encryption standards. RSA was named after the initials of its co-founders, Ron Rive ...
's crypto FAQ.
"Birthday Attack"
X5 Networks Crypto FAQs {{cryptography navbox , hash Cryptographic attacks de:Kollisionsangriff#Geburtstagsangriff