CS 2550 - Foundations of Cybersecurity
Project 3: Exploits
Description and DeliverablesIn this project, you will gain hands on experience leveraging exploits to make a program do unexpected things that were not intended by the programmer. The assignment is structured as a Capture The Flag (CTF), which is a common format in cybersecurity competitions. You will be given access to a vulnerable program, and your task is to locate six flags hidden in the program and its surrounding files. You are required to find five flags; the sixth flag is considerably more challenging, and is worth bonus points.
To receive full credit for this project, you will turn in a single file:
- A file named flags.txt that contains the flags that you will capture from the target program.
Getting Started with Expense ManagementHappy Funtime Plastic Co, Inc. uses a piece of software developed in-house for tracking expenses made by employees. This software is run on the command line, and allows users to add expenses (with a description and an amount), view their saved expenses, and delete expenses that were entered incorrectly. The program uses a SQLite3 database to store expenses. The command line syntax of the program is as follows:
/home/accounting$ ./expense This program allows users to track their expenses. It has commands for adding, viewing, and deleting expenses. Administrators may add, view, or delete expenses for any user. The program also keeps a log of all changes to facilitate offline auditing. Usage: ./expense [--admin] <--command> [arguments] Commands: --help Displays this message --add <Description> <Amount> Adds an expense for the current user --list Lists all expenses for the current user --del <ID> Deletes the current user's expense with the given ID Additional commands are available to administrators. See the developer docs for more information.The basic commands available to users are --add, --list, and --del. There are other commands and options available to system administrators; this additional functionality is accessed by passing the --admin option to the program. However, access to admin functionality is password protected.
As security auditors, you have been given access to the expense program in a secure environment for testing. To access the expense program, SSH into 18.104.22.168. For example:
$ ssh <username>@22.214.171.124where <username> is your CCIS username. You will be emailed a password to access this system.
The expense program is available in the /home/accounting directory on 126.96.36.199.
The expense program is written in C. The (slightly redacted) source code for the program is available here.
Identifying FlagsYour goal is to locate the six flags hidden in the expense program and it's surrounding files. You are required to find at least five flags; the sixth flag is a bonus. All flags are located somewhere within the the /home/accounting directory; there is no need to search other locations in the file system. All flags follow the following format:
SECRET_FLAG_<10 characters of random uppercase, lowercase, and digits>For example, a secret flag might look like this:
SECRET_FLAG_PLf8DsT0xKThe secret flags can be anywhere within the /home/accounting directory: inside the expense program, inside databases, inside files, etc. It is 100% feasible to find all six flags; none have been hidden in such a way that it requires wizard-level exploitation skills, or raw amounts of brute force, to locate.
RulesTo make this assignment fun for everyone, we ask that students obey some basic rules of decorum.
- As you progress through this assignment, you will achieve various levels of elevated privilege. This will give you the ability to take destructive actions. We ask that you exercise restraint and not destroy any data or files. Please leave things as you found them ;)
- Do not denial of service the server. Examples of denial of service attacks include but are not limited to: intentionally running large numbers of processes to control CPU and memory resources; intentionally filling the disk to capacity; and flooding the server with network traffic.
- Do not attack your classmates. This includes attempting to crack their passwords, read or alter files in their home directory, or kill their processes.
If you so desire, attacking the operating system is considered within bounds. If you achieve root, getting all the flags should be trivial. If you do choose to attack the OS, all we ask is that you do not take destructive actions that (1) leave the server in an unusable state; (2) harm your classmates or their files; or (3) generally prevent other students from completing the assignment.
Exploitation TipsLocating all six flags will require you to examine the C source code of the expense program, carefully investigate the program's command line behavior, and investigate the file system around the expense program. Several of the exploits necessary to find the flags are related to topics we discussed in class. Others will require you to think creatively ;)
The source code for the expense program is relatively simple, and well documented. However, online C language tutorials may be useful for students who have never seen code in the language before.
The expense program makes use of a SQLite3 database. Many online resources exist that describe SQL query syntax in general, and SQLite3-specific queries in particular.
Unfortunately, the source code for the expense program has been redacted. Thus, you may need to employ binary analysis tools that allow you inspect and disassemble the contents of compiled programs. Tools like hexdump, strings, and objdump may come in handy; the man pages for these programs offer help about their capabilities and syntax. A debugger like gdb may be useful for more advanced exploits.
Common programming tools like Python, gcc, g++, nasm, and make are available on the server. If there are additional tools available via apt that you would like installed, send an email or private Piazza message to Professor Wilson.
File Format for flags.txtTo receive full credit on this assignment, you must turn in a single (ASCII formatted with Unix-style line breaks) text file named flags.txt that contains the flags that you have recovered. Each flag should be on its own line. For example, your submission might look like the following:
SECRET_FLAG_AAAFLAG1AA SECRET_FLAG_BBBFLAG2BB SECRET_FLAG_CCCFLAG3CC SECRET_FLAG_DDDFLAG4DD SECRET_FLAG_EEEFLAG5EE SECRET_FLAG_FFFFLAG6FFYour file should contain at least five flags.
Submitting Your ProjectBefore turning in the project, you must register yourself for our grading system using the following command:
$ /course/cs2550/bin/register-student [NUID]NUID is your Northeastern ID number, including any leading zeroes. This command is available on all of the CCIS lab machines.
In this assignment, you will turn in exactly one file:
- A flags.txt file containing the captured flags. As noted above, the file must be formatted with one flag per line. Make sure your file uses Unix-style line endings before you submit (by using the file and dos2unix commands).
$ /course/cs2550/bin/turnin project3 <project directory>where <project directory> is the name of the directory with your submission. The script will print out every file that you are submitting, so make sure that it prints out all of the files you wish to submit! The turn-in script will not accept submissions that are missing flags.txt. You may submit as many times as you wish; only the last submission will be graded, and the time of the last submission will determine whether your assignment is late.
At any time, you can run the following command to see all of your current grades for projects, essays, quizzes, and tests.
GradingThis project is worth 9% of your final grade, broken down as follows (out of 100):
- 20 points each per flag (five flags)
- 20 bonus points for the sixth flag