Intro to web

Part 1

Description

5 vulns, 5 stages - can you find them all?

Files: intro-web-1.tar.gzarrow-up-right

Author: finn, vurlo

Solution

Intro_to_web.png

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

Intro_to_web-1.png

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

Intro_to_web-2.png

Cookies are not JWT, but Flask Cookies

The STAGE_1 flag is stored inside the .env file, hence we need LFI to get started.

Intro_to_web-3.png

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

Intro_to_web-4.png

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.

Intro_to_web-5.png

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.

Intro_to_web-6.png

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:

Intro_to_web-7.png

templates/report_note.html contains following lines:

TL;DR on safe filter is that it's going to render whatever HTML we pass.

circle-check

Part 3

Solution

Just rerun the above script with 3rd challenge domain and check your webhook for flag.

Intro_to_web-8.png
circle-check

Part 4

Solution

Part 4 is available on /development route, but we need to be

  1. Logged in

  2. Admin

  3. 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.

Intro_to_web-9.png

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 picklesarrow-up-right

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

Intro_to_web-11.png
circle-check

Last updated