munotes®

Cryptanalysis and the Attack Models

Get access to whole semester resourcesSemester Pass

Chapter Eight

Syllabus topic Module 1, "Classical Encryption Techniques: Symmetric Cipher Model"; Course Outcome OC 1, "attack models"

Pages 35 to 40 of 678

In one line

Cryptanalysis is breaking a cipher without being given the key. What counts as breaking it depends entirely on what the attacker is assumed to hold, and that assumption is called the attack model.

In the wording a student can write in an examination: there are two general approaches to attacking a symmetric cipher. Cryptanalysis relies on the nature of the algorithm, together with some knowledge of the general characteristics of the plaintext or some sample plaintext and ciphertext pairs, to deduce a specific plaintext or the key itself. Brute force tries every possible key on a piece of ciphertext until an intelligible translation is obtained; on average half of all possible keys must be tried.

Why the attack model comes before the attack

Because "this cipher is secure" is meaningless without it. A cipher can be perfectly safe against an opponent who has only ciphertext and fall apart against one who can choose the plaintext. Both statements can be true of the same cipher, and an examination question that says "can this cipher be broken" is incomplete until you say what the attacker has.

There is a second, sharper reason. The stronger models are the realistic ones. It is tempting to assume the attacker sees only ciphertext, but in practice attackers very often know part of the plaintext: every message begins with the same header, every letter ends with the same closing, every file format starts with the same magic bytes. Designing against the weak model and being attacked in the strong one is how real systems fail, which is why modern ciphers are required to resist the strongest models in the list.

The five attack models, weakest attacker first

1. Ciphertext only. The attacker has the encryption algorithm and some ciphertext. Nothing else. This is the weakest position and the only one in which a cipher with a large keyspace is safe simply by having a large keyspace.

2. Known plaintext. The attacker has the algorithm, some ciphertext, and one or more plaintext and ciphertext pairs formed with the secret key. This is common in reality. If every internal-marks submission begins DEPARTMENT: then the attacker knows eleven characters of every message's plaintext before starting. The Hill cipher, which is unbreakable under model 1 for a large enough matrix, falls immediately under model 2, and the Hill chapter shows why.

3. Chosen plaintext. The attacker can choose plaintext and obtain the matching ciphertext. This sounds unrealistic and is not: any system that encrypts whatever a user submits, such as a web application that stores your search terms encrypted, hands the attacker this power. It is the model in which the determinism of textbook RSA becomes fatal.

munotes.in35

Cryptanalysis and the Attack Models

4. Chosen ciphertext. The attacker can choose a ciphertext and obtain the matching decrypted plaintext, or at least learn whether decryption succeeded. Systems that report "bad padding" hand this over, and that one bit of feedback is enough to recover plaintext byte by byte. The chapter on cipher block chaining shows the mechanism.

5. Chosen text. Both 3 and 4 at once. The strongest attacker, and the model a modern cipher is expected to resist.

Two kinds of security, and the one that matters

Unconditionally secure. No amount of ciphertext, and no amount of computing, is enough to recover the plaintext, because the ciphertext simply does not contain enough information to determine it. Exactly one cipher in this syllabus is unconditionally secure, the one-time pad, and its chapter proves it.

Computationally secure. Either the cost of breaking the cipher exceeds the value of the information, or the time required to break it exceeds the useful lifetime of the information. Every other cipher in this book is in this class. Notice that both tests are about economics, not mathematics: a cipher protecting a share price for one minute needs far less than one protecting a medical record for fifty years.

This is why key length recommendations carry dates, and why NIST publishes transition schedules rather than permanent answers.

The cost of brute force, computed

The listing below takes the keyspaces of the ciphers in this syllabus and works out how long an exhaustive search takes at two speeds: one thousand million keys a second, which is roughly a single modern processor core, and one million million million keys a second, which is far beyond any machine that exists and is included to show that the large keyspaces do not care.

SECONDS_IN_YEAR = 365.25 * 24 * 60 * 60

def show(name, keyspace_bits, extra=""):
    keys = 2 ** keyspace_bits
    average = keys // 2
    for rate, label in ((10 ** 9, "1e9/s"), (10 ** 18, "1e18/s")):
        years = average / rate / SECONDS_IN_YEAR
        if years < 1 / 365.25:
            t = "%.3g seconds" % (average / rate)
        elif years < 1:
            t = "%.3g days" % (years * 365.25)
        else:
            t = "%.3g years" % years
        print("%-22s %4d bits  %-7s %s" % (name, keyspace_bits, label, t))
    if extra:
        print("%-22s %s" % ("", extra))

show("Caesar", 4.7, "25 keys in all, so the bits are only an analogy")
show("DES", 56)
show("two-key 3DES", 112)
show("AES-128", 128)
show("AES-256", 256)
Caesar                    4 bits  1e9/s   1.2e-08 seconds
Caesar                    4 bits  1e18/s  1.2e-17 seconds
                       25 keys in all, so the bits are only an analogy
DES                      56 bits  1e9/s   1.14 years
DES                      56 bits  1e18/s  0.036 seconds
two-key 3DES            112 bits  1e9/s   8.23e+16 years
two-key 3DES            112 bits  1e18/s  8.23e+07 years
AES-128                 128 bits  1e9/s   5.39e+21 years
AES-128                 128 bits  1e18/s  5.39e+12 years
AES-256                 256 bits  1e9/s   1.83e+60 years
AES-256                 256 bits  1e18/s  1.83e+51 years
munotes.in36

Cryptanalysis and the Attack Models

Read four things out of that.

DES at one core is 1.14 years, which is why DES fell. Not because the number is large but because it is not large enough: a thousand such cores bring it to about ten hours, and at the fanciful rate in the second row it is thirty-six thousandths of a second. In 1998 a purpose-built machine did it in under three days, and the chapter on the strength of DES gives that machine's name and date.

AES-128 at a million million million keys a second is still more than five million million years. Brute force against a 128-bit key is not a matter of waiting for better hardware; the number does not come down within any span that means anything, and a machine running at a million million million keys a second does not exist.

The jump from 56 to 112 bits multiplies the time by about seventy-two thousand million million, from 1.14 years to 8.23e+16 years. Doubling a key length does not double the work, it squares the size of the keyspace, and that is the single most important intuition in this chapter.

The Caesar row is honest about being an analogy, and the printed bit count is not. The program was given 4.7 bits, which is 26 keys, and printed it with an integer format as 4; the timing beside it was computed from the 26. The timing is what matters: it is instantaneous, which is the point of the next chapter. It is also a small demonstration of why a number in a book should be produced by the program that printed it, because a bit count of 4 would be wrong and a reader would have no way to know.

A worked example: what an attacker actually does

The setup. An opponent captures ciphertext from a college portal. They do not know the cipher's key. They know, because the algorithm is published, that it is AES with a 128-bit key.

Step 1: consider brute force. From the table, out of the question.

Step 2: consider cryptanalysis of the algorithm. AES has been attacked publicly since 1998 and no attack materially better than brute force is known against the full cipher. So this route is closed too.

Step 3: attack something else. And this is the real lesson. The opponent stops attacking the cipher and attacks the key, the implementation or the person: a password that generates the key and can be guessed; a key stored in a file that is backed up to a public bucket; a timing difference in the implementation; a clerk who will read out a code over the telephone. Every successful real attack in Module 2 of this syllabus is of this kind.

munotes.in37

Cryptanalysis and the Attack Models

The step that carries the marks. "The cipher is strong" and "the system is secure" are different claims. A question asking you to assess a system's security is not asking about AES's key length; it is asking where the weakest point is, and it is almost never the cipher.

Distinctions that carry marks

ModelThe attacker hasRealistic?
Ciphertext onlyalgorithm, ciphertextyes, the minimum
Known plaintextthe above, plus plaintext and ciphertext pairs under the same keyvery, because of fixed headers
Chosen plaintextthe above, plus plaintext of their choosing encryptedyes, whenever a system encrypts user input
Chosen ciphertextthe above, plus ciphertext of their choosing decrypted, or an error messageyes, whenever a system reports why decryption failed
Chosen textboth of the abovethe model a modern cipher must resist
CryptanalysisBrute force
Usesthe structure of the algorithm, and knowledge of the plaintextnothing but the keyspace
Costvaries, and can be very smallfixed and computable in advance
Defeated bygood designa long key
Tells yousomething is wrong with the ciphernothing about the cipher
Unconditionally secureComputationally secure
Meansthe ciphertext does not determine the plaintext, whatever you dobreaking it costs more than the data is worth, or takes longer than the data matters
Examplethe one-time padevery other cipher here
Depends on a datenoyes

What beginners get wrong here

Brute force is not cryptanalysis. They are the two separate approaches in the definition, and a question that asks for "approaches to attacking a cipher" wants both, named and distinguished.

"On average half the keys" is part of the definition. Exhaustive search succeeds after half the keyspace on average, not after all of it, and the factor of two is worth stating because it is in the standard phrasing.

A large keyspace does not make a cipher strong. It makes brute force infeasible, which is a different claim. The monoalphabetic cipher of the next chapter but one has a keyspace of twenty-six factorial, which is far beyond brute force, and a schoolchild can break it with a pencil.

"Broken" rarely means "plaintext recovered". In cryptanalysis a cipher is considered broken when any attack does better than brute force, even if it is still far too expensive to run. That is why a cipher can be "broken" in a paper and still be safe to use for years, and why the retirement dates in the trend chapter lag the attacks.

munotes.in38

Cryptanalysis and the Attack Models

Quick revision

  • Two approaches: cryptanalysis (uses the algorithm's structure and knowledge of the plaintext) and brute force (tries every key; on average half of them).
  • Five models, weakest attacker first: ciphertext only, known plaintext, chosen plaintext, chosen ciphertext, chosen text.
  • Known plaintext is realistic because of fixed headers and formats. A modern cipher must resist chosen text.
  • Unconditionally secure: only the one-time pad. Computationally secure: everything else, and the test is economic.
  • Computed: DES 56 bits is about 1.14 years at a thousand million keys a second; AES-128 is beyond any machine.
  • Doubling the key length squares the keyspace.
  • A strong cipher does not make a secure system; the weak point is the key, the implementation or the person.
  • "Broken" in cryptanalysis means "better than brute force", not "readable".

Test yourself

1. Name and distinguish the two general approaches to attacking a symmetric cipher. Cryptanalysis uses the nature of the algorithm together with knowledge of the general characteristics of the plaintext, or some plaintext and ciphertext pairs, to deduce a plaintext or the key. Brute force tries every possible key until an intelligible translation appears, and on average succeeds after half the keyspace. Cryptanalysis exploits design; brute force ignores it.

2. List the five attack models and what the attacker holds in each. Ciphertext only: the algorithm and ciphertext. Known plaintext: also one or more plaintext and ciphertext pairs under the same key. Chosen plaintext: also the ability to encrypt plaintext of their choice. Chosen ciphertext: also the ability to decrypt ciphertext of their choice, or to learn whether decryption succeeded. Chosen text: chosen plaintext and chosen ciphertext together.

3. Why is known plaintext a realistic model rather than a pessimistic one? Because real messages have predictable parts: standard headers, fixed salutations, file format signatures, repeated field names. An attacker who knows the message format therefore knows some plaintext before starting, without any special access.

4. Distinguish unconditionally secure from computationally secure, and name a cipher in each class. An unconditionally secure cipher cannot be broken however much ciphertext and computing power are available, because the ciphertext does not determine the plaintext; the one-time pad is the only example. A computationally secure cipher is one where the cost of breaking exceeds the value of the information or the time exceeds its useful life; DES, AES and RSA are all in this class.

5. Roughly how long does exhaustive search of a 56-bit key take at a thousand million keys a second, and what does that tell you about DES? About 1.14 years on average. It tells you DES was defensible in 1977 and indefensible once a thousand such processors, or a purpose-built machine, could be pointed at it, which is what happened in the 1990s. The cipher did not change; the cost of computing did.

munotes.in39

Cryptanalysis and the Attack Models

6. Why does a large keyspace not by itself make a cipher strong? Because cryptanalysis does not search the keyspace. A monoalphabetic substitution has twenty-six factorial keys, which is far beyond brute force, and yet letter frequencies in the ciphertext reveal the mapping directly. Resistance to brute force and resistance to cryptanalysis are separate properties and both are required.

7. What does a cryptanalyst mean by saying a cipher is "broken"? That some attack performs better than exhaustive search, even if it remains far too expensive to carry out. It is a statement about the design rather than about present-day readability, which is why an algorithm can be broken in a paper years before it is formally withdrawn from use.

munotes.in40

The rest of this subject

These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.

Issue
Done!