Lecture 4.2 - Block Cipher Part 2 Flashcards

(42 cards)

1
Q

Are the constructions of block ciphers secure?

A

There are constructions that are BELIEVED to be secure. Because someone trustworthy said they are safe (IBM, NSA).

Experts have tried to break the construction and failed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the typical requirements for block cyphers?

A

Security - ideally, the best possible attack should be a brute force key search

Efficiency in implementation:
- 8 bit microcontroller and smart-cards with limited memory space
- Tablet, mobile phone
- PC, Workstation, Server
- Specialized hardware (ASIC, FPGA) - speeds up to gigabits/second

Flexibility of the key: the key size can be adapted efficiently

Extended sec requirements: Protection against side-channel attacks, related-key attacks,…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain the iterated cipher design.

A

R: {0,1}^a x {0,1}^m –> {0,1}^m - a “secure” round-function.

Key k goes into Round-keys (makes multiple keys as part of a), then the input message is encrypted using all the keys one by one these steps are called rounds

If M0 is input message then:
M1 = Rk1(M0)
M2 = Rk2(M1)

Mn = Rkn(Mn-1)

Mn is the output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the advantages of the iteraded cipher design

A

Simplicity:
- easy to implement
- protection against backdoors in the design

Symmetry (repetitive design patterns):
- smaller circuits (in hardware)
- easier to program (in software)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Examples of the iterated cipher paradigm?

A

Feistel-Cipher (DES - Data Encryption Standard)

Substitution-Permutation networks (AES - Advanced Envryption Standard)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the Feistel Network cipher.

A

The input block is split into two halves L0 and R0 where each half is m/2 bits if the total block size is m.
The function is applied in n rounds, each using a different round key ki.

Each round follows these steps:
- Apply a round function f using the right half Ri and the round key ki
- XOR the result with Li
- The new right becomes the previous left half and the new left half is computed using f
- Repeat n rounds

Typically in the last step we would swap left and right, but in ciphers such as DES, we don’t

Even if f is NOT easily invertible, every round can be EASILY INVERTED!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In theory when is a feistel network a PRP?

A

Assuming that f is a pseudorandom function (PRF), that we use for the construction of the feistel-network

Then:
- 2-rounds Feistel-network isn’t a PRP
- 3-rounds Feistel-network is a PRP
- 4-rounds Feistel-network is a strong PRP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do we have to specify to get block cipher from feistel network?

A
  1. Concrete parameters:
    - Block size: m
    - Key size: |k|
    - Number of rounds: n
  2. Algorithm for generating the round keys
  3. The round function f.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What values are specified for the feistel network in DES?

A

Key size:
- effective: 56 bits
- formal: 64 bits (8 for parity check)

Block size: 64 bits

Number of rounds: 16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the DES diagram look like?

A

Input -> Initial permutation (IP) -> 16 rounds of feistel network with keys going in -> Final Permutation (IP^(-1)) -> Output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How secure is DES?

A
  • The biggest weakness is the short key (brute-force possible)
  • Also, block size is too short

Apart from that - DES is a secure design:
- even after 4 decades brute-force still most practical attack

Well known theoretical attacks:
- Differential cryptanalysis
- Linear cryptanalysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What alternatives are there to DES to increase the key size, and what are their specifications?

A

2DES

2DESk1,k2(m) := DESk1(DESk2(m))
- Vulnerable to Meet-in-the-middle attacks
- Security the same as with DES (approx. 2^57)

3DES

3DESk1,k2,k3(m) := DESk1(DESk2^(-1)(DESk3(m)))

Options for choice of key:
- k1,k2,k3 independently
- k1,k2 independently and k3-k1
k1=k2=k3 => DES=3DES (backward compatible)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain how substitution-permutation networks work

A
  1. The main secret key k is expanded into multiple round keys k0,k1…kn
  2. The input plaintext M0 is XORed with the first round key k0:
    M’=M0 ⊕ k0
  3. Rounds of the SPN (repeated multiple times), each round has 3 operations:
    - Substitution - the state is divided into small blocks, each block passes through an S-box (substitution box), which applies a non-linear transformation. Goal to introduce confusion.
  • Permutation (π Layer) - Output of s-box layer is shuffled according to a predefined permutation function π. This ensures diffusion (small input change changes through the whole block)
  • Add Round Key - The transformed state is XORed with the next round key ki (ensures each round is unique and dependent on the key)

After the final round the state is XORed with the final round key kn and the result Mn is the ciphertext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the round function in AES.

A

The message M is represented as a 4x4 matrix of bytes where one byte (Aij ∈ {0,1}^8)

The matrix is 4x4x4 = 128 bits, then:
- Sub Bytes
- Shift Rows
- Mix Columns

Output X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain how AES encryption utilizes the round function.

A

In the first round the initial key is added straight to the message so it would be there from the start. Then perform the round function over and over again until the last round.

Last round, just do sub bytes and shift rows, then add final round key kn and we get the Output Mn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Explain the decryption of AES.

A

Just invert the whole process, start from the cyphertext, add final round key kn, inverse shit rows, inverse shift bytes, and add ki round key.

Then, perform the round function but using inverses until last round, last round just add k0 and we get the input M0 plaintext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the properties of AES?

A
  • Permutation for fixed k: AES(k,.): {0,1}^128 –> {0,1}^128
  • Easy to invert for known k: AES^(-1)(k,.): {0,1)^128 –> {0,1}^128
  • All AES transformations can be represented by operations in the Galois field GF(2^n)
  • Concrete Parameters:
    Key size: 128 192 265
    Number of Rounds: 10 12 14
  • Security: the best attack known is the Biclique-attack
18
Q

Attacks on block siphers?

A

Brute force (always possible!) - does not use the property or the structure of the cipher: ideal cipher
- Idea: Try out all keys
- Time-Memory tradeoff:
– N = Size of the key space (=|K|)
– D = Data complexity (=|Target data available to the adversary|)
– P = Time complexity of pre-processing
– T = Time complexity of the attack after getting the target data
– M = Memory space of the adversary

Adversary Models:
- Known Plaintext Attack (KPA)
- Chosen Plaintext Attack (CPA)

19
Q

Time - Memory tradeoffs

A

Check slide 47 in Block Ciphers 4.2 (there are tables)

20
Q

Explain TMTO: Meet-in-the-middle attack

A

Goal: Given (m,c) find (k1, k2) such that: c=Ek2(Ek1(m))

Generic attack: Ek1(m) = Ek2^(-1)(c)

Remark: Successful against 2DES

It will attempt to encrypt the message using all possible instances of k1 and store the intermediate result. Then it will attempt to decript c using all possible instances of k2 and store the intermediate result. Then it will match the intermediate values, if the values match, that’s a potential key value pair candidate.

21
Q

What’s the complexity of a naive brute force attack on 2des?

22
Q

What’s the complexity of the meet-in-the-middle attack on 2DES

23
Q

Are differential and linear cryptanalysis practical on DES?

A

Neither differential nor linear cryptanalysis are practical.

Differential
- Chosen-plaintext attacks
- D = 2^47 requests to the encryption oracle -> not practical
- But: a small change in DES makes the differential analysis much easier
- Moral: NSA and IBM knew about differential cryptanalysis

Linear
- Known plaintext attack
- D = 2^43 pairs -> still not practical

24
Q

Explain attacks on the implementation of DES

A

Side-channel attacks
- Observe the device while encryption/decryption
– Measure the time needed for the cryptographic operation
– Measure the power consumption

Fault attacks
- Induce an Error (e.g. with a laser beam) to computation
– Observe the changes in the behavior
– E.g.: Errors in the last couple of rounds in DES reveal the key k

“It’s dangerous to implement cryptography by yourself!”

25
What is the goal of domain-extension block ciphers and how are they applied?
Goal: Encryption of messages with arbitrary length - Without increasing the length of the ciphertext (compared to the plaintext) - Block ciphers can not be used directly to encrypt long messages - They are always used in a certain "Mode of operation"
26
Name some modes of operation of block ciphers in domain-extension
Modes of operation: - Electronic Codebook (ECB) mode <-- Not secure - Cipher-Block Chaining (CBC) mode - Output Feedback (OFB) mode - Counter (CTR) mode
27
Explain Electronic code book (ECB) mode
Plaintext is split into blocks, each block is separately encrypted using Fk(block) we get blocks of cyphertext which concatinated represent the cyphertext of the whole input. Decryption is just splitting into blocks again and applying Fk^(-1) It is not secure: - In theory: it is deterministic and has no state and therefore cannot be CPA secure
28
Explain the cipher block chaining (CBC) mode.
If |m| isn't long enough we add padding. A random |IV| is applied to XOR the first block of m and then added into the function, the output of the first block is used to XOR the 2nd block and then pass it to the function, repeat until last block. Output is a cyphertext with padding included. Dec is performed just opposite, IV is given, then pass block 1 into the Fk^(-1) then XOR with IV to get plaintext of block 1, then use again the cytext of block one to xor with block 2 after it's Fk^(-1), etc until last block. If unsure check slide 45 of 4.2 block ciphers (on the slide says 63) - Errors don't propagate (error in ci only affects blocks mi and mi+1 - Not paralizible during Enc but yes during Dec (since all cytexts are available). - If 1 bit of plaintext is changed, everything following it needs to be encrypted again - Not suitable for HDD encryption, etc. If F is a PRP then F-CBC is CPA-secure
29
Explain how counter-mode (CTR) works, and it's specifics.
Plaintext is split into blocks, Into Fk function a random IV + blockNumber is passed. Then the block is XORed with the output of the function and we get the block of ciphertext, repeat this for all blocks where the blockNumber will change as the blocks change. For Dec, IV is again passed into the function, again XORed with the each block of ciphertext and the plaintext is gotten. Properties: - Resistant to errors - they don't propagate, errors in block ci only affect block mi - Parallelizable in both Enc and Dec - 1 bit in plaintext changes only the encryption of the block that contains it - Precomputation possible - if F is a PRF, then F-CTR is CPA-secure - There's proof on slide 53 of 4.2 block ciphers (slide says 71), but ain't no way I am writing that in here
30
In Chosen ciphertext attack security there are 2 types of attacks where attacker has access to different things, what are the attacks and what can the attacker access?
Security against chosen plaintext attack (CPA) - Attacker has access to the encryption oracle Security against chosen ciphertext attack (CCA) - Attacker has access to both the encryption and decryption oracle
31
Explain the CCA-Security game.
Sec param is sent to both Attacker and oracle. 1. Oracle generates the key 2. Attacker sends some requests to the oracle to figure out the patterns in enc/dec 3. Oracle enc/dec the requests 4. Attacker sends 2 messages of same length to the oracle 5. Oracle randomly chooses one and encrypts it and sends back the ciphertext 6. Attacker sends some more requests to the oracle to figure out patterns (not allowed to ask for dec of the message ciphertext from before) 7. Oracle enc/dec the requests 8. Attacker attempts to guess which message was encrypted randomly by the oracle in step 5 9. If the attacker guessed correct output is 1, if wrong output is 0 The algo is secure if for all polynomial time (efficient) adversaries A exists a negl(n) function such that the probability of the adversary guessing right is less than or equal a random guess + negl(n)
32
Does IND-CPA security imply IND-CCA security and vice versa.
CPA does not imply CCA security, but CCA does imply CPA
33
Explain the malleability in CBC mode
The attacker can modify the cyphertext without knowing the key, so that when decrypted it results in modified plaintext m' In CBC since when decripting the inverse of the block cipher is applied, and the result is XORed with the previous ciphertext block (or IV for the first block). The attacker can modify the IV or a ciphertext block, and therefore influence the bits being inverted during XOR resulting in a different plaintext.
34
Explain how padding works and why it's needed.
Problem: Block ciphers encrypt fixed-size blocks (e.g. 16 bytes for AES). If the plaintext is not a multiple of the block size, padding is required. - Break plaintext into blocks - Apply padding to the last block (to fill up missing bytes) - Encrypt all the blocks (including last with padding)
35
Explain padding according to PKCS#5
Mechanism: - Ensures the recipient can identify the exact end of the message - Padding consists of b bytes, where each byte has the value of 0xB (where B = b = number of padding bytes). - Always added, even if the block is already full Example (block size = 8 bytes) - If the last block has 5 plaintext bytes, we need 3 padding bytes (0x03 0x03 0x03) - If the last block is full, an entire new block of padding (0x08 0x08... 0x08) is added.
36
Explain the CCA in applications utilizing padding.
User encrypts and sends data to server. Server decrypts the message and checks correctness of padding, if padding is OK it processes the message, if it isn't OK it returns an error. The problem with this is that the error message reveals information about whether the padding is valid, which an attacker can exploit. In the padding oracle attack (using CCA),: - The adversary intercepts the encrypted message in transit. - Adversary modifies the ciphertext and sends to the server -- Server processes the message -- If padding incorrect, returns error message -- If padding correct, processes the message - By analyzing the server response (error or no error), the attacker learns information about the plaintext -- By systematically modifying bytes and observing responses, the attacker can gradually decrypt the entire message without knowing the key -- The responses let the attacker figure out the length of padding
37
Explain how the attacker gets the number of padding bytes and then reconstructs the message.
Get number of padding bytes: - Attacker modifies the first byte of cq and creates a new ciphertext c'=IV||c1'||c2 - Send c' to the server for decryption - Observe the response -- If decryption fails (padding err), it means the server checks all L bytes of padding -> b=L -- Otherwise, b < L, and the attacker repeats the process byte by byte to determine the exact padding length Get message m: - Once the attacker knows b, they can recover the original message byte by byte - Attacker creates modification Δi that alters the last byte to target a specific plaintext byte B - Modify the ciphertext and send to the server - Observe the response -- If padding valid, byte is correct -- Invalid, try again - Repeat for all bytes until full plaintext recovered Max 2^8 guesses per byte.
38
What are the core issues of padding?
Existence of a padding oracle in the application - Is not always easy to prevent (e.g. timing side channel) - The attacker can efficiently create new ciphertexts that are related to the original ciphertext
39
How to avoid the attacks on padding?
By using Message Authentication Codes (MACs)
40
Explain the intuition behind MACs
MAC protects the authenticity of the ciphertext - Adversary cannot create valid MACs - All MACs created by the adversary are invalid The server ("Padding oracle") becomes an oracle, that responds with an error message every time
41
Explain the need for stronger Pseudo-Random Permutation and what it is.
Construction of a CCA-secure encryption scheme requires stronger primitives than PRP The probabilistic polynomial time (PPT) distinguisher tries to distinguish between - Fk(x) which is computed using a secret key k - f(x) which is a truly random permutation The attacker doesn't initially know whether the function is F or f The difference is that in a Strong PRP, the attacker also gets access to the inverse function Fk^(-1)(.) or f^(-1)(.) The goal is to ensure that even with this additional access, an attacker cannot distinguish Fk from a truly random permutation.
42