Most Cookies (150)
Flask client-side sessions, cookie forgery
Problem
Alright, enough of using my own encryption. Flask session cookies should be plenty secure! server.py
Solution
From the source code, things to note:
1) The /display page checks the session cookie. We need to change the very_auth session variable to admin somehow.

2) The Flask session secret key is hardcoded into the source code!
We can decode the Flask session cookie like this:
1) Take the part before the period (.)

2) Append the == padding
3) Base64 decode:
So we can change the session variable to admin and encode it again, but first, we need to crack the secret key. This is because the remainder of the session cookie is the signature which will be checked at the server-side to prevent tampering.
The following script will bruteforce each secret in the wordlist:
Here, the secret key is 'butter'.

With the secret key, we can craft our own session cookie:

Putting this new crafted cookie back into Burpsuite, we get the flag in the response.

Last updated
Was this helpful?