Security Engineering. Ross Anderson

Чтение книги онлайн.

Читать онлайн книгу Security Engineering - Ross Anderson страница 63

Security Engineering - Ross  Anderson

Скачать книгу

alt="upper X"/> encrypted under the key upper K.

      Then the protocol between the access token and the parking garage can be written as:

upper T right-arrow upper G colon upper T comma StartSet upper T comma upper N EndSet Subscript upper K upper T Baseline

      This is standard protocol notation, so we'll take it slowly.

      The token upper T sends a message to the garage upper G consisting of its name upper T followed by the encrypted value of upper T concatenated with upper N, where upper N stands for ‘number used once’, or nonce. Everything within the braces is encrypted, and the encryption binds upper T and upper N together as well as obscuring their values. The purpose of the nonce is to assure the recipient that the message is fresh, that is, it is not a replay of an old message. Verification is simple: the garage reads upper T, gets the corresponding key upper K upper T, deciphers the rest of the message, checks that the nonce upper N has not been seen before, and finally that the plaintext contains upper T.

      One reason many people get confused is that to the left of the colon, upper T identifies one of the principals (the token that represents the subscriber) whereas to the right it means the name (that is, the unique device number) of the token. Another is that once we start discussing attacks on protocols, we may find that a message intended for one principal was intercepted and played back by another. So you might think of the upper T right-arrow upper G to the left of the colon as a hint as to what the protocol designer had in mind.

      A nonce can be anything that guarantees the freshness of a message. It can be a random number, a counter, a random challenge received from a third party, or even a timestamp. There are subtle differences between them, such as in the level of resistance they offer to various kinds of replay attack, and the ways in which they increase system cost and complexity. In very low-cost systems, random numbers and counters predominate as it's cheaper to communicate in one direction only, and cheap devices usually don't have clocks.

      Key management in such devices can be very simple. In a typical garage token product, each token's key is just its unique device number encrypted under a global master key upper K upper M known to the garage:

upper K upper T equals StartSet upper T EndSet Subscript upper K upper M

      This is known as key diversification or key derivation. It's a common way of implementing access tokens, and is widely used in smartcards too. The goal is that someone who compromises a token by drilling into it and extracting the key cannot masquerade as any other token; all he can do is make a copy of one particular subscriber's token. In order to do a complete break of the system, and extract the master key that would enable him to pretend to be any of the system's users, an attacker has to compromise the central server at the garage (which might protect this key in a tamper-resistant smartcard or hardware security module).

      But there is still room for error. A common failure mode is for the serial numbers – whether unique device numbers or protocol counters – not to be long enough, so that someone occasionally finds that their remote control works for another car in the car park as well. This can be masked by cryptography. Having 128-bit keys doesn't help if the key is derived by encrypting a 16-bit device number, or by taking a 16-bit key and repeating it eight times. In either case, there are only 2 Superscript 16 possible keys, and that's unlikely to be enough even if they appear to be random2.

      Protocol vulnerabilities usually give rise to more, and simpler, attacks than cryptographic weaknesses do. An example comes from the world of prepayment utility meters. Over a million households in the UK, plus over 400 million in developing countries, have an electricity or gas meter that accepts encrypted tokens: the householder buys a magic number and types it into the meter, which then dispenses the purchased quantity of energy. One early meter that was widely used in South Africa checked only that the nonce was different from last time. So the customer could charge their meter indefinitely by buying two low-value power tickets and then feeding them in one after the other; given two valid codes upper A and upper B, the series upper A upper B upper A upper B upper A upper B period period period was seen as valid [94].

      So designing even a simple token authentication mechanism is not as easy as it looks, and if you assume that your product will only attract low-grade adversaries, this assumption might fail over time. An example is accessory control. Many printer companies embed authentication mechanisms in printers to ensure that genuine toner cartridges are used. If a competitor's product is loaded instead, the printer may quietly downgrade from 1200 dpi to 300 dpi, or simply refuse to work at all. All sorts of other industries are getting in on the act, from scientific instruments to games consoles.

Скачать книгу