Exam Attack

In this lab you have to implement a model of a multiple choice exam for the scenario where students Alice and Bob are taking the exam. Exam is held by the examiner who has a pool of questions. The examiner asks students to answer questions from this pool. Alice and Bob are given in turn the text of a question and possible choices. After reading a questions they choose one of the possible options. When all answers are collected, the examiner calculates the totals and tells Alice and Bob their results.

Optional: once the exam is over, the examiner makes the correct answers available to Alice and Bob.

The lab consists of two parts.

Part One

In part one you are given a code for three Java classes ExamRoom, Question, and Exam and for the Java interface IStudent. These classes and interface can be described as follows:

The task in the this part is to write a malicious class Student (implementing IStudent) that leaks answers of Alice to Bob, allowing students to cheat during the exam. Alice may follow some simple strategy when choosing the right answer. An example of such a strategy might be just a random guess. In order to compile against the provided class ExamRoom, make sure your constructor in Student class accepts a string argument that is a name of the student.

You need to demonstrate the attack by providing the output (as below) that shows that Bob always chooses the same answer as Alice. There should be no direct communication between Bob and Alice or use of static class fields - the attack must exploit a weakness in the Exam class.

> java ExamRoom
Starting exam
Alice got question: What café in Göteborg offers Kope Luwak coffee?
Options: (0) Blue Mountain Café (1) Mauritz Kaffe 
::Alice replies 1
Bob got question: What café in Göteborg offers Kope Luwak coffee?
Options: (0) Hello, Bob. I think, the answer is 1 -Alice (1) Mauritz Kaffe 
::Bob replies 1
Alice got question: What's the price of a Kope Luwak espresso?
Options: (0) 100SEK (1) 60SEK 
::Alice replies 0
Bob got question: What's the price of a Kope Luwak espresso?
Options: (0) Hello, Bob. I think, the answer is 0 -Alice (1) 60SEK 
::Bob replies 0
exam finished
Student Alice has got 1 points
Student Bob has got 1 points
done.

Note how Bob obtains the answer from Alice.
Optional: what other attacks can you perform (i.e., against availability, integrity)?

Part Two

In part two you need to use Jif to implement this scenario.

How to start

To use Jif, login to any Linux machine (e.g. remote1.tekno.chalmers.se), and run the course setup script.

> setup_course TDA600

Use the skeleton ExamRoom.jif as a starting point. To compile ExamRoom.jif, type

> jifc -classpath $JIF/tests ExamRoom.jif -explain
To run the program, type
> jif -classpath $JIF/tests ExamRoom
Starting exam
exam finished
done.

When you complete the second part, the output of the program should look as follows:

Starting exam
exam finished
Alice has got 1 points
Bob has got 0 points
done.

Hints

Reporting

Submitting instructions

Demands

Downloads

Links

Check these before you start coding

 

Jif is installed on the student system. You can also experiment with your own installation at your own risk: [Jif 2.0.1 download]