21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

negotiate which version of the protocol is to be used, and perhaps negotiate which<br />

cryptographic algorithms and key sizes are to be used.<br />

In situations like this, there is the threat of a rollback attack, which occurs when an<br />

attacker tampers with messages during establishment and tricks the parties into<br />

negotiating an insecure set of parameters (such as an old, broken version of a protocol).<br />

A good protocol for authentication and key exchange, such as PAX or SAX (see Recipe<br />

8.15), ensures that there are no opportunities for rollback in the context of the<br />

protocol. If you don’t have messages that come before the key exchange, and if you<br />

immediately start using your encryption key after the exchange using an authenticated<br />

encryption solution, you can do other kinds of negotiation (such as agreeing on<br />

a protocol) and not have to worry about rollback.<br />

If, on the other hand, you send messages before your key exchange, or you create<br />

your own end-to-end protocol (neither is a solution we recommend), you will need<br />

to protect against replay attacks on your own. To accomplish this, after connection<br />

establishment, have each side MAC every message that it thinks took place during<br />

the establishment. If the client sends its MAC first, and the server validates it, the<br />

server should MAC not only the establishment messages but also the MAC value<br />

sent by the client. Similarly, if the server sends the MAC first, the client should<br />

include the server’s MAC in its response.<br />

Our overall recommendation is not to introduce SSL-style configurability for your<br />

cryptography. If, for example, you use PAX, the only real option possible in the<br />

whole key exchange and authentication process is the size of the key that gets<br />

exchanged. We recommend that you use that key in a strong predetermined authenticated<br />

encryption scheme without negotiation. If you feel that you absolutely must<br />

allow for algorithm negotiation, we recommend you have a highly conservative<br />

default that you immediately start using after the key exchange, such as AES in CWC<br />

mode with 256-bit keys, and allow for renegotiation.<br />

As we discuss in Recipe 6.21, you should use a message counter along with a MAC<br />

to thwart capture replay attacks. Message counters can also help determine when<br />

messages arrive out of order or are dropped, if you always check that the message<br />

number increases by exactly one (standard capture replay detection only checks to<br />

make sure the message number always increases).<br />

Note that if you’re using a “reliable” transport such as TCP, you will get modest prevention<br />

against message reordering and dropped messages. TCP’s protection against<br />

these problems is not cryptographically secure, however. A savvy attacker can still<br />

launch such attacks in a manner that the TCP layer will not detect.<br />

In some environments, message ordering and dropping aren’t a big deal. These are<br />

the environments in which you would traditionally use an “unreliable” protocol such<br />

as UDP. Generally, cryptographically strong protocols may be able to tolerate drops,<br />

492 | Chapter 9: Networking<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!