Capture the Flag Exercise 1

In this exercise each team will play the defender role (Blue team) for their own system and the attacker role (Red team) for another team's system. The team composition and pairing is the following:
TeamMembersAttacks teamMentor
1Zhou, Jiachen
Gerow, Michael
Puncel, Robert
2Hao Shi
2Wang, Jiahua
Garcia, Elizabeth
Kapitanski, Eric
3Simon Woo
3Rodriguez, Priscilla
Del Guercio, Chris
McLaughlin, Christopher
Batni, Prabhanjan
1Xiyue Deng
Here are the goals and responsibilities of Red and Blue teams.

Blue team

Develop a client and a server in Deterlab that talk between themselves using custom encryption/decryption. In the exercise you will be tasked to use one of the following crypto schemes:
  1. Monoalphabetic cipher
  2. Polyalphabetic cipher
  3. Homophonic cipher
  4. Polygram cipher
  5. Stream cipher> - you can either use XOR or develop your own encryption method that combines the key and the message.
Since your team does not know which cipher it will be asked to use you will need to develop and test each one before the exercise. You can choose the key length and the key itself. Choose wisely. The keys will be distributed to the client and the server machines prior to the exercise, i.e., you are not doing online key exchange.

You MUST write all the code yourself. You are not allowed to use crypto libraries in the OS nor to copy code from online sources, but you can read the code from online sources and use the ideas from it to write your own code.

You can assume that your messages will be in spoken English. They will be up to 100 characters long and will have only lower case letters, punctuation marks (.,!? no quotes) and spaces. I will supply the messages to each team at the beginning of the exercise.

In the exercise the client will send messages to the server every minute. You can assume that the messages are entered on the standard input with this frequency and sent immediately to the server. The server prints each received message on the screen.

There will be total of 10 messages to send, and they can be repeated multiple times during the exercise. Each message should be prepended by a sequence number by the client, before being sent to the server. You can choose how the sequence number changes and whether it is encrypted or not. You MUST encrypt each message using the same approach, i.e. you cannot change crypto scheme on the fly, unless it is broken by the Red team and you are fixing vulnerabilities.

Red team

The goal of the Red team is to break encryption and obtain secret messages and/or decryption key. Since you don't know which crypto scheme the Blue team will be using you need to develop analysis approaches for each listed scheme.

You MUST write all the code yourself. You are not allowed to use crypto libraries in the OS nor to copy code from online sources, but you can read the code from online sources and use the ideas from it to write your own code.

You can assume that your router sits in between the client and the server. You can observe message exchanges but you are not allowed to perform any man-in-the-middle attacks.

How Scoring Works

The Blue team receives a point for each message they send to the server that is not broken by the Red team. The Red team receives a point for each message they break. The Red team proves that it broke the message by printing it into a file. We can then compare this file with the server's screen output.

Exercise Dynamics

Teams will need to simultaneously act as Blue team and Red team throughout the 2h exercise. We will then have a 10 min break followed by a post-mortem discussion and selection of a winning team.

How Grading Works

Each team member will be graded based on their contribution to the team effort, not based on the team's performance. After the exercise each team member will submit a report containing the list of contributions they made to the team effort - e.g., modules that they coded, testing and setup they performed, etc. All team members must sign each report. Reports will be delivered to the instructor in class on March 8. The grades will be assigned based on the report and based on the team mentor's input.

Coding Language

You can choose any coding language you like to use but it may be easiest to reuse client/server in Python that you wrote for your homework.

Useful Links

The Red team will need to capture messages as they go through the router. This page tells you how to use netfilter and iptables to do that. You are allowed to use these libraries but you need to write your own code to mimic what the code on that Web page does. The callback function can be your encryption-breaking function or you can just write messages to a file and break encryption offline.

The Blue team may produce some non-printable code during encryption (e.g., if they use XOR with a stream cipher the result will be mostly non-printable characters). This page talks about packing binary values into a string and unpacking them. In case that Blue team produces some non-printable characters in encrypted messages the Red team must be prepared to deal with them.