Docsity

Exam 1 with Solution - Computer Network and Security | CMSC 414, Exams of Cybersecurity

Toggle sidebar
bg1
CMSC 414 F06 Exam 1 Page 1 of 8 Name:_________________________
_____________________________________________________________________________________
Total points: 40. Total time: 75 minutes. 6 problems over 6 pages. No book, notes, or calculator
1. [14 points]
Are n=187 and e=9 valid numbers for RSA. Explain. If you answer yes, obtain the corresponding d.
_____________________________________________________________________
Solution
There are two requirements:
n must be a product of two primes
e must be relatively prime to φ(n) (so that d, which equals e
−1
mod-n, exists)
First requirement [2 points]
n = 187 = 11·17. 11 and 17 are primes. So this holds.
Second requirement [6 points]
Recall that if n =p·q where p and q are distinct primes, then φ(p⋅q) = (p−1)⋅(q−1)
So φ(187) = (11−1)⋅(17−1) = 160.
e, which equals 9, is relatively prime to 160 (because 9=3
2
and 160=10·16=2·5·2
4
=2
5
·5)
So this requirement holds.
Obtaining d [6 points]
So we need to find 9
−1
mod 160,
i.e., need to find a and b such that 1 = a·9 + b·160 (then a = 9
−1
mod 160).
We can use Euclid's algorithm to obtain a and b
[Below, rows n = −2 and n = −1 are initialization.
r
n
remainder (r
n-2
/r
n-1
);
q
n
quotient ( r
n-2
/r
n-1
);
u
n
u
n-2
− q
n
⋅u
n-1
;
v
n
v
n-2
− q
n
⋅v
n-1
;
]
n q
n
r
n
u
n
v
n
−2 160 1 0
−1 9 0 1
0 17 7 1 −17
1 1 2 −1 18
2 3 1 4 −71
3 2 0
From row n=2, we have
r
n
= gcd(9,160) = 1 (which we already knew), and
1 = (4)·(160) + (−71)·9 = 1
So d = −71 mod 160 = 160−71 mod 160 = 89
_____________________________________________________________________
pf3
pf4
pf5
pf8

Partial preview of the text

Download Exam 1 with Solution - Computer Network and Security | CMSC 414 and more Exams Cybersecurity in PDF only on Docsity!

_____________________________________________________________________________________

Total points: 40. Total time: 75 minutes. 6 problems over 6 pages. No book, notes, or calculator

1. [14 points] Are n=187 and e=9 valid numbers for RSA. Explain. If you answer yes, obtain the corresponding d.

_____________________________________________________________________

Solution

There are two requirements:  n must be a product of two primes  e must be relatively prime to φ(n) (so that d, which equals e−^1 mod-n, exists)

First requirement [2 points] n = 187 = 11·17. 11 and 17 are primes. So this holds.

Second requirement [6 points] Recall that if n =p·q where p and q are distinct primes, then φ(p⋅q) = (p−1)⋅(q−1) So φ(187) = (11−1)⋅(17−1) = 160. e, which equals 9, is relatively prime to 160 (because 9=3^2 and 160=10·16=2·5·2^4 =2^5 ·5) So this requirement holds.

Obtaining d [6 points]

So we need to find 9−1^ mod 160, i.e., need to find a and b such that 1 = a·9 + b·160 (then a = 9−1^ mod 160). We can use Euclid's algorithm to obtain a and b [Below, rows n = −2 and n = −1 are initialization. rn  remainder (rn-2/rn-1); qn  quotient ( rn-2/rn-1 ); un  un-2 − qn⋅un-1; vn  vn-2 − qn⋅vn-1; ]

n qn rn un vn − 2 160 1 0 − 1 9 0 1 (^0 17 7 1) − 17 (^1 1 2) − 1 18 2 3 1 4 − 3 2 0

From row n=2, we have rn = gcd(9,160) = 1 (which we already knew), and 1 = (4)·(160) + (−71)·9 = 1 So d = −71 mod 160 = 160−71 mod 160 = 89

_____________________________________________________________________

2. [6 points] Consider a sensor X that periodically sends a 64-octet measurement to a receiver Y. One day the administrator decides that X should encrypt the measurement data using DES in CBC mode. How many octets does X now send for each measurement? Explain your answer.


Solution

DES takes a 8-octet (64-bit) plaintext block and yields a 8-octet cipherblock. [2 points]

CBC requires a 8-octet initialization vector (IV) to be sent along with the cipherblocks. [2 points]

So X now sends 64 octets of cipherblocks [1 point] plus 8 octets of IV, for a total of 72 octets. [1 point]

[3 points if you don’t say anything wrong and you say that CBC sends cipherblocks + IV.]


4. [4 points] In the authentication protocol below, pw is A's password and J is a key derived from pw. Can an attacker that can eavesdrop messages (but not intercept or spoof messages) obtain pw by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.

A (has pw) B (has J)

send [conn] to B

generate random challenge R send [R] compute J from pw compute X  encrypt(R) with key J send [X] to B compute Y  decrypt(X) with key J if Y = R then A is authenticated

_____________________________________________________________________

Solution

Yes, an eavesdropping attacker can do off-line password guessing. [1 point]

The attacker has R and X, and does the following: [3 points] repeat { choose candidate password cpw; compute cJ from cpw; compute cX  encrypt(R) with key J } until cX = X; // cpw = pw

[Lose 1 point for saying: obtain J from R and X, and then use offline password guessing to get pw from J.]


5. [4 points] In the authentication protocol below, pw is A's password, J is a key derived from pw, and L is a high-quality key (which A gets from B as shown below). Can an attacker that can eavesdrop messages (but not intercept or spoof messages) obtain pw by off- line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.

A (has pw) B (has J, L)

send [ conn ] to B

X  encrypt(L) with key J generate random challenge R send [ X, R ] compute J from pw L  decrypt(X) with key J Y  encrypt(R) with key L send [ Y ] to B compute Y  encrypt(R) with key L if Y = Y then A is authenticated

_____________________________________________________________________

Solution

Yes, an eavesdropping attacker can do off-line password guessing.

The attacker has X, R, and Y, and does the following: [4 points] repeat { choose candidate password cpw; compute cJ from cpw; compute cL  decrypt(X) with key cJ compute cY  encrypt(R) with key cL } until cY = Y; // cpw = pw

[0 points if you say: obtain J from R, X, and Y, and then use offline password guessing to get pw from J.]


_____________________________________________________________________

Solution to 6

There are several solutions based on some form of authenticated Diffie-Hellman (DH). Two are outlined below.

Solution 1 (detailed handshake at end) : After obtaining L, principal A initiates DH to establish a session key S, where the DH messages are encrypted by L. Encrypting the DH messages by L ensures that the attacker cannot hijack the data exchange phase (otherwise the attacker can spoof A in the DH and thus have the session key established between itself and B).

Solution 2: After obtaining L, principal A initiates DH (with unencrypted messages) to establish a session key S. Then B sends a challenge, say R, encrypted with S, to which A responds with a message M applying S and L to R, for example:  [encrypt(encrypt(R) with L) with S]  [encrypt(hash(R | L) with S]  [encrypt(R+1) with S]

Grading: 2 points for Diffie-Hellman.

2 points for secure authentication:

  • −1 point for using a challenge-response (as in problem 5) before doing DH; this is vulnerable to offline password guessing.
  • −1 point if you have B authenticate A based receiving a static message generated by A, such as [encrypt(J) with L]. This is vulnerable to replay attack (i.e., attacker eavesdroping response from an earlier authentication and then replaying it here).
  • −1 point if you have B authenticate A based receiving a message generated by A with no input from B, such as [encrypt(R) with L, R], where R is a random number generated by A (not B). This is vulnerable to replay attack.

Solution 1 handshake details

A (has pw) B (has J, L)

send [ conn ] to B

X  encrypt(L) with key J send [ X ] compute J from pw L  decrypt(X) with key J

 <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solution Start - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->

choose Diffie-Helman g, p [2 points] generate random number SA compute TA  g SA mod p compute YA  encrypt( TA ) with L send [ YA , g, p ] to B

generate random number SB [2 points] compute TB  g SB mod p compute YB  encrypt( TB ) with L send [ YB ] to B session key S  TA^ SB^ mod p

 (^) session key S  TB^ SA^ mod p

A and B now have session key S (= S )

<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solution End -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->

<------------------- A and B exchange data ----------------->

<------------------- A and B disconnect ---------------------->