Wagner Spring 2014 CS 161 Computer Security Final Exam: (Last) (First)
Wagner Spring 2014 CS 161 Computer Security Final Exam: (Last) (First)
Wagner Spring 2014 CS 161 Computer Security Final Exam: (Last) (First)
You may consult three sheets of notes (each double-sided). You may not consult other notes,
textbooks, etc. Calculators, computers, and other electronic devices are not permitted.
Please write your answers in the spaces provided in the test. We will not grade anything on
the back of an exam page unless we are clearly told on the front of the page to look there.
You have 180 minutes. There are 14 questions, of varying credit (200 points total). The
questions are of varying difficulty, so avoid spending too long on any one question.
Do not turn this page until your instructor tells you to do so.
Page 1 of 23
Problem 1 True or False (17 points)
Circle True or False. Do not justify your answer.
(a) True or False: The SHA256 hash of a user-generated passphrase makes a good
key for an encryption scheme because hashes are random.
(b) True or False: The reason that AES-CBC mode is preferred over ECB mode is
because CBC provides integrity.
(c) True or False: Comparing a hashed password to a precomputed list of hashes of
commonly used passwords is one example of a side-channel attack.
(d) True or False: In Bitcoin, if there are multiple versions of the block chain, the
longest version will be accepted as the winner/valid block chain.
(e) True or False: A denial-of-service attack requires injecting spoofed packets.
(f) True or False: TLS provides both confidentiality and integrity for messages sent
using it.
(g) True or False: If there are only a few possibilities for M , an eavesdropper who
sees SHA256(M ) can figure out what M was.
(h) True or False: If there are only a few possibilities for M , an eavesdropper who
sees EKB (M ) can figure out what M was. (Assume EKB (M ) is the El Gamal
encryption of M under Bob’s public key and the eavesdropper doesn’t know Bob’s
private key.)
(i) True or False: If there are only a few possibilities for M , an eavesdropper who
sees the AES-CBC encryption of M can figure out what M was. (Assume the
eavesdropper does not know the key used for AES-CBC encryption.)
(b) An attack that reconstructs what you are typing on your keyboard by recording
and then analyzing the specific sounds made as you type would be an example of a
attack.
(c) To evaluate an intrusion detection system, we usually need to know its false
rate, its false rate, the base rate of
attacks, and the relative cost of a vs. a
.
(c) AirBears is an open (unencrypted) Wifi network. Suppose you are using AirBears
to connect to HTTP websites on the Internet. Can another Berkeley student who
is nearby eavesdrop on the payload of all the packets you send over this Wifi link?
(Answer yes or no.)
(d) Assume you are using AirBears to connect to HTTP websites on the Internet, as
before. Can a random stranger off the street (who has no affiliation with the campus
and doesn’t have any Berkeley account) eavesdrop on the payload of all the packets
you send over this Wifi link, assuming the stranger is nearby? (Answer yes or no.)
(e) You’re still using AirBears. You visit your bank web site in your browser. Assume
your bank uses HTTPS for everything (no HTTP). Can a nearby Berkeley stu-
dent observe your bank account balance by eavesdropping on the Wifi connection?
(Answer yes or no.)
(b) What is the difference between reflected XSS and stored XSS?
Justification:
(b) When designing their cryptography system, www.doh.com assumed that no one
could figure out their data encryption scheme since they guard their source code
very carefully.
Principle:
Justification:
if (/*TODO*/)
return -1;
if (memcmp(data, "ASCII\0\0\0", 8) != 0)
return -1;
n = len - 8 + 1;
val = malloc(n);
if (val == NULL)
return -1;
memcpy(val, data+8, n-1);
val[n-1] = ’\0’;
(d) Perform reflected XSS against some web site that has a reflected XSS vulnerability
(b) Waiting at the bus stop the next day, Prof. Goodhearted realizes the flaw in her
scheme. To repair the flaw, she has the idea of letting K = Hslow (N ), where Hslow
is a slow hash function chosen so that computing Hslow on a single input will take
100 milliseconds. Is this adequate to fix the flaw? In other words, is this enough
that students will have to solve the math puzzle to learn the hint? Write “yes” or
“no”, then explain why or why not.
K=
(d) The next day, Prof. Goodhearted has second thoughts: asking students to solve all
three puzzles might be a bit too much. Instead, she wants students to be able to
unlock the hint M if they solve any two out of the three math puzzles (and it should
be as hard as possible for dishonest students to learn the hint if they’ve solved fewer
of the puzzles; for her purposes, it suffices if a dishonest student would need to solve
at least one of the puzzles to learn the hint). She spends all day trying to figure
out a way to do this, without any luck, so she gives up. That night, she wakes up
in the middle of the night with a brilliant idea for how to do this: she will compute
three ciphertexts C1 = EK1 (M ), C2 = EK2 (M ), C3 = EK3 (M ), hardcode C1 , C2 , C3
into her program, and then the program will ask the student to input their two
solutions and the program will do something clever. Pleased with herself, she goes
back to sleep.
Unfortunately, when she wakes up in the morning she can’t quite remember how her
program was going to work or how she was planning to choose the keys K1 , K2 , K3 .
Help her out. How should she define K1 , K2 , K3 ? (You are not allowed to use mod-
ular arithmetic or public-key cryptography; Prof. Goodhearted is sure she didn’t
need them. Don’t describe how her program should work; she can figure that out
on her own.)
K1 =
K2 =
K3 =
(e) The initial sequence number is H(k || g) mod 232 , where g is a global counter that
is initialized to zero at boot time and is incremented once each time a new initial
sequence number is needed.
Is it secure?
If insecure, the attack:
The machine A has initiated a TCP connection to machine J. As it turns out, all packets
from A to J happen to follow the path indicated by the right-facing dotted arrows, and
all packets from J to A happen to follow the path indicated by the left-facing dotted
arrows. Machines A and J use modern TCP software and do not have any special
defenses against attack.
(a) Suppose that Mallory controls (only) machine C. Can she inject RST packets des-
tined for machine J into this TCP connection, such that they will be accepted by
machine J? Why or why not?
(b) Suppose that Mallory controls (only) machine C. Can she inject spoofed data into
this TCP connection, so machine J will accept the spoofed data thinking that it
came from machine A? Why or why not?
(c) Suppose that Mallory controls (only) machine H. Can she inject spoofed data into
this TCP connection, so machine J will accept the spoofed data thinking that it
came from machine A? Why or why not?
(e) Suppose that Mallory can eavesdrop on all packets that go through machine F (but
cannot inject forged packets from F). Also Mallory can run software on machine F
that lets her inject forged packets from C (but cannot eavesdrop on packets going
through C). Can Mallory injected spoofed data into the TCP connection, so that
it will be accepted by machine J as though it came from A? Why or why not?
(b) Explain why this is not a secure way of scrambling the SSNs.