21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The basic idea is to take two model documents, one that the target will sign, and one<br />

that the attacker would like the target to sign. Then, vary a few places in each of<br />

those, and generate hashes of each document.<br />

The difference between these two attacks is that it’s statistically a lot easier to find a<br />

collision when you don’t have to find a collision for a particular message.<br />

This is canonically illustrated with something called the birthday paradox. The common<br />

analogy involves finding people with the same birthday. If you’re in a room of<br />

253 people, the odds are just about even that one of them will share your birthday.<br />

Surprisingly to some, if there are a mere 23 people in a room, the odds of finding two<br />

people with the same birth date is also a bit over 50 percent.<br />

In both cases, we’ve got a better than 50% chance after checking 253 pairs of people.<br />

The difference is that in the first scenario, a fixed person must always be a part<br />

of the pairings, which seriously reduces the number of possible combinations of people<br />

we can consider. For this reason, the situation where an attacker can find a collision<br />

between any two messages is called a birthday attack.<br />

When a birthday attack applies, the maximum bit strength of a hash function is half<br />

the length of the hash function’s output (the digest size). Also, birthday attacks are<br />

often possible when people think they’re not. That is, the attacker doesn’t need to be<br />

able to control both messages for a birthday attack to apply.<br />

For example, let’s say that the target hashes a series of messages. An attacker can<br />

precompute a series of hashes and wait for one of the messages to give the same<br />

hash. That’s the same problem, even though the attacker doesn’t control the messages<br />

the target processes.<br />

Generally, the only reliable way to thwart birthday attacks is to use a per-message<br />

nonce, which is typically done only with MAC constructs. Indeed, many MAC constructs<br />

have built-in facilities for this. We discuss how to use a nonce with a hash<br />

function in Recipe 6.8, and we discuss how to use one with MACs that aren’t built to<br />

use one in Recipe 6.12.<br />

Another problem that occurs with every practical cryptographic hash function is that<br />

they are susceptible to length extension attacks. That is, if you have a message and a<br />

hash value associated with that message, you can easily construct a new message and<br />

hash value by extending the original message.<br />

The MACs we recommend in this chapter avoid length-extension problems and other<br />

attack vectors against hash functions. * We discuss how to thwart length extension<br />

problems when using a hash function outside the context of a MAC in Recipe 6.7.<br />

* While most of the MACs we recommend are based on block ciphers, if a MAC isn’t carefully designed, it<br />

will still be susceptible to the attacks we describe in this section, even if it’s built on a block cipher.<br />

252 | Chapter 6: Hashes and Message Authentication<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!