Reveal ALL Solution

Worksheet 7: Software Security I

Worksheets are self-guided activities that reinforce lectures. They are not graded for accuracy, only for completion. Worksheets are due by the end of the Tuesday before the next lecture via Blackboard link as a single pdf document. Be sure to properly label each question.

Questions

  1. Explain what a TOCTOU Race is using the following short program example, assuming the program has some level of additional privileged to access file that an attacker normally doesn’t.

    if(access("file",PERMS REQUESTED)==0)   // Line 1
      filedescr = open("file", PERMS)       // Line 2
    

    Reveal Solution

  2. What is the mitigation to the above example?

    Reveal Solution

  3. What does the function unlink() and link() do in an i-node file systems?

    Reveal Solution

  4. What is the difference between a symbolic and hard link in an i-node file system?

    Reveal Solution

  5. What is the PATH environment variable, what is it used for?

    Reveal Solution

  6. Consider the function call to system(), like so system("cat foo.txt"). Explain how this is a potential security vulnerability if the program is privileged.

    Reveal Solution

  7. What is an injection attack? Provide an example.

    Reveal Solution

  8. What is a buffer overflow, and how can it be used in an exploit?

    Reveal Solution

  9. Download the following exercise exploit-me-1 as a zip file and unzip it. You should open that directory in a VSCode environment. If you already have Docker Desktop installed, it should also prompt you to open it in a container. Please do so. If you need some review, refer to problem #12 in Worksheet 3.

    In here you’ll find the source code (minus the flag) for a program that can be exploited using a path attack, injection attack, and a buffer overflow. Do so and retrieve the flag. Also, come up with as many ways to exploit it as possible.

    Reveal Solution

  10. Consider a three-bit number in 2’s compliment. For all bit arrangements, write out the values in base 10.

    Hint: Refer to slide 81.

    Reveal Solution

  11. Still considering the three-bit number in 2’s compliment, what would be 3+2 ? Show the math.

    Reveal Solution

  12. Using the example from above, explain how an integer overflow attack would be possible?

    Reveal Solution

  13. Download the following exercise exploit-me-2 as a zip file and unzip it. You should open that directory in a VSCode environment. If you already have Docker Desktop installed, it should also prompt you to open it in a container. Please do so. If you need some review, refer to problem #12 in Worksheet 2.

    In here you’ll find the source code (minus the flag) for a program that can be exploited using an integer overflow. Do so and retrieve the flag. Also describe a way to fix this program.

    Reveal Solution