Author : W00dy
Solves : 6
Description :
The developper just created his own website, he is persuaded his authentification system is robust. Prove him wrong !
Recon :
It’s a flask web application and when we come up on the web application, we can find an home page and two endpoint :
- /login
- /register
I created an account named owne and I log into it
When I saw my username reflected in the web application, I instantenatly thought about SSTI. Spoiler: It was not :'(
Exploitation :
I tried many injection type like SQLi, Authentification bypass as an admin in the login page and of course the supposed SSTI but it didn’t works.
I saw a Flask session token when I log on :
|
|
The Flask session token take 2 values, an username field and an uuid field.
When we speak about Flask session token, we think about the secret used to craft the token but what if I can found it and craft my own token ?
Let’s try to bruteforce :
|
|
Great ! the secret was secret. Now, i’m able to craft my own Flask Token.
I tried few things like changing my username to admin etc but nothing until I put a " in the uuid field. I got a Internal Server Error…
At this moment, I knew it was an SQLI. The query should looked like that :
|
|
Payload to confirm the SQLI :
" or 1=1 #
How to detect DBMS ?
Example for SQLite :
|
|
And we got a 200 response code. We know that the DBMS is SQLite.
Payload :
|
|
First and second column are reflected in the page !
Extract table :
|
|
Extract Column
|
|
Extract value :
|
|
Finally, we found the flag : MCTF{SQlInj33c710n_inFl4sk_s3s5sssssion}