Docsity

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

Toggle sidebar
bg1
CMSC 414 F08 Exam 1 Page 1 of 10 Name:____________________________________
____________________________________________________________________________________________________
Total points: 71. Total time: 75 minutes. 9 problems over 7 pages. No book, notes, or calculator
1. [14 points]
a. Are n=221 and e=3 valid numbers for RSA. Explain. If you answer yes, obtain the corresponding d.
b. Are n=221 and e=5 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 = 221 = 13·17. 13 and 17 are primes. So this holds.
Second requirement [4 points]
If n =p·q where p and q are distinct primes, then φ(p⋅q) = (p−1)⋅(q−1)
So φ(221) = (13−1)⋅(17−1) = 12·16 = 192
Part (a)
gcd(3, 192) > 1 [because 3 divides 192 exactly (with quotient 64)].
So e=3 is not valid. [2 points]
Part(b)
gcd(5, 192) = 1 [because 5 is prime and does not divide 192 exactly].
So e=5 is valid.
So d = 5
−1
mod 192 [2 points]
Obtaining d [4 points]
We want integers a and b such that 1 = a·192 + b·5 (then b will be d).
We can do trial and error or use Euclid’s algorithm, as shown below.
[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 192 1 0
−1 5 0 1
0 38 2 1 −38
1 2 1 −2 77
2 2 0 5 −192
From row n=1, we have
r
n
= gcd(5, 192) = 1 (which we already knew), and
1 = (−2)·(192) + (77)·5 [ = -384 + 385 ]
So d = 77 mod 192 = 77.
_____________________________________________________________________
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

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

____________________________________________________________________________________________________

Total points: 71. Total time: 75 minutes. 9 problems over 7 pages. No book, notes, or calculator

1. [14 points] a. Are n=221 and e=3 valid numbers for RSA. Explain. If you answer yes, obtain the corresponding d. b. Are n=221 and e=5 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 = 221 = 13·17. 13 and 17 are primes. So this holds.

Second requirement [4 points] If n =p·q where p and q are distinct primes, then φ(p⋅q) = (p−1)⋅(q−1) So φ(221) = (13−1)⋅(17−1) = 12·16 = 192

Part (a) gcd(3, 192) > 1 [because 3 divides 192 exactly (with quotient 64)]. So e=3 is not valid. [2 points]

Part(b) gcd(5, 192) = 1 [because 5 is prime and does not divide 192 exactly]. So e=5 is valid. So d = 5−1^ mod 192 [2 points]

Obtaining d [4 points] We want integers a and b such that 1 = a·192 + b·5 (then b will be d). We can do trial and error or use Euclid’s algorithm, as shown below. [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 192 1 0 − 1 5 0 1 0 38 2 1 − 38 1 2 1 − 2 77 2 2 0 5 −

From row n=1, we have rn = gcd(5, 192) = 1 (which we already knew), and 1 = (−2)·(192) + (77)·5 [ = -384 + 385 ] So d = 77 mod 192 = 77.

_____________________________________________________________________

2. [6 points] Sensor X periodically sends a 32-octet measurement to a receiver Y (1 octet = 8 bits). One day the administrator decides that X should protect the measurement data by adding a MAC obtained using DES in CBC mode (in the standard way). How many octets does X now send for each measurement? Explain your answer.


Solution

DES operates on 8-octet (64-bit) data blocks. CBC requires an IV of the encryption block size, so this too is 8 octets. The MAC consists of the IV and the residue (last cipherblock) of DES-CBC encryption. So X now sends 32-octet measurement plus 8-octet IV plus 8-octet residue: 48 octets total

[Roughly 3 points for the IV part and 3 points for the residue part.]

[3 points if you you don’t say anything wrong, you say that a residue and IV is sent and your numbers are off.]

[3 points if you correctly solved for encryption instead of MAC.]


4. [15 points]

client A (has J) server B (has J) generate random NA send [A, B, conn, NA] // msg 1 receive [A, B, conn, NA] SA  encrypt NA with key J generate random NB send [B, A, SA, NB ] // msg 2 receive [B, A, SA, NB] TA  decrypt SA with key J if TA = NA then B is authenticated else abort SB  encrypt NB with key J send [A, B, SB ] // msg 3 receive [A, B, SB ] TB  decrypt SB with key J if TB= NB then A is authenticated else abort

Client A and server B use the above authentication protocol. J is a key obtained from a password. B handles at most one client at a time. Answer the following; each part below is independent.

a. Consider an attacker that can only eavesdrop (i.e., hear messages in transit but cannot intercept messages or send messages with somebody else’s sender id). Can this attacker obtain J by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.

b. Consider an attacker that can only spoof A (i.e., send messages with sender id A and receive messages with destination id A, but not eavesdrop or intercept messages). Can this attacker obtain J by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.

c. Consider an attacker that can only spoof B. Can this attacker obtain J by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.

__________________________________________________________________________ Solution Part a. Attacker can do off-line password guessing:

  • get NA, SA (from msgs 1,2) or NA, SA (from msgs 2,3). [2 points]
  • run following password-guessing algorithm: for candidate password cpw do { obtain candidate key cJ from cpw; [3 points] cSA  encrypt NA with cJ; if cSA = SA then {cJ is J; exit} }

Part b. Attacker can do off-line password guessing:

  • generate any NA send [A, B, conn, NA] // msg 1 [3 points] receive [B, A, SA NB] // msg 2
  • run password-guessing algorithm in part a

Part c. Attacker cannot do off-line password guessing because it cannot get a <plaintext, ciphertext> pair. [2 points]

At most it can get NA (from receiving msg 1) and send msg 2 with a known NB. and garbage for SA. [3 points] But A will not respond with msg 3 because SA won’t match.


5. [5 points] The same protocol as in problem 4 except that J is now a high-quality key; B still handles at most one client at a time.

client A (has J) server B (has J) generate random NA send [A, B, conn, NA] // msg 1 receive [A, B, conn, NA] SA  encrypt NA with key J generate random NB send [B, A, SA, NB ] // msg 2 receive [B, A, SA, NB] TB  decrypt SA with key J if TA = NA then B is authenticated else abort SB  encrypt NB with key J send [A, B, SB ] // msg 3 receive [A, B, SB ] TB  decrypt SB with key J if TB= NB then A is authenticated else abort

Consider an attacker who can eavesdrop, intercept messages, spoof A, and spoof B. Can this attacker impersonate A to B. If you answer no, explain briefly. If you answer yes, describe the attack.

__________________________________________________________________________ Solution

To impersonate A to B, the attacker must deliver a suitable msg 3 to B, [2 points] i.e., one that has SB equal to the J{NB} (the encryption of NA with J).

Because the attacker does not have J, it must do one of the following:

  1. pass NB to A in msg 2 and get A to return J{NA} in msg 3, or
  2. pass NB to B in msg 1 and get B to return J{NA} in msg 2. [3 points] Option 1 is not possible because A sends msg 3 only if msg 2 also has J{NA}, which the attacker cannot do. Option 2 is not possible because each time B response to msg 1, it chooses a new NB.

So the attacker cannot impersonate A to B.

0 points for any of the following answers:

• Attacker impersonates A to B because it can (observe / relay) messages between A and B.

Any intermediate node in the path between A and B would be an attacker by this standard.

• Password-guessing attacks: these are not possible because J is a high-quality secret.

__________________________________________________________________________

7. [5 points] Human principal A uses an RSA public-key pair {< e , n >, < d , n > for signature purposes. However, A does not remember the public-key pair. Instead A remembers a password pw and obtains its public key pair from a directory server D. D’s entry for A consists of three pieces of information: e , n , and L , where L is d encrypted with a key J obtained from pw. Here is the protocol A uses to obtain its public-key pair and send a signed message to B.

A (has pw ) D (has <A, e , n , L >) B send [A, D, gimme] // msg 1

receive [A, D, gimme] send [D, A, e , n, L ] to A // msg 2 receive [D, A, e , n , L ] compute key J from pw d  decrypt L with key J

send [A, B, msg, signature on msg] // msg 3 receive [A, B, msg, signature on msg] ….

Can an attacker who can only eavesdrop (i.e., hear messages but not intercept messages or spoof messages) obtain d by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack..

__________________________________________________________________________ Solution

Yes, the attacker can obtain d by off-line password guessing.

From msg 2, the attacker gets e , n , L. [2 points] From msg 3, the attacker gets msg and sig (the signature on msg ).

It executes the following: for candidate password cpw do { [3 points] cd  decrypt L with cpw ; csig  signature on msg ; if csig = sig then {< cd , n > is A’s private key; exit} }

Note: Attacker does not need msg 3. It can chose any plaintext x and check whether xe · cd^ mod n equals x. __________________________________________________________________________

8. [10 points] Principals A and B use the following authentication protocol involving a shared high-quality secret key K and Diffie-Hellman parameters g and p (not secret).

A (has K, g, p) B (has K, g, p)

generate random NA and SA TA ← gSA^ mod p send [A, B, K{NA}, TA] receive [A, B, K{NA}, TA] MA ← decrypt K{NA} using K generate random NB and SB TB ← gSB^ mod p send [B, A, MA, K{NB}, TB] session key S ←TASB^ mod p

receive [B, A, MA, K{NB}, TB] if MA = NA then B authenticated else abort MB ← decrypt K{NB} using K session key S ←TBSA^ mod p send [ A, B, MB ] receive [A, B, MB] if MB = NB then A authenticated else abort <-- ---- A and B use session key S for data exchange ------->

Consider an attacker C that can eavesdrop, intercept messages, and send messages with another’s sender id. Can this attacker decrypt the data exchange between A and B? If you answer no, explain briefly. If you answer yes, describe the attack.

9. [1 point] Deterministic methods can be used to find out if a 10-digit numbers is prime. One helpful fact is that a number is divisible by 9 if and only if the sum of its digits is divisible by 9; for example, 12834 (and 84312) is divisible by 9 because 1+2+8+3+ equals 18 which is divisible by 9. Prove this fact.


Solution

Figure it out. It’s easy.