mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-09 19:55:04 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-post-exploitation/aws
This commit is contained in:
@@ -6,9 +6,9 @@ In un account Cloudflare ci sono alcune **impostazioni e servizi generali** che
|
||||
|
||||
<figure><img src="../../images/image (117).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
## Siti web
|
||||
## Websites
|
||||
|
||||
Rivedere ciascuno con:
|
||||
Review each with:
|
||||
|
||||
{{#ref}}
|
||||
cloudflare-domains.md
|
||||
@@ -16,9 +16,9 @@ cloudflare-domains.md
|
||||
|
||||
### Domain Registration
|
||||
|
||||
- [ ] In **`Transfer Domains`** verificare che non sia possibile trasferire alcun dominio.
|
||||
- [ ] In **`Transfer Domains`** check that it's not possible to transfer any domain.
|
||||
|
||||
Rivedere ciascuno con:
|
||||
Review each with:
|
||||
|
||||
{{#ref}}
|
||||
cloudflare-domains.md
|
||||
@@ -26,7 +26,7 @@ cloudflare-domains.md
|
||||
|
||||
## Analytics
|
||||
|
||||
_Non sono riuscito a trovare nulla da verificare per una revisione della configurazione di sicurezza._
|
||||
_Non sono riuscito a trovare nulla da controllare per una review di configurazione della sicurezza._
|
||||
|
||||
## Pages
|
||||
|
||||
@@ -34,7 +34,7 @@ On each Cloudflare's page:
|
||||
|
||||
- [ ] Check for **sensitive information** in the **`Build log`**.
|
||||
- [ ] Check for **sensitive information** in the **Github repository** assigned to the pages.
|
||||
- [ ] Check for potential github repo compromise via workflow command injection or `pull_request_target` compromise. More info in the [**Github Security page**](../github-security/index.html).
|
||||
- [ ] Check for potential github repo compromise via **workflow command injection** or `pull_request_target` compromise. More info in the [**Github Security page**](../github-security/index.html).
|
||||
- [ ] Check for **vulnerable functions** in the `/fuctions` directory (if any), check the **redirects** in the `_redirects` file (if any) and **misconfigured headers** in the `_headers` file (if any).
|
||||
- [ ] Check for **vulnerabilities** in the **web page** via **blackbox** or **whitebox** if you can **access the code**
|
||||
- [ ] In the details of each page `/<page_id>/pages/view/blocklist/settings/functions`. Check for **sensitive information** in the **`Environment variables`**.
|
||||
@@ -44,12 +44,12 @@ On each Cloudflare's page:
|
||||
|
||||
On each Cloudflare's worker check:
|
||||
|
||||
- [ ] I trigger: cosa fa scattare il Worker? Un utente può inviare dati che verranno usati dal Worker?
|
||||
- [ ] The triggers: What makes the worker trigger? Can a **user send data** that will be **used** by the worker?
|
||||
- [ ] In the **`Settings`**, check for **`Variables`** containing **sensitive information**
|
||||
- [ ] Verificare il codice del worker e cercare vulnerabilità (soprattutto nei punti in cui l'utente può controllare l'input)
|
||||
- Cercare SSRF che restituiscano la pagina indicata e che tu possa controllare
|
||||
- Cercare XSS che eseguano JS all'interno di un'immagine svg
|
||||
- È possibile che il worker interagisca con altri servizi interni. Per esempio, un worker può interagire con un bucket R2 memorizzandovi informazioni ottenute dall'input. In tal caso, è necessario verificare quali capacità ha il worker sul bucket R2 e come potrebbero essere abusate dall'input dell'utente.
|
||||
- [ ] Check the **code of the worker** and search for **vulnerabilities** (specially in places where the user can manage the input)
|
||||
- Check for SSRFs returning the indicated page that you can control
|
||||
- Check XSSs executing JS inside a svg image
|
||||
- It is possible that the worker interacts with other internal services. For example, a worker may interact with a R2 bucket storing information in it obtained from the input. In that case, it would be necessary to check what capabilities does the worker have over the R2 bucket and how could it be abused from the user input.
|
||||
|
||||
> [!WARNING]
|
||||
> Note that by default a **Worker is given a URL** such as `<worker-name>.<account>.workers.dev`. The user can set it to a **subdomain** but you can always access it with that **original URL** if you know it.
|
||||
@@ -64,7 +64,7 @@ cloudflare-workers-pass-through-proxy-ip-rotation.md
|
||||
|
||||
On each R2 bucket check:
|
||||
|
||||
- [ ] Configurare la **CORS Policy**.
|
||||
- [ ] Configure **CORS Policy**.
|
||||
|
||||
## Stream
|
||||
|
||||
@@ -76,8 +76,8 @@ TODO
|
||||
|
||||
## Security Center
|
||||
|
||||
- [ ] Se possibile, eseguire una scansione `Security Insights` e una scansione `Infrastructure`, poiché metteranno in evidenza informazioni interessanti dal punto di vista della sicurezza.
|
||||
- [ ] Controllare queste informazioni per misconfigurazioni di sicurezza e informazioni interessanti
|
||||
- [ ] If possible, run a **`Security Insights`** **scan** and an **`Infrastructure`** **scan**, as they will **highlight** interesting information **security** wise.
|
||||
- [ ] Just **check this information** for security misconfigurations and interesting info
|
||||
|
||||
## Turnstile
|
||||
|
||||
@@ -94,12 +94,12 @@ cloudflare-zero-trust-network.md
|
||||
> [!NOTE]
|
||||
> Unlike [Dynamic Redirects](https://developers.cloudflare.com/rules/url-forwarding/dynamic-redirects/), [**Bulk Redirects**](https://developers.cloudflare.com/rules/url-forwarding/bulk-redirects/) are essentially static — they do **not support any string replacement** operations or regular expressions. However, you can configure URL redirect parameters that affect their URL matching behavior and their runtime behavior.
|
||||
|
||||
- [ ] Verificare che le **espressioni** e i **requisiti** per i redirect abbiano senso.
|
||||
- [ ] Verificare anche la presenza di endpoint nascosti sensibili che contengono informazioni interessanti.
|
||||
- [ ] Check that the **expressions** and **requirements** for redirects **make sense**.
|
||||
- [ ] Check also for **sensitive hidden endpoints** that you contain interesting info.
|
||||
|
||||
## Notifications
|
||||
|
||||
- [ ] Controllare le notifiche. Queste notifiche sono raccomandate per la sicurezza:
|
||||
- [ ] Check the **notifications.** These notifications are recommended for security:
|
||||
- `Usage Based Billing`
|
||||
- `HTTP DDoS Attack Alert`
|
||||
- `Layer 3/4 DDoS Attack Alert`
|
||||
@@ -119,16 +119,16 @@ cloudflare-zero-trust-network.md
|
||||
- `Script Monitor New Script Exceeds Max URL Length Alert`
|
||||
- `Advanced Security Events Alert`
|
||||
- `Security Events Alert`
|
||||
- [ ] Verificare tutte le **destinazioni**, poiché potrebbero esserci **informazioni sensibili** (basic http auth) nelle webhook urls. Assicurarsi inoltre che le webhook urls usino **HTTPS**
|
||||
- [ ] Come controllo aggiuntivo, potresti provare a impersonare una notifica Cloudflare a una terza parte; forse puoi in qualche modo iniettare qualcosa di pericoloso
|
||||
- [ ] Check all the **destinations**, as there could be **sensitive info** (basic http auth) in webhook urls. Make also sure webhook urls use **HTTPS**
|
||||
- [ ] As extra check, you could try to **impersonate a cloudflare notification** to a third party, maybe you can somehow **inject something dangerous**
|
||||
|
||||
## Gestione account
|
||||
## Manage Account
|
||||
|
||||
- [ ] È possibile vedere le **ultime 4 cifre della carta di credito**, la **data di scadenza** e l'**indirizzo di fatturazione** in **`Billing` -> `Payment info`**.
|
||||
- [ ] È possibile vedere il **tipo di piano** usato nell'account in **`Billing` -> `Subscriptions`**.
|
||||
- [ ] In **`Members`** è possibile vedere tutti i membri dell'account e il loro **`role`**. Nota che se il tipo di piano non è Enterprise, esistono solo 2 ruoli: Administrator e Super Administrator. Ma se il **piano usato è Enterprise**, [**more roles**](https://developers.cloudflare.com/fundamentals/account-and-billing/account-setup/account-roles/) possono essere usati per seguire il principio del least privilege.
|
||||
- Pertanto, quando possibile è `recommended` usare il `Enterprise plan`.
|
||||
- [ ] In `Members` è possibile verificare quali membri hanno la 2FA abilitata. Ogni utente dovrebbe averla abilitata.
|
||||
- [ ] It's possible to see the **last 4 digits of the credit card**, **expiration** time and **billing address** in **`Billing` -> `Payment info`**.
|
||||
- [ ] It's possible to see the **plan type** used in the account in **`Billing` -> `Subscriptions`**.
|
||||
- [ ] In **`Members`** it's possible to see all the members of the account and their **role**. Note that if the plan type isn't Enterprise, only 2 roles exist: Administrator and Super Administrator. But if the used **plan is Enterprise**, [**more roles**](https://developers.cloudflare.com/fundamentals/account-and-billing/account-setup/account-roles/) can be used to follow the least privilege principle.
|
||||
- Therefore, whenever possible is **recommended** to use the **Enterprise plan**.
|
||||
- [ ] In Members it's possible to check which **members** has **2FA enabled**. **Every** user should have it enabled.
|
||||
|
||||
> [!NOTE]
|
||||
> Note that fortunately the role **`Administrator`** doesn't give permissions to manage memberships (**cannot escalate privs or invite** new members)
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
# Abusing Cloudflare Workers as pass-through proxies (IP rotation, FireProx-style)
|
||||
# Abusare dei Cloudflare Workers come pass-through proxies (rotazione IP, stile FireProx)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
Cloudflare Workers possono essere distribuiti come proxy HTTP trasparenti pass-through in cui l'URL di destinazione upstream è fornito dal client. Le richieste escono dalla rete di Cloudflare, quindi la destinazione vede gli IP di Cloudflare invece di quelli del client. Questo rispecchia la famosa tecnica FireProx su AWS API Gateway, ma utilizza Cloudflare Workers.
|
||||
Cloudflare Workers possono essere deployati come proxy HTTP trasparenti pass-through dove l'URL di destinazione upstream è fornito dal client. Le richieste escono dalla rete di Cloudflare, quindi il target osserva gli IP di Cloudflare invece di quelli del client. Questo rispecchia la nota tecnica FireProx su AWS API Gateway, ma utilizza Cloudflare Workers.
|
||||
|
||||
### Key capabilities
|
||||
- Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD)
|
||||
- La destinazione può essere fornita tramite parametro di query (?url=...), un header (X-Target-URL), o persino codificata nel path (es., /https://target)
|
||||
- Header e body vengono inoltrati tramite il proxy con filtraggio degli header hop-by-hop quando necessario
|
||||
- Le risposte vengono rilanciate indietro, preservando lo status code e la maggior parte degli header
|
||||
### Funzionalità principali
|
||||
- Supporto per tutti i metodi HTTP (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD)
|
||||
- Il target può essere fornito tramite parametro di query (?url=...), un header (X-Target-URL), o anche codificato nel path (es., /https://target)
|
||||
- Headers e body sono proxati attraverso con filtraggio di hop-by-hop/header se necessario
|
||||
- Le risposte vengono relayate al client preservando il codice di stato e la maggior parte degli header
|
||||
- Spoofing opzionale di X-Forwarded-For (se il Worker lo imposta da un header controllato dall'utente)
|
||||
- Rotazione estremamente rapida/facile distribuendo più endpoint Worker e smistando le richieste
|
||||
- Rotazione estremamente rapida/facile distribuendo più endpoint Worker e distribuendo le richieste
|
||||
|
||||
### How it works (flow)
|
||||
1) Il client invia una richiesta HTTP a un URL Worker (`<name>.<account>.workers.dev` o una route su dominio custom).
|
||||
2) Il Worker estrae la destinazione da un parametro di query (?url=...), dall'header X-Target-URL, o da un segmento del path se implementato.
|
||||
3) Il Worker inoltra il metodo, gli header e il body in arrivo all'URL upstream specificato (filtrando gli header problematici).
|
||||
4) La risposta upstream viene trasmessa al client attraverso Cloudflare; l'origine vede gli IP di uscita di Cloudflare.
|
||||
### Come funziona (flusso)
|
||||
1) Il client invia una richiesta HTTP a un Worker URL (`<name>.<account>.workers.dev` o una route di dominio custom).
|
||||
2) Il Worker estrae il target da un parametro di query (?url=...), dall'header X-Target-URL, o da un segmento del path se implementato.
|
||||
3) Il Worker inoltra il metodo, gli header e il body in ingresso all'URL upstream specificato (filtrando gli header problematici).
|
||||
4) La risposta upstream viene streamata indietro al client attraverso Cloudflare; l'origin vede gli IP di egress di Cloudflare.
|
||||
|
||||
### Worker implementation example
|
||||
### Esempio di implementazione del Worker
|
||||
- Legge l'URL di destinazione dal parametro di query, dall'header o dal path
|
||||
- Copia un sottoinsieme sicuro di header e inoltra il metodo/body originale
|
||||
- Opzionalmente imposta X-Forwarded-For usando un header controllato dall'utente (X-My-X-Forwarded-For) o un IP casuale
|
||||
- Aggiunge CORS permissivo e gestisce i preflight
|
||||
- Aggiunge CORS permissivo e gestisce il preflight
|
||||
|
||||
<details>
|
||||
<summary>Esempio di Worker (JavaScript) per proxy pass-through</summary>
|
||||
<summary>Esempio Worker (JavaScript) per proxy pass-through</summary>
|
||||
```javascript
|
||||
/**
|
||||
* Minimal Worker pass-through proxy
|
||||
@@ -135,17 +135,17 @@ function randomIP() { return [1,2,3,4].map(() => Math.floor(Math.random()*255)+1
|
||||
|
||||
### Automatizzare la distribuzione e la rotazione con FlareProx
|
||||
|
||||
FlareProx è uno strumento Python che usa la Cloudflare API per distribuire molti endpoint Worker e ruotare tra essi. Questo fornisce una rotazione IP in stile FireProx dalla rete di Cloudflare.
|
||||
FlareProx è uno strumento Python che utilizza la Cloudflare API per distribuire molti endpoint Worker e ruotare tra di essi. Questo fornisce una rotazione degli IP simile a FireProx sfruttando la rete di Cloudflare.
|
||||
|
||||
Configurazione
|
||||
1) Crea un Cloudflare API Token usando il template “Edit Cloudflare Workers” e recupera il tuo Account ID dalla dashboard.
|
||||
1) Crea un Cloudflare API Token usando il template “Edit Cloudflare Workers” e ottieni il tuo Account ID dalla dashboard.
|
||||
2) Configura FlareProx:
|
||||
```bash
|
||||
git clone https://github.com/MrTurvey/flareprox
|
||||
cd flareprox
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
**Crea il file di configurazione flareprox.json:**
|
||||
**Crea il config file flareprox.json:**
|
||||
```json
|
||||
{
|
||||
"cloudflare": {
|
||||
@@ -154,26 +154,26 @@ pip install -r requirements.txt
|
||||
}
|
||||
}
|
||||
```
|
||||
**CLI usage**
|
||||
**Uso della CLI**
|
||||
|
||||
- Crea N Worker proxies:
|
||||
```bash
|
||||
python3 flareprox.py create --count 2
|
||||
```
|
||||
- Elencare gli endpoint:
|
||||
- Elenca endpoints:
|
||||
```bash
|
||||
python3 flareprox.py list
|
||||
```
|
||||
- Endpoint di controllo dello stato:
|
||||
- Endpoint per il controllo dello stato:
|
||||
```bash
|
||||
python3 flareprox.py test
|
||||
```
|
||||
- Elimina tutti gli endpoint:
|
||||
- Eliminare tutti gli endpoints:
|
||||
```bash
|
||||
python3 flareprox.py cleanup
|
||||
```
|
||||
**Instradare il traffico attraverso un Worker**
|
||||
- Formato con parametri di query:
|
||||
**Instradamento del traffico attraverso un Worker**
|
||||
- Forma con parametro di query:
|
||||
```bash
|
||||
curl "https://your-worker.account.workers.dev?url=https://httpbin.org/ip"
|
||||
```
|
||||
@@ -185,7 +185,7 @@ curl -H "X-Target-URL: https://httpbin.org/ip" https://your-worker.account.worke
|
||||
```bash
|
||||
curl https://your-worker.account.workers.dev/https://httpbin.org/ip
|
||||
```
|
||||
- Esempi di metodi:
|
||||
- Esempi di metodo:
|
||||
```bash
|
||||
# GET
|
||||
curl "https://your-worker.account.workers.dev?url=https://httpbin.org/get"
|
||||
@@ -204,17 +204,17 @@ curl -X DELETE \
|
||||
```
|
||||
**`X-Forwarded-For` controllo**
|
||||
|
||||
Se il Worker rispetta `X-My-X-Forwarded-For`, puoi influenzare il valore upstream di `X-Forwarded-For`:
|
||||
Se il Worker rispetta `X-My-X-Forwarded-For`, puoi influenzare il valore `X-Forwarded-For` a monte:
|
||||
```bash
|
||||
curl -H "X-My-X-Forwarded-For: 203.0.113.10" \
|
||||
"https://your-worker.account.workers.dev?url=https://httpbin.org/headers"
|
||||
```
|
||||
**Uso programmatico**
|
||||
|
||||
Usa la libreria FlareProx per creare, elencare e testare endpoint e per instradare richieste da Python.
|
||||
Usare la libreria FlareProx per creare/elencare/testare endpoint e instradare richieste da Python.
|
||||
|
||||
<details>
|
||||
<summary>Esempio Python: Invia un POST tramite un endpoint Worker casuale</summary>
|
||||
<summary>Esempio Python: Inviare una richiesta POST tramite un endpoint Worker casuale</summary>
|
||||
```python
|
||||
#!/usr/bin/env python3
|
||||
from flareprox import FlareProx, FlareProxError
|
||||
@@ -268,14 +268,14 @@ print(f"Request error: {e}")
|
||||
</details>
|
||||
|
||||
**Integrazione Burp/Scanner**
|
||||
- Indirizzare gli strumenti (per esempio, Burp Suite) al Worker URL.
|
||||
- Puntare gli strumenti (per esempio, Burp Suite) sull'URL del Worker.
|
||||
- Fornire l'upstream reale usando ?url= o X-Target-URL.
|
||||
- La semantica HTTP (methods/headers/body) viene preservata mentre l'IP sorgente viene mascherato dietro Cloudflare.
|
||||
- La semantica HTTP (methods/headers/body) viene preservata mentre si maschera il tuo indirizzo IP sorgente dietro Cloudflare.
|
||||
|
||||
**Note operative e limiti**
|
||||
- Cloudflare Workers Free plan consente circa 100.000 richieste/giorno per account; usare più endpoint per distribuire il traffico se necessario.
|
||||
- I Workers vengono eseguiti sulla rete di Cloudflare; molti target vedranno solo gli IP/ASN di Cloudflare, il che può bypassare semplici allow/deny lists basate su IP o le euristiche geografiche.
|
||||
- Usare responsabilmente e solo con autorizzazione. Rispettare ToS e robots.txt.
|
||||
- Il piano Free di Cloudflare Workers consente approssimativamente 100.000 richieste/giorno per account; usa più endpoint per distribuire il traffico se necessario.
|
||||
- I Workers girano sulla rete di Cloudflare; molti target vedranno soltanto gli IP/ASN di Cloudflare, il che può eludere liste naive di allow/deny basate su IP o euristiche geografiche.
|
||||
- Usare responsabilmente e solo con autorizzazione. Rispettare i ToS e robots.txt.
|
||||
|
||||
## Riferimenti
|
||||
- [FlareProx (Cloudflare Workers pass-through/rotation)](https://github.com/MrTurvey/flareprox)
|
||||
|
||||
Reference in New Issue
Block a user