Sheet 5

General Information

All solutions must be Python 3 scripts if not stated otherwise. If you are new to Python 3, have a look online, there are many good resources to get started such as this intro course, this advanced course, this blog post, and this slide deck.

Please keep in mind that you should:

  • read the task description carefully

  • push all your changes to the GitLab repository (main branch) before the deadline. Make also sure that the file permissions are set correctly! If you are new to Git check out this site!

  • Make sure that your solution (also) runs in the CI environment (and not just your local machine); this also means that you must install all additional packages yourself from within the solution script (see our blog post for details how to do that).

  • Check the CI-Pipeline status and output for any errors. If the Pipeline is green and the output looks right, your solution should be correct.

  • Make sure that the solution is an executable Python 3 script named solution (chmod +x ./solution) with a working shebang line at the top (i.e. #!/usr/bin/env python3) so that it can be executed like this: ./solution (do not name your script solution.py, Solution, solution.sh, … – just solution)

  • The final solution string, and only that, must be written to stdout and could be a number, a string, a string with the format FLAG{some letters and digits here}, depending on the specific task.

  • Describe what you are doing using detailed comments for all your solution scripts! For example, use Docstrings (link) or inline comments:

    1
    2
    3
    4
    5
    6
    7
    8
    
    def check_input_length(input_string):
        """
        The input string must have a length greater than 42 and must also be even.
        """
        length = len(input_string)
    
        # the final check happens here
        return (length > 42) and (length % 2 == 0)
    

    This helps us to find out if you really understood the task and you are not just brute-forcing some solutions. Please do not leave any commented code (i.e., code that is not needed to solve the task) in your solution files!

  • Make sure that your solution executes within 10 seconds (this is a hard timeout on our server).

  • Violating any of the points above might lead to reduced final points for the specific task!


The deadline for this sheet is 2024-06-30 22:00:00 UTC

Task 21 – Simple Heap (8 Points)

This exercise uses a simple implementation for malloc and free which you can find in simple_heap.c.

Exploit the simple_heap binary to print the flag.

Edit the provided solution template and explain your approach with meaningful comments!

Your solution should execute like this:

1
2
./solution
FLAG{some letters here}

Task 22 – Simple Heap, but different (8 Points)

This exercise uses a simple implementation for malloc and free which you can find in simple_heap.c.

Exploit the simple_heap binary and print the flag!

Edit the provided solution template and explain your approach with meaningful comments!

Your solution should execute like this:

1
2
./solution
FLAG{some letters here}

Task 23 – An unlinkely secure binary (8 Points, individual Task)

Back to glibc, are you still able to to print the flag?

Your solution should execute like this:

1
2
./solution
FLAG{some letters here}

Task 24 – SNAKE? SNAKE!? SNAAAAKE! (8 Points)

Please beat the high score in our snake-clone by any means necessary!

hint:

  • What heap technique allows us to write a large value?

Your solution should execute like this:

1
2
./solution
FLAG{some letters here}

Task 25 – Frankenstein (12 Points)

Behold, a text editor as unassuming as the ancient tomes of forgotten knowledge. Within its binary, the essence of the 1818 edition of Frankenstein is displayed. Yet, a cunning adventurer might perceive the fissures within its design. Dare you exploit this creation, and from the heart of the digital monster, extract the hidden flag?

Hints:

  • How does the heap look after typing a bunch of characters?
  • Figure out how to overflow, leak and subsequently rewrite the contents of the heap.

Thus shall your endeavor culminate in this manner:

1
2
./solution
FLAG{some letters here}