A request is text, and every character in it came from the client. This set checks that you can read a request line, and that you can confine the path it carries to the directory the server meant to serve.
Each one is marked as you go, and the explanation arrives straight after, which is
the part worth reading.
4 questions, marked as you go.
Tasks
These need your own device. Run the command in Termux, then paste what it printed.
The marking looks at what the output means, so spacing, version numbers and
ordering do not matter. If you have not installed anything yet, the
lesson covers the setup.
Show a path escaping its root, and the check that stops it
This writes a small web root with a public file, then a secret file just outside it. It joins the request /../secret.txt onto the root the way the flawed server does, prints what the join points at, then resolves the path and asks whether it is still inside the root. Run it and paste what comes back.
Run this in Termux
On your own device. Nothing on this page executes it. The command runs in
your terminal, and this box only reads what you paste back.
Three lines should come back. The first shows what the flawed join served, and the last is a yes or no answer.
the flawed join served a file outside the root
the resolved path is shown outside the root
the confinement check refuses the path
the commands actually ran
What a good answer looks like
Three lines. The first reads served: secret, which shows the flawed join walked out of the web root and read a file that was never meant to be served. The second prints the resolved path, which is outside /tmp/wr. The third reads allowed : False, which is the confinement check refusing it. Together they show the bug and the fix in one run: the plain join escapes, and the resolved-path check catches it.
Marking your own work
Both halves of this are checked in your browser, with no server involved, so nothing
stops you from pasting output you did not run. The tasks are written so that the
easiest way to pass one is to actually do it and read the result, which is the whole
intention.