Assignment: CHALLENGE

Changelog:

  • 18 Apr 2025: update challenge.tgz to fix comments in challenge5.example.py; adjust what each challenge consists of to mention other source/example files;
  • 18 Apr 2025: remove due time information from this page

This assignment is the take-home portion of the final. It consists of seven challenges. You must complete five of them. You may complete them in any order. They are numbered in approximate order of difficulty. (What I think is likely to be easiest has the lowest number.)

The challenges will be distributed via Canvas under the Files tab as challenge.tgz.

Your task for each challenge

Each challenge consists of:

For each challenge, your task is to produce a program such that running something like (where ./YOUR_PROGRAM is your program and SOME-TEMP-FILE is a temporary file we choose):

      ./YOUR_PROGRAM SOME-TEMP-FILE

    

and then

      setarch -RL x86_64 env - ./challengeX.exe <SOME-TEMP-FILE

    

causes the program challengeX.exe to produce output ending in the string

      Congratulations, YOUR_NAME!
You have passed this challenge.

    

(or something extremely similar), but where the YOUR_NAME is replaced with your name. In each case, it is okay if the program also outputs other strings, such as prompts for input, before this string, but this should be the last string output, no messages about not passing the challenge should be output, and the program should terminate normally.

(So, for example, if the program prints out:

      Sorry, Congratulations, Student! You have passed this challenge.
You have not passed this challenge.

    

because you supplied a name of “Congratulations, Student! You have passed this challenge”, that is not an acceptable solution.)

A copy of all the files extracted from challenge.tgz be available in the current directory when your exploit program runs. Before testing your exploit, we will obtain a new, fresh copy of challengeX.exe, so modifying the executables will not be useful.

You should supply each attack program in any one of three formats:

Your program can include comments, which may help us understand what is going on if we can’t get the program to work on our system.

Your program may:

General Hints

  1. Running Ghidra and/or objdump and/or running the challenge programs under a debugger could be helpful.

  2. You can fh = open(sys.argv[1], 'wb') followed by use fh.write(b'\x0A\x0B\x0C') to write the bytes 0A 0B 0C to the file specified by the first argument in Python3 (after import sys).

  3. You can use struct.pack('<Q', 0x123456789A) to get 0x123456789A formatted as an 8-byte little-endnian number in Python 3 (after import struct).

  4. You can use ROPgadget to find gadgets in the executables, if you think that would be useful.

    By default, ROPgadget won’t find gadgets that use the syscall instruction and then return. You can change this behavior by passing the --multibr option.

Collaboration

Please do not discuss or expect TAs to answer questions about what startegy you should apply to particular challenges. You are responsible for figuring this out yourself.

You may, however, ask TAs or share general information about how to identify whether an exploit technique is applicable to a particular program or about how to apply an exploit technique to other executables.

We have supplied reference solutions to some prior homework assignments. You may use these when constructing your solutions. You may also use your solutions to a prior homework assignment.