LinuxCommandLibrary

flask-unsign

Flask session cookie manipulation and cracking

TLDR

Decode a Flask session cookie

$ flask-unsign --decode --cookie "[cookie_value]"
copy
Brute force secret key
$ flask-unsign --unsign --cookie "[cookie]" --wordlist [wordlist.txt]
copy
Sign a cookie with known key
$ flask-unsign --sign --cookie "{'user':'admin'}" --secret "[key]"
copy
Show cookie without verification
$ flask-unsign --decode --cookie "[cookie]" --no-verify
copy

SYNOPSIS

flask-unsign [options]

DESCRIPTION

Flask-unsign is a security testing tool for analyzing and manipulating Flask session cookies. Flask stores session data in cryptographically signed cookies, and this tool can decode the contents, attempt to recover the secret key through brute-force attacks, and craft custom signed cookies.
The tool is primarily used in web application security assessments to test Flask applications for weak secret keys. If the secret key can be recovered, attackers could forge arbitrary session data, potentially leading to privilege escalation or authentication bypass vulnerabilities.
Flask-unsign supports multithreaded brute-forcing, custom wordlists, and both encoding and decoding operations. It can work with sessions even when the signature verification fails, allowing inspection of tampered or expired cookies.

PARAMETERS

--decode

Decode session cookie.
--unsign
Brute force secret key.
--sign
Sign a cookie.
--cookie cookie
Cookie value.
--secret key
Secret key.
--wordlist file
Wordlist for brute forcing.
--no-verify
Skip signature verification.
--threads num
Number of threads.

SEE ALSO

flask(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community