Information
Room#
- Name: Introduction to Flask
- Profile: tryhackme.com
- Difficulty: Easy
- Description: How it works and how can I exploit it?
Write-up
Installation and Deployment basics#
Which environment variable do you need to change in order to run Flask?
Answer: FLASK_APP
Clone the example repository:
Create a virtual environment:
Install flask:
Choose the app to run and run it:
Basic syntax and routing#
What's the default deployment port used by Flask?
Answer: 5000
Check in your terminal.
Is it possible to change that port? (yay/nay)
Answer: yay
HTTP Methods and Template Rendering#
Does Flask support POST requests? (yay/nay)
Answer: yay
httpmethods.py
What markup language can you use to make templates for Flask?
Answer: html
templaterendering.py
Flask Injection#
What's inside /home/flask/flag.txt ?
Answer: THM{flask_1njected}
Use a LFI in the SSTI: http://10.10.17.26:5000/vuln?name={{%20get_user_file(%22/home/flask/flag.txt%22)%20}}