Intro to web
Part 1
Description
5 vulns, 5 stages - can you find them all?
Files: intro-web-1.tar.gz
Author: finn, vurlo
Solution

It says password is optional? After trying lots of usernames basically username can be anything you want.

We can create new notes, but doesn't seem useful.

Cookies are not JWT, but Flask Cookies
The STAGE_1 flag is stored inside the .env file, hence we need LFI to get started.

main.py implements custom jinja filters which are used in the templates.

image_path is controlled by the user, meaning it's injectable.
lfi.py:
Part 2
Solution
For part 2 the bot logs in as random user and creates note with flag.

We are not able to leak the /proc/environ as it's outside wwwroot.
The /report/<note_id> route is able to interact with the bot, this is our entrypoint.

First we need to be able to Report the notes, this requires admin or moderator access.
To become admin we just have to have one of the following roles.
Since we leaked .env it's possible to forge custom cookies:

templates/report_note.html contains following lines:
TL;DR on safe filter is that it's going to render whatever HTML we pass.
Flag: GPNCTF{forg3_d15_JU1Cy_mOD}
Part 3
Solution
Just rerun the above script with 3rd challenge domain and check your webhook for flag.

Flag: GPNCTF{i_1oVe_s7olen_cooKI3s}
Part 4
Solution
Part 4 is available on /development route, but we need to be
Logged in
Admin
Have access to development routes
By default the dev is turned off, but with admin access we can turn it back on.
Admin access might not be so simple...
Ugh.... The reason we didn't see ADMIN_PASSWORD in XSS is because of httpOnly switch.
On the other hand, do we really need the password? The bot can do the hard work for us since it has the password.

Part 5
Solution
The setup.py writes last file to god knows where, LFI bruteforce will take decades hence we require RCE.
Glancing over the leftover code we see pickle module used with user input -> Exploiting Python pickles
This was kind of painful to make it work, curl didn't exist or bash. Had to go into the container to discover this... wget exists

Flag: GPNCTF{rcE_is_EV3RYtH1nG}
Last updated