Paxson Spring 2011 CS 161 Computer Security Final Exam: (Last) (First)
Paxson Spring 2011 CS 161 Computer Security Final Exam: (Last) (First)
You may consult two sheets of notes (each double-sided). You may not consult other notes,
textbooks, etc. Calculators and computers 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 170 minutes. There are 9 questions, of varying credit (300 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.
Question: 1 2 3 4 5 6 7 8 9 Total
Points: 36 24 38 35 24 36 32 35 40 300
Score:
Page 1 of 18
Problem 1 Software Vulnerabilities (36 points)
A broad class of security vulnerabilities come from attackers exploiting data vs. instruc-
tions. In these attacks, attackers provide input that’s intended to be used solely as
data (operated on in a pre-determined manner), but due to a flaw in the processing of
that data, elements of the data instead become treated as instructions (programming)
that control execution. That is, some of the data provided by the attacker winds up
being interpreted as “code” of some sort, even though that was not the intent of the
programmer.
For each of the following types of attacks, circle YES if it exploits (or at least, one
common version of it exploits) a data-vs.-instructions vulnerability, or NO if the nature
of the attack does not involve such a vulnerability. If uncertain, you might want to not
circle either, as points will be deducted for circling the wrong answer.
—— NO TOCTTOU (time-of-check-to-time-of-use)
—— NO Integer overflow
—— NO CSRF
—— NO Clickjacking
Solution: Two principles clearly apply. The use of two different staff members
to handle payment/receipt processing illustrates separation of responsibilities.
The fact that customers can only exit the building by passing through the second
check illustrates complete mediation.
That the user’s payment is captured by one staff member and the receipt then
double-checked by another plausibly illustrates defense-in-depth, though this is
not quite as compelling a fit because it’s not so clear that the register cashier
provides “defense”.
A number of other principles can apply, too, if accompanied by thoughtful
discussion.
(b) (8 points) Identify an attack that Costco seeks to prevent by having the staffmem-
ber draw the line down your receipt. Briefly describe how the attack works.
Solution: One threat is a replay attack whereby a customer returns to the store
and picks up another set of the same goods for which they’ve just paid. They
then directly exit the building. If challenged to produce a receipt, they show
the one from their previous trip.
For an ecommerce attack of a similar flavor, see http://www.schneier.com/
blog/archives/2011/05/vulnerabilities_2.html .
(b) (20 points) Is this mode of encryption secure? If so, state what desirable properties
it has that make it secure. If not, sketch a weakness.
(c) (12 points) Suppose we replace the computation of Ci with Ci = AES-128K (Ci−1 ⊕ Mi ).
Does this make the mode of encryption more secure, less secure, or unchanged?
Briefly explain your answer.
Solution: The mode is more secure. This alternate form is exactly the defini-
tion of CBC mode, which has been proven secure in the face of chosen plaintext
attacks.
Solution: An attacker can continually add shopping cart items without end,
exhausting the state available on the server for remembering the items.
(b) (16 points) Suppose that instead the site keeps a list of shopping cart items on
the client side. Every time a user clicks on add-to-cart, the server sends all of
the associated details (item name, price, quantity) in its reply, incorporating them
into a hidden HTML form field. Through some Javascript magic, now when the
user finally clicks on Checkout, all of the previously bought items embedded in the
hidden form field are sent to the server. The server then joins them together into a
list and presents the user with the corresponding total amount for payment.
1. Is this design vulnerable to the DoS attack you sketched above? Explain why
or why not.
2. Is this design secure from other attacks? If so, explain the basis for your claim.
If not, describe an attack on it. (You can assume that the site is safe from
web attacks such as CSRF, XSS and SQL injection, and uses HTTPS for the
Checkout procedure.)
Solution: It is not secure. As described, the server does not assure any
integrity of the information stored on the client. An attacker can modify
the information, in particular including the price.
Solution: A simple approach is that the botmaster registers two Twitter ac-
counts, A and B. (This requires only solving two CAPTCHAs, trivial to do by
hand.) A is used to send commands, and B for receiving commands. The bot
malware includes within it the credentials for the B account. New bots then
access the B account to read the tweets sent by the A account, which encode
the instructions to the bots.
An alternative approach would be to create a new account per bot. This requires
some discussion of how to solve all the CAPTCHAs; for example, by purchasing
solutions from a solving service available from the underground economy.
A third approach would be for the botmaster to register a single account and
use it to generate 1000s of identical tweets for each command they want to send
to their bots. Each bot visits the Twitter home page and examines the random
sample of tweets there to look for instructions.
(b) (12 points) Briefly describe a method that Twitter could use to detect botnets using
this C&C scheme.
Solution: For the first scheme, Twitter could look for access to the same ac-
count from many different IP addresses.
For the second scheme, Twitter could look for accounts whose followers all only
follow that account.
For the third scheme, Twitter could filter out tweets from their random sample
if the tweet is identical to a previous tweet.
(c) (6 points) How well will this detection method for Twitter method work?
Solution: The first scheme likely works well—it would be unusual for a legiti-
mate account to be accessed form 1000s of different IP addresses.
(d) (6 points) Briefly discuss a revised design that the botmaster could employ to resist
this detection by Twitter.
Solution: For the first defense, the botmaster will need to shift to using one of
the other two approaches given in part (a) above.
For the second defense, the botmaster could have the bots follow some other
randomly selected users in order to look more normal.
For the third defense, the botmaster could add some minor variation to their
repeated tweets so that Twitter doesn’t view them as identical.
Solution: YES for DNSSEC-only: the web traffic uses ordinary HTTP, which
does not provide any confidentiality of its contents.
NO for HTTPS-only and DNSSEC+HTTPS, as HTTPS provides confiden-
tiality. This assumes that you are prudent and do not continue with your web
surfing if your browser alerts you to a certificate problem. Otherwise, Prof. Evil
can launch a MITM attack and read the contents of your connections.
Solution: YES for all three schemes. DNSSEC does not hide the names you
look up nor the replies for those names. HTTPS does not mask your IP address
nor that of the servers you visit.
Solution: YES for DNSSEC-only, because HTTP does not provide integrity.
NO for HTTPS-only and DNSSEC+HTTPS, as HTTPS provides integrity.
This again assumes that you are prudent and do not continue with your web
surfing if your browser alerts you to a certificate problem.
Solution: YES for all three schemes. Prof. Evil can (for example) use TCP
RST injection to terminate your connections before you are able to receive any
web content. HTTPS protects above layer 4, but not layer 4 itself.
Solution: Here’s one of many possibilities. Suppose the RIAA suspects that
Alice is distributing illegal copies of Harry Potter and the Big Fat Residual
Check. They can compute S, the SHA-256 hash of the movie, and then try
to fetch https://plopit.com/storage/Alice/S . If the fetch succeeds then
they have proof that Alice did indeed upload the movie to PlopIt!, presumably
for purposes of sharing it. This undermines Alice’s privacy (putting aside the
legality of her actions).
Similarly, if there’s any specific content you wonder that Alice may have stored
in PlopIt!, this attack suffices to confirm its presence.
(b) (8 points) Describe a way that PlopIt! can defend against this attack. Your defense
should require minimal changes on their part, and not disrupt their service model
of enabling users to share files with friends.
Solution: A simple solution for the attack above is for PlopIt! to introduce
a salt when they compute hashes for uploaded files. Unless an attacker knows
the value of the salt, they cannot compute the correct URL for a given item of
content, and so won’t succeed with this “confirmation” attack.
(c) (12 points) PlopIt! has become successful enough that they incur significant ex-
penses for disk storage and network capacity. To reduce the volume of data they
deal with, PlopIt! changes its upload mechanism to use compression, as follows.
When a user wishes to upload a file, the uploader breaks the file into blocks. Before
uploading a given block, the uploader sends a SHA-256 hash of the block’s contents
to see whether the server already has that block. If so, the browser avoids sending
the block.
Given this compression (and assuming that PlopIt! uses the defense you developed
Your scheme: Solution: The key insight is that Bob can test whether a
given block of data is already present on PlopIt! by attempting to upload
that block and seeing whether the server responds with “that hash is already
present, no need to upload it.” This gives Bob a bit of information.
Alice and Bob can then agree upon a scheme of what blocks Bob should test
for in order to recover different bits of Alice’s message. For example, one
scheme is that Alice will upload a file for which each block looks like: “Bit n
of Alice’s message is a 1” or “Bit n of Alice’s message is a 0”.
She uploads one of these blocks, as appropriate, for each of n = 1, 2, . . .
She can include all of the blocks in a single file (perhaps each with a lot
of padding, depending on the blocksize used by PlopIt! ), or as separate
files. For each bit position, Bob then computes the corresponding hashes
for the “. . . is a 1” and “. . . is a 0” cases, and tests which of those blocks
is already present on the server.
A completely different approach is based on agreement of how to use Plo-
pIt! ’s search functionality. Alice and Bob can agree on a particular distinct
search phrase; Alice uploads data for Bob that matches that phrase; and
Bob then retrieves the data by issuing the search.
Extra credit (6 points): Describe how you can use your scheme to transmit GBs
of data to Bob in a feasible amount of time.
Solution: Once Alice can transmit a message of a few dozen bytes to Bob
using the first scheme outlined above, she can then use that channel to send
Bob a PlopIt! URL that points to a file holding a very large amount of data.
For the second scheme above, this is even easier: the search functionality
can pull up a very large file that Alice has stored in PlopIt!.
Solution: Here the key insight is that Alice and Bob can agree to treat part of
the hash present in the URL as data Alice wants to send to Bob. For example,
they can agree that every time Alice sends a URL to Bob, the bottom two
hexadecimal digits of the hash will encode the next byte of Alice’s message.
Alice now needs to put together a set of URLs that have hashes for which the
bottom hexadecimal digits match the different bytes she wishes to transmit.
She can do this by simply uploading a series of files with different contents,
observing the hashes that PlopIt! assigns to them (this works even if PlopIt!
adds salting to its hashes). It won’t take more than a few hundred such file
creations for Alice to have a complete set of URLs that amongst them have all
possible pairs of final hexadecimal digits. She then for each byte of her message
selects the URL that encodes that particular byte and sends it to Bob. The
warden will verify that the URL is indeed a valid PlopIt! URL and allow Bob
to receive it.
Solution:
This scheme only provides Confidentiality. While Bob cannot recover sk from
EKA (sk ) (because Bob lacks Alice’s private key), he can do so from EKB (sk ). The
encryption using M ⊕ PRNGsk is the same as a stream cipher, which will indeed
provide confidentiality. However, without a separate MAC, the communication
lacks integrity, and because Alice does not sign her message, it also lacks non-
repudiation.
Note that confidentiality for multiple messages is undermined by the lack of use
of an Initialization Vector. However, the problem framing specifically discusses
(b) (5 points) Alice generates a new symmetric key sk and sends to Bob: EKA (sk ),
EKB (sk ), AESsk (M )
Solution: The only difference between this scheme and the previous one is the
use of AES rather than the stream cipher. By itself, AES does not provide
integrity, so this scheme likewise only provides Confidentiality.
Solution: Broken: to decrypt with this scheme, Bob needs to possess Alice’s
private key.
Solution: Broken: this scheme requires Alice to possess Bob’s private key for
the signing operation.
Solution: Broken: to decrypt with this scheme, Bob needs to possess Al-
ice’s private key. Alice also needs to possess Bob’s private key for the signing
operation.
Solution: This solution provide all of Confidentiality (via the encryption us-
ing Bob’s public key), Integrity (via the digital signature over the hash of the
message), and Non-Repudiation (via Alice using her private key for the digital
signature).
Solution: This scheme provides Confidentiality (via the use of AES) and In-
tegrity (via use of the keyed MAC function). It does not provide non-repudiation
because the integrity/authentication component does not demonstrate posses-
sion of Alice’s private key.
That said, a legitimate criticism of this approach is the reuse of the same key
for encryption and the MAC computation, which may make it easier to break
the secret key.
(h) (5 points) Alice generates a new symmetric key sk and sends to Bob: EKA (sk ),
EKB (sk ), SignK −1 (sk ), AESsk (M )
A
Solution: The crucial insight for this problem is that Alice’s signature over
sk allows Mallory to recover sk simply by computing EKA (SignK −1 (sk )), which
A
Mallory can easily do since KA is well-known. Given possession of sk , all of the
properties fail to hold: Mallory can read the message and can alter it, so there is
no confidentiality and no integrity. There is no non-repudiation, either; all that
the signature can demonstrate is that Alice signed sk , but not that she signed
M.
However, Bob can still recover M . Therefore this scheme is marked None,
rather than Broken.