Flask Unsign is a penetration testing utility that attempts to uncover a Flask server's secret key by taking a signed session verifying it against a wordlist of commonly used and publicly known secret keys (sourced from books, GitHub, StackOverflow and various other sources).
Low maintenance activity. Last release 24 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install flask-unsignFlask Unsign
Command line tool to fetch, decode, brute-force and craft session cookies of a Flask application by guessing secret keys. For the standalone wordlist component, please visit the flask-unsign-wordlist repository.
Requirements
- Python 3.6+
Installation
To install the application, simply use pip:
$ pip3 install flask-unsign[wordlist]
If you only want to install the core code, omit the [wordlist] suffix:
$ pip3 install flask-unsign
To install the tool for development purposes, run the following command (after downloading a copy):
$ pip3 install -e .[test]
Usage
To get an overview of all possible options, simply call flask-unsign without any arguments like so:
$ flask-unsign
Obtaining & Decoding Session Cookies
Due to the fact that Flask cookies are signed and not encrypted, it's
possible to locally decode the session data. For this, you can use the --decode
argument.
Session cookies can be obtained by inspecting your HTTP requests using a proxy
like Burp Proxy, using your browser's network inspector or using a browser
extension to view/change your cookies. By default, Flask uses the session name
"session".
$ flask-unsign --decode --cookie 'eyJsb2dnZWRfaW4iOmZhbHNlfQ.XDuWxQ.E2Pyb6x3w-NODuflHoGnZOEpbH8'
{'logged_in': False}
You can also use Flask-Unsign's automatic session grabbing functionality by
passing the --server argument, instead of the --cookie argument. Do note
however, that not all web pages might return a session, so be sure to pass an
url which does.
$ flask-unsign --decode --server 'https://www.example.com/login'
[*] Server returned HTTP 302 (FOUND)
[+] Successfully obtained session cookie: eyJsb2dnZWRfaW4iOmZhbHNlfQ.XDuWxQ.E2Pyb6x3w-NODuflHoGnZOEpbH8
{'logged_in': False}