CTF Challenge for the 2021 Activity Fair
Windows
Install Python:
https://www.python.org/downloads/release/python-397/
Set PATH:
- Start > Edit Environment Variables
- Add Python install directory to both System and Environment variables
Check python installed:
PS > python --version
Install flask and other dependencies:
PS > python -m pip install -r requirements.txt
Linux
$ python3 -m pip install -r requirements.txt
PS > cd .\web\
PS > $env:FLASK_APP = "app"
PS > $env:FLASK_DEBUG = "true"
PS > python -m flask run
Spoilers
Via login function:
- Looking closely at the requests when submitting a password shows a POST to
/verify-loginthat gives a 302 status code, redirecting to/secretwhich then 302s back to the index page - When a password is submitted, a
statuscookie is added - it has a value ofhanhgubevfrq- checking this in a ROT13 decoder, it readsunauthorized - If we change this to
authorizedby deleting the first two letters of the encoded version, we can navigate directly to/secret
Via password reset (TODO):
- The page has minified javascript that can be prettified
- It shows that when the 'Forgot Password' button is clicked, the security question pops up
- The security question is compared server-side via Ajax - the form is submitted with
new_password=&security_question=answer- this shows the user the request format - If the question answer is correct, the new password field appears and a new password can be posted to the same endpoint
- However, the user can simply send
new_password=new&security_question=and the flask app will behave based on which parameter is set