Worksheet 06: 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 start of the next lecture via Blackboard link as a single PDF document. Be sure to properly label each question.
Questions
-
Explain what a TOCTOU Race is using the following short program example, assuming the program has some level of additional priviledge to access
file
that an attacker normally doesn’t.if(access("file",PERMS REQUESTED)==0) // Line 1 filedescr = open("file", PERMS) // Line 2
-
What is the mitigation to the above example?
-
What does the function
unlink()
andlink()
do in an i-node file systems? -
What is the difference between a symbolic and hard link in an i-node file system?
-
What is the
PATH
environment variable, what is it used for? -
Consider the function call to
system()
, like sosystem("cat foo.txt")
. Explain how this is a potential security vulnerability if the program is privileged. -
What is an injection attack? Provide an example.
-
What is a buffer overflow, and how can it be used in an exploit?
-
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.
-
Consider a three-bit number in 2’s compliment. For all bit arrangements, write out the values in base 10.
-
Still considering the three-bit number in 2’s compliment, what would be 3+2 ? Show the math.
-
Using the example from above, explain how an integer overflow attack would be possible?
-
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.