Black Hat MEA 2024 Web write-ups

Challenge : Watermelon easy 120 points

we have this Flask app, which is an api to store files and share files

it uses from werkzeug.utils import secure_filename in the upload Route to secure against lfi while storing files since we can not overwrite any file on the system

but anyway secure_filename is used directly in the function and the file path can still be malformed when it is used in the next route , so if we uploaded a file with name `../../../etc/passwd` we can read it's content

let's try

nice now we want to get the admin creds. remember admin's pass is created using this function

and the db is sqlite app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.db' so we can read it and get admin's pass. from docker instance it got the path which is /app/instance/db.db

nice we got the admin's pass and now login with it and get the flag

Challenge: Free Flag 110 points

we have a php app which is vuln to lfi from the first sight but it have one challenge that the start of the file must be with <?php or <html .

we can use this tool https://github.com/synacktiv/php_filter_chain_generatorarrow-up-right which we can use to emped the <?php part, and change the last part to/srv/flag.txt to get the flag

we could read /etc/passwd, using the same way we can read the flag

Challenge: Notey Meduim 180 points

we have a NodeJs app that is used to create notes and our goal is to read admin's note

index.js

middlewares.js

database.js

first thing is the app is using require('mysql'); and prepared statments (which is not we will see) to secure agains sql injection from https://github.com/mysqljs/mysql?tab=readme-ov-file#escaping-query-valuesarrow-up-right and https://youtu.be/mlRvMiTx3-I?si=OQwuhLy3-UGy5L_Harrow-up-right we can see that it is vuln to sql injection and this is not prepared statments so something like note_id=66&note_secret[username]=admin in the getNotebyID function can lead to sql injection

also this challnge had jail and set the memory to 0, so we need to write a script to automate the exploit

Challenge: Fastes Delivery Service Hard 270 points

this nodejs app is vuln to prototype pollution in the address `address` function and we need to get RCE from ejs which is vuln to this CVE-2024-33883

first we need to polluote the addresses object , if we used the same logic in this script we can polluote the Object and control crtical values in Nodejs runtime

next we can use this poc for CVE-2024-33883arrow-up-right which is baed on prototype pollution. again the challenge is jailed and we need to make a script

Last updated